Lecture 17.5: More image processing: Segmentation

Similar documents
Extended Introduction to Computer Science CS1001.py Lecture 24: Introduction to Digital Image Processing

מבוא כללי לתכנות ולמדעי המחשב

Computing for Engineers in Python

Images and Graphics. 4. Images and Graphics - Copyright Denis Hamelin - Ryerson University

International Journal of Advanced Research in Computer Science and Software Engineering

UNIT 7B Data Representa1on: Images and Sound. Pixels. An image is stored in a computer as a sequence of pixels, picture elements.

CS101 Lecture 19: Digital Images. John Magee 18 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

The BIOS in many personal computers stores the date and time in BCD. M-Mushtaq Hussain

Fundamentals of Multimedia

Computer Programming

Carmen Alonso Montes 23rd-27th November 2015

Chapter 17. Shape-Based Operations

15110 Principles of Computing, Carnegie Mellon University

Image Processing Lecture 4

Image and video processing

Compression and Image Formats

Computer Science 1001.py. Lecture 25 : Intro to Error Correction and Detection Codes

15110 Principles of Computing, Carnegie Mellon University

UNIVERSITY OF CALICUT INTRODUCTION TO MULTIMEDIA QUESTION BANK

2. Color spaces Introduction The RGB color space

Computer Vision. Howie Choset Introduction to Robotics

CS101 Lecture 12: Digital Images. What You ll Learn Today

IMAGE ENHANCEMENT - POINT PROCESSING

Introduction to Image Analysis with

Introduction to Photography

Computer and Machine Vision

CS 262 Lecture 01: Digital Images and Video. John Magee Some material copyright Jones and Bartlett

SYLLABUS CHAPTER - 2 : INTENSITY TRANSFORMATIONS. Some Basic Intensity Transformation Functions, Histogram Processing.

CSC 170 Introduction to Computers and Their Applications. Lecture #3 Digital Graphics and Video Basics. Bitmap Basics

Graphics for Web. Desain Web Sistem Informasi PTIIK UB

Automatic Morphological Segmentation and Region Growing Method of Diagnosing Medical Images

Cellular Bioengineering Boot Camp. Image Analysis

INTRODUCTION TO COMPUTER GRAPHICS

ECC419 IMAGE PROCESSING

2. Color spaces Introduction The RGB color space

Digital Image Processing. Lecture # 6 Corner Detection & Color Processing

UNIT 7C Data Representation: Images and Sound

Sampling Rate = Resolution Quantization Level = Color Depth = Bit Depth = Number of Colors

8.2 IMAGE PROCESSING VERSUS IMAGE ANALYSIS Image processing: The collection of routines and

Chroma Mask. Manual. Chroma Mask. Manual

ITP 140 Mobile App Technologies. Images

Chapter 3 Graphics and Image Data Representations

Segmentation of Microscopic Bone Images

An Efficient Color Image Segmentation using Edge Detection and Thresholding Methods

Applying mathematics to digital image processing using a spreadsheet

SECTION I - CHAPTER 2 DIGITAL IMAGING PROCESSING CONCEPTS

CSE 564: Scientific Visualization

Mask Integrator. Manual. Mask Integrator. Manual

Color Image Processing

EEL 6562 Image Processing and Computer Vision Box Filter and Laplacian Filter Implementation

TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES

Raster (Bitmap) Graphic File Formats & Standards

Digital Images. Back to top-level. Digital Images. Back to top-level Representing Images. Dr. Hayden Kwok-Hay So ENGG st semester, 2010

GE 113 REMOTE SENSING. Topic 7. Image Enhancement

Chapter 9 Image Compression Standards

Computer Vision Introduction or

Background. Computer Vision & Digital Image Processing. Improved Bartlane transmitted image. Example Bartlane transmitted image

LECTURE 02 IMAGE AND GRAPHICS

Image processing in MATLAB. Linguaggio Programmazione Matlab-Simulink (2017/2018)

Digital Media. Lecture 4: Bitmapped images: Compression & Convolution Georgia Gwinnett College School of Science and Technology Dr.

LECTURE 03 BITMAP IMAGE FORMATS

Lecture # 01. Introduction

ImageJ, A Useful Tool for Image Processing and Analysis Joel B. Sheffield

CoE4TN4 Image Processing. Chapter 3: Intensity Transformation and Spatial Filtering

Camera Image Processing Pipeline: Part II

How is Information Stored

Computer Graphics. Si Lu. Fall er_graphics.htm 10/02/2015

CMPSC 390 Visual Computing Spring 2014 Bob Roos Review Notes Introduction and PixelMath

Digital Image Processing. Lecture # 8 Color Processing

LAB MANUAL SUBJECT: IMAGE PROCESSING BE (COMPUTER) SEM VII

BEng (Hons) Electronic Engineering. Examinations for / Semester 1

The Study on the Image Thresholding Segmentation Algorithm. Yue Liu, Jia-mei Xue *, Hua Li

Project: Sudoku solver

ITP 140 Mobile App Technologies. Colors Images Icons

PENGENALAN TEKNIK TELEKOMUNIKASI CLO

CGT 511. Image. Image. Digital Image. 2D intensity light function z=f(x,y) defined over a square 0 x,y 1. the value of z can be:

MOTION GRAPHICS BITE 3623

Image Processing : Introduction

Camera Image Processing Pipeline: Part II

Fig Color spectrum seen by passing white light through a prism.

For a long time I limited myself to one color as a form of discipline. Pablo Picasso. Color Image Processing

CHAPTER 3 I M A G E S

Digital Image Processing 3/e

Overview. Pinhole camera model Projective geometry Vanishing points and lines Projection matrix Cameras with Lenses Color Digital image

The Need for Data Compression. Data Compression (for Images) -Compressing Graphical Data. Lossy vs Lossless compression

Bit Depth. Introduction

BEST PRACTICES FOR SCANNING DOCUMENTS. By Frank Harrell

UNIT 7C Data Representation: Images and Sound Principles of Computing, Carnegie Mellon University CORTINA/GUNA

Elements of Design. Basic Concepts

Keywords: Image segmentation, pixels, threshold, histograms, MATLAB

MAV-ID card processing using camera images

Image Processing for Mechatronics Engineering For senior undergraduate students Academic Year 2017/2018, Winter Semester

ELE 882: Introduction to Digital Image Processing (DIP)

Review of Image Segmentation Techniques based on Region Merging Approach

The next table shows the suitability of each format to particular applications.

