introduction to dipimage

12
8/13/2019 Introduction to DIPimage http://slidepdf.com/reader/full/introduction-to-dipimage 1/12 Introduction to DIPimage Contents 1 Introduction.............................................................................................................................. 2 2 MATLAB ................................................................................................................................. 2 3 DIPimage ................................................................................................................................. 2 Edit a MATLAB command file ...................................................................................... 3 4 Loading and displaing an image ............................................................................................ 4 ! Image filtering .......................................................................................................................... 4 Blurring filters................................................................................................................. ! Deri"ati"e filters# gradient and Laplace .......................................................................... ! $%n&s'arpening................................................................................................................ ( Local ma)imum and minimum filters ............................................................................ * ( Point operations....................................................................................................................... * +istogram,-ased operations ........................................................................................... T'res'olding................................................................................................................... * Binar morp'olog.................................................................................................................. / T'e 0ourier transform............................................................................................................ 1 / Measurements in images ........................................................................................................ 11 Quantitative Imaging Group Department of Imaging Science & Technology Faculty of Applied Sciences Delft niversity of Technology Delft! The "etherlands T# $% ' ()* +, -# Secr.QI.T"/0tudelft1nl I# http#223331ist1tudelft1nl24i I# http#223331dipli51org2  1

Upload: sapane

Post on 04-Jun-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 1/12

Introduction to DIPimage

Contents

1 Introduction .............................................................................................................................. 2

2 MATLAB ................................................................................................................................. 2

3 DIPimage ................................................................................................................................. 2

Edit a MATLAB command file ...................................................................................... 3

4 Loading and displaing an image ............................................................................................ 4

! Image filtering .......................................................................................................................... 4

Blurring filters ................................................................................................................. !

Deri"ati"e filters# gradient and Laplace .......................................................................... !

$%n&s'arpening ................................................................................................................ (Local ma)imum and minimum filters ............................................................................ *

( Point operations ....................................................................................................................... *

+istogram,-ased operations ...........................................................................................

T'res'olding ...................................................................................................................

* Binar morp'olog .................................................................................................................. /

T'e 0ourier transform ............................................................................................................ 1

/ Measurements in images ........................................................................................................ 11

Quantitative Imaging GroupDepartment of Imaging Science & TechnologyFaculty of Applied Sciences

Delft niversity of TechnologyDelft! The "etherlands

T# $% ' ()* +,-# Secr.QI.T"/0tudelft1nlI# http#223331ist1tudelft1nl24i

I# http#223331dipli51org2

 1

Page 2: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 2/12

Introduction

T'e goal of t'is la-orator or is to get 'ands,on e)perience it' image processing. To do

so ou ill 'a"e to learn t'e image,processing en"ironment# MATLAB and t'e DIPimage

tool-o) for multi,dimensional image processing. To facilitate a 5uic start t'ere ill not -e

an in,dept' e)planation of all t'e features in t'e softare. 6e ill -riefl present t'e t'ings

ou need at t'is moment. 6e 'a"e mared t'e sections t'at e)plain somet'ing a-out t'e

en"ironment it' t'e  sm-ol so t'at t'e stand out. Let us start it' a s'ort introduction to

t'e MATLAB en"ironment.

( 6AT7A8

T'is section is to mae ou familiar it' MATLAB7 if ou alread are sip t'is section.

MATLAB is a computing8programming en"ironment especiall designed to or it' data

sets as a 'ole suc' as "ectors matrices and images. T'ese data sets can -e treated t'e same

as a mat'ematical e)pression of scalar "aria-les. MATLAB pro"ides onl a command lineand grap'ics capa-ilities. T'e idea is t'at ou gi"e it commands t'roug' t'e command line

'ic' are e)ecuted immediatel. T'e MATLAB snta) ill -ecome clear during t'is

la-orator session. +ere 9ust a fe s'ort comments#

a = b;

ill cause 'ate"er is in "aria-le  b $a scalar or an image& to -e copied into "aria-le  a.

6'ate"er as in "aria-le a gets lost. If ou omit t'e semicolon at t'e end of t'e command

t'e ne contents of a ill -e printed $scalars "ectors and matrices ill printed in t'e

command indo 'ereas images displaed in a separate indo&. If  max is t'e name of a

function t'en

a = max(a,b);

ill call t'at function it' t'e "alues a and b as its parameters. T'e result of t'e function

$its return "alue& ill -e ritten into  a o"erriting its pre"ious contents. If no e)plicit

assignment is done t'e output of a function ill -e put into a "aria-le called ans#

 max(a,b);

is t'e same as

ans = max(a,b);

It is possi-le to use t'e result of a function call as a parameter in anot'er function#

a = max(max(a,b), max(c,d));

% DIPimage

DIPimage is t'e tool-o) e ill -e using under MATLAB to do image processing. T'is

section taes ou t'roug' t'e most rele"ant features.

:ou ma 'a"e noticed t'e indos t'at appeared around t'e screen 'en ou started

MATLAB. T'e one on t'e top,left is t'e ;%I $;rap'ical %ser Interface&. T'e ot'er indos

are t'e ones used to displa t'e images in. T'e ;%I contains a menu -ar. <pend some time

e)ploring t'e menus. 6'en ou c'oose one of t'e options t'e area -eneat' t'e menu -ar

c'anges into a dialog -o) t'at allos ou to enter t'e parameters for t'e function ou 'a"ec'osen#

 2

Page 3: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 3/12

T'ere are to as of using t'e functions in t'is tool-o). T'e first one is t'roug' t'e ;%I

'ic' maes it eas to select filters and its parameters. 6e ill -e using it "er often at first

 -ut graduall less during t'e course of t'e afternoon. T'e ot'er met'od is t'roug' t'e

command line.

6'en sol"ing t'e pro-lems in t'is la-orator session e ill -e maing te)t files t'at

contain all commands e used to get to t'e result $e ill call t'em e)ercise command files&.T'is maes t'e results reproduci-le. It ill also a"oid lots of repetiti"e and tedious or. 6e

recommend ou mae a ne file for eac' e)ercise and gi"e t'em names t'at are eas to

recogni=e.

If ou start eac' file it' t'e commands

clear

dipclf

t'en t'e "aria-les and t'e figure indos ill -e cleared -efore our commands are

e)ecuted. T'is a"oids undetected errors.

Edit a MATLAB command file

To open t'e editor tpe

edit

T'e MATLAB editor ill -e started. 6e ill tpe $or cop8paste& t'e commands e ant to

e)ecute in it. T'ere is a >?un@ menu item under t'e >Tools@ menu. It can -e used to let

MATLAB run t'e file currentl -eing edited. :ou can also e)ecute t'e script - tping its

name in t'e MATLAB prompt.

 

3

Page 4: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 4/12

+ 7oading and displaying an image

6e need to load an image $from file& into a "aria-le -efore e can do an image processing.

T'e left,most menu is called >0ile I8@ and its first item >?ead image $readim&@. <elect it.

Press t'e >Brose@ -utton and c'oose t'e file cermet.ics. 'ange t'e name of t'e output

"aria-le from ans to a. Co press t'e >E)ecute@ -utton. To t'ings s'ould 'appen#1& T'e image cermet is loaded into t'e "aria-le  a and displaed to some figure

indo#

2& T'e folloing lines $or somet'ing similar& appear in t'e command indo#

» a = readim('c:\matlab\toolbox\dipimage\images\cermet.ics','')

Displayed in figure !

T'is is to s'o ou t'at e)actl t'e same ould 'a"e 'appened if ou 'ad tped t'at

command directl in t'e command indo. Tr tping t'is command#

 b = readim('cermet')T'e same image ill -e loaded into t'e "aria-le b and again displaed in a indo. Cote t'at

e omitted t'e  '.ics' e)tension to t'e filename.  readim can find t'e file it'out ou

'a"ing to specif t'e file tpe. 6e also didnt specif t'e second argument to t'e readimfunction since '' denotes t'e default "alue. 0inall - not specifing a full pat' to t'e file

e ased t'e function to loo for it eit'er in t'e current director or in t'e default image

director.

op t'e command as printed - t'e ;%I into t'e editor $6indos# select it' t'e mouse

trlF to cop t'e te)t7 go to t'e editor trlFG to paste. %ni)# select it' t'e mouse go to

t'e editor and clic it' t'e middle mouse -utton to paste.&

To suppress automatic displa of t'e image in a indo add a semicolon to t'e end of t'ecommand#

a = readim('"dna');

 Cote t'at t'e contents of  a c'anged -ut t'e displa is not updated. To update t'e displa

simpl tpe#

a

' Image filtering

T'e >0ilters@ menu contains a series of image filters. A filter is a neig'-or'ood operations in'ic' t'e output "alue is a function of t'e "alues in a local indo around t'e current pi)el.

 4

Page 5: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 5/12

Blurring filters

'oose >;aussian filter@. T'e name -eteen parent'eses on t'e menu indicates t'e name of

t'e function t'at implements t'is filter. T'e re5uired input image s'ould alread reside in one

of t'e "aria-les e.g. a. Tpe an name for t'e output image for e)ample b. Co e need to

c'oose t'e si=e of t'e ;aussian filter# t'e standard de"iation in pi)els. Tr out different "alues

for it and see 'at 'appens.

Also e)plore t'e >%niform filter@. 6'at is t'e difference it' t'e >;aussian filter@H 6'at

 parameters ould ou c'oose to mae t'e result of t'e uniform filter similar to t'e result from

t'e ;aussian filterH 6' cant ou mae t'e results e)actl t'e sameH

Mae sure ou cop some of t'e function calls ou mae to our e)ercise command file.

It is possi-le to c'oose a different filter si=e parameter for t'e 'ori=ontal and "ertical -lur.

T'is can -e accomplis'ed - separating t'e to "alues it' a comma and surrounding t'e

'ole t'ing it' s5uare -racets#  #$,!%. T'is is t'e a t'at arras are constructed in

MATLAB. T'e first "alue ill -e used in t'e  x,direction and t'e second one in t'e  y,direction.

Derivative filters: gradient and Laplace

T'e menu >Differential 0ilters@ contains a general deri"ati"e filter $gauss&deriatie& and a

complete set of first and second order deri"ati"es. T'ere are also some more filters -ased on

com-inations of deri"ati"es suc' as laplace and gradmag.

As ou 'a"e learned toda t'e Laplace operator is a general second deri"ati"e. Lets mae

one -ased on t'e -asic deri"ati"es onl. T'is ill allo us to s'o ou 'o to compute it'

images. 0irst e need t'e second deri"ati"es in t'e  x and  y,directions. Put t'em in "aria-les

named a&xx and a&yy $an name is as good as t'e ot'er isnt itH&.:ou ill notice t'at t'e second deri"ati"e does not ield "er 'ig' gre,"alues. T'e displa

loos -lac. B default images are displaed - mapping t'e "alue to -lac and t'e "alue

2!! to 'ite. <ince all gre,"alues in t'is particular image are $appro)imatel& -eteen ,3

and 3 t'is mapping is not ade5uate. 6e can c'ange t'is mapping t'roug' t'e menus of t'e

figure indos. pen t'e >Mappings@ menu. It contains a couple of options t'at allos ou

to c'ange t'e displa mapping. 'oose >Based at @. T'is mode ill map t'e image "alues

linearl -eteen -lac and 'ite forcing t'e "alue to ! gre. Tr out t'e ot'er modes

too.

 !

Page 6: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 6/12

 Co e need to add t'ese to deri"ati"es toget'er. T'is is accomplis'ed it' t'e command

 b = a&xx a&yy

$Cote t'at t'ere is no menu item for adding to images&. Images can -e su-tracted multiplied

and di"ided in a similar a. It is also possi-le to use a constant "alue instead of eit'er image.

Lets compare t'e result it' t'e Laplace operator $laplace&. Put its result in  c. Co

compare  b and  c  - su-tracting t'e to images. <ince -ot' are e5ual t'e result is

completel -lac. But e ant to mae sure t'at t'e difference is =ero e"er'ere and not

 9ust "er small.

T'e >Actions@ menu allos ou to specif t'e mouse action on t'e figure indo. <elect

>Pi)el testing@ and press t'e mouse -utton 'ile pointing some'ere in t'e image $eep t'e

 -utton don&. T'e figure caption c'anges to s'o t'e coordinates of t'e mouse in t'e image

and t'e "alue of t'e pi)el at t'ose coordinates. Tr mo"ing t'e mouse 'ile 'olding t'e

 -utton don and c'ec t'at t'e "alues are all indeed =ero. Tr t'is out on anot'er image too.

Anot'er option on t'e >Actions@ menu is used to =oom in on an image. Tr it out too.

Mae sure ou 'a"e copied e"er command ou e)ecuted to t'e e)ercise command file.

(Un)sharpening 

 Co e ill s'arpen t'e image 5dna1 load it in "aria-le a - t'e command#

a = readim('"dna')

%ns'arp masing 'as -een defined toda as t'e original image minus t'e Laplace of t'e

image. 6e can rite t'is "er easil using onl t'e command line#

a laplace(a)

T'e anser is put into t'e "aria-le ans.

 Cote t'at uns'arp masing gets its name from a procedure emploed - p'otograp'ers long

 -efore t'e das of computers or image processing. 6'at t'e used to do as print an uns'arp

"ersion of t'e image on film and use t'at to mas t'e negati"e. T'e to com-ined produced

a s'arper "ersion of t'e p'otograp'. T'e tric is t'at t'e uns'arp print mass t'e lo,

fre5uenc components -ut not t'e 'ig' fre5uencies7 t'e procedure t'us implements a 'ig',

 pass filter. Lets reproduce t'at tric it' our cermet. Tpe t'is#

*+a gaussf(a)

B multipling t'e image - to e multipl -ot' t'e lo and 'ig' fre5uencies. T'e lo

fre5uenc components are t'en su-tracted again t'us remaining in t'eir original intensit.nl t'e 'ig',fre5uenc components are effecti"el multiplied - to.

 (

Page 7: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 7/12

T'e to uns'arp filters $>a-laplace(a)@ and >2*a - gaussf(a)@& are not t'e same.

In 'at do t'e differH +o are t'e alieH

Local maximum and minimum filters

T'e local >minimum and ma)imum filters@ $ minf and  maxf& assign respecti"el t'e

minimum or t'e ma)imum "alue of a local indo to t'e current pi)el in t'e output image.

T'e general names for t'ese operations are erosion and dilation and can -e found as suc'

under t'e >Morp'olog@ menu. Dilation is a local ma)imum filter erosion is a local

minimum filter opening is t'e se5uence erosion and dilation and closing is t'e in"erse

se5uence. 0or e)ample tr a closing it' different si=e parameter on t'e image cermet

$'ic' is a microscopic image it' some dar o-9ects in it&. Cote 'o t'e image is made

smoot'er it'out maing t'e o-9ect edges less s'arp. Also note 'o t'e smaller o-9ects are

remo"ed from t'e image.

 

Tr t'e ot'er filters on t'e same image and atc' t'e si=e of o-9ects. Tr different filter si=es

as ell.

%sing ma)8min filters $e5ui"alent to dilation8erosion& e ill construct a morp'ological

gradient t'at ill -e modified into a morp'ological s'arpening operation. Load t'e image

cermet into "aria-le a. <u-tract t'e original from t'e dilated image and put t'e result in  b.

<u-tract t'e eroded image from t'e original and put t'e result in c.

a = readim('cermet')

 b = dilation(a) a

c = a erosion(a)

Bot' results detect a-rupt c'anges in gre,le"el. Cotice t'e su-tle difference in t'e ees.

$?emem-er to rite all commands in an e)ercise command file.&

, Point operations

T'ere e)ist a large num-er of monadic point operations t'at are onl accessi-le t'roug' t'e

command line. T'e act on t'e image pi)el,-,pi)el. E)amples are t'e mat'ematical

functions:

sin, cos, tan, atan*, etc.

abs, angle, real, imag, con, complex, etc.

log, log!, log*, exp, s"rt, etc.

 *

Page 8: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 8/12

istogram!"ased operations

T'e function dip-ist $under t'e ><tatistics@ menu& plots t'e 'istogram of an image. pen a

ne image# sca7 in t'is image are -loodcells of a sicle cell anaemia patient s'on. Plot t'e

'istogram of t'e image sca. :ou ill notice t'at t'e loer / gre,"alues are not used as

are t'e upper 4. orrect t'is using t'e function stretc- $under t'e >Point@ menu&. To see t'e

difference it' t'e original image mae sure t'at t'e displa mode is set to >Cormal@. Plot

t'e 'istogram of t'e ne image.

T'is stretc'ing met'od is "er sensiti"e to noise. 0or e)ample set a single pi)el in t'e

original image a to 1. T'is can -e accomplis'ed - inde)ing. It is not "er important 'o

t'is ors e)actl since manipulating an image in t'is a is not part of t'e course. Tpe#

a(!,!) = !

 Co plot t'e 'istogram again. :ou ill not  notice t'e difference. +oe"er t'e stretc'ing

algorit'm ill. Plot t'e 'istogram of t'e stretc'ed image to see t'is. 6' is t'e loer part of

t'e 'istogram flatH

?epeat t'e pre"ious se5uence of commands it' t'e loer and upper percentiles in t'e stretc'

function 1 and // respecti"el. T'is causes t'e loer and upper 1 of t'e gre,"alues to -e

clipped -efore stretc'ing.

T'e 'istogram of sca is also "er poorl distri-uted. T'is is a feature of most images. It

simpl means t'at some gre,"alues occur more often in t'e image t'an ot'ers. <ometimes

t'is is not desira-le for e)ample 'en comparing images ac5uired under different lig'ting

circumstances. Appl t'e -ist&e"ualie function $also on t'e >Point@ menu& to t'e image

JscaJ and t'en plot t'e 'istogram again. Is in t'is image a stretc' or an e5uali=ation of t'e

'istogram prefera-leH

a = readim('sca') b = -ist&e"ualie(a)

?epeat t'e pre"ious se5uence of commands it' t'e image maan one of t'e earl images of

our moon.

a = readim('maan')

 b = -ist&e"ualie(a)

Plot t'e 'istogram -efore and after 'istogram e5uali=ation. Is in t'is image a stretc' or an

e5uali=ation of t'e 'istogram prefera-leH

Thresholding 

Load and stretc' t'e image sca again into "aria-le a. T'e o-9ects in it are clearl defined

and are eas to segment. T'e t-res-old function contains a couple of different algorit'ms to

do t'is. T'e simplest one fi)ed re5uires ou to pro"ide a parameter# t'e t'res'old le"el.

T'e ot'er t'ree estimate t'is parameter -ased on t'e 'istogram of t'e image in different as.

0or t'is image t'e parameter is not "er critical7 lets use 1. T'e red portion of t'e

segmented image is t'e o-9ect and t'e -lac is t'e -acground. n t'is image it goes all

rong# t'e -acground 'as -ecome t'e o-9ect and t'e particles 'a"e -ecome 'oles in t'e

o-9ect. T'at is -ecause gre,"alues larger t'an t'e t'res'old are considered as part of t'e

o-9ect. ne solution is to in"ert t'e image -efore or after t'res'olding. T'is can -e done it't'e negation operator for t'e -inar image $/t-res-old(a,'fixed',!!)& or t'e minus

Page 9: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 9/12

operator for t'e gre,"alue image $t-res-old(a,'fixed',!!) note 'o t'e t'res'old

"alue s'ould also -e c'anged&. Anot'er a is to c'ange t'e t'res'olding operation. 6e can

use t'e relational operators to do t'res'olding $ 0 1  == /= etc&. In our case#

 b = a 0 !!

 Co e 'a"e a -inar image recogni=a-le - t'e red coloring of t'e displa. T'is leads us to -inar morp'olog.

) 8inary morphology

T'ere are dedicated operations for -inar images. T'e point operations not $/& or $2&

and $3& )or $xor& can onl -e issued directl onto t'e command line. T'e -inar

morp'ological filters can -e found under t'e >Binar 0ilters@ menu.

0or e)ample e can use t'e >Binar pening@ $ bopening) to remo"e small o-9ects. In t'e

same a e can use bclosing to remo"e small 'oles in t'e o-9ects. 6'at is t'e effect of

t'e >Edge condition@H 6'at connecti"it gi"es t'e -est results for t'is imageH 6'at is t'eeffect of t'e specified num-er of iterationsH

 Co load t'e image sca stretc' and t'res'old it $K1*!&. Mae sure t'at t'e t'res'olding

operation retains t'e 'ole o-9ects. T'e cells 'ic' are not full inside t'e picture s'ould -e

remo"ed. T'is can -e done - t'e function remo"e edge o-9ects $under >Binar filters@&.

6e ill use t'e seleton operations to separate t'e 'ealt' from t'e sicle cells.

%se t'e bs4eleton function $under t'e >Binar 0ilters@ menu& to create a seleton of t'e

o-9ects. 6'at is t'e influence of t'e Edge onditionH 6'at does End,Pi)el ondition

controlH

<ince most of t'e normal cells 'a"e a reflection 'ic' is also "isi-le in t'e t'res'oldedimage t'e seleton image s'os a circle for a normal cell. A sicle cell ill s'o a straig't

line.

 /

Page 10: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 10/12

T'e picture re"eals one straig't line se"eral ellipses and some cur"ed lines $originating from

to cells o"erlapping&.

* The Fourier transformLoad t'e image 5dna1 into "aria-le a. %nder t'e >Transforms@ menu ou ill find t'e

forard and in"erse 0ourier transforms. Appl t'e forard transform to t'e image in "aria-le

a, and store t'e 0ourier spectrum in "aria-le b.

 b = ft(a)

T'e result loos lie a 'ite cloud in a -lac -acground7 t'is is -ecause t'e default displa

mapping is not t'e most ade5uate. Tr linear stretc'ing. Co all ou 'a"e left is a single dot

in t'e middle. T'e dnamic range is "er large. Logarit'mic stretc'ing is usuall emploed to

loo at 0ourier spectra.

 Co sitc' on t'e >Pi)el testing@ mode and loo at t'e "alues in t'e spectrum. T'e "alues

are comple). 6'at ou see as an image is 9ust t'e amplitude of t'e spectrum. Co e ill

decompose it into a real and an imaginar part. 6e ill do t'is t'roug' t'e  real and imagcommands $t'ese are not in t'e menus&. 6rite t'ese and t'e pre"ious commands into a

command file $e assume t'at - is t'e 0ourier spectrum&#

re = real(b)

im = imag(b)

:ou ill notice t'at t'e image im contains real "alues. 6e need to multipl it - i. If ou

o"errote "aria-le i it' an image ou can use . If ou also o"errote it clear t'em it'

clear i

 1

Page 11: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 11/12

Page 12: Introduction to DIPimage

8/13/2019 Introduction to DIPimage

http://slidepdf.com/reader/full/introduction-to-dipimage 12/12

 

 Co e are read to do some measuring. <elect t'e measure function in t'e >Analsis@

menu. T'e -9ect image is t'e la-eled image la. T'e ;re,"alue image is t'e original

image -efore segmentation7 it ont -e used - t'e measurements e ill mae so it can -e

left out. <elect 'sie' as t'e measurement. If ou lea"e -9ect IDs empt all o-9ects ill

 -e measured. Put t'e output in a "aria-le called data. Co

s = data.sie

is a MATLAB arra it' t'e si=es of t'e o-9ects. Co tpe

dip-ist(s,#,*!!!%,!!)

T'is ill create a 'istogram for t'e si=es. T'ere are o-"iousl to si=e categories. Lets sa

t'at si=es up to 1 are for t'e nuts and larger si=es for t'e -olts. T'ere e)ist as of doing

t'is automaticall -ut e ont go into t'em no. 6e ill use t'e function   mrs*ob to

paint eac' o-9ect it' t'eir measured si=e. 'oose t'e la-el image as t'e input and dataas t'e measurement data. 6e can no t'res'old t'is image at t'e c'osen "alue of 1 to

retrie"e t'e -olts. T'e nuts can -e o-tained - xor,ing t'e original -inar image and t'e -olts

image#nuts = xor(b,bolts)

6e could do t'e same t'ing it' ot'er measurements of t'e o-9ects lie t'e lengt'

$'feret'& t'e si=e of -ounding -o) $'dimension'& or t'e perimeter $'perimeter'&. Tr

t'em out.

 

12