0

I'm using a pi cam with a jetson nano.

This is the result. https://i.stack.imgur.com/mAShR.jpg

Any ideas on how to make it better, so it detects all the dots and not just some of them.

Can't post the full code. So I shortened it down

        # Blur image
        blur=cv2.medianBlur(gray,5)
        cv2.imshow("blur",blur)
        cv2.moveWindow("blur",0,dispH)

        # Convert back to color
        ColorBlur = cv2.cvtColor(blur, cv2.COLOR_GRAY2BGR)
        cv2.imshow("ColorBlur",ColorBlur)
        cv2.moveWindow("ColorBlur",dispW,dispH)

        # Detect cirkels
        circles = cv2.HoughCircles(blur,cv2.HOUGH_GRADIENT,1,15,param1=100,param2=30,minRadius=3, maxRadius=30)
        circles = np.uint16(np.around(circles))
        N=0

        # Count cirkels
        for i in circles[0, :]:
            # Outer Circel
            cv2.circle(diceTray, (i[0],i[1]),i[2],(255,0,0),-1)

            N = N +1
            print(N)
  • There's several parameters you can play with for [HoughCircles](https://docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga47849c3be0d0406ad3ca45db65a25d2d) but things I notice in your choice of parameters: your min radius is pretty small, i'd think your min and max radius would be pretty close to each other since all your circles are of equal size, `param2` is `30` but the docs talk about `0.9` being fine. – Macattack Feb 16 '21 at 21:54
  • thank you. param2=14 works a lot better. It gets it correct most of the time now. So I'm thinking of having a for loop that makes 10 circle checks and takes the average of them. But it looks like it doesn't take a new picture in the loop. – Zautos Gaming Feb 16 '21 at 23:55

0 Answers0