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 views (last 30 days)
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

Accepted Answer

Image Analyst
Image Analyst on 10 Jan 2022
PhaseData is structure. you need the Data field
theImage = PhaseData.Data;
  19 Comments
Sobia Rehman
Sobia Rehman on 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 on 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')

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!