How to draw a line on a image (result of data plotting) and get the data crossed by the line? like a cross section.

조회 수: 4 (최근 30일)
Hello, I know there is a fuction called 'imgprofile' that works for Pixel-value cross-sections along line segments, but this is onli for images (.jpg o .png) . My idea is to do that cross section on an image from a data set. How do you do it?, Thanks.

답변 (1개)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni 2021년 2월 11일
Hi,
if you want to do cross section on images from dataset . You can try writting a for loop in below manner.
OutputFolder = 'C:\Temp'; % Set as needed [EDITED]
dinfo = dir('*.jpg');% image extension can be changed or you can write another outer loop for the list of extensions available in your dataset.
for K = 1 : length(dinfo)
thisimage = dinfo(K).name;
Img = imread(thisimage);
Y = imshow(Img);
improfile(I,x,y),grid on; %x,y can be defined
end
You can also try using imageSet function which returns an object for storing an image data set or a collection of image data sets.
follow the below link for more information on imageset.
hope it helps,
thanks.
  댓글 수: 1
Fercho_Sala
Fercho_Sala 2021년 2월 12일
ok Shiva thanks for the answer, the function 'improfile' works good if your are working on the image a '.jpg .bmp' etc extentions, as a result it gives you the number of pixels your profile is crossing, but in my case I want to work directly with the data set, and cross the profile like a graphic view.

댓글을 달려면 로그인하십시오.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by