CV 418 — RECALL and TEACH (say it before you flip)

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/387

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:23 PM on 7/7/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

388 Terms

1
New cards

Trace the path of light through the eye and name the job of each structure: cornea, iris/pupil, lens, retina, optic nerve. Which one does the most light-bending, and which one converts light to signals?

Light hits the CORNEA (the clear front dome) which does MOST of the refraction, passes through the PUPIL (the opening) whose size is controlled by the IRIS (the colored ring, like a camera aperture), then the LENS fine-tunes focus, and lands on the RETINA (the light-sensitive back membrane) which CONVERTS light into neural signals. The OPTIC NERVE then carries those signals to the brain. Key contrasts: cornea bends light but can't refocus; lens refocuses but does less bending; retina converts, optic nerve only transmits.

2
New cards

How does the EYE focus on near vs. far objects, and how is that fundamentally different from how a CAMERA focuses?

The eye keeps a FIXED lens-to-retina distance (~17 mm) and focuses by CHANGING THE SHAPE of its flexible lens (accommodation), so focal length varies ~14–17 mm. A camera does the opposite: FIXED focal length, and it focuses by physically MOVING the lens. The classic trap is saying the eye 'moves its lens' — that's the camera.

3
New cards

What is the fovea, why does it give the sharpest vision, and roughly how many cones does it hold?

The fovea is the tiny central pit of the retina (~1.5 mm diameter, ~1.77 mm² area) densely packed with CONES (~150,000 cones/mm², ~265,000 total). When you look straight at something its image lands here, giving the sharpest, most detailed, color vision — because cone density peaks and each cone gets its own nerve. It's the opposite of the blind spot (which has no receptors).

4
New cards

What is the blind spot, and what makes it 'blind'? How does it relate to the optic nerve and the myelin sheath?

The blind spot is the point where the OPTIC NERVE exits the eye — it has NO photoreceptors (no rods or cones), so no image is detected there. The optic nerve is the 'cable' carrying visual info to the brain, and the MYELIN SHEATH is the insulation around it that speeds signal transmission (like insulation on a wire). It's the exact opposite of the fovea (max receptor density).

5
New cards

Compare rods and cones on: what light level they work in, whether they see color, sharpness, where they sit, and how many there are.

RODS: dim-light / night (scotopic) vision, very sensitive, NO color, low-detail/blurred, spread across the retina, 75–150 million per eye. CONES: bright-light (photopic) vision, COLOR, sharp detail, concentrated in the fovea (each wired to its own nerve), only 6–7 million per eye. Mnemonic: Cones = Color + Central + Crisp; Rods = dim/peripheral. Number trap: there are ~10–20× more rods than cones.

6
New cards

Define photopic vs. scotopic vision — which photoreceptor, which light level, and color or not?

PHOTOPIC = bright-light, daytime, CONE-based, COLOR vision. SCOTOPIC = dim-light, nighttime, ROD-based, colorless vision. These are the eye's two operating modes. The classic trap is swapping them or pairing photopic with rods (photopic goes with cones).

7
New cards

Cones peak in density at 0° (fovea center) — but at roughly what angle off the visual axis do RODS reach their maximum density?

Rods peak in density about 20° off-axis, then thin out toward the periphery. This is why your peripheral/night vision (rod-driven) is actually better slightly off-center than dead-center. The 0° peak belongs to cones (fovea center).

8
New cards

The eye-as-camera analogy assigns megapixel counts: what's the rough MP (and data size at 3 bytes/pixel) for fovea-only vision, the wider high-res area, and the full retina?

Fovea-focused ≈ 5 MP (~15 MB), wider high-res area ≈ 15 MP (~45 MB), and the FULL retina including periphery ≈ 576 MP (~1.73 GB). Data size = pixels × 3 bytes (RGB). The headline number for full human vision is 576 MP.

9
New cards

The eye adapts to a huge range of light. About what total intensity ratio can it span, and why can't it use that whole range at once?

The total brightness-adaptation range is roughly 10^10 (10 billion to 1), from starlight to bright sun. But it can't span that whole range at any single instant — instead it uses BRIGHTNESS ADAPTATION, shifting its overall sensitivity to a particular level. Simultaneous discrimination at any moment is far narrower than the full 10^10.

10
New cards

Is PERCEIVED brightness a linear function of actual incident light intensity? If not, what function is it, and what's the consequence?

It's LOGARITHMIC, not linear: perceived brightness ≈ log(incident intensity). The consequence is that equal PERCEPTUAL steps correspond to MULTIPLICATIVE intensity steps (you need to keep doubling light to keep feeling equal increases). This is why the eye handles such a wide dynamic range.

11
New cards

What is the Weber ratio, how is it written, and does a SMALL value mean good or poor brightness discrimination?

Weber ratio = ΔI_c / I, where ΔI_c is the just-noticeable intensity increment and I is the background intensity. A SMALL Weber ratio means GOOD discrimination — you can detect tiny changes relative to the background. It's ΔI/I (not I/ΔI), and small = good (large = poor).

12
New cards

What are Mach bands, and what do they prove about perception?

Mach bands are an illusion where you see extra bright and dark scalloped bands right at the boundary between two uniform-intensity regions — even though the physical intensity there is perfectly flat. They prove perceived intensity is NOT a simple function of actual intensity (the visual system overshoots/undershoots at edges). Don't confuse with simultaneous contrast (which is about surroundings, not edges).

13
New cards

