xcode - Using OpenCV to detect ecllipse -


trying use opencv in xcode detect ellipse of image:

cvmemstorage *storage2 = cvcreatememstorage(0); cvseq *contours = cvcreateseq(0, sizeof(cvseq), sizeof(cvpoint), storage2);  iplimage *th = cvcreateimage(imgsize, 8, 1); cvthreshold(mask, th, 0.1, 255, cv_thresh_binary_inv );   cvfindcontours(th, storage2, &contours, sizeof(cvcontour), cv_retr_list, cv_chain_approx_none, cvpoint(0, 0));  cvdrawcontours(th, contours, cv_rgb(0,255,0), cv_rgb(0,0,255),                2, 3, 8, cvpoint(0, 0));   cv::vector<cv::rotatedrect> minrect(contours->total); cv::vector<cv::rotatedrect> minellipse(contours->total);  for( int = 0; < contours->total ; i++ ) {     minrect[i] = cvminarearect2(&contours[i]);  } 

i'm using example provided in opencv documentation.

when try run code, error:

error: (-5) input array not valid matrix in function cvpointseqfrommat

for line: minrect[i] = cvminarearect2(&contours[i]);

i'm new opencv appreciate help!!

thanks

turns out need call h_next next pointer contours!!


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -