i know the scale but when i use imagesc function the image doesnt show me the right size of my spot. what am i doing wrong?

3 Ansichten (letzte 30 Tage)
clear all;
close all;
Scale = 29.4/64; % Pixelscale of the image
[FileName, PathName] = uigetfile({'*.txt','PHASICS Txt File';'*.*', 'All Files (*.*)'},'Pick a file');
PhaseFile = fullfile(PathName,FileName);
PhaseData=importdata(PhaseFile,'\t'); % Read header less tab delimited txt file[Ny, Nx] = size(PhaseData);
[Nx, Ny] = size(PhaseData);
figure
imagesc(PhaseData); % Plot the data

Akzeptierte Antwort

Image Analyst
Image Analyst am 10 Jan. 2022
PhaseData is structure. you need the Data field
theImage = PhaseData.Data;
  19 Kommentare
Sobia Rehman
Sobia Rehman am 16 Feb. 2022
Finally I have got this using this code
clear all;
close all;
%nBulk = 1.4536;
Scale = 29.4/64; % Pixelscale of the image
[FileName, PathName] = uigetfile({'*.txt','PHASICS Txt File';'*.*', 'All Files (*.*)'},'Pick a file');
PhaseFile = fullfile(PathName,FileName);
PhaseData=importdata(PhaseFile,'\t'); % Read header less tab delimited txt file[Ny, Nx] = size(PhaseData);
[Nx, Ny] = size(PhaseData);
XData = [0, Nx] * Scale;
YData = [0, Ny] * Scale;
imagesc(XData, YData, PhaseData);
This shows me the picture now in real life units.
Thanks heaps for your help.
Image Analyst
Image Analyst am 16 Feb. 2022
You must have floating point image outside the range of 0-1. So try it this way:
XData = [0, Nx] * Scale;
YData = [0, Ny] * Scale;
imshow(PhaseData, [], 'XData', XData, 'YData', YData);
axis('on', 'image')

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by