Ask Your Question

Dtractus's profile - activity

2020-06-06 03:34:10 -0500 commented answer OpenCV does not detect the my rectangle

Thank you for everything.. @supra56

2020-06-06 03:33:43 -0500 received badge  Supporter (source)
2020-06-06 03:33:41 -0500 marked best answer OpenCV does not detect the my rectangle

Hello, im new on OpenCV.

I Have a picture like this;

image description

I wrote code like this;

        image = cv2.imread("photos/testtt.png")
        gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
        edged = cv2.Canny(image, 170, 490)
        (cnts, _) = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
        idx = 0
        for c in cnts:
            x,y,w,h = cv2.boundingRect(c)
            if w>50 and h>50:
                idx+=1
                new_img=image[y:y+h,x:x+w]
                cv2.imwrite(str(idx) + '.png', new_img)
        cv2.imshow("im",image)
        cv2.waitKey(0)

There are rectangles in the photo, but this code I wrote does not detect these rectangles. I guess I'm not sure, as it leaves very thinly.

I would be very grateful if you could help me, good day everyone.

2020-06-06 03:33:41 -0500 received badge  Scholar (source)
2020-06-05 06:28:49 -0500 commented answer OpenCV does not detect the my rectangle

By the way yes, i want draw each gray area rectangle and save them. @supra56

2020-06-05 06:27:42 -0500 commented answer OpenCV does not detect the my rectangle

My goal is to choose only these gray rectangles. Thank you very much for the code you wrote, but it does not work in th

2020-06-05 04:21:38 -0500 commented answer OpenCV does not detect the my rectangle

Hello again @supra56 i edited image on first post. Really thank you for helping.

2020-06-05 04:20:54 -0500 received badge  Editor (source)
2020-06-05 04:20:54 -0500 edited question OpenCV does not detect the my rectangle

OpenCV does not detect the my rectangle Hello, im new on OpenCV. I Have a picture like this; I wrote code like this

2020-06-04 14:46:26 -0500 commented answer OpenCV does not detect the my rectangle

Hello, thanks for code but I just want to get those rectangles(gray areas) I mentioned. Because there can be different w

2020-06-04 10:14:53 -0500 commented question OpenCV does not detect the my rectangle

@supra56 , thanks but when i use drawContours, draws the outer rectangle of the image. it does not detect rectangles ins

2020-06-04 07:58:29 -0500 asked a question OpenCV does not detect the my rectangle

OpenCV does not detect the my rectangle Hello, im new on OpenCV. I Have a picture like this; I wrote code like this