Ask Your Question
0

BGR pixel transformations

asked 2015-02-07 00:24:51 -0500

Evoxz gravatar image

updated 2015-02-07 00:25:34 -0500

Hi :) I'm searching for a function wich is able to get the BGR data of any pixel (with the X/Y coordinates of this pixel) and change it. Do you know something about a function like that? I program in C++.

Best regards, Evoxz

edit retag flag offensive close merge delete

Comments

See an example here

Haris gravatar imageHaris ( 2015-02-07 01:27:15 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2015-02-07 01:11:13 -0500

jamesnzt gravatar image

updated 2015-02-07 03:06:54 -0500

berak gravatar image
Mat img=imread("<<filename>.<extension>>",CV_LOAD_IMAGE_COLOR);

int i=;//row pixel co-ordinate;
int j= ;//coloumn pixel co-ordinate;
Vec3b intensity = img.at<Vec3b>(i,j);
float blue=intensity.val[0];
float green=intensity.val[1];
float red=intensity.val[2];

the variables blue,green and red contains the BGR value.

edit flag offensive delete link more

Comments

Thanks a lot! :) And how can I do to change these values?

Evoxz gravatar imageEvoxz ( 2015-02-07 02:18:25 -0500 )edit
1

@Evoxz, use a reference: Vec3b & pixel = img.at<Vec3b>(i,j); pixel.val[1] = 17;

berak gravatar imageberak ( 2015-02-07 03:08:45 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-02-07 00:24:51 -0500

Seen: 86 times

Last updated: Feb 07 '15