Announcements • Assignment 1: Due on next thursday • For this week, there is a link on the web page for reading which isn’t yet active. Analysis of Binary Images Introduction to Computer Vision CSE 152 Lecture 6 CSE152, Spr 05 Intro Computer Vision CSE152, Spr 05 Intro Computer Vision Light Spectrum The appearance of colors • Color appearance is strongly affected by (at least): – – – – Spectrum of lighting striking the retina other nearby colors (space) adaptation to previous views (time) “state of mind” CSE152, Spr 05 Intro Computer Vision CSE152, Spr 05 Talking about colors Color Reflectance Measured color spectrum is a function of the spectrum of the illumination and reflectance 1. Spectrum – • • Intro Computer Vision A positive function over interval 400nm700nm “Infinite” number of values needed. 2. Names • • red, harvest gold, cyan, aquamarine, auburn, chestnut A large, discrete set of color names 3. R,G,B values • CSE152, Spr 05 Just 3 numbers From Foundations of Vision, Brian Wandell, 1995, via B. Freeman slides Intro Computer Vision CSE152, Spr 05 Intro Computer Vision 1 Color Matching Functions RGB • Primaries are monochromatic, wavelengths are 645.2nm, 526.3nm, 444.4nm. • Color matching functions have negative parts -> some colors can be matched only subtractively. Primary light = p1P1(λ) + p2P2(λ) + p3P3(λ) Where pi is the strength of each primary, and Pi(λ) is the spectrum of primary i slideIntro from T. Darrel Computer Vision CSE152, Spr 05 CSE152, Spr 05 RGB Color Cube YIQ Model • Block of colours for (r, g, b) in the range (0-1). • Convenient to have an upper bound on coefficient of each primary. • In practice: – primaries given by monitor phosphors – (phosphors are the materials on the face of the monitor screen that glow when struck by electrons) CSE152, Spr 05 Intro Computer Vision 0.114 R Y 0.299 0.587 I = 0.596 − 0.275 − 0.321 G Q 0.212 − 0.532 0.311 B • Used by NTSC TV standard • Separates Hue & Saturation (I,Q) from Luminance (Y) CSE152, Spr 05 Intro Computer Vision CIE xyY (Chromaticity Space) CIE -XYZ and x-y CSE152, Spr 05 Intro Computer Vision Intro Computer Vision CSE152, Spr 05 Intro Computer Vision 2 HSV Hexcone RGB-> HSV [[ Note that for HW1 you may find different ways to do this convertion in the literature. If you use something different, just inclue a citation so we can know where your equations came from ]] Hue, Saturation, Value AKA: Hue, Saturatation, Intensity (HIS) Let MAX=max(R,G,B), let MIN=min(R,G,B) S=(max-min)/max V= max Hexagon arises from projection of cube onto plane orthogonal to (R,G,B) = (1,1,1) CSE152, Spr 05 Intro Computer Vision Metameric Lights (Metamers) CSE152, Spr 05 CSE152, Spr 05 Intro Computer Vision Blob Tracking for Robot Control Intro Computer Vision CSE152, Spr 05 Intro Computer Vision Basic Steps 1. Labeling pixels as foreground/background (0,1). 2. Morphological operators (sometimes) 3. Find pixels corresponding to a region 4. Compute properties of each region Binary Image Processing CSE152, Spr 05 Intro Computer Vision CSE152, Spr 05 Intro Computer Vision 3 How do we select a Threshold? Histogram-based Segmentation • Manually determine threshold experimentally. Ex: bright object on dark background: Histogram • Select threshold • Create binary image: Number of pixels – Good when lighting is stable and high contrast. • Automatic thresholding – – – – – I(x,y) < T -> O(x,y) = 0 – I(x,y) > T -> O(x,y) = 1 P-tile method Mode method Peakiness detection Iterative algorithm Gray value T CSE152, Spr 05 [ From Octavia Camps] Intro Computer Vision CSE152, Spr 05 P-Tile Method Intro Computer Vision Mode Method • If the size of the object is approx. known, pick T s.t. the area under the histogram corresponds to the size of the object: • Model intensity in each region Ri as “constant” + N(0,σi): T CSE152, Spr 05 [ From Octavia Camps] Intro Computer Vision CSE152, Spr 05 • It is a not trivial problem: Ideal histogram: µ2 µ3 Add noise: µ1 CSE152, Spr 05 Intro Computer Vision Finding the peaks and valleys Example: Image with 3 regions µ1 [ From Octavia Camps] µ2 µ3 [ From Octavia Camps] The valleys are good places for thresholding to separate regions. Intro Computer Vision CSE152, Spr 05 [ From Octavia Camps] Intro Computer Vision 4 “Peakiness” Detection Algorithm • Find the two HIGHEST LOCAL MAXIMA at a MINIMUM DISTANCE APART: gi and gj Regions • Find lowest point between them: gk • Measure “peakiness”: – min(H(gi),H(gj))/H(gk) • Find (gi,gj,gk) with highest peakiness gi [ From Octavia Camps] CSE152, Spr 05 gk gj Intro Computer Vision CSE152, Spr 05 What is a region? Connected Regions • “Maximal connected set of points in the image with same brightness value” (e.g., 1) 1 1 1 1 1 1 1 1 1 • Two points are connected if there exists a continuous path joining them. • Regions can be simply connected (For every pair of points in the region, all smooth paths can be smoothly and continuously deformed into each other). Otherwise, region is multiply connected (holes) CSE152, Spr 05 Intro Computer Vision 1 1 1 1 1 1 1 1 1 1 1 1 1 1 CSE152, Spr 05 Intro Computer Vision Four & Eight Connectedness 1 1 1 1 1 1 1 1 1 1 1 1 1 Four Connected • What the connected regions in this binary image? • Which regions are contained within which region? CSE152, Spr 05 1 1 1 1 1 1 1 1 1 1 • What are the connected regions in this binary image? • Which regions are contained within which region? Connected Regions 1 1 1 1 1 1 1 Intro Computer Vision Intro Computer Vision CSE152, Spr 05 Eight Connected Intro Computer Vision 5 Jordan Curve Theorem Problem of 4/8 Connectedness • “Every closed curve in R2 divides the plane into two region, the ‘outside’ and ‘inside’ of the curve.” • 8 Connected: 1 1 – 1’s form a closed curve, but background only forms one region. 1 1 1 1 1 1 1 • 4 Connected – Background has two regions, but ones form four “open” curves (no closed curve) 1 Almost obvious CSE152, Spr 05 Intro Computer Vision To achieve consistency w.r.t. Jordan Curve Theorem CSE152, Spr 05 Recursive Labeling Connected Component Exploration 1. Treat background as 4-connected and foreground as 8connected. 2. Use 6-connectedness CSE152, Spr 05 Intro Computer Vision 1 Intro Computer Vision CSE152, Spr 05 Recursive Labeling Connected Component Exploration Procedure Label (Pixel) BEGIN Mark(Pixel) <- Marker; FOR neighbor in Neighbors(Pixel) DO IF Image (neighbor) = 1 AND Mark(neighbor)=nil THEN Label(neighbor) END 2 Intro Computer Vision Some notes • How deep does stack go? • Iterative algorithms (See reading from Horn) • Parallel algorithms BEGIN Main Marker <- 0; FOR Pixel in Image DO IF Image(Pixel) = 1 AND Mark(Pixel)=nil THEN BEGIN Globals: Marker <- Marker + 1; Marker: integer Label(Pixel); Mark: Matrix same size as Image, END; initialized to NIL END CSE152, Spr 05 Intro Computer Vision CSE152, Spr 05 Intro Computer Vision 6
© Copyright 2026 Paperzz