Ask Your Question

agarciamontoro's profile - activity

2014-03-22 10:41:06 -0600 commented question Why do I get a repeated image in a single frame and how do I solve it?

I tried this some days ago, but it doesn't solve the problem :/

2014-03-19 18:05:07 -0600 received badge  Critic (source)
2014-03-19 17:27:18 -0600 commented question Why do I get a repeated image in a single frame and how do I solve it?

That makes a lot of sense, @diegoroman17!! I will look for more info about the three versus one channel, but what do you mean by the routine of frame acquisition? I'm not sure if I understood you. Thank you very much :)

2014-03-18 15:43:10 -0600 received badge  Editor (source)
2014-03-18 15:42:38 -0600 asked a question Why do I get a repeated image in a single frame and how do I solve it?

I am trying to build an application to simply get, save and show some frames from my camera, a DMK 41BU02 (you can consult the specifications of the device in the following link: datasheet)

My code is as simple as that:

#include "opencv2/opencv.hpp"

using namespace std;
using namespace cv;

int main(int, char**)
{
    String path="~/proof.jpg";
    VideoCapture cap(1); // /dev/video0 is the integrated webcam of my laptop, while /dev/video1 is the DMK41BU02 camera
    cvNamedWindow( "Video", CV_WINDOW_AUTOSIZE );
    if(!cap.isOpened())  // check if we succeeded
        return -1;

    Mat frame;
    cap >> frame;
    imwrite(path, frame);
    imshow("Video", frame);
    waitkey(0);

    return 0;
}

The code compiles and executes whithout any problem, but the error arrives when the image is shown on the window or saved in the jpg file, because I get something like the following jpg, where the image is triplicated in the frame:

Resulting image of the code shown above

Some aspects to remark:

  1. The code executes normally and returns normal images when working with the integrated webcam of my laptop.
  2. The DMK41BU02 camera works normally and returns normal images when working with another application, such as fswebcam or VLC.
  3. The camera datasheet says it is compatible with OpenCV.
  4. I have also tried the code with an infinite loop, as I know the first frame grabbed can be blank or with some type of error, but the problem is still there.
  5. I have had some issues installing the camera drivers, but I think they're all resolved.
  6. The laptop is a 32-bit machine with Ubuntu installed on it. Here you can see the output of uname -a: Linux AsusPC 3.11.0-18-generic #32~precise1-Ubuntu SMP Thu Feb 20 17:54:21 UTC 2014 i686 i686 i386 GNU/Linux

I have no idea of how to debug this problem and, of course, I don't know where the error could be. Could you give me any hint, please?

Thank you very much.