Store improfile data issue

2 views (last 30 days)
dan kin
dan kin on 13 Sep 2013
Hi,
I am using the code below to get the intensity profile plot data (Typically zero is taken to be black, and 255 is taken to be white) and I have a a problem that I will appreciate the help:
- The improfile plotted on the image is a mirror of the the data stored intensitySet (I wish my stored profile to start from left to right). Therefore, why and how can it be fixed?
Thanks
Code:
clc;
clear;
I = imread('liftingbody.png');
xline = [100, 300];
yline = [300, 300];
% line([x1,x2],[y1,y2]), not line([x1,y1],[x2,y2]);
imshow(I)
hold on;
line(xline,yline)
improfile(I,xline, yline);
[cx,cy,YofIntensity]=improfile(I,xline, yline);
Xindex = zeros(size(YofIntensity), 1, 'double')
for i=1:size(YofIntensity)
Xindex(i)=i;
end
intensitySet = horzcat(Xindex, YofIntensity)
figure(2);
plot(Xindex, YofIntensity)

Answers (1)

Image Analyst
Image Analyst on 13 Sep 2013
Set the ydir property of the axes to 'normal' or 'reverse' to flip the plot of the data:
set(gca,'YDir','reverse')

Tags

Community Treasure Hunt

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

Start Hunting!