Remove unwanted area of image ?

조회 수: 2 (최근 30일)
Jenifer NG
Jenifer NG 2022년 10월 6일
댓글: Jenifer NG 2022년 10월 14일
Hi Everyone,
I want to remove unwanted area of an image by apply image processing. But i stuck to remove area after thresholding.
Could anyone help ?
Bellow is my step.
Img = imread('image.png')
img = im2gray(img)
img = img<150
imshow(img)
Thanks and Regards!
Han

채택된 답변

Matt J
Matt J 2022년 10월 6일
A=im2gray(imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1147135/image.png'));
A(205:260,:)=[];
imshow(A)
  댓글 수: 5
Matt J
Matt J 2022년 10월 6일
Did you try it? It worked for me.
Jenifer NG
Jenifer NG 2022년 10월 6일
Oh it work for me also.
I used wrong image
Thanks you

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Taru
Taru 2022년 10월 7일
Hi,
Try the below code, it performs image matrix manipulation to get the required output.
img=imread('image.png');
im2=img>150;
sz=size(img)
row=sz(1,1);
col=sz(1,2);
psz=0;
for i=1:row
if im2(i,:)==im2(1,:)
psz=psz+1;
end
end
patchsize=psz;
nimg=[img(1:sz/2-patchsize,:);img(1:patchsize,:);img(sz/2+patchsize:end,:)];
imshow(nimg)
  댓글 수: 3
Image Analyst
Image Analyst 2022년 10월 13일
Try this:
grayImage = imread('boxes.png');
subplot(2, 2, 1);
imshow(grayImage, []);
impixelinfo;
% Get mask
mask = grayImage > 143;
% Get rid of stripe
mask = imclearborder(mask);
% Enlarge by one layer
mask = imdilate(mask, true(3));
subplot(2, 2, 2);
imshow(mask, []);
impixelinfo;
% Fill in the mask regions in the original image.
grayImage(mask) = 0;
grayImage = regionfill(grayImage, mask);
subplot(2, 2, 3);
imshow(grayImage, []);
impixelinfo;
Jenifer NG
Jenifer NG 2022년 10월 14일
Thanks you so much!
I got it

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by