Improfile: Integrating over many pixels
10 ビュー (過去 30 日間)
古いコメントを表示
Tamsin O'Reilly
2019 年 11 月 28 日
コメント済み: Tamsin O'Reilly
2019 年 11 月 29 日
I = imread("1.1.png");
imshow(I);
%180 pixels = 1um
%getting points
[xi,yi] = getpts;
x = [xi(1) xi(2)];
y = [yi(1) yi(2)];
line(x,y,'Color','red','LineStyle','-','LineWidth',2.5);
% newx1 = [ (xi(1)-2) (xi(1)-1) (xi(1)) (xi(1)+1) (xi(1)+2) ];
% newx2 = [ (xi(2)-2) (xi(2)-1) (xi(2)) (xi(2)+1) (xi(2)+2) ];
% newy1 = [ (yi(1)-2) (yi(1)-1) (yi(1)) (yi(1)+1) (yi(1)+2) ];
% newy2 = [ (yi(2)-2) (yi(2)-1) (yi(2)) (yi(2)+1) (yi(2)+2) ];
%
% x = [newx1 newx2];
% y = [newy1 newy2];
% Intensity Profile
[c] = improfile(I, x, y);
figure; improfile(I, x, y);
Hi all,
I am attempting to analyse the intensity profiles of several grayscale images like attached using the improfile function. The intensity levels are very similar in the image leading to noisy profiles that are difficult to extract minima/maxima from. To reduce this noise I want to integrate over several pixels orthogonal to the line drawn. I have attempted to do this manually with no luck, would anyone know how to increase the width of the improfile function?
Many thanks,
Tamsin
0 件のコメント
採用された回答
Image Analyst
2019 年 11 月 28 日
One way would be to make a temporary image using imrotate() where you rotate the line so that it's aligned with rows or columns, then extract several rows or columns and average them.
rotatedImage = imrotate(grayImage, angle);
subImage = rotatedImage(row1:row2, col1:col2);
profile = mean(subimage, 1);
You'll need to figure out the angle and the starting and ending rows and columns, but it's just pure geometry - I'm sure you can do it.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!