Importing pixel array in Excel and creating an image

7 Ansichten (letzte 30 Tage)
Johoon Kim
Johoon Kim am 9 Nov. 2018
Kommentiert: Johoon Kim am 10 Nov. 2018
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 Kommentare
Caglar
Caglar am 9 Nov. 2018
can you post your excel file?
Johoon Kim
Johoon Kim am 9 Nov. 2018
Sorry for the lack of detail in my original question. Please see attached. It is a 128 x 100 matrix.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 9 Nov. 2018
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 Kommentare
Image Analyst
Image Analyst am 9 Nov. 2018
Bearbeitet: Image Analyst am 9 Nov. 2018
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.
Johoon Kim
Johoon Kim am 10 Nov. 2018
Got it. Thank you again!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by