4 Images and Graphics

][ R G [ Q] Y =[ a b c. d e f. g h I

Anna University, Chennai B.E./B.TECH DEGREE EXAMINATION, MAY/JUNE 2013 Seventh Semester

Mech 296: Vision for Robotic Applications. Vision for Robotic Applications

Unit 1.1: Information representation

Transcription:

Extended Introduction to Computer Science CS1001.py Lecture 17.5: More image processing: Segmentation Instructors: Benny Chor, Amir Rubinstein Teaching Assistants: Michal Kleinbort, Yael Baran School of Computer Science Tel-Aviv University Spring Semester, 2014-15 http://tau-cs1001-py.wikidot.com

Lecture 17.5: Plan Segmentation Binary segmentation by thresholding Otsu s method Wrap-up Higher dimension images Resolution and pixel size Compression 2

Segmentation The process of partitioning a digital image into multiple segments (sets of pixels, also known as superpixels). Source: http://www.sonycsl.co.jp/person/nielsen/applets.html The goal of segmentation is to simplify and/or change the representation of an image into something that is more meaningful and easier to analyze. Image segmentation is critical for many subsequent processes, such as object recognition, shape analysis and tracking. It is typically used to locate objects and boundaries (lines, curves, etc.). 3 Examples: locating tumors or anatomical structures in medical images; face detection; identifying objects in satellite images (roads, forests, crops, etc.).

Binary Segmentation by Thresholding Simplest segmentation method. Apply a threshold to turn a gray-scale image into a binary image (BW) this is called binary segmentation. Assumes the image contains two classes of pixels denoted foreground and background, and these two classes have distinct, different light intensities: the background is much darker than the foreground. Human HT29 colon-cancer cells http://www.broadinstitute.org/bbbc/image_sets.html Binary segmentation, threshold = 40 4 Generally, one can apply more than one threshold, creating >2 segments

Picking a Threshold The key is to select the appropriate threshold Which one is the best here? Original When the threshold is too low (20 in this case) areas in the image where cells are densely populated become bulbs. When it is too high (60) some cells are lost (those whose brightness was low in the original image). Threshold = 20 Threshold = 40 Threshold = 60

Binary Segmentation - Code from matrix import * #make sure matrix.py is in the current folder def segment(mat, thrd): ''' Binary segmentation of image im by threshold thrd ''' n,m = mat.dim() out = Matrix(n,m) for x in range(n): for y in range(m): if mat[x, y] >= thrd: out[x,y] = 255 #white else: out[x,y] = 0 #black return out

Binary Segmentation - Execution im = Matrix.load("./plate.bitmap") for th in [20,40,60,80,100,120]: out = segment(im, th) out.save("./out_" + str(th) + ".bitmap") bitmap2image("./out_" + str(th) + ".bitmap")

Otsu method for threshold calculation A good threshold for segmentation: minimizes differences within each segment, and maximizes differences between segments. Otsu s method finds an optimal threshold for segmentation. Uses image histogram: grey level values distribution. x-axis grey hues y-axis number of pixels with a particular hue

Image Histogram - Code def histogram(im): ''' Return a histogram as a list, where index i hold the number of pixels with value I ''' mat = im.load() width, height = im.size hist = [0]*256 for x in range(width): for y in range(height): gray_level= mat[x,y] hist[gray_level] += 1 return hist #hist[i] = number of pixels with gray level=i

Otsu method for threshold calculation Otsu's method relies on the assumption that the foreground and the background of the image differ substantially in their brightness. This assumption is not true in many cases, as in the Mona Lisa example. However, when this assumption holds, there are expected to be two peaks in the gray values of an image s histogram (such image histograms are called bi-modal). In this case the lowest mid-point between these two peaks would be a good choice for a threshold. Foreground peak Background peak A good threshold

Otsu method for threshold calculation When the difference between foreground and background are less sharp, the peaks may be partly overlapping: A good threshold Furthermore, when the image is rather uniform, there will be no such two peaks at all (in which case Otsu's method will be inapplicable):

For every threshold t denote: Otsu's Formula back number of background pixels (<= t) fore number of foreground pixels ( > t) mean_back mean value of the background pixels mean_fore mean value of the foreground pixels var_between(t) = back * fore * (mean_back - mean_fore) 2 Otsu threshold is the one that maximizes the var_between among all possible thresholds t. What is the effect of the difference between the means? What is the effect of the relative sizes of the background and foreground?

Otsu threshold - Run We will not show code for Otsu s method (HW?). Original: Human HT29 colon-cancer cells But here is an execution: >>> im = Matrix.load("./HT29.bitmap") >>> th = otsu(im) 38 >>> segment(im, th).display() Otsu's Threshold = 38

Image Processing - Summary Signal processing for which the input is an image Common problems: Noise reduction (denoising) - removing noise from an image. Segmentation - partitioning a digital image into segments (e.g. identify the boundaries of cells in a multi-cell image) Tracking - relate objects in subsequent frames of a film Edge detection detecting discontinuities in the image Registration - transforming different images into one coordinate system (e.g. minor shifts in the camera position in subsequent frames Typical applications: Machine vision Medical / biological image analysis Face detection Augmented reality 14

Edge Detection (for reference only) Edge - sharp change in intensity between close pixels Usually captures much of the meaningful information in the image images extracted using Sobel filter from: http://micro.magnet.fsu.edu/primer/java/digitalimaging/russ/sobelfilter/index.html 15

Wrap-up: Images of Higher Dimensions A 2D image is encoded as a n-by-m matrix M 3D: spatial slices of 2D images video 2D images over time Higher dimension are also used (example: fluorescence images of 5D: spatial (3D), time (1D), and multiple fluorescent markers (1D)) 16

Wrap-up: Resolution and Pixel Physical Size Resolution is the capability of the sensor to observe or measure the smallest object clearly with distinct boundaries. Resolution depends upon the physical size of a pixel. Higher resolution = lower pixel size. Increasing resolution Source: wikipedia 17

Number of bits per pixel. Wrap-up: Image Bit Depth Image from: http://micro.magnet.fsu.edu/ A human observer is able to discriminate between at most a few hundreds shades of gray in optimal conditions (some estimations are lower, depending also on the background, distance from the image etc.). Higher bit depths images are sometimes aimed for an automated analysis by a computer.

Wrap-up: Compression and Image Formats Digital images with high pixel resolution and bit depth take up lots of computer memory. This motivates the need for compressing images. During compression, some of the information in the image may be lost, in which case the compression is termed lossy. Otherwise, we call it lossless. jpg, tiff, png, bmp, gif etc., differ by the type of compression applied to the original image. The bmp format is lossless, while the other formats are lossy (tiff can be both, depending on some parameter settings).

Wrap-up: The example of jpg jpg format partitions the image into squares of 8-by-8 pixels. Most such squares will exhibit only gradual, moderate changes, especially in smooth areas of the image. These gradual changes can be well approximated by far fewer bits than the 8 8 8 = 512 bits in the original representation. A factor of 10 (or even more) saving in space can be achieved. original image highly compressed version Human HT29 colon-cancer cells. In the compressed image on the right, In the blue square all pixels are identical. In the green square, pixels only change from top to bottom. In the yellow square, pixels change in both directions.