Why imerode( ) is not giving intended results ?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
% MATLAB Code used by me , the output of this program is appended at the end % see the two unwanted white pixels in the last row of the eroded image
a=[0 0 0 0 0 0 0;0 1 0 1 0 1 0;0 1 0 1 0 1 0;0 1 0 1 0 1 0;0 1 1 1 1 1 0;0 0 0 1 0 0 0;0 0 0 1 0 0 0;];
b=[0 1;1 0 ];
a1=imdilate(a,b); a2=imerode(a,b); a3=imopen(a,b); a4=imclose(a,b);
subplot(2,3,1);imshow(a),title('Original image'); subplot(2,3,2);imshow(a1),title('Dilated image'); subplot(2,3,3);imshow(a2),title('Eroded image'); subplot(2,3,4);imshow(a3),title('Opened Image'); subplot(2,3,5);imshow(a4),title('Closed image');
0 comentarios
Respuestas (2)
Jeff E
el 18 de Feb. de 2014
Some (all?) morphological functions make assumptions about the value of pixels beyond the border of the image in cases where the processing kernel extends outside the image.
For erosion: Pixels beyond the image border are assigned the maximum value afforded by the data type.
So, you can think of your image as having an infinite field of white pixels beyond its border. If you do not want this default behavior, use the PADARRAY function.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!