Potting Cross-section of an image

12 次查看(过去 30 天)
Hellow..! I have the following image and I want to plot the cross-section of any three bars (elements of any group of USAF resolution chart), but I dont know how to plot it.. can anyone help me please??

回答(1 个)

Bjorn Gustavsson
Bjorn Gustavsson 2020-3-11
First you need to figure out the size of your image - whethre it is an intensity-image or an rgb-image:
imsz = size(img);
Once you know this you need to select row or column to plot
idx_row = 280;
idx_col = 520;
Then were good to start.
subplot(3,3,[1 2 4 5])
imagesc(img)
hold on
plot(idx_col*ones(size(1:imsz(1))),1:imsz(1),'c')
plot(1:imsz(2),idx_row*ones(size(1:imsz(2))),'r')
if numel(imsz) == 3
subplot(3,3,7:8)
rgbplot(squeeze(img(idx_row,:,:)))
subplot(3,3,[3,6])
ph = plot(squeeze(img(:,idx_col,:)),1:imsz(1));
set(ph(1),'color','r')
set(ph(2),'color','g')
set(ph(3),'color','b')
else
subplot(3,3,7:8)
plot(img(idx_row,:))
subplot(3,3,[3,6])
plot(squeeze(img(:,idx_col)),1:imsz(1));
end
From there you can continue with zooming into regions on the row and column-panels as you see fit and then possibly select the corresponding indices and replot only those row or column-parts.
HTH

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by