i have following code
Mat image;
image =initialize to CV_8CU3 ie bgr image
ptr=(unsigned int *)image.data;
cout<<*ptr;
Now i will get a value of first pixel(example 2156890498 or 2222951812 or 2374403213)
now i want to convert that value into RGB format so that i can convert that value into
gray scale value using formula (0.299R + 0.587G + 0.114B)
how i can do that please provide solution
i am using cuda programming and opencv
thanks in advance
wait, this idea looks broken:
no, you can't just cast to uint ( a bgr pixel is only 24 bits, not 32 ) and expect the result to be a32bit repr. of the pixel.
if you wanted a grayscale conversion, use cvtColor() instead
i am using cuda to to convert the image to gray hence i need a dirrect access to pixel values
yes, maybe. but not like this.