Ask Your Question

OpenCV Macro CV_BGR2RGBA Not Defined.

asked 2019-04-14 13:26:33 -0500

updated 2019-04-14 13:29:27 -0500

Hello OpenCV experts,

I was using the following function with headers:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
cv::cvtColor(imageBGR, imageRGBA, CV_BGR2RGBA);

However, when I compile, I got error:

"error: identifier "CV_BGR2RGBA" is undefined" Please let me know how to use this macro correctly. Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-04-14 13:33:35 -0500

The API might have been changed. Use cv::cvtColor(imageBGR, imageRGBA, cv::COLOR_BGR2BGRA);.

edit flag offensive delete link more


Since OpenCV 3.4.x all CV_ prefixes where indeed removed, because they did not resemble the new unified backend. They are now all available in the COLOR subspace :)

StevenPuttemans gravatar imageStevenPuttemans ( 2019-04-15 04:35:48 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-04-14 13:26:33 -0500

Seen: 22 times

Last updated: Apr 14