Potting Cross-section of an image

조회 수: 12 (최근 30일)
Aqiba Hafeez
Aqiba Hafeez 2020년 3월 11일
답변: Bjorn Gustavsson 2020년 3월 11일
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