Ok, thanks for encouragement with my problem. Thanks to it i found this partially soloution:
Mat mazeImage = Imgcodecs.imread("vzory/real_5.jpg"); //, Imgcodecs.CV_LOAD_IMAGE_COLOR
Mat hsv = new Mat();
Mat treshold = new Mat();
Mat hierarchy = new Mat();
Imgproc.cvtColor(mazeImage, hsv, Imgproc.COLOR_BGR2HSV);
Core.inRange(hsv, new Scalar(20,135,135), new Scalar(30, 255, 255), treshold);
List<MatOfPoint> contours = new ArrayList<>();
Imgproc.findContours(treshold, contours, hierarchy, Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE);
PointContourCollection pointContourCollection = new PointContourCollection(new PointContourComparator());
for (MatOfPoint contour : contours) {
Point center = new Point();
Moments moments = Imgproc.moments(contour);
center.x = (int) (moments.m10/moments.m00);
center.y = (int) (moments.m01/moments.m00);
double area = Imgproc.contourArea(contour);
if(area > 0.1){
pointContourCollection.add(new PointContour(center, area, contour));
}
}
Imgproc.drawContours(mazeImage, contours, -1, new Scalar(0, 255, 0), 5);
Class PointContourCollection - extension of ArrayList - for store only yellow corners with center position and their area. Corners are sorted with PointContourComparator by area size. ![Partial result]()