Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mat imageHough = new Mat();
- //DETECING CIRCLES FROM CANNY IMAGE
- Imgproc.HoughCircles(imageCanny, imageHough, Imgproc.CV_HOUGH_GRADIENT, 2.0, mindist, highThresh2, accum,
- minR, maxR);
- //IDENTIFYING CIRCLE LOCATION AND SIZE
- if (imageHough.cols() > 0) {
- for (int x = 0; x < imageHough.cols(); x++) {
- double crcle[] = imageHough.get(0, x);
- if (crcle == null) {
- break;
- }
- i = crcle[0];
- y = crcle[1];
- radius = (int) Math.round(crcle[2]);
- if (radius2 < radius) {
- radius2 = radius;
- }
- pt = new Point(i, y);
- //DRAWING CIRCLE TO ORIGINAL IMAGE
- if (imageHough.cols() != 0) {
- Imgproc.circle(rgbImage, pt, 3, new Scalar(0, 255, 0), 1,8,0);
- Imgproc.circle(rgbImage, pt, radius2, new Scalar(0, 0, 255), 3,8,0);
- circ++;
- } else {
- System.out.println("NO CIRCLES PRESENT!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement