Search code examples
videoopencvcolorsosx-snow-leopardpixel

pixel value changed after rewrite the video


I have videos which are grayscale (x-ray) ... the problem is when I read and write the videos the pixel value change !!! I print the pixel values as a gray and as BGR and I got values in all of them ... I read the video then I write it using openCV then I re print the pixel value and I see different in the pixel values !!!

I am using openCV 2.4.3 with FFMPEG 0.11 on MAC 10.6.8

why the pixel value changed ? ... how can I read and write the video without changing the pixel value? BTW: the original videos has been written in windows using FFMPEG with YUV240 pixel format !

Thanks in Advance :D


Solution

  • The pixels values change because openCV convert the frames to BGR by default ! the reading operation do the conversion process , I guess , that why the pixels change

    I hope this can help who face this problem , to get the exact value , you can read and write the videos using FFMPEG which provide a lot of pixel format