← All posts
Tag

edge-detection

11 posts · browse all tags

Fundamentals
·15 min read Intermediate

Boundary Detection: Finding Lines and Circles with the Hough Transform

How to find straight lines and circles in an image without being told where they are, and why the same method works for any shape you can write as an equation. One pipeline, from image to grey to edges to votes to the best shapes, run on the lane markings of a highway and the balls on a pool table, and checked against what a person drew by hand.

image-processingedge-detectionfundamentals
Read more →
Fundamentals
·14 min read Intermediate

The Hough Circle Transform: Finding Pool Balls with HoughCircles

The Hough circle transform finds round things by letting every edge pixel vote for the centres a circle through it could have. On three photos of a pool table with 41 hand-labelled balls, OpenCV's HoughCircles finds 27 with one false alarm, and 17 of 26 on the two photos it was not tuned on. Built from scratch at one radius and checked against OpenCV on the biggest ball.

image-processingedge-detectionfundamentals
Read more →
Fundamentals
·8 min read Intermediate

What Is the Hough Transform? Finding Lines by Voting

The Hough transform finds straight lines by letting every edge pixel vote for every line that could pass through it. On a dashcam highway frame, 1,749 edge pixels cast 314,820 votes and the 15 strongest lines all lie on painted lane markings, but on only two of them. A from-scratch accumulator matches cv2.HoughLines vote for vote.

image-processingedge-detectionfundamentals
Read more →
Fundamentals
·8 min read Intermediate

Fitting a Line to Points: Least Squares vs Total Least Squares

The line you fit to a set of points depends on how you measure the distance to it. Worked by hand on eight pixels of a painted lane dash: least squares y on x gives 18.5°, x on y gives 32.7°, total least squares 20.2°. Over 473 lane markings, the two least-squares lines differ by more than 1° on a third of them.

image-processingedge-detectionfundamentals
Read more →
Fundamentals
·8 min read Intermediate

Probabilistic Hough Transform: Lane Segments with OpenCV's HoughLinesP

The full Hough vote reports lines that are not lanes. On a hard dashcam frame it gives 72 lines, 18 of them on paint; dropping near-horizontal lines and voting within ±5° of each pixel's gradient leaves 13, all on paint. Over 299 frames that takes the median share of lines on paint from 50% to 100%, and leaves 108 frames with no line at all.

image-processingedge-detectionfundamentals
Read more →
Fundamentals
·9 min read Intermediate

Canny: Non-Maximum Suppression and Hysteresis, Taken Apart

Canny is two independent mechanisms. NMS collapses a five-pixel ridge to one pixel by comparing along the gradient; hysteresis keeps a weak chain because it touches a strong seed. Worked on nine numbers: a single threshold gives either 1 pixel or 9, and hysteresis gives the 6 that belong to a real contour. Measured on a photo, that is 204 contours averaging 18.68 px against 393 averaging 9.69 px at the same pixel budget.

image-processingedge-detectionfundamentals
Read more →
Fundamentals
·10 min read Intermediate

Corners: The Structure Tensor, Harris, Shi-Tomasi and Förstner

A contour says where a boundary runs but not where you are along it. Two eigenvalues of a 2x2 matrix fix that: measured on a real photo, flat background scores 0.001/0.000, an edge 0.411/0.019 and a corner 0.442/0.318. Harris, Shi-Tomasi and Förstner all read that same matrix, and on the edge patch Harris comes out positive at k = 0.04 and negative at k = 0.06, so k decides the answer rather than the data.

image-processingedge-detectionfeaturesfundamentals
Read more →
Fundamentals
·14 min read Beginner

Edge Detection: Finding Where One Thing Stops and Another Begins

How to find, in any photo, the places where one thing stops and another begins, and turn them into a clean black-and-white edge map. One pipeline, from grey to smoothed to the change at every pixel to thin linked edges, with corners as a branch, measured on one photo and shown step by step on another.

image-processingedge-detectionfundamentals
Read more →
Fundamentals
·10 min read Intermediate

Image Gradients: Central Differences, Prewitt and Sobel

Three operators compute the same derivative and behave differently on a noisy photo. Worked by hand on a 3x3 patch: Sobel gives Gx = Gy = 1.80, a magnitude of 2.55 and an orientation of 45 degrees, while Prewitt gives 1.20 and 1.70 on identical pixels. Measured across a noise sweep, Prewitt beats Sobel at every level, and the reason is that its normalised weights have a smaller sum of squares.

image-processingedge-detectionfundamentals
Read more →
Fundamentals
·9 min read Intermediate

The Laplacian, LoG and Zero-Crossings

The second derivative crosses zero at an edge instead of peaking, and interpolating between two samples places a step edge at x = 3.5. The naive Laplacian has no smoothing in it: nine pixels disturbed by 0.03 produce four sign changes where there should be one. Measured on a photo, noise multiplies the zero-crossing pixels by 2.76x at sigma = 1.0 and 1.02x at sigma = 3.0, and only 33% of the clean-image contours are closed.

image-processingedge-detectionfundamentals
Read more →
Fundamentals
·9 min read Beginner

What Is an Edge? Step, Ramp and Roof, and the Two Derivatives That Find Them

An edge is a peak in the first derivative and a sign change in the second. Worked by hand on nine pixels: the peak lands on column 4 and the second difference is exactly zero there. Add noise of at most 0.03 and the zero-crossing moves by 0.05 px, which is small; the real cost of the second derivative is the sign changes noise makes on its own, with no size attached to threshold, which is why Canny is built on the first derivative.

image-processingedge-detectionfundamentals
Read more →