← Latest posts

Blog

Page 3 of 9

Fundamentals
·3 min read Beginner

Brightness and Contrast in OpenCV

Brighten an underexposed photo two ways, adding a constant with cv2.add or multiplying with cv2.convertScaleAbs, and measure which lands closer to the target exposure: 18.0 against 9.1.

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

Where Color Detection Fails in OpenCV

Score a colour-mask pipeline against a hand count on three pool table photos, fix the pockets and the shadows, and see what colour cannot fix: 27 of 41 balls found at first, 29 after the fixes, 9 of the 12 misses touching another ball.

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

Crop, Resize and Save an Image in OpenCV

Finish the fix: crop the colour chart with array slicing, shrink the photo with cv2.resize and INTER_AREA, and save it with cv2.imwrite, where the same picture is 54 KB as a JPEG and 276 KB as a PNG.

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

Gamma Correction in OpenCV with a Lookup Table

Build a 256-entry lookup table and apply it with cv2.LUT to brighten dark tones more than bright ones. Two stops dark, multiplying wins (9.1 against 10.7); three stops dark, gamma wins (13.9 against 15.1).

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

Find the HSV Range of an Object in OpenCV

Read pixels of a pool table in HSV with cv2.cvtColor and find the range its cloth takes: its green value falls almost tenfold between the lit end and a shadow while its hue stays between 86 and 90.

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

Histogram Equalization and CLAHE in OpenCV

Try OpenCV's automatic contrast fixes, cv2.equalizeHist and CLAHE, on a dark photo with a bright lamp in it, and measure why they land further from the target exposure (30.6 and 35.5) than a plain multiplier (9.1).

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

Find, Measure and Filter Contours in OpenCV

Find the outline of every blob in a mask with cv2.findContours, measure its area and roundness, and keep the ones shaped like a ball. On the pool table 11 of 14 blobs pass and the cue is rejected at roundness 0.12.

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

Image Histograms in OpenCV

Count how many pixels sit at each brightness with cv2.calcHist, draw the histogram, and read from it that the dark photo has 79.3% of its pixels in the bottom quarter and 7.8% burnt out.

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

Make a Color Mask with cv2.inRange in OpenCV

Turn an HSV range into a black-and-white mask with cv2.inRange, flip it with bitwise_not and apply it with bitwise_and. On the pool table one call marks 79.3% of the photo as cloth.

opencvimage-processing
Read more →