Potting Cross-section of an image

4 Ansichten (letzte 30 Tage)
Aqiba Hafeez
Aqiba Hafeez am 11 Mär. 2020
Beantwortet: Bjorn Gustavsson am 11 Mär. 2020
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??

Antworten (1)

Bjorn Gustavsson
Bjorn Gustavsson am 11 Mär. 2020
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

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by