What is simultaneous contrast, and how is it different from Mach bands?

Simultaneous contrast: a region's perceived brightness depends on its SURROUNDINGS — the SAME gray square looks darker on a light background and lighter on a dark background. It's about the surround. Mach bands, by contrast, are about scalloped over/undershoot right AT an edge. Both show perception ≠ raw intensity, but one is surround-driven and the other edge-driven.

14
New cards

What is light, and how big is the visible band relative to the whole electromagnetic spectrum? Give the equation linking speed, wavelength, and frequency.

Light is electromagnetic radiation; the visible band humans see is only a VERY NARROW slice of the full EM spectrum (which runs gamma/X-ray → UV → visible → IR → radio). They connect by c = λ·f (speed of light = wavelength × frequency). The trap is thinking visible light is a large fraction — it's tiny.

15
New cards

How are wavelength and frequency related — does shorter wavelength mean higher or lower frequency? What ties them together?

They are INVERSELY related: shorter wavelength = HIGHER frequency (λ = c/f). The speed of light c is the constant linking them, so if one goes up the other goes down. Trap: 'shorter wavelength → lower frequency' inverts the relationship.

16
New cards

Describe the three image-sensor types (single element, line/strip, array) and which ones need mechanical motion to build a 2-D image.

SINGLE sensing element: one detector (0-D) — must be moved mechanically in BOTH directions to build a 2-D image. LINE sensor / strip: a 1-D row — captures one line at a time and is moved across the scene (linear strip = flatbed scanner; circular/rotating strip = CT). ARRAY sensor: a full 2-D grid (CCD/CMOS chip in a digital camera) — captures the whole image at once, NO scanning. Only single and line sensors need motion.

17
New cards

In the image-formation model, what physically produces the intensity f(x,y)? Give the formula and the ranges of its two factors.

f(x,y) = i(x,y)·r(x,y): illumination i (how much light hits the object) TIMES reflectance r (fraction the object reflects back). Ranges: 0 < i < ∞ (illumination is unbounded above), and 0 < r < 1 (reflectance is a fraction between 0 and 1). So intensity is the product of incoming light and the object's reflectivity.

18
New cards

Digitizing an image needs sampling AND quantization — which one discretizes coordinates and which discretizes amplitude, and what does each control?

SAMPLING discretizes the COORDINATES (spatial position) — it sets the NUMBER OF PIXELS / resolution. QUANTIZATION discretizes the AMPLITUDE (brightness) — it sets the number of INTENSITY LEVELS (L = 2^k). Mnemonic: SAMPLING = Space, Quantization = Quantity-of-levels. The classic trap is the reversed pairing (sampling = amplitude is wrong).

19
New cards

How is a digital (grayscale) image represented mathematically, and what are the coordinate conventions (origin, x vs. rows)?

It's a 2-D M×N MATRIX f(x,y) where each entry is a pixel intensity. Coordinates are INTEGERS, so there's a one-to-one match between (x,y) and (row r, column c): x ↔ rows, y ↔ columns, with the ORIGIN at TOP-LEFT (y goes down). This differs from standard math axes (origin bottom-left, y-up). Color images add a 3rd dimension (channels).

20
New cards

What is saturation in an image, and how does it differ from noise? (These are the two artifacts often shown together.)

SATURATION is the maximum intensity beyond which everything is CLIPPED to the same high constant — detail in over-bright areas is lost because all those pixels read the same max value (a flat, blown-out region). NOISE is random unwanted pixel variation showing up as a GRAINY texture (often most visible in dark areas). They're opposites: saturation = flat clipped block, noise = random grain.

21
New cards

How many bits store an N×N image with k bits per pixel, and how do you get bytes? How many intensity levels does k bits give?

bits = N·N·k (pixels × bits/pixel); bytes = N·N·k / 8 (divide by 8). Intensity levels L = 2^k. Traps: forgetting to multiply by k, or mixing up bits vs. bytes (must divide by 8).

22
New cards

What is the storage size in BYTES of a binary image stored as uint8, and why are answers like 256·H·W wrong?

Size = Height × Width bytes. Even though a binary pixel is only 0 or 255 (1 bit of information), when STORED as uint8 each pixel occupies exactly 1 byte, so it's just H×W. Answers like (256)(H·W), (256²)(H·W), (256³)(H·W) are wrong — 256 is the number of possible uint8 values, not the bytes per pixel.

23
New cards

How does a binary image compare to a grayscale image in color depth, and how is it stored (dimensions)?

A binary image has the LOWEST color depth: 1 bit per pixel = 2 possible values, LOWER than grayscale's 8 bits = 256 values. It's stored as a 2-D array (like grayscale), NOT a 3-D array (that's RGB) and not 1-D. Traps: claiming it has HIGHER depth (reversed), or is saved as a 3D/1D array.

24
New cards

What's the difference between SPATIAL resolution and INTENSITY resolution? Which is measured in dpi and which in gray levels?

SPATIAL resolution = how many pixel samples per unit distance, measured in dpi (dots per inch, a 1-D linear density) — it's about PIXEL COUNT / fine detail. INTENSITY resolution = how many distinct brightness levels (2^k) — it's about GRAY LEVELS, not pixels. They are independent axes: dpi is NOT about color, and gray-level count is NOT about pixel density.

25
New cards

What artifact appears when you reduce INTENSITY resolution (too few gray levels) while keeping the pixel count the same, and what causes it?

FALSE CONTOURING (banding): smooth gradients break into visible bands/ridges. It's caused by coarse QUANTIZATION (too few intensity levels, e.g. 256→128→…→2). Contrast with aliasing/pixelation, which comes from too few PIXELS (low spatial resolution), not too few levels.

26
New cards

What are isopreference curves, and what tradeoff do they capture?

Isopreference curves are curves in N-vs-k space (spatial resolution vs. intensity resolution) along which different (N, k) combinations are judged EQUAL in subjective quality by human observers. They capture the tradeoff: you can trade pixels for gray levels and keep the same perceived quality. (Not histograms or ROC curves.)

27
New cards

Which images are MOST hurt by low spatial/intensity resolution — low-detail or high-detail ones — and why?

LOW-detail images (like a single face) are MOST susceptible to degradation, while HIGH-detail images (like a dense crowd) are LEAST affected — because busy textures HIDE the coarseness. This is counterintuitive: many guess the opposite, but complex/detailed images mask resolution loss.

28
New cards

Compare the three interpolation methods (nearest-neighbor, bilinear, bicubic): how many source pixels each uses, and the quality-vs-speed tradeoff.

NEAREST-NEIGHBOR: copies the 1 closest pixel — fastest but blocky/jagged (no smoothing). BILINEAR: weighted average of the 4 nearest pixels (2×2, linear in x then y) — smoother, some blur. BICUBIC: cubic-weighted average of the 16 nearest pixels (4×4) — smoothest/highest quality but most computation. Quality: NN < bilinear < bicubic; Speed: the reverse.

29
New cards

Define 4-adjacency vs. 8-adjacency for pixels — which neighbors does each count?

4-ADJACENCY: only the 4 edge neighbors (up, down, left, right) — NO diagonals: N4(p) = {(x±1,y),(x,y±1)}. 8-ADJACENCY: all 8 surrounding neighbors = the 4 edge PLUS the 4 diagonal ones. So 8-adjacency = 4-adjacency + diagonals. Trap: including diagonals in 4-adjacency.

30
New cards

What is m-adjacency (mixed adjacency), what's its exact rule, and what problem does it solve?

Two foreground pixels p and q are m-adjacent if: (1) q is in N4(p) [4-adjacent], OR (2) q is a diagonal neighbor AND their shared 4-neighbors N4(p)∩N4(q) contain NO foreground pixels. It EXISTS TO AVOID AMBIGUITY in connected-component labeling — by dropping redundant diagonal links it ensures each region has a single unambiguous path. It's NOT about making the 'strongest' connection (that's explicitly wrong); it fixes the multiple-path ambiguity that 4- and 8-adjacency create.

31
New cards

Give the three pixel distance metrics (Euclidean, City-block/Manhattan/D4, Chessboard/Chebyshev/D8) with their formulas, and how they rank in value.

EUCLIDEAN (straight line): D_e = √((x2−x1)² + (y2−y1)²). CITY-BLOCK / MANHATTAN / D4 (grid travel): D4 = |x2−x1| + |y2−y1| (SUM of abs differences). CHESSBOARD / CHEBYSHEV / D8 (king's move): D8 = max(|x2−x1|, |y2−y1|) (MAX of abs differences). Ranking for the same points: Manhattan ≥ Euclidean ≥ Chessboard. Mnemonic: SUM = Manhattan, SQRT = Euclidean, MAX = Chessboard.

32
New cards

For pixel offset (dx, dy) = (3, 4), compute the Manhattan (D4), Euclidean, and Chessboard (D8) distances — and say which formula gives which.

Manhattan D4 = |3|+|4| = 7 (SUM). Euclidean = √(3²+4²) = √25 = 5 (SQRT of sum of squares). Chessboard D8 = max(3,4) = 4 (MAX). So 7=Manhattan, 5=Euclidean, 4=Chessboard. Always pair SUM=Manhattan, SQRT=Euclidean, MAX=Chessboard so you don't mix them up.

33
New cards

How does averaging multiple noisy images reduce noise, and by what factor does the noise standard deviation drop for K images?

Capture the same scene K times (each with different random ZERO-MEAN noise), then average: g_avg = (1/K)·Σ g_i. The random fluctuations (+, 0, −) cancel toward 0 while the true image stays, so the noise standard deviation drops by √K — NOT by K. The underlying image is unchanged. This works because zero-mean noise averages to its true mean of 0 by the law of large numbers (assumes uniform/Gaussian, i.e. zero-mean noise; biased noise wouldn't fully cancel).

34
New cards

What is bit-plane slicing, and which plane holds the most visually important information vs. the least?

Bit-plane slicing splits an 8-bit image into 8 separate 1-bit images, one per bit position, so that Image = Σ 2^b·(plane b). The MOST-significant plane (bit-7, MSB) holds most of the visual structure; the LEAST-significant plane (bit-0, LSB) holds fine detail/noise — zeroing the LSB causes an almost invisible change. Useful for compression and understanding where image information lives.

35
New cards

What does image SUBTRACTION do, and what's the medical example (DSA)?

Image subtraction g = f1 − f2 (then scaled to [0,255]) highlights the DIFFERENCES between two images — change detection. The medical example is Digital Subtraction Angiography (DSA): subtract a 'mask' image (before contrast dye) from a 'live' image (with dye) to erase static bone/tissue and leave ONLY the blood vessels. Uses subtraction, not addition or thresholding.

36
New cards

What are the image-MULTIPLICATION uses — shading correction and ROI masking? Give the operation for each.

SHADING / illumination correction: multiply the shaded image by the RECIPROCAL of the estimated shading pattern (corrected = shaded × 1/shading) to flatten uneven brightness. ROI MASKING: multiply the image by a BINARY mask (1 inside the region of interest, 0 outside) so only the ROI survives and everything else goes black. Multiplication = masking/AND; subtraction = change detection (don't swap them).

37
New cards

What do the set operations union, intersection, and complement do to images — and specifically, what does complement produce on a grayscale image?

Images can be combined as sets: UNION combines/brightens (max-like), INTERSECTION overlaps (min-like), and COMPLEMENT (Aᶜ) produces the image NEGATIVE on grayscale. So set-complementation = negative. (On binary images these map to OR, AND, and NOT.)

38
New cards

What do the logical operations AND, OR, and NOT do on binary images, and which keeps only pixels that are foreground in BOTH?

On binary images (white=1=foreground): AND keeps a pixel only if it's 1 in BOTH images (overlap); OR keeps it if it's 1 in EITHER; NOT flips 0↔1 (inverts). The one that keeps pixels foreground in both is AND. (This AND/NOR-style logic is exactly what m-adjacency's shared-neighbor condition relies on.)

39
New cards

What is the image-negative intensity transform, its formula, and when is it useful?

The image negative reverses light and dark: s = (L−1) − r, i.e. for 8-bit s = 255 − r (output = max minus input). It's useful for enhancing white/gray detail embedded in dark regions — classic example, X-rays. It's a POINT (per-pixel) transform and plots as a straight line from top-left to bottom-right; unlike thresholding it produces a full range of values, not just 2.

40
New cards

What is an intensity (point) transformation s = T(r), and how does it differ from a neighborhood/spatial operation?

A point transform maps each input intensity r to an output s INDEPENDENTLY of neighboring pixels: s = T(r). Examples: negative, log, power-law (gamma), thresholding. It differs from NEIGHBORHOOD/spatial operations (like local averaging or convolution) which compute each output from a WINDOW of surrounding pixels. Point = one pixel in, one pixel out.

41
New cards

What does the LOG transform do to an image, and what's its formula and typical use?

s = c·log(1 + r): it EXPANDS dark (low) intensity values and COMPRESSES bright (high) ones — brightening shadow detail. Typical use: displaying data with huge dynamic range, like a Fourier spectrum, so faint values become visible. Its curve shape is fixed (unlike gamma, whose exponent you can tune).

42
New cards

What is the power-law (gamma) transform, and how does the exponent change the image (γ

s = c·r^γ (often with r normalized to [0,1]). γ < 1 BRIGHTENS dark areas (expands shadows); γ > 1 DARKENS and increases contrast in bright areas. Used for display gamma correction. It's the tunable cousin of the log transform (log has one fixed curve; gamma's exponent lets you steer direction and strength).

43
New cards

What is a sigmoid (S-curve) intensity transform, and what does it do to shadows, highlights, and mid-tones?

A sigmoid is an S-shaped mapping that rises smoothly from 0 to 1 (e.g. s = 1/(1+e^(−a(r−b)))). It DARKENS shadows and BRIGHTENS highlights, boosting MID-TONE contrast. It's smooth — NOT piecewise-linear (straight segments) and not a simple quadratic/cubic polynomial, which are the usual distractors.

44
New cards

What is a piecewise-linear intensity transform, and how does it contrast with a sigmoid?

A piecewise-linear transform is built from connected STRAIGHT-LINE segments (e.g. contrast stretching), letting you shape the mapping region-by-region. It contrasts with the SIGMOID, which is one smooth S-curve. So: piecewise-linear = segmented straight lines; sigmoid = smooth S-shape.

45
New cards

What is neighborhood (local averaging) processing, and how does it differ from a point transform? Give the averaging formula.

Neighborhood processing computes each output pixel from a WINDOW of surrounding pixels — e.g. local averaging replaces a pixel with the mean of its m×n neighborhood: g(x,y) = (1/(m·n))·Σ (neighborhood of f). This BLURS/smooths and reduces noise. It differs from point transforms, which ignore neighbors and map one pixel at a time.

46
New cards

In spatial convolution g(x,y) = Σᵢ Σⱼ f(x−i, y−j)·h(i,j), what do f, h, and g each represent? And what's the difference between convolution and correlation?

f = the INPUT image, h = the KERNEL/filter (small weight matrix), g = the OUTPUT image. Each output pixel is a weighted sum of input pixels under the kernel as it slides across. Convolution FLIPS the kernel before applying; correlation does NOT flip. Trap: calling h the input or the output — h is the kernel.

47
New cards

What is a kernel (filter mask), and how does changing its weights change the effect?

A kernel is a small matrix of weights (e.g. 3×3, 5×5) that defines a filtering operation as it slides over the image via convolution. Different weight patterns produce different effects: all-equal weights → blur, center-peaked → Gaussian blur, signed weights → edge detection/sharpening. Don't confuse the kernel with the input image (f) or output (g).

48
New cards

How do you tell a box/mean filter, a Gaussian kernel, and a gradient/edge kernel apart just by their weights?

BOX/MEAN filter: ALL weights EQUAL (e.g. every entry 1/9 in a 3×3) → averages/blurs. GAUSSIAN kernel: all positive but a CENTER PEAK decaying symmetrically outward (bell shape) → smoother, more natural blur. GRADIENT/EDGE kernel (Sobel/Prewitt): SIGNED weights (positive AND negative, e.g. Sobel-x [[-1,0,1],[-2,0,2],[-1,0,1]]) → responds to intensity CHANGES, big output at edges, ~zero in flat areas. So: equal=box, peaked=Gaussian, signed=edge.

49
New cards

What is an affine transformation, what does it preserve, and which geometric operations does it cover?

An affine transform maps coordinates via matrix multiplication (in homogeneous coords: [x',y',1] = [x,y,1]·A) and PRESERVES straight lines and parallelism. It covers translation, scaling, rotation, and shear. Note it does NOT generally preserve angles and lengths (that stricter case is rigid/Euclidean); it just keeps lines straight and parallel lines parallel.

50
New cards

In the slides' rotation convention, does a POSITIVE angle rotate the image clockwise or counterclockwise? Give the rotation equations and one practical consequence.

A POSITIVE angle rotates COUNTERCLOCKWISE (negative = clockwise). Equations: x' = x·cos(t) − y·sin(t), y' = x·sin(t) + y·cos(t). Practical consequence: the rotated image may not fit the original grid, so you must crop or enlarge the canvas, and the new pixel positions need interpolation.

51
New cards

Why is interpolation needed after geometric transforms like rotation/scaling, and how do the methods rank in quality?

After rotating or scaling, output pixel positions rarely land exactly on source-pixel locations, so intensities must be INTERPOLATED from nearby source pixels. Methods rank in quality nearest-neighbor (blocky) < bilinear (smoother) < bicubic (smoothest); speed is the reverse. Without interpolation you'd have gaps or misassigned values.

52
New cards

What is image registration, what does it use to align images, and how is it different from image subtraction?

Image registration ALIGNS two images of the same scene (taken at different times or geometrically distorted) by matching corresponding 'tie points' and warping the input to fit the reference. It's a prerequisite step: registration ALIGNS images, whereas subtraction/DSA COMPARES images that are ALREADY aligned.

53
New cards

How is an RGB color pixel represented, and what's the RGB color space visualized as?

An RGB pixel is a VECTOR stacking its Red, Green, Blue values: [R, G, B]ᵀ (each 0–255 for 8-bit), formed from the three component images. The whole RGB color space is visualized as a 3-D CUBE with R, G, B on the axes — corners are the pure/primary colors and the main diagonal is grayscale. (A grayscale pixel, by contrast, is a single scalar, not a vector.)

54
New cards

What is OpenCV's default color channel order, and why does it matter when displaying images?

OpenCV loads and stores color images in BGR order (Blue, Green, Red = index 0,1,2), NOT RGB. This matters because libraries like matplotlib expect RGB, so an OpenCV image shown directly looks color-swapped (reds/blues flipped) unless you convert with cv2.cvtColor(img, COLOR_BGR2RGB).

55
New cards

What is the HSV color space, why is it good for color segmentation, and what's OpenCV's special range for Hue?

HSV = Hue (which color), Saturation (how vivid), Value (how bright). Because it SEPARATES color (hue) from brightness (value), color-based filtering/segmentation is easy and robust to lighting changes — unlike RGB, where color and brightness are entangled. Trap: in OpenCV, Hue is 0–179 (not 0–255 or 0–359), while S and V are 0–255.

56
New cards

What is a grayscale image, and what's the standard weighted formula to convert RGB to grayscale (and why is green weighted most)?

Grayscale is a single-channel intensity image, each pixel one brightness value 0 (black) to 255 (white), no color. Conversion: gray = 0.299·R + 0.587·G + 0.114·B (luminosity weights). Green is weighted most because the human eye is MOST sensitive to green light. (RGB and HSV are 3-channel; grayscale is 1-channel.)

57
New cards

What is color filtering via HSV inRange masking, and how is it different from converting to grayscale?

Color filtering isolates ONE color: convert to HSV, then keep only pixels whose (H,S,V) fall in a target range using inRange to build a mask, then AND the mask with the image so everything else goes black. Result: only the target-colored object remains. This is DIFFERENT from RGB-to-grayscale (which removes all color to make one intensity channel) — color filtering keeps one color and discards the rest.

58
New cards

What does a color histogram show, and how is it different from a color FILTER and from histogram EQUALIZATION?

A color histogram COUNTS how many pixels fall into each color/intensity bin — it DESCRIBES color content but does NOT modify the image. A color FILTER changes the image (masks out all but one color). Histogram EQUALIZATION also changes the image (remaps intensities). So histogram = describe; filter/equalization = modify.

59
New cards

What is histogram equalization, how does it work (the CDF), and what does it achieve?

Histogram equalization boosts global contrast by spreading out the most frequent intensities using the cumulative distribution: s = T(r) = (L−1)·CDF(r), where CDF is the normalized cumulative histogram. This flattens the histogram so intensities are more evenly used. It REMAPS pixels (unlike a plain color histogram, which only counts them).

60
New cards

Write the 2-D Discrete Fourier Transform formula and say what it does — spatial domain to what, and what is the image expressed as?

F(u,v) = Σₓ Σᵧ f(x,y)·e^(−j2π(ux/M + vy/N)). It transforms an image from the SPATIAL domain to the FREQUENCY domain, expressing the image as a sum of sinusoids of different frequencies. Used for frequency-domain filtering and spectrum analysis. Recognize it by the complex exponential e^(−j2π…).

61
New cards

How do the DFT and DCT differ, and which one is used in JPEG?

Both move an image into the frequency domain, but the DFT uses COMPLEX exponentials (sines AND cosines, e^(−j2π…), producing complex output), while the DCT uses only REAL cosines (real output) — and the DCT is the basis of JPEG compression. So: has an 'j'/imaginary part = DFT; real cosines & used in JPEG = DCT.

62
New cards

What is the Hough transform used for, how does it work (voting/accumulator), and what does its output image look like?

The Hough transform detects shapes — especially lines and circles — by mapping each edge point into a parameter (accumulator) space where points on the same shape VOTE for the same cell; peaks in the accumulator reveal the shapes. For lines: ρ = x·cosθ + y·sinθ, so each edge point becomes a SINUSOID in (ρ,θ) space. Its output looks like a mostly-black image with faint bright sinusoidal curves. (Not a Fourier spectrum or a histogram.)

63
New cards

What is the distance transform — what value does each pixel get, and what does the result look like?

The distance transform assigns each FOREGROUND pixel its distance to the NEAREST BACKGROUND pixel: DT(p) = min over background q of distance(p,q). The result is a gradient that fades from object edges inward (brightest deep inside the object). Used for skeletonization and shape analysis. It outputs DISTANCES — not frequencies (Fourier) or votes (Hough).

64
New cards

What is thresholding in general, and how does it decide each pixel's output? How many OpenCV threshold types are there?

Thresholding converts a grayscale image to a simpler form by comparing each pixel to a threshold T; each pixel's decision is made INDEPENDENTLY (a point operation). OpenCV has 5 types: BINARY, BINARY_INV, TRUNC (truncate), TOZERO, and TOZERO_INV. Exams give one type's rule and ask you to name it among the 5 — so learn the whole family.

65
New cards

Give the rules for all 5 OpenCV thresholding types (what happens above vs. below T for each).

BINARY: f≥T → 255, else 0. BINARY_INV: f≥T → 0, else 255 (flips binary). TRUNC (truncate): f>T → T, else keep f (caps the top, zeros nothing). TOZERO: f≥T → keep f, else 0 (zeros the dark side). TOZERO_INV: f≥T → 0, else keep f (zeros the bright side). Grouping: BINARY pair forces 0/255; TRUNC caps; TOZERO pair keeps one side and zeros the other.

66
New cards

Contrast the two 'to-zero' thresholds and truncate: for a pixel ABOVE T, what does each do?

TOZERO: above T → KEEP the original value (zeros only the BELOW-T pixels). TOZERO_INV: above T → set to 0 (keeps only the below-T pixels). TRUNC: above T → set to T (caps at the threshold, doesn't zero). So above T: to-zero keeps, to-zero-inverse zeros, truncate clips to T.

67
New cards

What is vectorization / linear indexing of an image, and what's the column-major index formula?

Vectorization flattens a 2-D image matrix into a 1-D array (the slides scan COLUMN-by-column), giving each (x,y) a single linear index for fast array operations. For an M-row image, column-major linear index = x + y·M (0-based). Note: row-major vs column-major ordering changes the formula — the slides use column scanning.

68
New cards

What's the exam strategy for these multiple-choice questions, given how the distractors are built?

The distractors are always SIBLINGS of the correct answer — all 5 thresholding types, all 3 distance metrics, all color spaces, or all frequency transforms. So the winning move is: first identify which FAMILY the item belongs to, then pick the exact member by its defining feature (SUM vs SQRT vs MAX, complex vs real cosine, etc.). Also watch for 'None of the above' (NOTA), used when no listed sibling matches.

69
New cards

What is a digital image, and what two processes turn a continuous (analog) image into it?

An image is a 2D function f(x,y) giving the light intensity at each spatial position; a digital image is that function sampled onto a finite grid of pixels holding discrete numbers. Analog->digital needs two steps: sampling makes it discrete in SPACE (choosing the pixel grid), and quantization makes it discrete in INTENSITY (choosing the finite gray levels). Don't swap them: sampling=space, quantization=amplitude.

70
New cards

How do sampling and quantization each control an image, and what formulas govern them?

Sampling sets spatial resolution: number of samples = width x height, so more samples = finer detail. Quantization sets intensity depth: number of gray levels L = 2^k where k = bits per pixel (so 8-bit = 256 levels). Sampling is the SPACE side; quantization is the INTENSITY side.

71
New cards

In OpenCV/Python, what data structure IS an image, and how are grayscale vs color images shaped?

Every OpenCV image is a NumPy ndarray (not a Python list, PIL Image, or C++ cv2.Mat). Grayscale is a 2D array of shape (height, width) with one intensity per pixel and NO channel dimension. Color is a 3D array of shape (height, width, 3) where the 3 is the color channels. RGBA is (H, W, 4).

72
New cards

What is OpenCV's default channel order, why does it matter, and what does [255,0,0] mean?

OpenCV stores color as BGR (Blue-Green-Red), not RGB. So [255,0,0] is pure BLUE, not red. This is the #1 cause of wrong colors when mixing with other libraries: Matplotlib/PIL expect RGB, so an OpenCV image looks red/blue-swapped in plt.imshow unless you first convert with cv2.cvtColor(img, cv2.COLOR_BGR2RGB). The problem is channel ORDER, not dtype or shape.

73
New cards

What is the most common image dtype, its value range, and how much memory does it use?

uint8 = 8-bit unsigned integer, holding whole numbers 0 to 255 (that's 2^8 = 256 values, max 255), one byte per value. Not int8 (signed -128..127) and not float. You read a pixel's type with img.dtype; you convert type with img.astype(np.float32) (needed for decimal math), then convert back to uint8 before saving/displaying.

74
New cards

For a 200-tall by 300-wide color image, what does img.shape return, and why is height first?

It returns (200, 300, 3) - HEIGHT first, then width, then channels. Images are stored row-major, so the first index is the row (y/height) and the second is the column (x/width), the opposite of the (x,y) math convention. So image[row, col] = image[y, x]. Grayscale of the same image would be (200, 300).

75
New cards

How do you READ, MODIFY, and CROP pixels with NumPy indexing (give the exact syntax)?

Read: pixel = image[y, x] (row first, col second); color returns [B,G,R], gray returns one number. Modify: image[y, x] = [255,255,255] makes it white, [0,0,0] black (all-255 is white even in BGR). Crop an ROI by slicing rows then cols: roi = image[row_start:row_end, col_start:col_end], e.g. image[100:200, 200:300]. Always ROWS first - swapping is the classic trap.

76
New cards

How do you split, merge, and index individual color channels in OpenCV?

cv2.split(img) separates a color image into single-channel arrays: b, g, r = cv2.split(img). cv2.merge([b,g,r]) recombines them (the inverse) - watch the order. You can also index the 3rd axis directly: image[:,:,0]=Blue, [:,:,1]=Green, [:,:,2]=Red, because OpenCV is BGR. So image[:,:,2] is the RED channel.

77
New cards

What does img.flatten() do and in what order?

It collapses the whole multi-dimensional array into a single 1D array containing every pixel value, read in row-major order (row by row). Useful for histograms and vector operations.

78
New cards

Name the OpenCV functions to read, write, and display an image, and how you keep the display window open.

cv2.imread(path, flag) loads a file into a NumPy array (flags: IMREAD_COLOR drops alpha, IMREAD_GRAYSCALE, IMREAD_UNCHANGED keeps alpha). cv2.imwrite('out.jpg', img) saves it, format chosen by the extension. To display: cv2.imshow('win', img); cv2.waitKey(0); cv2.destroyAllWindows(). waitKey(0) is what keeps the window open (waits forever for any key); imshow alone won't stay, and destroyAllWindows closes it.

79
New cards

What is color/bit depth, how does it differ from resolution, and what's the formula?

Bit depth is how many bits store each pixel; it sets the number of possible colors/gray levels = 2^(bits per pixel). It is NOT resolution: resolution is the pixel count (the sampling side). Higher depth = more colors, not more pixels. E.g. 8-bit -> 256 levels.

80
New cards

Walk through the color depths 1, 8, 16, 24, 32, and 48-bit: how many colors and what each is used for.

1-bit = 2 colors (pure black/white, monochrome/binary). 8-bit = 256 (grayscale shades OR 256-color indexed palette). 16-bit = 65,536 (high color, often 5-6-5 RGB with the extra bit on green since the eye is most green-sensitive). 24-bit = 16.7 million (true color: 8 bits each R,G,B = 3 bytes/pixel; JPEG/PNG standard). 32-bit = same 16.7M colors PLUS an 8-bit alpha channel (4 bytes/pixel). 48-bit = deep color/HDR, 16 bits per channel. The professor's STANDARD forms are 1, 8, 24, 32 (16 and 48 are labeled high-color/deep-color, not standard).

81
New cards

What is indexed (mapped) color, and how does it differ from true color?

In indexed color each pixel stores an INDEX into a small palette (e.g. 256 colors), and palette[index] gives the actual color - unlike true color where the pixel stores the full RGB value directly. It saves space for images with few colors, which is why GIF uses it.

82
New cards

What is a binary image, and how does its color depth compare to a grayscale image?

A binary image has only two pixel values (0=black, 255=white), stored as a 2D single-channel array, used for masks and thresholding results. Its color depth is LOWER than a grayscale image's: 2 values vs 256. The classic trap is calling it 'higher' - fewer possible values means lower depth. It is also NOT 1D or 3D.

83
New cards

How do you compute the size in bytes of a grayscale/binary image vs a color image?

Each pixel is one uint8 byte per channel, so bytes = Height x Width x channels. Grayscale/binary = H x W (1 channel, so just the pixel count). Color BGR = H x W x 3; RGBA = H x W x 4. The trap is multiplying by 256 (levels) or 256^2/256^3 - byte size depends on CHANNELS, not the number of gray levels.

84
New cards

What is the alpha channel, what values mean what, and what shape does an RGBA image have?

Alpha is an extra channel storing transparency: 0 = fully transparent (see-through), 255 = fully opaque (solid). It lets an image blend over a background (PNG). It is not brightness and not a 4th color. An RGBA image is 3D with shape (H, W, 4) - the 4th slot is alpha, versus (H, W, 3) for plain BGR.

85
New cards

What does cv2.cvtColor do, and how is it different from .astype()?

cv2.cvtColor(img, code) converts between COLOR SPACES (e.g. COLOR_BGR2HSV, BGR2GRAY, BGR2RGB) using a directional code (BGR2HSV != HSV2BGR). It changes color representation, not the numeric type. .astype(np.float32) changes only the DATA TYPE (dtype), not the color space. Don't confuse the two.

86
New cards

Contrast the RGB and HSV color spaces: their models, geometry, and why HSV is easier for color selection.

RGB is additive - every color is a mix of Red, Green, Blue - and is visualized as a 3D CUBE (black at one corner, white opposite). HSV describes color as Hue (which color), Saturation (how vivid), Value (brightness), visualized as a CYLINDER/CONE. HSV separates color from brightness, so selecting 'the blue object' is far easier than in RGB where color and brightness are entangled. Remember: cube=RGB, cylinder/cone=HSV.

87
New cards

What are OpenCV's HSV ranges, and why is Hue 0-179 instead of 0-360?

OpenCV uses H in [0,179], S in [0,255], V in [0,255]. The textbook hue is 0-360, but OpenCV HALVES it to 179 so it fits in a single uint8 byte (360 wouldn't). The trap is answering 0-360 (standard) or 0-255 (that's S and V, not H).

88
New cards

What is the YCrCb color space, what do its channels mean, and where is it used?

YCrCb separates brightness (Y = luminance/luma) from two color-difference (chroma) channels: Cr = red difference (R-Y), Cb = blue difference (B-Y). Because the eye is less sensitive to chroma, this split enables compression, so it's used in JPEG and video encoding - unlike RGB/HSV.

89
New cards

How does an HSV color filter (inRange masking) isolate a single color, and what's the code?

You convert to HSV, then keep only pixels whose HSV values fall inside a chosen range and mask the rest to black: mask = cv2.inRange(hsv, lower, upper); result = cv2.bitwise_and(img, img, mask=mask). This SELECTS a color range (e.g. show only the blue object, everything else black). Contrast with a color histogram, which DESCRIBES the color distribution rather than selecting one color.

90
New cards

What's the difference between adding a constant to an image vs multiplying it, and what's the danger with uint8?

Adding a constant (image + c) shifts brightness uniformly (offset). Multiplying by a factor (image * k) scales values, changing CONTRAST (k>1 brightens/adds contrast, k

91
New cards

What is pixel-by-pixel image-on-image arithmetic used for, and what's the size requirement?

You can add/subtract/multiply/divide two images element-wise: out(x,y) = imgA(x,y) op imgB(x,y). The images MUST be the same size. Subtracting two frames is a classic way to detect differences/motion (weighted addition, not subtraction, is blending).

92
New cards

What do the four bitwise operators (AND, OR, XOR, NOT) do with image masks?

They operate on the pixels' binary bits, mainly for masking: AND keeps the overlap/intersection (e.g. keep image only inside a white mask: cv2.bitwise_and(img,img,mask=m)), OR combines/unions, XOR keeps the differences, NOT inverts. A mask is a binary image where white(255)=keep, black(0)=remove.

93
New cards

How do you compute an image negative, and what does it accomplish?

Bitwise NOT (~) inverts every pixel, turning bright to dark and vice versa - a photographic negative. For uint8 it's simply s = 255 - r (equivalently cv2.bitwise_not). Useful for revealing detail in dark regions (e.g. X-rays). It's not pixel/255 or a log transform - it just flips the intensity scale.

94
New cards

How do you generate simple test images (blank canvas, shapes, random) from scratch?

Blank binary/gray canvas: np.zeros((h,w), np.uint8) (all black). Then draw with cv2.rectangle / cv2.circle. Random gray: np.random.randint(0,256,(h,w)); random color adds a 3rd channel. Trap: np.ones gives all-1s (nearly black, not white) - you'd need *255 for white.

95
New cards

When displaying a grayscale image in Matplotlib, how do you preserve true intensities?

Matplotlib auto-scales gray images by default, distorting apparent brightness. Pass cmap='gray' with vmin=0, vmax=255 so the 0-255 values map honestly: plt.imshow(img, cmap='gray', vmin=0, vmax=255). Relying on default auto-scaling is the trap.

96
New cards

What is morphing?

Morphing gradually transforms one image into another through smooth intermediate blends, so the first image appears to melt into the second. It's a weighted-blend/interpolation across a transition: blend = (1-a)imgA + aimgB for a going 0 to 1. Not masking or thresholding.

97
New cards

What does the 2-D Discrete Fourier Transform do, what's its formula, and how do you recognize it?

The DFT converts an image from the spatial domain (pixels) to the frequency domain (how fast intensities change), revealing edges, patterns, and periodic noise; it's the basis of frequency filtering. Formula: F(u,v) = sum_x sum_y f(x,y) * e^{-j2pi(ux/M + vy/N)}. Recognize it by the complex exponential e^{-j2pi…} and the F(u,v) output.

98
New cards

How does the DCT differ from the DFT, and why does JPEG use DCT?

The DCT uses only real COSINE basis terms (real-valued output), while the DFT uses complex exponentials (complex output). The DCT packs most image energy into a few low-frequency coefficients, so JPEG uses DCT for COMPRESSION; the DFT is used for general frequency analysis/filtering. DCT = real, DFT = complex.

99
New cards

What does the Hough transform detect, how does it work, and what does its accumulator image look like?

It detects shapes like lines/circles by mapping each edge point into a parameter (accumulator) space where votes accumulate; peaks reveal the shapes. For lines: rho = xcos(theta) + ysin(theta), and each edge point becomes a SINUSOID in (rho, theta). So a mostly-black image with faint bright sinusoidal curves is the Hough accumulator.

100
New cards

What does the distance transform compute, and what is it used for?

It replaces each foreground pixel with its distance to the nearest background (0) pixel: D(p) = min distance from p to any background pixel. The result is bright far from edges (peaks at object centers) and dark near them. Used for skeletons and separating touching objects. Not shape detection (Hough) or frequency (Fourier).