How to find intensity profile of multiple lines in an image?

7 vues (au cours des 30 derniers jours)
Warid Islam
Warid Islam le 1 Août 2019
Commenté : Warid Islam le 1 Août 2019
I have an image on which I want to find the intensity profiles of 50 lines along the vertical direction. Below is my code and the result.
I = imread('Intensity1.jpg');
x=[size(I,2)/2 size(I,2)/2];
y=[0 size(I,1)];
n = 50;
c = improfile(I,x,y,n);
figure
subplot(2,1,1)
imshow(I)
hold on
plot(x,y,'r')
subplot(2,1,2)
plot(c(:,1,1),'r')
hold on
plot(c(:,1,2),'g')
plot(c(:,1,3),'b')
U.jpg
The graph above probably shows the intensity profile of 50 points along the same vertical direction. Whereas I want to find the intensity profiles of 50 equally spaced vertical lines of the image above. Any help would be appreciated.
  2 commentaires
Walter Roberson
Walter Roberson le 1 Août 2019
improfile() internally does an interp2() along each of the color panes independently. You can do the same thing to evaluate all of the values at once.
I would suggest that for your purposes it would probably be good enough to
whichcols = round(linspace(1,size(I,2),50+1));
profiles = I(:, whichcols(1:end-1), :);
adjust the 50+1 and the 1:end-1 depending upon whether you want the "equally spaced to exactly start at the first and exactly end at the last, or if instead you want to divide into 50 bands that have the same amount of image to their "right".
Warid Islam
Warid Islam le 1 Août 2019
Hi Walter,
Thank you very much for the suggestion.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by