Ask Your Question

elfsingle's profile - activity

2019-04-28 23:59:48 -0600 received badge  Notable Question (source)
2017-09-29 11:43:06 -0600 received badge  Popular Question (source)
2015-02-06 02:36:12 -0600 commented answer read camera image incorrect

Thanks for that you discussing with me. I got an answer and the detail is showing above,

2015-02-04 08:03:15 -0600 commented answer read camera image incorrect

What's your mean about cap interface?

2015-02-04 01:19:13 -0600 received badge  Enthusiast
2015-02-03 20:18:03 -0600 commented answer read camera image incorrect

Camera is a usb3.0 device and I connected it in usb3.0 port

2015-02-03 08:29:47 -0600 commented answer read camera image incorrect

it show assertion failed (scn==1 && dcn==3) in cv:cvtcolor

2015-02-03 06:05:08 -0600 commented answer read camera image incorrect

All type of bayer pattern I have tried that got the same incorrect output. I think that reading unknown input which have 3 channels by cap.read and using Mat function to read input data that losing information by unknown format translate to 16UC1.

2015-02-03 01:51:27 -0600 received badge  Editor (source)
2015-02-02 19:32:32 -0600 received badge  Supporter (source)
2015-02-02 19:32:25 -0600 received badge  Scholar (source)
2015-02-02 08:24:08 -0600 commented answer read camera image incorrect

if(cap.read(src)!=NULL)

     cout<<src.channels()<<endl;

src.channels() is three.... oh...I don't set anything just using cap.read(src) so the function of videocapture is change the input format automatically? or the function isn't adapt this camera......

2015-02-01 21:57:43 -0600 commented answer read camera image incorrect

it show assertion failed (scn==1 && dcn==3) in cv:cvtcolor

2015-02-01 21:57:11 -0600 commented answer read camera image incorrect

it show assertion failed (scn==1 && dcn==3) in cv:cvtcolor

2015-01-30 10:36:43 -0600 asked a question read camera image incorrect

I using the function of videocapture to read camera data

VideoCapture cap(0);

int Key;
Mat src;

if(cap.isOpened())
{
    while(1)
{

        cap.read(src);
        namedWindow("capture", 0);
        imshow("capture",src);

        Key = waitKey(10);
        if(Key ==27)
                break;
}}

The output is likely bayer image with green visionimage description And the image size is not correct(640X480), it should be 2592X1944 in raw 12 bits.

Is some parameters for function videocapture need I set? or have anything I miss for opencv videocapture?

----------------------------------------------------------------------------------------------------------------

I got it!

The problem is causing by a function which is translating raw data to bayer pattern.

The camera input is raw in 12 bits format, as reading the camera data that one element is separated to two bytes (low byte and high byte)

We need to merge this two byte to a int format(0~2^8 -> 0~2^16).

OpenCV has a mistake in the data merging, so I got the wrong image first.

I coding that translating raw data to bayer pattern and getting the correct result without white balance.

image description