Image Segmentation and Image File...

Post on 15-Mar-2020

27 views 0 download

Transcript of Image Segmentation and Image File...

Digital Image Processing

Lecture # 13

Image Segmentation and Image File Formats

Autumn 2012

Digital Image Processing Lecture # 13 2

Region-Based Segmentation

► Region Growing

1. Region growing is a procedure that groups pixels or subregions into larger regions.

2. The simplest of these approaches is pixel aggregation, which starts with a set of “seed” points and from these grows regions by appending to each seed points those neighboring pixels that have similar properties (such as gray level, texture, color, shape).

3. Region growing based techniques are better than the edge-based techniques in noisy images where edges are difficult to detect.

Digital Image Processing Lecture # 13 3

Region-Based Segmentation

Example: Region Growing based on 8-connectivity

( , ) : input image array

( , ): seed array containing 1s (seeds) and 0s

( , ): predicate

f x y

S x y

Q x y

Digital Image Processing Lecture # 13 4

Region Growing based on 8-connectivity

1. Find all connected components in ( , ) and erode each

connected components to one pixel; label all such pixels

found as 1. All other pixels in S are labeled 0.

2. Form an image such that, aQ

S x y

f t a pair of coordinates (x,y),

let ( , ) 1 if the is satisfied otherwise ( , ) 0.

3. Let be an image formed by appending to each seed point

in all the 1-value points in that are 8-con

Q Q

Q

f x y Q f x y

g

S f

nected to that

seed point.

4. Label each connencted component in g with a different region

label. This is the segmented image obtained by region growing.

Digital Image Processing Lecture # 13 5

TRUE if the absolute difference of the intensities

between the seed and the pixel at (x,y) is T

FALSE otherwise

Q

Digital Image Processing Lecture # 13 6

Digital Image Processing Lecture # 13 7

4-connectivity

Digital Image Processing Lecture # 13 8

8-connectivity

Digital Image Processing Lecture # 13 9

Digital Image Processing Lecture # 13 10

Digital Image Processing Lecture # 13 11

Region Splitting and Merging

: entire image :entire image : predicate

1. For any region , If ( ) = FALSE,

we divide the image into quadrants.

2. When no further splitting is possible,

merge any adjacent regi

i

i i

i

R R Q

R Q R

R

ons and

for which ( ) = TRUE.

3. Stop when no further merging is possible.

j k

j k

R R

Q R R

Digital Image Processing Lecture # 13 12

Digital Image Processing Lecture # 13 13

Digital Image Processing Lecture # 13 14

TRUE if and 0

FALSE otherwise

a m bQ

Digital Image Processing Lecture # 13 15

K-means Clustering

► Partition the data points into K clusters randomly. Find the centroids of each cluster.

► For each data point:

Calculate the distance from the data point to each cluster.

Assign the data point to the closest cluster.

► Recompute the centroid of each cluster.

► Repeat steps 2 and 3 until there is no further change in the assignment of data points (or in the centroids).

K-Means Clustering

K-Means Clustering

K-Means Clustering

K-Means Clustering

K-Means Clustering

K-Means Clustering

K-Means Clustering

K-Means Clustering

Digital Image Processing Lecture # 13 24

Clustering

► Example

D. Comaniciu and P.

Meer, Robust Analysis

of Feature Spaces:

Color Image

Segmentation, 1997.

Digital Image Processing Lecture # 13 25

Image File Formats

►To understand the advantages and disadvantages of various image formats

►Categories

One category

►Raster Image Formats

►Vector Image Formats

Another category

►Binary Image Formats

►ASCII Image Formats

Digital Image Processing Lecture # 13 26

Raster Image Formats ►Breaks the image into a series of color dots

called “pixels”

►The number of bits at each pixel determines the maximum number of colors

1 bits= 2 (21) colors

2 bits= 4(22) colors

4 bits= 16 (24) colors

8 bits= 256 (28) colors

16 bits= 65,536 (216) colors

24 bits = 16,777,216 (224) colors !

Digital Image Processing Lecture # 13 27

Vector Image Formats

►Break the image into a set of mathematical descriptions of shapes: curve, arc, rectangle, sphere etc.

►Resolution-independent: scalable without the problem of “pixelating” .

►Not all images are easily described in a mathematical form.

How to describe a photograph?

Comparison

►Raster

-Resolution-dependent

-Suitable for photographs

-smooth tones and subtle details

-larger size

►Vector

-Resolution-independent

-suitable for line drawings, CAD, Logos

- Smooth curves

- Smaller size

Digital Image Processing Lecture # 13 29

What are the common types of image formats

►Raster

►GIF (Graphics Interchange Format), Bitmap, JPEG,TIFF, PBM (portable Bit Map – binary), PGM (Portable Gray map – grayscale), PPM (Portable Pixel Map – color), PNM (Portable Any Map – any three), PCD(photo CD), PNG (Portable Network Graphics), etc.

►Vector: PS(postscript), EPS (embedded postscript), CDW (CorelDraw), WMF (windows metafile), SVG (Scalable vector graphics), etc.

Digital Image Processing Lecture # 13 30

CompuServ GIF – Graphics Interchange Format

►First standardized in 1987 by compuserv (called GIF87a)

►Updated in 1989 to include transparency, interlacing, and animation (called GIF89a)

►Use the LZW (Lempel-Ziv Welch) algorithm for compression

►A maximum of 256 colors, so doesn’t work well for photographs

►Suitable for small images such as icons ►Simple animations

Digital Image Processing Lecture # 13 31

Bitmaps

►Can create great image with 24 or even 32 bits per pixel

►File size is large, for example, a bitmap image of size 1024*768*3= 2MBs

►How to reduce size? Run Length Encoding (RLE) – lossless

►What about even smaller size? Lossy encoding such as JPEG.

Digital Image Processing Lecture # 13 32

JPEG (Joint Photographic Experts

Group)

►Lossy encoding

Digital Image Processing Lecture # 13 33

TIFF (Tag Image File Format)

► Tag-based image format ► Originated in 1986 at Aldus Corp. (PageMaker), the

latest version 6.0 ► Developed by Aldus and Microsoft ► Platform-independent ► Mostly used by scanners and desktop publishing ► http://www.libtiff.org/ for a TIFF library ► Support compressions of CCITT Fax 3 & 4, LZW,

JPEG etc. ► Support multiple color spaces: Grayscale, RGB,

YCbCr, CMYK etc.

Digital Image Processing Lecture # 13 34

Which One to Use

►No unique answer

►For small image e.g. icon …. GIF

►For large image e.g. photograph … JPEG

►If scalability required … PS, EPS