Reputation: 1
I would like to put an image on video and i'm wondering if it's possible in opencv without multithreading. I would like to avoid it because in my project i am operating on RPI 0W(that's whyi don't want multithreading) . i can't find anything about it on internet. I got some basic code in c++ . I'm new to open cv.
int main(){
VideoCapture cap(0);
if (!cap.isOpened())
{
cout << "error"<<endl;
return -1;
}
Mat edges;
namedWindow("edges", 1);
Mat img = imread("logo.png");
for (;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
imshow("edges", WINDOW_AUTOSIZE );
imshow("edges", img);
imshow("edges", frame);
if (waitKey(30) >= 0) break;
}
}
Upvotes: 0
Views: 169
Reputation: 131
In OpenCV showing two things in the same window overwrites the previous one which I think is happening in your case. You can use OpenCV addWeighted() function or bitwise operations. OpenCV has good documentation on this. You can find it here
Upvotes: 1