I am doing a project on image encryption and decryption. So I need to extract RGB Color components in a color image. Please clear my doubt in open cv using c++. Thanks in advance. Deepak Chiradoni
Asked
Active
Viewed 1,937 times
-3
-
1You left out a ton of information. – Evan Carslake Feb 03 '15 at 06:00
-
http://stackoverflow.com/questions/8932893/accessing-certain-pixel-rgb-value-in-opencv – lcjury Feb 03 '15 at 06:01
1 Answers
0
first load your image as
Mat img=imread(file_name);
It returns img in BGR format. Now use following code snippet to access color components in BGR image. here y-row index and x-column index
Vec3b intensity = img.at<Vec3b>(y, x);
uchar blue = intensity.val[0];
uchar green = intensity.val[1];
uchar red = intensity.val[2];
Reference: http://docs.opencv.org/doc/user_guide/ug_mat.html

ssh99
- 309
- 1
- 3
- 16