Why imerode( ) is not giving intended results ?
조회 수: 4 (최근 30일)
이전 댓글 표시
% 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
답변 (2개)
Jeff E
2014년 2월 18일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!