Ask Your Question
1

why the captured image from code is not bright as normal captured image?

asked 2015-06-23 01:05:37 -0600

Akki gravatar image

updated 2016-01-02 11:19:21 -0600

Hello,

I am facing one problem regarding the capturing image from the USB camera. when I captured image without using coding i.e. directly from the camera than its give me bright image. but when i took image from capture image code from opencv than same image from same camera looks very dark.

what should be the probably reasons for this?? and i am using normal capture camera code only from tutorial. please guide me. waiting for suggestions.

Thank you very much in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-07-13 22:02:52 -0600

updated 2015-07-16 04:26:21 -0600

when capturing image from webcam, if you grab only the first frame you will never get a quality image. you must let the camera to be warmed up.

let us test this stuation with the code below

#include "opencv2/opencv.hpp"

using namespace cv;

int main(int argc, char** argv)
{
    VideoCapture cap;

    if(!cap.open(0))
        return 0;

    Mat frame[5];

    for(int i=0; i<5; )
    {

        cap >> frame[i];

        if( !frame[i].empty() )
        {
            imshow(format("Frame - %d",i), frame[i]);
            i++;
        }
    }

    waitKey();
    return 0;
}

difference between 1st and 5th frame is blurriness on my cam. i think on some cams the brightness difference can occur.

image description

image description

edit flag offensive delete link more

Comments

Thank you for your answer. I am trying to use your suggestion, but I am getting error at line imshow(format("Frame - %d",i), frame[i]);

Like , assertion failed. unrecognized or unsupported array type. can you please guide me how can I Solve this error. Thank you very much once again for your comment.

Akki gravatar imageAkki ( 2015-07-15 05:06:12 -0600 )edit

@Akki i have edited the source. could you try it.

sturkmen gravatar imagesturkmen ( 2015-07-16 04:28:10 -0600 )edit
1

may be you have a webcam with autofocus so you have to wait some frame

LBerger gravatar imageLBerger ( 2015-07-16 04:58:15 -0600 )edit
1

@Akki did you try the code again?. did you solve your problem?

sturkmen gravatar imagesturkmen ( 2015-07-21 08:35:15 -0600 )edit

Thank you very much Sturkmen, Moment its working fine. Thank you very much for your suggestion.

Akki gravatar imageAkki ( 2015-07-21 09:19:46 -0600 )edit

did you tried the code? i want to know your result. any difference between first and second frame?

sturkmen gravatar imagesturkmen ( 2015-07-21 09:23:20 -0600 )edit
1

I tried the code... but there is not big changes between two frames. But its give time to the camera to set the auto focus before capturing the image.

Akki gravatar imageAkki ( 2015-07-22 02:17:53 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-06-23 01:05:37 -0600

Seen: 2,624 times

Last updated: Jul 16 '15