← Latest posts

Blog

Page 2 of 9

Fundamentals
·10 min read Intermediate

Camera Geometry: From a 3-D Point to a Pixel, and Back to the Camera

How a camera sends any point of the world to a pixel with one matrix, and how running that matrix backwards gives you the camera's focal length and where it stood. One pipeline, from a point on a chessboard to a pixel to a calibration and a pose, measured on OpenCV's own thirteen photographs of a board.

camera-calibrationgeometryfundamentals
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
·5 min read Intermediate

What Is Camera Calibration? Finding K from Photos of a Chessboard

Lesson 3 of Camera Geometry. Calibration measures a camera's focal length, image centre and lens bend by fitting the camera model to photos of a flat board whose corners are known. On OpenCV's thirteen chessboard photos: 0.41 px of reprojection error, a held-out photo that scores like the fitted ones, and a focal length anywhere from 520 to 568 px if only three photos are used.

camera-calibrationopencvgeometryfundamentals
Read more →
Fundamentals
·5 min read Intermediate

What Is PnP? Finding Where the Camera Is from Known Points

Lesson 4 of Camera Geometry. PnP finds where a calibrated camera stood and which way it faced from points whose positions are known and where they appear in one photo. On OpenCV's chessboard photos it returns the calibration's own pose to 0.00002°, four corners are enough for 0.27 px, and with five corners found wrong a plain fit moves the camera 2.5 squares where RANSAC moves it 0.008.

camera-calibrationopencvgeometryfundamentals
Read more →
Fundamentals
·8 min read Beginner

Find Every Ball on a Pool Table with OpenCV

The second OpenCV in Practice project: find the balls on a pool table by the one colour they are not, the cloth, and score the result ball by ball against a hand count on three photos. 29 of 41 found with 2 false alarms; 9 of the 12 misses are touching another ball.

opencvimage-processing
Read more →
Fundamentals
·6 min read Beginner

Fix a Badly Exposed Photo with OpenCV

The first OpenCV in Practice project: open a photo taken two stops too dark, read its histogram, try five ways to fix it, and measure each against a longer, better-exposed shot of the same scene (the target). Multiplying lands closest; the automatic fixes land furthest.

opencvimage-processing
Read more →