Quantcast
Viewing all articles
Browse latest Browse all 41027

Triangle detection - Canny failing on corner

Hi I'm trying to detect a triangle however approxPolyDP fails because length(approx) != 3 approx = cv2.approxPolyDP(.....) I think its because the Canny algortihm somehow cannot find lower right virtex edge. (see image below). The input image (zoomed using Imagj) ![image description](/upfiles/14522945681341307.png) and Imagej pixel inspection tool output of lower right virtexd ![image description](/upfiles/14522946118468856.png) Here is the Canny output. I've tried numerous thresholds and get the same opening in the lower RHS virtex. ![image description](/upfiles/14522948128414155.png) My code >>> import cv2>>> import sys>>> import numpy as np>>> filename = 'diffGr.png'>>> img = cv2.imread(filename,cv2.IMREAD_GRAYSCALE)>>> minVal = 20>>> maxVal = 200>>> edges = cv2.Canny(img,minVal,maxVal)>>> cv2.namedWindow('Edge image')>>> cv2.imshow('Edge image',edges)>>> cv2.waitKey(0) My input file [C:\fakepath\diffGr.png](/upfiles/14522949659053204.png) Any info on understanding why Canny fails would be appreciated. If this is expected, should I use a different edge detection method? Cheers

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>