Store improfile data issue

3 次查看(过去 30 天)
dan kin
dan kin 2013-9-13
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)

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by