What’s the use of Canny before HoughLines (opencv)?

Short Answer cvCanny is used to detect Edges, as well as increase contrast and remove image noise. HoughLines which uses the Hough Transform is used to determine whether those edges are lines or not. Hough Transform requires edges to be detected well in order to be efficient and provide meaning results. Long Answer The Limitations … Read more

Detect semicircle in OpenCV

Use houghCircle directly on your image, don’t extract edges first. Then test for each detected circle, how much percentage is really present in the image: int main() { cv::Mat color = cv::imread(“../houghCircles.png”); cv::namedWindow(“input”); cv::imshow(“input”, color); cv::Mat canny; cv::Mat gray; /// Convert it to gray cv::cvtColor( color, gray, CV_BGR2GRAY ); // compute canny (don’t blur with … Read more

find intersection point of two lines drawn using houghlines opencv

You don’t want to get the intersections of the parallel lines; only the intersections of the vertical lines with those of the horizontal lines. Also, since you have vertical lines, calculating the slope will likely result in exploding or inf slopes, so you shouldn’t use the y = mx+b equations. You need to do two … Read more

Algorithm to detect corners of paper sheet in photo

I’m Martin’s friend who was working on this earlier this year. This was my first ever coding project, and kinda ended in a bit of a rush, so the code needs some errr…decoding… I’ll give a few tips from what I’ve seen you doing already, and then sort my code on my day off tomorrow. … Read more

Peak-finding algorithm for Python/SciPy

The function scipy.signal.find_peaks, as its name suggests, is useful for this. But it’s important to understand well its parameters width, threshold, distance and above all prominence to get a good peak extraction. According to my tests and the documentation, the concept of prominence is “the useful concept” to keep the good peaks, and discard the … Read more