Bad Argument <Unknown array type> [closed]

asked 2013-08-05 04:01:52 -0500

dogucan159 gravatar image

updated 2017-11-14 15:27:30 -0500

I want to Use the capture and store code below together with the doPyrDown() code to create a program that reads from a camera and stores downsampled color images to disk. Then I want to display the frames as they are processed.


#include <opencv/cv.h>
#include <opencv2/highgui/highgui.hpp>
IplImage* doPyrDown(
IplImage* in,
int filter = IPL_GAUSSIAN_5x5
) {
// Best to make sure input image is divisible by two.
//
//assert( in->width%2 == 0 && in->height%2 == 0 );
IplImage* out = cvCreateImage(
cvSize( in->width/2, in->height/2 ),
in->depth,
in->nChannels
);
cvPyrDown( in, out );
return( out );
}
int main( int argc, char** argv ) {
CvCapture* capture = 0;
capture = cvCreateFileCapture( argv[1] );
if(!capture){
return -1;
}
IplImage *bgr_frame=cvQueryFrame(capture);//Init the video read
double fps = cvGetCaptureProperty (
capture,
CV_CAP_PROP_FPS
);
CvSize size = cvSize(
(int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH),
(int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT)
);
CvVideoWriter* writer = cvCreateVideoWriter(
argv[2],
CV_FOURCC('M','J','P','G'),
fps,
size
);
IplImage* logpolar_frame = cvCreateImage(
size,
IPL_DEPTH_8U,
3
);
while( (bgr_frame=cvQueryFrame(capture)) != NULL ) {
cvLogPolar( bgr_frame, logpolar_frame,
cvPoint2D32f(bgr_frame->width/2,
bgr_frame->height/2),
40,
CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS );
logpolar_frame=doPyrDown(logpolar_frame,IPL_GAUSSIAN_5x5);
cvWriteFrame( writer, logpolar_frame );
}
cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
capture = cvCreateFileCapture( argv[2] );
IplImage* frame;
while(1) {
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "Example2", frame );
char c = cvWaitKey(33);
if( c == 27 ) break;
}
cvReleaseVideoWriter( &writer );
cvReleaseImage( &logpolar_frame );
cvReleaseCapture( &capture );
cvDestroyWindow( "Example2" );
return(0);
}

I got this error in the command line OpenCV Error: Insufficient memory (Failed to allocate 1228820 bytes) in unknown function, file ......\src\opencv\modules\core\src\alloc.cpp, line 52

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-08-16 12:26:26.387691