Ask Your Question

fabio's profile - activity

2020-10-04 14:59:31 -0600 received badge  Notable Question (source)
2017-03-12 15:32:03 -0600 received badge  Popular Question (source)
2012-12-05 05:03:11 -0600 asked a question Trooble with OpenCV with cvarrToMat
Hi,

I have issues when I execute my program (see below):

#include "opencv2/video/tracking.hpp"

#include "opencv2/imgproc/imgproc.hpp"

#include "opencv2/highgui/highgui.hpp"

#include <time.h>

#include <stdio.h>

#include <ctype.h>

int main(int argc, char** argv) {

CvCapture *capture;
IplImage *FrameRef;
IplImage *NextFrame;
IplImage *NextFrameGrey;
IplImage *BitImage;
IplImage *ImageResultSubstract;
IplImage *FrameRefGrey;

// Capture the Image from the webcam
capture = cvCreateCameraCapture(0);

// Get the frame
FrameRef = cvQueryFrame(capture);

// Image bufferised
cvCloneImage(FrameRef);

// Convert color image in grey image
cvCvtColor(FrameRef,FrameRefGrey,CV_RGB2GRAY);

while(1){

    // Capturing the next frame
    NextFrame = cvQueryFrame(capture);

    // Image bufferised
    cvCloneImage(NextFrame);

    // Convert color image in grey image
    cvCvtColor(NextFrame,NextFrameGrey,CV_RGB2GRAY);

    // Substrac FrameRefGrey and NextFrameGrey
    cvAbsDiff(FrameRefGrey,NextFrameGrey,ImageResultSubstract);

    // public static double cvThreshold(
    //  IntPtr image_source,
    //  IntPtr image_destination,
    //  double threshold,
    //  double maxValue,
    //  THRESH thresholdType)

    // Apply a threshold
    cvThreshold(ImageResultSubstract,BitImage,100,255,CV_THRESH_BINARY);

    // 
    cvShowImage("CamSub", BitImage);

    if(cvWaitKey(10) >= 0 ){
            break;
    }

    cvReleaseCapture( &capture );
    cvDestroyWindow( "Motion" );

}

}

When I execute, my webcam works 2 sec and after I see this message on command windows

-> OpenCV Error: Bad argument (Unknown array type) in cvarrToMat, file /home/morbiducci/OpenCV-2.3.1/modules/core/src/matrix.cpp, line 646 terminate called after throwing an instance of 'cv::Exception' what(): /home/morbiducci/OpenCV-2.3.1/modules/core/src/matrix.cpp:646: error: (-5) Unknown array type in function cvarrToMat

Abandon

Someone had had this problem? I need help because I dont know openCV completely :s

Sicerely

Faab

2012-11-21 02:17:19 -0600 received badge  Editor (source)
2012-11-21 02:09:59 -0600 asked a question libv4lconvert: Error

Hello,

I'm trying to capture pictures with my webcam under Debian 6. When I execute my program Ihave many erros:

morbiducci@debian:~/OpenCV-2.3.1/mycprogs$ ./FirstProg
libv4lconvert: warning more framesizes then I can handle!    

libv4lconvert: warning more framesizes then I can handle!

VIDIOC_QUERYMENU: Invalid argument

VIDIOC_QUERYMENU: Invalid argument

VIDIOC_QUERYMENU: Invalid argument

VIDIOC_QUERYMENU: Invalid argument

libv4lconvert: Error decompressing JPEG: fill_nbits error: need 3 more bits

libv4lconvert: Error decompressing JPEG: fill_nbits error: need 1 more bits

libv4lconvert: Error decompressing JPEG: fill_nbits error: need 6 more bits

libv4lconvert: Error decompressing JPEG: unknown huffman code: 0000ffff

libv4lconvert: Error decompressing JPEG: fill_nbits error: need 1 more bits

libv4lconvert: Error decompressing JPEG: fill_nbits error: need 2 more bits

libv4lconvert: Error decompressing JPEG: fill_nbits error: need 2 more bits

Could you help me to understand this errors an try to debug these? Because I'm novice in openCV an Debian.

Note:I run with OpenCV 2.3.1

Thx