How to remove the extra unwanted white pixels from an image.

조회 수: 5 (최근 30일)
kanika bhalla
kanika bhalla 2021년 6월 26일
답변: kanika bhalla 2021년 6월 26일
I want to automatically remove the marked white pixels in attached Figure named as Picture 2. I have also attached an original image with name Picture1. Can anyone please help me in this. I will be very Thank Full to you.

채택된 답변

Image Analyst
Image Analyst 2021년 6월 26일
What is it that defines those pixels? How about if you just picked some column, and erased from there to the center of the image, like
[rows, columns, numberOfColorChannels] = size(binaryImage)
binaryImage(:, 50 : round(columns/2), :) = 0;
I don't know if you just want to pick 50 or some other value, basically manually by turning the axis tick marks on and looking at them, or if you can explain somehow how that column could be automatically chosen.
  댓글 수: 2
kanika bhalla
kanika bhalla 2021년 6월 26일
편집: kanika bhalla 2021년 6월 26일
Thank you so much for your answer @Image Analyst.
Answering your first question. Those are extra white pixels which are required to remove for my further process. I have basically thresholded an image from colored image. But I want to remove those pixels.
Answering your second question. It is really a good idea to remove pixels by selecting column. And I have tried your answer. For trial i have maually checked the column as shown in attached figure by using data cursor tool. But I observed that the code provided by you has no effect on the binary image. Result is same as before.
Could you please guide me where i went wrong.
[rows, columns, numberOfColorChannels] = size(binaryImage)
binaryImage(:, 50 : round(28/2), :) = 0; % I have put 28 because i want to make pixels from 28th column to zero.
Image Analyst
Image Analyst 2021년 6월 26일
You went from column 50 to column 28, which means no columns were chosen. You really need to take this 2 hour course to learn how indexing is done:
What you should have done is
[rows, columns, numberOfColorChannels] = size(binaryImage)
% Erase from column 28 to middle of the image.
binaryImage(:, 28 : round(columns/2), :) = 0;

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

추가 답변 (1개)

kanika bhalla
kanika bhalla 2021년 6월 26일
Thank you so much Sir @Image Analyst. This was so exact.
And thank you so much for providing me MATLAB Academy link. This would be really helpful in my research and I am going through this. I hope to learn more and more from you everyday.
I will be forever grateful to you.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by