CSE152a Computer Vision Assignment 2 WI14 Instructor: Prof. David Kriegman. Revision 1

Similar documents
CSE152a Computer Vision Assignment 1 WI14 Instructor: Prof. David Kriegman. Revision 0

CSE 152 Lecture 7` Intro Computer Vision

CSE 152 Lecture 7. Intro Computer Vision

Announcements. Binary Image Processing. Binary System Summary. Histogram-based Segmentation. How do we select a Threshold?

Announcements. Analysis of Binary Images. Color Reflectance

Analysis of Binary Images

Binary Image Processing. Introduction to Computer Vision CSE 152 Lecture 5

CSE152 Introduction to Computer Vision Assignment 3 (SP15) Instructor: Ben Ochoa Maximum Points : 85 Deadline : 11:59 p.m., Friday, 29-May-2015

Color Matching Functions. The principle of trichromacy. CIE xyy (Chromaticity Space) Color spaces. Intro Computer Vision. CSE 152 Lecture 7`

Perspective Projection [2 pts]

EE 584 MACHINE VISION

Announcements. The principle of trichromacy. Color Matching Functions. The appearance of colors

CSE 252A Computer Vision Homework 3 Instructor: Ben Ochoa Due : Monday, November 21, 2016, 11:59 PM

CIS 520, Machine Learning, Fall 2015: Assignment 7 Due: Mon, Nov 16, :59pm, PDF to Canvas [100 points]

Image Processing: Final Exam November 10, :30 10:30

NAME: Sample Final Exam (based on previous CSE 455 exams by Profs. Seitz and Shapiro)

Motivation. Gray Levels

EN1610 Image Understanding Lab # 3: Edges

Advanced Image Processing, TNM034 Optical Music Recognition

IMAGE SEGMENTATION. Václav Hlaváč

Augmented Reality VU. Computer Vision 3D Registration (2) Prof. Vincent Lepetit

EE 701 ROBOT VISION. Segmentation

CITS 4402 Computer Vision

UNIVERSITY OF OSLO. Faculty of Mathematics and Natural Sciences

Understanding Tracking and StroMotion of Soccer Ball

Processing of binary images

OBJECT SORTING IN MANUFACTURING INDUSTRIES USING IMAGE PROCESSING

Comparative Study of ROI Extraction of Palmprint

Lecture 11: E-M and MeanShift. CAP 5415 Fall 2007

Final Review CMSC 733 Fall 2014

Motivation. Intensity Levels

Edges and Binary Images

Biometrics Technology: Image Processing & Pattern Recognition (by Dr. Dickson Tong)

Anno accademico 2006/2007. Davide Migliore

Schedule for Rest of Semester

BSB663 Image Processing Pinar Duygulu. Slides are adapted from Selim Aksoy

Image Processing. Bilkent University. CS554 Computer Vision Pinar Duygulu

Last week. Multi-Frame Structure from Motion: Multi-View Stereo. Unknown camera viewpoints

CS4670: Computer Vision

Practice Exam Sample Solutions

Supervised vs. Unsupervised Learning

Edge and corner detection

IDL Tutorial. Working with Images. Copyright 2008 ITT Visual Information Solutions All Rights Reserved

Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM

Homework 4 Computer Vision CS 4731, Fall 2011 Due Date: Nov. 15, 2011 Total Points: 40

Harder case. Image matching. Even harder case. Harder still? by Diva Sian. by swashford

Motion Estimation and Optical Flow Tracking

Harder case. Image matching. Even harder case. Harder still? by Diva Sian. by swashford

(Refer Slide Time 00:17) Welcome to the course on Digital Image Processing. (Refer Slide Time 00:22)

An Introduction to PDF Estimation and Clustering

EXAM SOLUTIONS. Image Processing and Computer Vision Course 2D1421 Monday, 13 th of March 2006,

Problem definition Image acquisition Image segmentation Connected component analysis. Machine vision systems - 1

Final Exam Study Guide

Straight Lines and Hough

A Vision System for Automatic State Determination of Grid Based Board Games

Chapter 3 Image Registration. Chapter 3 Image Registration

Region-based Segmentation

Homework #1. Displays, Image Processing, Affine Transformations, Hierarchical Modeling

Previously. Edge detection. Today. Thresholding. Gradients -> edges 2/1/2011. Edges and Binary Image Analysis

Lecture 9: Hough Transform and Thresholding base Segmentation

UNIVERSITY OF CALIFORNIA RIVERSIDE MAGIC CAMERA. A project report submitted in partial satisfaction of the requirements of the degree of

(Sample) Final Exam with brief answers

Homework #1. Displays, Alpha Compositing, Image Processing, Affine Transformations, Hierarchical Modeling

[ ] Review. Edges and Binary Images. Edge detection. Derivative of Gaussian filter. Image gradient. Tuesday, Sept 16

C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S. Image Operations I

Computer Vision CSCI-GA Assignment 1.

EECS150 - Digital Design Lecture 14 FIFO 2 and SIFT. Recap and Outline

