How to change BGR to RGB of a video frame using C /C++
Webcam feed reads as a inverted RGB and so the rendered colors are incorrect. I need to change BGR to RGB. Below shows incomplete code of trying to achieve the end result. Can someone guide me through this to complete? Currently using OoenCV 2.xx
GdkPixbuf* pix;
IplImage* frame;
CvCapture* capture;
frame = cvQueryFrame( capture );
// Converting BGR to RGB
for (int i = 0; i<frame->height; i++)
{
for (int x=0; x<frame->width; x++)
{
// LOST
}
}
pix = gdk_pixbuf_new_from_data((guchar*) frame->imageData,
GDK_COLORSPACE_RGB, FALSE, frame->depth, frame->width,
frame->height, (frame->widthStep), NULL, NULL);
Edit: Its OK the same requirement is coded in C++
please do not try to use opencv's discontinued c-api for anything.
they moved away from that half a decade ago, and so should you.
please do not try to use opencv's discontinued c-api for anything.
they moved away from that half a decade ago, and so should you.
@berak Then can I know how to perform the same task with C++ please? I edited the question.