I'm having a problem with linking the libraries. From what I have, I've linked the libraries to OpenCV correctly, but not the one's for rpi-rgb-led-matrix. How do I link the libraries?
Makefile:
led: minimal-example.cc
g++ -o led minimal-example.cc -lopencv_core -lopencv_imgproc -lopencv_imgcodecs
Errors:
/tmp/ccYPtyMS.o: In function main': minimal-example.cc:(.text+0x1c0): undefined reference torgb_matrix::RGBMatrix::Options::Options()'
minimal-example.cc:(.text+0x204): undefined reference to `rgb_matrix::CreateMatrixFromFlags(int*, char, rgb_matrix::RGBMatrix::Options, rgb_matrix::RuntimeOptions, bool)'
collect2: error: ld returned 1 exit status
Makefile:2: recipe for target 'led' failed
make: [led] Error 1
Code:
include "led-matrix.h"
include
include
include
include
include <opencv2/core.hpp>
include <opencv2/imgproc.hpp>
include <opencv2/imgcodecs.hpp>
using rgb_matrix::GPIO;
using rgb_matrix::RGBMatrix;
using rgb_matrix::Canvas;
using namespace cv;
static void DrawOnCanvas(Canvas *canvas) {
Mat input_image = cv::imread("snapshot.png");
for (int y = 0; y < 32; y++) {
for (int x = 0; x < 32; x++) {
Vec3b color = input_image.at(Point(x,y));
canvas->setPixel(x,y,color[0],color[1],color[2]);
}
}
}
int main(int argc, char argv[]) {
RGBMatrix::Options defaults;
defaults.hardware_mapping = "regular"; // or e.g. "adafruit-hat"
defaults.rows = 32;
defaults.chain_length = 1;
defaults.parallel = 1;
defaults.show_refresh_rate = true;
Canvas canvas = rgb_matrix::CreateMatrixFromFlags(&argc, &argv, &defaults);
if (canvas == NULL)
return 1;
// It is always good to set up a signal handler to cleanly exit when we
// receive a CTRL-C for instance. The DrawOnCanvas() routine is looking
// for that.
signal(SIGTERM, InterruptHandler);
signal(SIGINT, InterruptHandler);
DrawOnCanvas(canvas); // Using the canvas.
// Animation finished. Shut down the RGB matrix.
canvas->Clear();
delete canvas;
Hello
I'm having a problem with linking the libraries. From what I have, I've linked the libraries to OpenCV correctly, but not the one's for rpi-rgb-led-matrix. How do I link the libraries? Makefile:
Errors:
Code: