[python] 11.1
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- '''
- Učitati sliku figura.tif. Nad slikom primeniti morfološke operacije dilatacije i erozije sa strukturnim elementom kvadratnog oblika veličine 15x15.
- '''
- import plotly.express as px
- from skimage import io
- img = io.imread('figura.tif')
- fig = px.imshow(img, color_continuous_scale='gray')
- fig.show(config={'modeBarButtonsToAdd':['drawline',
- 'drawopenpath',
- 'drawrect',
- 'eraseshape']}
- from skimage import morphology
- se = morphology.square(15)
- fig = px.imshow(se, zmin=0, color_continuous_scale='gray')
- fig.show()
- '''
- DILATACIJA
- Dilatacija je morfološka operacija kod koje se strukturni element koristi za proširenje objekata u slici.
- Za dilataciju se koristi funkcija skimage.morphology.dilation. Funkcija prima parametar slike koja se obrađuje i parametar
- selem koji definiše strukturni element koji se koristi.
- Znak za dilataciju se predstavlja kao +
- '''
- img_dil = morphology.dilation(img,selem=se)
- fig = px.imshow(img_dil, color_continuous_scale='gray')
- fig.show(config={'modeBarButtonsToAdd':['drawline',
- 'drawopenpath',
- 'drawrect',
- 'eraseshape']})
- '''
- EROZIJA
- Erozija je morfološka operacija koja se upotrebljava za sužavanje objekata.
- Erozija slike implementirana je funkcijom skimage.morphology.erosion.
- Znak za eroziju se predstavlja kao -
- '''
- img_erode = morphology.erosion(img,se)
- fig = px.imshow(img_erode, color_continuous_scale='gray')
- fig.show(config={'modeBarButtonsToAdd':['drawline',
- 'drawopenpath',
- 'drawrect',
- 'eraseshape']})
Editor
You can edit this paste and save as new: