Code for Tchebichef Moments of an RGB image

2 次查看(过去 30 天)
Hello All,
I need help in obtaining the Tchebichef moments of the RGB image (Brain MRI Image). I am new to this field and have to do this for my project, I went through papers but was not able to get the exact concept. Can some explain me how I can get the Moments, and how can it be used for analysis.

回答(1 个)

Hari
Hari 2023-10-27
编辑:Hari 2023-10-27
Hi Ankitha,
I understand that you want to calculate “Tchebichef” moments for an RGB image to do further analysis.
To calculate “Tchebichef” moments for an RGB image, you can follow these steps:
  1. Convert the RGB image to grayscale using the “rgb2gray” function.
% Read the RGB image
rgbImage = imread('sample_image.jpg');
% Convert RGB image to grayscale
grayImage = rgb2gray(rgbImage);
2. Iterate over the indices of the converted image (here p and q) to calculate each moment using the Chebyshev polynomial.
% Calculate Tchebichef moments
[M, N] = size(grayImage); % Get image dimensions
moments = zeros(1, min(M, N));
for p = 0:min(M, N)-1
for q = 0:min(M, N)-1
moments(p+1, q+1) = sum(sum(double(grayImage) .* cos(p * acos((0:M-1)'/(M-1))) .* cos(q * acos((0:N-1)/(N-1))))) / (M*N);
end
end
% Example: Print the first 5 moments
disp(moments(1:5));
3. After obtaining the “Tchebichef” moments, you can use them for further analysis or feature extraction in various ways. Here are some MATLAB functions that you can use for analysis:
  • “pdist”: This function can be used to calculate pairwise distances between moment vectors. It is useful for measuring the similarity or dissimilarity between images based on their moment values.
  • “corrcoef”: This function computes the correlation coefficient between moment vectors. It can be used to quantify the linear relationship between different moments and identify patterns or dependencies.
  • ”svd”: Singular Value Decomposition (SVD) can be used to analyse the structure and significance of moment matrices. It can help identify dominant modes or patterns in the moments.
Here is the output observed when I have used default “cameraman” image in MATLAB. Make sure to replace 'sample_image.jpg' with the actual file name and extension of your sample image.
First 5 moments:
118.7245 52.9128 -50.0990 -55.9984 9.6036
Refer to the following documentation links for more information on “rgb2gray” function and “Chebyshev Polynomials”:
Refer to the following documentation links to understand the usage of “pdist”, “corrcoef”, and “svd” for analysis:
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 MRI 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by