0
Mat img =Imgcodecs.imread(path);
Mat src = new Mat();
Imgproc.cvtColor(img, src, Imgproc.COLOR_BGR2GRAY);
Imgproc.threshold(src, src, 127, 255, Imgproc.THRESH_TOZERO);
Imgproc.Canny(src, src, 10,100, 3,true);
ArrayList<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Imgproc.findContours(src, contours, new Mat(), Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_SIMPLE);
Mat contourImg = new Mat(img.size(), img.type());
Point p= new Point(150,260);
for (int i = 0; i < contours.size(); i++) {
Imgproc.drawContours(contourImg, contours, i, new Scalar(0, 0, 255), -1);
}
enter image description here境界は、私は、楕円領域にどこをクリックしたとき、私は赤い楕円の色を変更するにはどうすればよい
をトレース? マウスのクリックでx座標とy座標を取得できますが、 "境界トレース"を操作することはできません。ここに書いたコードはあります。