I’m currently working on a traffic light detection code, that I would like to implement on a Raspberry Pi 3.
To do it, I need to have the fastest program possible to detect in real time the different traffic lights. At one step of my program, I need to separate the R, G and B values from an RGB image. The only problem is that with my method, it takes 80000ms approximately to only do this (due to the imwrite and imread function I think).
Here is my code :
Mat bgr; split(cropped_img, bgr); imwrite("blue.png", bgr); imwrite("green.png", bgr); imwrite("red.png", bgr); Mat red_img = imread("red.png", IMREAD_COLOR); Mat green_img = imread("green.png", IMREAD_COLOR); Mat blue_img = imread("blue.png", IMREAD_COLOR);
So does anyone have a solution to make this part much faster ?
Thank’s a lot and have a nice week !
Source: Windows Questions C++