Importing pixel array in Excel and creating an image

Hello everyone,
A MATLAB beginner here. I would like to ask a quick question. I believe this is simple for a lot of you folks. I have an image in the form of pixel array in Excel sheet. I wish to create an image from this and also be able to set a certain threshold so that the numerical values of any pixels that do not meet the threshold become zero.
I really really appreciate everyone's help in advance!

댓글 수: 2

can you post your excel file?
Sorry for the lack of detail in my original question. Please see attached. It is a 128 x 100 matrix.

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

 채택된 답변

Image Analyst
Image Analyst 2018년 11월 9일
Try this:
data = importdata('AuL_1.csv', ',', 5);
grayImage = data.data;
subplot(2, 2, 1);
imshow(imadjust(grayImage), []);
subplot(2, 2, 2);
histogram(grayImage);
grid on;
threshold = 4;
mask = grayImage < threshold;
% Erase mask pixels.
grayImage(mask) = 0;
subplot(2, 2, 3);
imshow(imadjust(grayImage), []);

댓글 수: 4

This is exactly what I needed! Thank you!
Actually one more thing... Is it possible to assign a color of different shades to the white pixels depending on its intensity value? e.g. brighter yellow to pixels that originally had value of 4, a darker shade to 5, an even darker shade to 6, and so on.
Thank you so much in advance!
Image Analyst
Image Analyst 2018년 11월 9일
편집: Image Analyst 2018년 11월 9일
Yes, just use ind2rgb() to create an RGB image. Or you can keep it grayscale and just use colormap() to change the way it's displayed.
Got it. Thank you again!

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

추가 답변 (0개)

카테고리

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

제품

릴리스

R2017b

질문:

2018년 11월 9일

댓글:

2018년 11월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by