필터 지우기
필터 지우기

Improfile: Integrating over many pixels

조회 수: 10 (최근 30일)
Tamsin O'Reilly
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

채택된 답변

Image Analyst
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!

Translated by