Can someone helt me to figure this one out?
I have an grayscale image of concentric bright rings agains black. Using
A=double(imread('2H-CAR-C6_05.tif'));
[x,y]=meshgrid(1:size(A,1), 1:size(A,2));
result=[x(:),y(:),A(:)];
I can read convert the brightness to a z coordinate (the units of the coordinate system dont matter too much currently).
What I'd like to do now is to get an average cross section of the 3d image. Basically:
  1. Get cross section through the middle of the image
  2. Store values of that cross section
  3. Rotate the cross section around the center of the image by an angle (say 1 degree)
  4. Add these values to the values before
  5. Loop until 360° and then either show sum or average of this
As a bonus would be to ignore values outside a certain z-range :)
Ideas? Any help is greatly appreciated!

 채택된 답변

Raj Bhakta
Raj Bhakta 2021년 11월 21일

1 개 추천

Hi Michel,
If I understand correctly, you want the average value of a "slice" ( a single row) for the z coordinate. If so, we can use the original image itself to get this value, using:
averageValue = A(size(A,1)/2,:);
This gives us a single value along the middle of the image. Then, rotate the image 1 degree by using imrotate
rotatedImg = imrotate(A,1);
The imrotate function changes the image size to preserve the rotation and fills in the image with black pixels where it needs padding. In your averaging function, you can ignore these by only averaging over the pixels that have a value greater than 0.
middleRow = rotatedImg(size(rotatedImd,1)/2,:)>0;
averageValue = mean(middleRow);
Hope this helps!
-Raj

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2021년 11월 17일

댓글:

2021년 11월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by