}
double minVal, maxVal;
- minMaxLoc( raw_dist, &minVal, &maxVal );
+ Point maxDistPt; // inscribed circle center
+ minMaxLoc(raw_dist, &minVal, &maxVal, NULL, &maxDistPt);
minVal = abs(minVal);
maxVal = abs(maxVal);
}
}
}
+ circle(drawing, maxDistPt, (int)maxVal, Scalar(255,255,255));
/// Show your results
imshow( "Source", src );
- imshow( "Distance", drawing );
+ imshow( "Distance and inscribed circle", drawing );
waitKey();
return 0;
}
}
drawing.put(0, 0, drawingData);
+ Imgproc.circle(drawing, res.maxLoc, (int)res.maxVal, new Scalar(255, 255, 255), 2, 8, 0);
/// Show your results
HighGui.imshow("Source", src);
- HighGui.imshow("Distance", drawing);
+ HighGui.imshow("Distance and inscribed circle", drawing);
HighGui.waitKey();
System.exit(0);
for j in range(src.shape[1]):
raw_dist[i,j] = cv.pointPolygonTest(contours[0], (j,i), True)
-minVal, maxVal, _, _ = cv.minMaxLoc(raw_dist)
+minVal, maxVal, _, maxDistPt = cv.minMaxLoc(raw_dist)
minVal = abs(minVal)
maxVal = abs(maxVal)
drawing[i,j,1] = 255
drawing[i,j,2] = 255
+cv.circle(drawing,maxDistPt, int(maxVal),tuple(255,255,255), 1, cv.LINE_8, 0)
cv.imshow('Source', src)
-cv.imshow('Distance', drawing)
+cv.imshow('Distance and inscribed circle', drawing)
cv.waitKey()