[問題] 顯示圖像特定區域
看板C_and_CPP (C/C++)作者davidfisher (davidfisher)時間15年前 (2011/04/14 15:46)推噓1(1推 0噓 3→)留言4則, 2人參與討論串1/1
如題
我想要只顯示原圖中的ROI區域
在網路上找到這個程式碼
卻不知道為何一直出現"發生存取違規"的錯誤訊息
到底是怎麼回事呢QQ
#include "stdafx.h"
#include <highgui.h>
#include <stdio.h>
int _tmain(int argc, _TCHAR* argv[])
{
IplImage *Image1;
IplROI ROI;
CvRect Rect1,Rect2;
Image1=cvLoadImage("123.bmp",1);
Rect1=cvRect(176,186,14,22);
ROI=cvRectToROI(Rect1,0);
Image1->roi=&ROI;
Rect2=cvROIToRect(*Image1->roi);
cvNamedWindow("Coast(Region Of Interesting)",1);
cvShowImage("Coast(Region Of Interesting)",Image1);
Image1->roi=NULL;
cvRectangle(Image1,cvPoint(176,186),cvPoint(176 + 14,186 +
22),CV_RGB(255,0,0),1,8,0);
cvNamedWindow("Coast",1);
cvShowImage("Coast",Image1);
cvWaitKey(0);
return 0;
}
好像是在 Image1->roi=&ROI 這行出現錯誤 > <
謝謝大家幫忙!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.40.159
※ 編輯: davidfisher 來自: 140.116.40.159 (04/14 15:47)
推
04/14 21:15, , 1F
04/14 21:15, 1F
→
04/14 21:15, , 2F
04/14 21:15, 2F
→
04/14 21:31, , 3F
04/14 21:31, 3F
→
04/14 21:32, , 4F
04/14 21:32, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章