[問題] Open CV取面積
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
OpenCV
問題(Question):
我要計算一塊黑色區域的面積(已經二值化過),但是我跑到最後一段的時候卻會發生錯誤
,請各位高手幫忙看看哪裡錯誤,感謝
程式碼(Code):(請善用置底文網頁, 記得排版)
using namespace cv;
using namespace std;
double area;
Mat image=imread("binary1.Jpg",0);
vector<vector <cv::Point>> contours;
findContours(image,contours,CV_RETR_EXTERNAL,CV_CHAIN_APPROX_NONE);
Mat result(image.size(),CV_8U,Scalar(255));
drawContours(result,contours,-1,Scalar(0),2);
imshow("resultImage",result);
area=contourArea(contours);
--
Sent from my Android
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.138.234.34
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1428578790.A.4A6.html
推
04/09 20:10, , 1F
04/09 20:10, 1F
→
04/09 20:14, , 2F
04/09 20:14, 2F
推
04/09 21:27, , 3F
04/09 21:27, 3F
→
04/09 21:28, , 4F
04/09 21:28, 4F
→
04/09 21:31, , 5F
04/09 21:31, 5F
推
04/09 21:37, , 6F
04/09 21:37, 6F
→
04/13 16:05, , 7F
04/13 16:05, 7F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章