cvSetData測試
IplImage *image = cvLoadImage("D:\\original(W).bmp" ,1); IplImage *rere =new IplImage; cvInitImageHeader(rere, cvSize( image->width,image->height), 8, 3,IPL_ORIGIN_BL, 4); cvSetData(rere, image->imageData, image->widthStep ); int cannyV1 = 150; int cannyV2 = 50; IplImage *image_Gray =cvCreateImage(cvSize(image->width , image->height) ,image->depth ,1); IplImage *image_Canny = cvCreateImage(cvSize(image->width , image->height) ,image->depth ,1); CvMemStorage *storage = cvCreateMemStorage(0); CvSeq *seq =0; cvCvtColor(image , image_Gray ,CV_BGR2GRAY); cvCanny(image_Gray ,image_Canny , cannyV1 ,cannyV2 ,3); seq = cvHoughLines2(image_Canny , storage , CV_HOUGH_PROBABILISTIC , 1 , CV_PI/180, 100, 20, 10 ); for(int i=0 ;i< seq->total ; i++) { CvPoint* line = (CvPoint*)cvGetSeqElem(seq,i); cvLine(rere , line[0] ,line[1] , CV_RGB(255, 0, 0) ,2 ,8 ,0); } cvShowImage("A" ,image); cvShowImage(&q