Image fft2 metric?

7 views (last 30 days)
Dan Griffiths
Dan Griffiths on 17 Jan 2023
Answered: Image Analyst on 3 Feb 2023
Hi!
I would like to analyze microscope images of cells to assess alignment of cells. I wrote a simple script to get the fft2 of an image and can plot the result, but I need to find a way to reduce the plot to a single number that represents the cell alignment of the fft2 plot. Idealy, the fft2 of the Clouds image would produce a value of zero or close to zero and the fft2 of the Fibers image would produce a value of 1 or close to 1. I feel like there has to be a way to measure/describe the pattern observed in the fft2 image, but I have no idea where to look or what to search. Any ideas?
My simplified code:
I=imread('MyImage.png');
G=rgb2gray(I);
F=fft2(double(G));
S=fftshift(F);
L=log2(S);
A=abs(L);
imagesc(A)
My representative images, random clouds (top) and fibers (bottom)... raw images on the left and fft2 on the right.
Any help is greatly appreciated!
Thanks,
Dan
  2 Comments
Kartikay Sapra
Kartikay Sapra on 18 Jan 2023
It looks like a binary classification problem. You will have to use a classification algorithm(Logistic Regression most likely) and train the model over your dataset(i.e preprocessing images to get the fft2 output). Moreover, the task is to create a training set where ground truth (fibres OR clouds) must exist. It may require manual labelling for some images.
Dan Griffiths
Dan Griffiths on 30 Jan 2023
Sorry for the delay... I was hoping there was a way to get an alignment statistic out of the fft2 function but eventually settled on the linear regression of the fft2... my code works... thanks for your input!

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 3 Feb 2023
You can use the attached algorithm to find the orientation of the pixels.

More Answers (1)

Daksh
Daksh on 3 Feb 2023
I understand that you want to "classify" an image dataset consisting of clouds and fibers to either "0" or "1" labels based on the fft2 output plot produced by images.
To my understanding, this is a Binary Classification problem consisting of a shuffled dataset of fft2 images of both clouds and fibers, and the goal is to train a Machine Learning / Deep Learning algorithm that can learn representations for both clouds and fibers into a model, which can be used to classify and predict the label of unseen new fft2 images for clouds and fibers.
The process will include the following steps:
  • Curating a small but sufficiently-varying dataset of fft2 image metrics of both clouds and fibres images. Note that you can either choose the fft2 matrix metric (described as "A" variable for an image in your code), or the fft2 image itself
  • Labelling the dataset with labels "0" and "1" for clouds and fibers respectively, splitting the same into training and testing sets
  • Preprocessing the matrix metric / image for data standardization and normalization
  • Fitting a Machine Learning / Deep Learning binary classification model and training it sufficiently to effectively learn data representations
  • Testing the model out on testing dataset
Kindly refer to the following links for more insight into the algorithm for the same:
Hope it helps!
  1 Comment
Dan Griffiths
Dan Griffiths on 3 Feb 2023
I'm sorry, I didn't explain my problem well. I don't want to classify images as binary with values of "0" or "1" but rather score images on a gradient between the values of "0" and "1". When I posted the question, I thought that there was a way to meaasure the alignment of the fft2 of an image... it looks like this isn't a thing and the best way to do it is to do a linear regression on the fft2 data. This seems to work okay, but it is difficult compare across sections. I think I need to take quick step back to explain... I'm trying to find the alignment of cells in a 20um coronal rodent brain section (~20,000 x ~30,000 pixels). I break the image up into subimages that I then process to find cell alignment in that area to assess if that area contains "healthy" or "injured" tissue. The method above works well on individual brain sections, but I have had trouble standardizing the color values between images. I'm open to an improved method to assess alignment...

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!