CS443: Digital Imaging and Multimedia Binary Image Analysis. Spring 2008 Ahmed Elgammal Dept. of Computer Science Rutgers University

CS 5540 Spring 2013 Assignment 3, v1.0 Due: Apr. 24th 11:59PM

EE795: Computer Vision and Intelligent Systems

Bus Detection and recognition for visually impaired people

Solving Word Jumbles

Chapter 4. Clustering Core Atoms by Location

Image Features: Local Descriptors. Sanja Fidler CSC420: Intro to Image Understanding 1/ 58

Robotics Programming Laboratory

Homework #1. Displays, Image Processing, Affine Transformations, Hierarchical Modeling

CS 223B Computer Vision Problem Set 3

Feature Descriptors. CS 510 Lecture #21 April 29 th, 2013

Local Feature Detectors

Feature descriptors. Alain Pagani Prof. Didier Stricker. Computer Vision: Object and People Tracking

CS 231A Computer Vision (Winter 2014) Problem Set 3

1 Background and Introduction 2. 2 Assessment 2

Multi-pass approach to adaptive thresholding based image segmentation

Local features: detection and description. Local invariant features

CS 534: Computer Vision Segmentation and Perceptual Grouping

Image segmentation. Václav Hlaváč. Czech Technical University in Prague

Mobile Camera Based Calculator

Homework #4 Programming Assignment Due: 11:59 pm, November 4, 2018

Image matching. Announcements. Harder case. Even harder case. Project 1 Out today Help session at the end of class. by Diva Sian.

Building a Panorama. Matching features. Matching with Features. How do we build a panorama? Computational Photography, 6.882

Part-Based Skew Estimation for Mathematical Expressions

Feature descriptors and matching

CEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.

Homework 4: Clustering, Recommenders, Dim. Reduction, ML and Graph Mining (due November 19 th, 2014, 2:30pm, in class hard-copy please)

EE795: Computer Vision and Intelligent Systems

Assignment 2: Stereo and 3D Reconstruction from Disparity

A Computer Vision System for Graphical Pattern Recognition and Semantic Object Detection

Miniaturized Camera Systems for Microfactories

Robust PDF Table Locator

Computer Vision 2. SS 18 Dr. Benjamin Guthier Professur für Bildverarbeitung. Computer Vision 2 Dr. Benjamin Guthier

Transcription:

CSE152a Computer Vision Assignment 2 WI14 Instructor: Prof. David Kriegman. Revision 1 Instructions: This assignment should be solved, and written up in groups of 2. Work alone only if you can not find a partner. No groups of 3 are allowed. Submit your assignment electronically by email to obeijbom@cs.ucsd.edu with the subject line CSE152 Assignment 2. The email should have two files attached. 1. A pdf file with your writeup. This should have all code attached in the appendix. Name this file: CSE 152 hw2 writeup lastname1 lastname2.pdf. 2. A compressed archive with all your Matlab code files. Name this file: CSE 152 hw2 code lastname1 lastname2.zip. The code is thus attached both as text in the writeup appendix and as m-files in the compressed archive. Please make this a proper report, with methods, thoughts, comments and discussions. All code should be tucked away in an appendix. Include name and student ID in your report and always use figure legends. No physical hand-in for this assignment. You may do problems on pen an paper, just scan and include in the writeup pdf file. In general, Matlab code does not have to be efficient. Focus on clarity, correctness and function here, and we can worry about speed in another course. The following matlab commands are useful for formatting your plots nicely 1. subplot.m allows your to grid your figures 2. set(gcf, Color, [111]) makes the figure background white. 3. set(0, defaultlinelinewidth,2) increases line thickness. 1 Binarization [10 points] Write a Matlab function to implement the peakiness detection algorithm described in class (http://cseweb.ucsd.edu/classes/wi14/cse152-a/lec7.pdf). This algorithm should automatically determine an intensity level to threshold an image to segment out the foreground from the background. The output of your function should be a binary image that is 0 for all background pixels and 1 for all foreground pixels. Apply this function to the image can.jpg and turn in the output image in your report. Notes: Load in an image as a grayscale, double-precision image, e.g. img = im2double(rgb2gray(imread( can.jpg ))); You can use the Matlab function hist(img(:),numbins) to create a histogram of pixel intensities as a first step to the peakiness detection algorithm. Using numbins=15 and a minimum distance of 3 bins between peaks should work. 1

Probability of intensity(x) 7 6 5 4 3 2 1 Image histogram Fitted GMM model 0 0.2 0 0.2 0.4 0.6 0.8 1 1.2 Image intensity Figure 1: Fitted Gaussian Mixture Model to a sample image histogram 1.1 BONUS: Gaussian Mixture Models [5 points] Instead of the peakiness algorithm, try fitting a Gaussian Mixture Model to the grayscale image. Let one of the modes represent the foreground and the other the background. You can use the Matlab function gmdistribution.fit to fit the model to the data. Include the image histogram along with the fitted distribution overlaid, as shown in fig. 1. Note that it will suffice to use 2 mixture models. Once you have fitted your distribution, a segmentation can be achieved by B(x, y) = arg max P (I(x, y) c)p (c) (1) c where P (I(x, y) c) is the probability of intensity at pixel (x, y) for class c 0, 1, and P (c) is the (prior) probability of class c, and B(x, y) is the output binary image. Compare and contrast your results using this method to the peakiness method above. In addition to the class slides, some more details on gaussian mixture models can be seen at Professor Vasconcelo s slides (http://www.svcl.ucsd.edu/courses/ece271a/handouts/em.pdf), which also contain some information about the EM-algorithm used by gmdistribution.fit to fit the model. 2 Connected Components [15 points] (a) Write Matlab code to implement the connected component labeling algorithm discussed in class, assuming 8-connectedness. Your function should take as input a binary image (computed using your algorithm from question 1) and output a 2D matrix of the same size where each connected region is marked with a distinct positive number (e.g. 1, 2, 3). On the image can.jpg, display an image of detected connected components where connected region is mapped to a distinct color (using the function imagesc in Matlab). (b) How many components do you think are in the image coins.png? What does your connected component algorithm give as output for this image? Include your output on this image in your report. Notes: To avoid Matlab recursion limits, you may find it necessary to increase the recursion limit: set(0, RecursionLimit,1000); 2

Figure 2: Sample images Figure 3: Sample images with principle directions overlaid For the coin image, it may help to reduce the size of the image before running the connected components algorithm but after converting the image to a binary image: binarysmall = imresize(binary, 0.25, bilinear ); 3 Take your own images [5 points] For the next parts, you will be using images you take with your own camera. Choose three objects of different shapes, preferably with non-shiny surfaces. Possibilities include paper/cardboard cutouts, bottle tops, pencils, Lego pieces, etc. Take 3 pictures of these objects individually with a solid background. The object should be clearly distinguishable from the background (e.g. bright object & dark background). Include these three images in your report as in Figure 2. In addition, show similar output images as in Problem 2 for each of your new images (there is only 1 connected component in this case). 4 Image moments and rectification [10 points] Write three functions which compute the moments, central moments, and normalized moments of a marked region (http://cseweb.ucsd.edu/classes/wi14/cse152-a/lec7.pdf). Each function should take as input a 2D matrix (output of part 2) and 3 numbers j, k, and d. The output should be the (i, k) moment M j,k, central moment µ j,k, normalized moment m j,k of the region marked with positive number d in the input matrix. Using these functions, on each of the three images, draw the centroid of each object. Also compute the eigenvectors of the centralized second moment matrix (http://cseweb.ucsd.edu/ classes/wi14/cse152-a/lec7.pdf) and draw the two eigenvectors on the centroid. This should indicate the orientation of each object, see Figure 3 for the results on the example images. Turn in the outputs for your own images. 3

Figure 4: Aligning one of the sample images 5 Image alignment [10 points] We have seen that the orientation computed from Problem 4 can be used to roughly align the orientation of the region (i.e. in-plane rotation). Write a function to rotate the region around its centroid so that the eigenvector corresponding to the largest eigenvalue (i.e. the blue vector in Figure 3) will be horizontal (aligned with [1, 0] T ). This might look like in Figure 4. Your function should take as input a 2D matrix (output of Problem 2) and output a matrix of the same size in which all marked regions are aligned. Turn in the aligned outputs for your images. Note: After finding the rotation matrix R to rotate the largest eigenvector to [1, 0] T, we rotate all points (x, y) belonging to that region using the following transformation [ ] [ ] [ ] x x ˆx ˆx y = R + y ŷ ŷ where [ˆx, ŷ] T are the centroid coordinates of the region For simplicity, just ignore the cases when part of the aligned region falls outside of the image border or is overlapped with other regions. You can avoid these issues when capturing your images (e.g. put your objects a bit far apart). Finally, note that the rotation matrix can be created trivially from the eigenvectors. 6 Full recognition pipeline [20 points] Now you will put all the pieces together. Take an additional picture with all objects present in the image (e.g Figure 5). Do the following: Use your segmentation routine (Problem 1) to produce a binary image. Use your connected components routine (Problem 2) to produce an image of connected regions (should be three). Display your result for this step. Use your alignment routine (Problem 4) to produce an image of aligned regions. Display your result. Extract a feature vector fi of the moments (µ 2,0, µ 0,2, m 2,0, m 0,2 ) T for each aligned regions. Label each region in the 4th image by comparing its feature vector to the feature vectors extracted from the aligned objects in the first three images (images with individual objects). Choose the label for which the Euclidean distance between feature vectors is minimized: arg min i z x i 2 2, where x i is the feature vector for object i, and z is the feature vector for the unknown object that you want to classify. Note: Use Matlab text function to label the regions with a text at their centroids (e.g. Circle, Stick). Depending on the shape of your object, you may not get perfect results. Though it is not required, you can play with different set of moments to see which moments are most discriminative for your objects. 4

Figure 5: Picture of all objects together 5