Note that there are some explanatory texts on larger screens.

plurals
  1. POcvExtractSURF throwing exception, incorrect size of input array ( ) in cvCreateSeq
    text
    copied!<p>I'm using the following code with OpenCV on a Mac. The following function receives a path to an image file from another function, and that works fine. However, cvExtractSURF throws an exception stating:</p> <blockquote> <p>OpenCV Error: Incorrect size of input array () in cvCreateSeq, file >/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarb>alls_ports_graphics_opencv/opencv/work/OpenCV-2.4.1/modules/core/src/datastructs.cpp, line 372 terminate called throwing an exception</p> </blockquote> <p>The code is as follows:</p> <pre><code>- (int)extractFromImagePath:(NSString*)pathToFile{ [self.statusText setStringValue:@"image received"]; NSLog(@"Path: %@",pathToFile); // Path: /Users/loco/Desktop/testimage.png const char * path = [pathToFile UTF8String]; IplImage* image = cvLoadImage(path, CV_LOAD_IMAGE_GRAYSCALE ); cv::Mat im = cv::imread(path,0); if(im.data == NULL) { std::cout&lt;&lt;"Unable to read "&lt;&lt;path&lt;&lt;std::endl; return 0; } /* extract the SURF keypoints/descriptors of an image */ // presumes a previously declared IplImage *image CvSeq *keypoints = NULL; CvSeq *descriptors = NULL; CvMemStorage *storage = cvCreateMemStorage(0); cvExtractSURF(image, NULL, &amp;keypoints, &amp;descriptors, storage, cvSURFParams(0, 600)); // OpenCV Error: Incorrect size of input array () in cvCreateSeq, file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_opencv/opencv/work/OpenCV-2.4.1/modules/core/src/datastructs.cpp, line 372 // terminate called throwing an exception [self.statusText setStringValue:@"writing to files"]; /* build a path to save a file in the documents directoy */ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *docs = [paths objectAtIndex:0]; NSString *xmlpath_kp = [docs stringByAppendingPathComponent:@"keypoints.xml"]; NSString *xmlpath_desc = [docs stringByAppendingPathComponent:@"descriptors.xml"]; /* serialize to xml and save to disc */ cvSave([xmlpath_kp UTF8String], keypoints); cvSave([xmlpath_desc UTF8String], descriptors); [self.statusText setStringValue:@"done"]; /* don't forget your cleanup ;) */ cvReleaseImage(&amp;image); cvClearMemStorage(storage); return 1; } </code></pre> <p>Would anybody know what's going on? Any help would be appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload