c++ - Unhandled Exception while using cvCreateSeq -



c++ - Unhandled Exception while using cvCreateSeq -

i using cvcreateseq function create sequence in opencv,while debugging exception occurs 'unhandled exception @ 0x7c812afb'.i coding in c , ide visual c++ 2010 express edition.

can tell me why exception ocurring.

thanks,

the code is:-

void main() { char * file = "d:\\testimage.jpg"; temp(file); } void computecococlust(char * filepath) { cvmemstorage * storagecontour = null; cvseq * first_contour = null; iplimage * ioriginal = null; /*load image*/ ioriginal = cvloadimage(filepath,cv_load_image_unchanged); /*load grayscale image*/ iplimage * igray = cvloadimage(filepath,cv_load_image_grayscale); /*show original image in window named 'original image'*/ fnshowimageinwindow("original image",ioriginal); /*show graylevel image in window named 'graylevel image'*/ fnshowimageinwindow("graylevel image",igray); fnreleasingmemoryofwindow("graylevel image",igray); /*------getting single channel image reddish greenish bluish rgb ioriginal----------*/ iplimage *ired = cvcreateimage(cvgetsize(ioriginal), ioriginal->depth, 1); iplimage *igreen = cvcreateimage(cvgetsize(ioriginal), ioriginal->depth, 1); iplimage *iblue = cvcreateimage(cvgetsize(ioriginal), ioriginal->depth, 1); cvsplit(ioriginal, iblue, igreen, ired, null); /*show ired,igreen,iblue in window*/ fnshowimageinwindow("red component image",ired); fnshowimageinwindow("green component image",igreen); fnshowimageinwindow("blue component image",iblue); /*---------------------------------------------------------------------------------*/ /*--------perform canny border detection--------------------------------------------*/ /*for reddish component*/ iplimage * ered = cvcreateimage(cvgetsize(ired),ired->depth,1); cvcanny(ired,ered,10,100,3); /*for greenish component*/ iplimage * egreen = cvcreateimage(cvgetsize(igreen),igreen->depth,1); cvcanny(igreen,egreen,10,100,3); /*for bluish component*/ iplimage * eblue = cvcreateimage(cvgetsize(iblue),iblue->depth,1); cvcanny(iblue,eblue,10,100,3); /*-----show ered,egreen,eblue in window------------------------------------------*/ fnshowimageinwindow("red component border image",ered); fnshowimageinwindow("green component border image",egreen); fnshowimageinwindow("blue component border image",eblue); /*-------------------------------------------------------------------------------*/ /*-----performing union of border images using cvmax-----------------------------*/ iplimage * imaxtmp = cvcreateimage(cvgetsize(ioriginal),ioriginal->depth,1); iplimage * iunionimage = cvcreateimage(cvgetsize(ioriginal),ioriginal->depth,1); cvmax(ered,egreen,imaxtmp); cvmax(imaxtmp,eblue,iunionimage); fnshowimageinwindow("union of images",iunionimage); /*-------------------------------------------------------------------------------*/ /*----getting boundary pixel of each connected component---------------------*/ storagecontour = cvcreatememstorage(0); int numcountour = cvfindcontours(iunionimage,storagecontour,&first_contour,sizeof(cvcontour),cv_retr_ccomp,cv_chain_approx_none); printf("total countours detected %d",numcountour); cvmemstorage * storage = cvcreatememstorage(0); /*-------------------------------------------------------------------------------*/ /*----smoothing contour------------------------------------------------------*/ for(cvseq * seqsmooth = first_contour;seqsmooth!=null;seqsmooth = seqsmooth->h_next) { cvseq * newseq = cvcreateseq(cv_32fc1,sizeof(cvseq),sizeof(cvpoint),storage); for(int =3 ; i<seqsmooth->total-2 ;i++) { cvpoint * ps1 = cv_get_seq_elem(cvpoint,seqsmooth,i-2); cvpoint * ps2 = cv_get_seq_elem(cvpoint,seqsmooth,i-1); cvpoint * ps3 = cv_get_seq_elem(cvpoint,seqsmooth,i); cvpoint * ps4 = cv_get_seq_elem(cvpoint,seqsmooth,i+1); cvpoint * ps5 = cv_get_seq_elem(cvpoint,seqsmooth,i+2); cvpoint newpoint = cvpoint((ps1->x + ps2->x + ps3->x + ps4->x + ps5->x)/5,(ps1->y + ps2->y + ps3->y + ps4->y + ps5->y)/5); cvseqpush(newseq,&newpoint); } if(storagecontour->bottom->prev != null) { cvmemblock * oldnext = storagecontour->bottom->next; cvmemblock * oldprev = storagecontour->bottom->prev; storagecontour->bottom = newseq->storage->bottom; storagecontour->bottom->next = oldnext; storagecontour->bottom->prev = oldprev; } else { cvmemblock * oldnext = storagecontour->bottom->next; storagecontour->bottom = newseq->storage->bottom; } }

c++ c opencv

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -