opencv visual studio 2005 exception (windows 7 32 bit) -
please can me please i'm suffering every time debug project have exception , cant solve please causing exception , how can solve it. code:
//////////////////////////////////////////////////////////////////////// // simple, introductory opencv program. //////////////////////////////////////////////////////////////////////// #include <stdlib.h> #include <stdio.h> #include <math.h> #include <iostream> #include <cv.h> #include <highgui.h> #define pixel(img,x,y) (img)->imagedata[x*img->widthstep+y] /** * replacement matlab's bwareaopen() * input image must 8 bits, 1 channel, black , white (objects) * values 0 , 255 respectively */ /*void removesmallblobs(cv::mat& im, double size) { // accept cv_8uc1 if (im.channels() != 1 || im.type() != cv_8u) return; // find contours std::vector<std::vector<cv::point> > contours; cv::findcontours(im.clone(), contours, cv_retr_external, cv_chain_approx_simple); (int = 0; < contours.size(); i++) { // calculate contour area double area = cv::contourarea(contours[i]); // remove small objects drawing contour black color if (area > 0 && area <= size) cv::drawcontours(im, contours, i, cv_rgb(0,0,0), -1); } } */ int main(int argc, char *argv[]) { iplimage *img, *img; int height,width; int i,j, count=0; int morph_elem=0; int morph_size = 0; int morph_operator = 0; //read image img = cvloadimage("1.jpg",1); cvshowimage("original image",img ); //rgb hsv iplimage* hsv = cvcreateimage( cvgetsize(img), 8, 3 ); cvcvtcolor( img, hsv, cv_bgr2hsv ); cvshowimage("hsv image ",hsv ); //extract h, s, , v images individualy iplimage* h_plane = cvcreateimage( cvgetsize(img), 8, 1 ); iplimage* s_plane = cvcreateimage( cvgetsize(img), 8, 1 ); iplimage* v_plane = cvcreateimage( cvgetsize(img), 8, 1 ); iplimage* planes[] = { h_plane, s_plane }; cvcvtpixtoplane( hsv, h_plane, s_plane, v_plane, 0 ); // apply each color band's particular thresholds color band iplimage* yellow = cvcreateimage( cvgetsize(v_plane), 8, 3 ); cvthreshold( h_plane, h_plane,0.09*255,0.14*255,cv_thresh_binary); cvthreshold( s_plane, s_plane,0.1*255,1.0*255,cv_thresh_binary); cvthreshold( v_plane, v_plane,0.1*255,1.0*255,cv_thresh_binary); cvshowimage("h mask ",h_plane ); cvshowimage("s mask ",s_plane ); cvshowimage("v mask ",v_plane ); cvmat *h_array = cvcreatemat(h_plane->height,h_plane->width,cv_8uc1 ); cvmat *s_array = cvcreatemat(s_plane->height,s_plane->width,cv_8uc1 ); cvmat *v_array= cvcreatemat(v_plane->height,v_plane->width,cv_8uc1 ); cvconvert( h_plane, h_array ); cvconvert( s_plane,s_array ); cvconvert( v_plane,v_array ); // anding cvmat* yellowobjectsmask= cvcreatemat( img->height,img->width,cv_8uc1 ); cvand(h_array, s_array,yellowobjectsmask); cvshowimage("yellow objects ",yellowobjectsmask ); cvshowimage("yellow objects ",yellowobjectsmask ); //convert iplimage //iplimage *im = cvloadimage( "1.jpg"); //cvmat *mat = cvcreatemat(im->height,im->width,cv_32fc3 ); //cvconvert( im,mat ); /*int count=0; (int i=0;i<yellowobjectsmask->rows;i++){ int j=0;j<yellowobjectsmask->cols;j++){ if (yellowobjectsmask(i,j)==0){ count=count+1; } } } if (count==i*j){ cout<<"not infected"; } */ // wait key cvwaitkey(0); // release images , close windows cvreleaseimage(&img ); //cvdestroywindow("output"); //cvdestroywindow("gray"); return 0; } unhandled exception @ 0x75ba9617 in firstproj.exe: microsoft c++ exception: cv::exception @ memory location 0x0011fb38..
it's path error caused exception
Comments
Post a Comment