Download presentation
Presentation is loading. Please wait.
Published byAnnabel Hood Modified over 9 years ago
1
CSSE463: Image Recognition Day 3 Announcements/reminders: Announcements/reminders: Lab 1 should have been turned in yesterday (due now if use a late day). Lab 1 should have been turned in yesterday (due now if use a late day). Tomorrow: Lab 2 on color images. Bring laptop again. Tomorrow: Lab 2 on color images. Bring laptop again. If you see examples of Img Rec in life, please send to me! If you see examples of Img Rec in life, please send to me! Last class? Last class? Today: Today: Introduce Fruit Finder, due next Friday. Introduce Fruit Finder, due next Friday. Lots of helpful hints in Matlab. Lots of helpful hints in Matlab. Connected components and morphology Connected components and morphology Next week: Edge features Next week: Edge features Questions? Questions?
2
Spatial component of color Break image into parts and describe each one Break image into parts and describe each one Can describe each part with moments or histograms Regular grid Regular grid Pros? Cons? Image regions Image regions Pros? Cons? Q9
3
Additional reading Color gamuts Color gamuts http://en.wikipedia.org/wiki/Gamut http://en.wikipedia.org/wiki/Gamut http://en.wikipedia.org/wiki/Gamut Color coherence vectors Color coherence vectors Extension of color histograms within local neighborhoods Extension of color histograms within local neighborhoods Used in: Used in: A. Vailaya, H-J Zhang, and A. Jain. On image classification: City images vs. landscapes. Pattern Recognition 31:1921-1936, Dec 1998. A. Vailaya, H-J Zhang, and A. Jain. On image classification: City images vs. landscapes. Pattern Recognition 31:1921-1936, Dec 1998. Defined in: Defined in: G Pass, R Zabih, and J Miller. Comparing images using color coherence vectors. 4 th ACM Conf. Multimedia, pp 65-73, Boston, 1996. G Pass, R Zabih, and J Miller. Comparing images using color coherence vectors. 4 th ACM Conf. Multimedia, pp 65-73, Boston, 1996. Q10
4
Project 1: Counting Fruit How many apples? bananas? oranges? How many apples? bananas? oranges?
5
Why the fruit-finder? Crash-course in using and applying Matlab Crash-course in using and applying Matlab For this reason, I will direct you to some useful functions, but will not give details of all of them For this reason, I will direct you to some useful functions, but will not give details of all of them Practice feature extraction Practice feature extraction Practice writing a conference-paper style report Practice writing a conference-paper style report Formal and professional! Formal and professional! Use style similar to ICME sunset paper (Abstract, Introduction, Process, Results, …) Use style similar to ICME sunset paper (Abstract, Introduction, Process, Results, …) Lots of details in specification and rubric. Lots of details in specification and rubric.
6
Fruit-finding technique Observe Observe What numbers define a banana’s “yellow”? (using imtool pixel zoom) What numbers define a banana’s “yellow”? (using imtool pixel zoom) Model Model Can you differentiate between yellow and orange? Orange and red? (Decisions) Can you differentiate between yellow and orange? Orange and red? (Decisions) Note: this isn’t using a classifier yet; just our best guess at hand- tuned boundaries Note: this isn’t using a classifier yet; just our best guess at hand- tuned boundaries Classify pixels using your model (today’s how-to) Classify pixels using your model (today’s how-to) “Clean up” the results “Clean up” the results Mathematical morphology: today’s discussion! Mathematical morphology: today’s discussion! Write up your results in a professional report (as you go) Write up your results in a professional report (as you go)
7
Region processing Binary image analysis Binary image analysis Today, we’ll only consider binary images composed of foreground and background regions Today, we’ll only consider binary images composed of foreground and background regions Example: apple and non-apple Example: apple and non-apple Use find to create a mask of which pixels belong to each Use find to create a mask of which pixels belong to each Q1
8
Matlab How-to create a mask Lots of “Random” tidbits that I used in my solution: Lots of “Random” tidbits that I used in my solution: zeros zeros size size find find Q2-3
9
Modifying the mask requires us to define which pixels are neighbors
10
Neighborhoods Do we consider diagonals or not? Do we consider diagonals or not? 4-neighborhood of pixel p: 4-neighborhood of pixel p: Consists of pixels in the 4 primary compass directions from p. Consists of pixels in the 4 primary compass directions from p. 8-neighborhood of pixel p: 8-neighborhood of pixel p: Adds 4 pixels in the 4 secondary compass directions from p. Adds 4 pixels in the 4 secondary compass directions from p. Q4-5
11
Morphological operations (Sonka, ch 13) Morphology = form and structure (shape) Morphology = form and structure (shape) For binary images For binary images Done via a structuring element (usually a rectangle or circle) Done via a structuring element (usually a rectangle or circle) Basic operations: Basic operations: Dilation, erosion, closing, opening Dilation, erosion, closing, opening
12
Dilation Given a structuring element, adds points in the union of the structuring element and the mask Given a structuring element, adds points in the union of the structuring element and the mask Intuition: Adds background pixels adjacent to the boundary of the foreground region to the foreground. Intuition: Adds background pixels adjacent to the boundary of the foreground region to the foreground. Def, for image X and structuring element B: Def, for image X and structuring element B: Q7a
13
Dilation in action Strel = 2x1, centered on dot
14
Dilation Matlab: imdilate(bw, structureElt) Matlab: imdilate(bw, structureElt) Typically want symmetric structuring elements Typically want symmetric structuring elements structureElt (for 8 neighborhood) found by: structureElt (for 8 neighborhood) found by: structureElt = strel(‘square’, 3); % for erosion using 3x3 neighborhood structureElt = strel(‘square’, 3); % for erosion using 3x3 neighborhood structureElt (for 4 neighborhood) found by: structureElt (for 4 neighborhood) found by: structureElt = strel([0 1 0; 1 1 1; 0 1 0]); structureElt = strel([0 1 0; 1 1 1; 0 1 0]); help strel lists 11 others help strel lists 11 others Demo for intuition: Enlarges a region Demo for intuition: Enlarges a region Def: Def: Q7a
15
Erosion Removes all pixels on the boundary Removes all pixels on the boundary Matlab: imerode(bw, structureElt) Matlab: imerode(bw, structureElt) Q7b
16
Closing and Opening Closing (imclose) Closing (imclose) Dilate, then erode Dilate, then erode Fills internal holes in a region, while maintaining approximate pixel count Fills internal holes in a region, while maintaining approximate pixel count Eliminates inlets on the boundary Eliminates inlets on the boundary Opening (imopen) Opening (imopen) erode, then dilate erode, then dilate Removes small regions Removes small regions Eliminates peninsulas on the boundary Eliminates peninsulas on the boundary To make dilation more aggressive, To make dilation more aggressive, Dilate n times, then erode n times. Dilate n times, then erode n times. Or, use a larger structuring element Or, use a larger structuring element Example: compare dilating twice using a 3x3 square with dilating once using a 5x5 square. Example: compare dilating twice using a 3x3 square with dilating once using a 5x5 square.
17
Connected Components Goal: to label groups of connected pixels. Goal: to label groups of connected pixels. Assign each block of foreground pixels a unique integer Assign each block of foreground pixels a unique integer 4-connectivity vs. 8-connectivity matters 4-connectivity vs. 8-connectivity matters Matlab help: search for connected components, and use bwlabel function Matlab help: search for connected components, and use bwlabel function Demo Demo You’ll likely devise an algorithm to do this as part of week 3 take-home test. You’ll likely devise an algorithm to do this as part of week 3 take-home test. Q6
18
Lab 2 What format? See nice lab 1 What format? See nice lab 1 You will work with a partner for each lab You will work with a partner for each lab Can stay same or change Can stay same or change I have posted a simpler 10-point grading rubric at the top of each lab I have posted a simpler 10-point grading rubric at the top of each lab Please ask questions and complete as much as you can in class Please ask questions and complete as much as you can in class Each lab is due the following Weds at the same time as the start of class Each lab is due the following Weds at the same time as the start of class Start now! Start now!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.