Detect if image is pixelated using canny and hough transform [closed]

asked 2018-06-29 16:05:59 -0600

joru gravatar image

Hello guys, I'm very new to the OpenCV world and image processing. I was reading online and I found it's possible to tell if an image is pixelated or not based on the number of lines detected using an edge detector and then applying Hough transform.
I tried that method and the Hough transform doesn't seem to be detecting the lines properly I can't figure out why isn't it working properly.
Here are some result images for reference: The canny edge detection result and the Hough Transform result
The code I'm using to do this based on some online tutorials:

img = cv2.imread(image_path)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

high_thresh, thresh_im = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
lowThresh = 0.5*high_thresh
edges = cv2.Canny(img, lowThresh, high_thresh)

minLineLength = 200
maxLineGap = 10
lines = cv2.HoughLinesP(edges,1,np.pi/180,100,minLineLength,maxLineGap)
for x1,y1,x2,y2 in lines[0]:
    cv2.line(img,(x1,y1),(x2,y2),(0,255,0),2)

cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-14 12:35:31.746764