Image Processing Toolbox - Texture Segmentation Using Texture Filters Demo - MathWorks India
India Accelerating the pace of engineering and science Create Account Log In Contact Us Store
Solutions
Academ ia
Support
Events
Com pany
Share
Contents
Step 1: Read Image Step 2: Create Texture Image Step 3: Create Rough Mask for the Bottom Texture Step 4: Use Rough Mask to Segment the Top Texture Step 5: Display Segmentation Results Using Other Texture Filters in Segmentation
E=e n t r o p y f i l t ( I ) ;
Use m a t 2 g r a yto rescale the texture image Eso that its values are in the default range for a double image.
E i m=m a t 2 g r a y ( E ) ; i m s h o w ( E i m ) ;
www.mathworks.in/products/image/examples.html?file=/products/demos/shipping/images/ipextexturefilter.html#1
1/8
3/18/13
Image Processing Toolbox - Texture Segmentation Using Texture Filters Demo - MathWorks India
B W 1=i m 2 b w ( E i m ,. 8 ) ;
i m s h o w ( B W 1 ) ; f i g u r e ,i m s h o w ( I ) ;
The segmented objects in the binary image B W 1are white. If you compare B W 1to I , you notice the top texture is overly
www.mathworks.in/products/image/examples.html?file=/products/demos/shipping/images/ipextexturefilter.html#1
2/8
3/18/13
texture using b w a r e a o p e n .
Image Processing Toolbox - Texture Segmentation Using Texture Filters Demo - MathWorks India
segmented (multiple white objects) and the bottom texture is segmented almost in its entirety. You can extract the bottom
B W a o=b w a r e a o p e n ( B W 1 , 2 0 0 0 ) ; i m s h o w ( B W a o ) ;
Use i m c l o s eto smooth the edges and to close any open holes in the object in B W a o . A 9-by-9 neighborhood is selected because this neighborhood was also used by e n t r o p y f i l t .
n h o o d=t r u e ( 9 ) ; c l o s e B W a o=i m c l o s e ( B W a o , n h o o d ) ; i m s h o w ( c l o s e B W a o )
i m s h o w ( r o u g h M a s k ) ; f i g u r e ,i m s h o w ( I ) ;
www.mathworks.in/products/image/examples.html?file=/products/demos/shipping/images/ipextexturefilter.html#1
3/8
3/18/13
Image Processing Toolbox - Texture Segmentation Using Texture Filters Demo - MathWorks India
I 2=I ; I 2 ( r o u g h M a s k )=0 ; i m s h o w ( I 2 ) ;
E 2=e n t r o p y f i l t ( I 2 ) ; E 2 i m=m a t 2 g r a y ( E 2 ) ; i m s h o w ( E 2 i m ) ;
www.mathworks.in/products/image/examples.html?file=/products/demos/shipping/images/ipextexturefilter.html#1
4/8
3/18/13
Image Processing Toolbox - Texture Segmentation Using Texture Filters Demo - MathWorks India
Threshold E 2 i musing g r a y t h r e s h .
B W 2=i m 2 b w ( E 2 i m , g r a y t h r e s h ( E 2 i m ) ) ;
i m s h o w ( B W 2 ) f i g u r e ,i m s h o w ( I ) ;
If you compare B W 2to I , you notice there are two objects segmented in B W 2 . Use b w a r e a o p e nto get a mask for the top texture.
www.mathworks.in/products/image/examples.html?file=/products/demos/shipping/images/ipextexturefilter.html#1
5/8
3/18/13
Image Processing Toolbox - Texture Segmentation Using Texture Filters Demo - MathWorks India
m a s k 2=b w a r e a o p e n ( B W 2 , 1 0 0 0 ) ; i m s h o w ( m a s k 2 ) ;
i m s h o w ( t e x t u r e 1 ) ; f i g u r e ,i m s h o w ( t e x t u r e 2 ) ;
www.mathworks.in/products/image/examples.html?file=/products/demos/shipping/images/ipextexturefilter.html#1
6/8
3/18/13
Image Processing Toolbox - Texture Segmentation Using Texture Filters Demo - MathWorks India
S=s t d f i l t ( I , n h o o d ) ; i m s h o w ( m a t 2 g r a y ( S ) ) ;
www.mathworks.in/products/image/examples.html?file=/products/demos/shipping/images/ipextexturefilter.html#1
7/8
3/18/13
Image Processing Toolbox - Texture Segmentation Using Texture Filters Demo - MathWorks India
R=r a n g e f i l t ( I , o n e s ( 5 ) ) ; i m s h o w ( R ) ;
Site Help
Patents
Trademarks
Privacy Policy
www.mathworks.in/products/image/examples.html?file=/products/demos/shipping/images/ipextexturefilter.html#1
8/8