Rotational Cross-Section Average

5 views (last 30 days)
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!

Accepted Answer

Raj Bhakta
Raj Bhakta on 21 Nov 2021
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

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!