Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to convert pixel intensities into values rgb values

    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
click to hide/show revision 2
retagged

updated 2014-03-14 02:47:32 -0600

berak gravatar image

how to convert pixel intensities into values rgb values

    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