I have 1D array data, and I need to convert data points used in plot to generate white pixels in a binary image, considering data points(array values) in plot as rows and indexes of an array as respective columns containing white pixels. Attached is mat file of 1D array i need to convert into binary image. Kindly have a look at that.

 채택된 답변

Image Analyst
Image Analyst 2017년 12월 3일

1 개 추천

Try this:
s = load('yo_1.mat')
yo = s.yo
rows = max(yo);
columns = length(yo);
outputImage = false(rows, columns);
for k = 1 : columns
outputImage(yo(k), k) = true;
end
imshow(outputImage);

댓글 수: 2

User_q q
User_q q 2017년 12월 3일
Thanks alot. I tried this but i need white pixels with no gaps, so this plot (in mat file) is my after interpolation result, but after conversion to image it is again giving gaps. How can I fill these. But again thanks for the reply
Image Analyst
Image Analyst 2017년 12월 3일
You can use imline() or polyfit() to draw lines between the dots. See attached demo.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2017년 12월 3일

댓글:

2017년 12월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by