I tried to apply 'emd' function on image to get output image with IMFs selected. But got stuck at the errors. Thanks in Advance.
3 次查看(过去 30 天)
显示 更早的评论
Applied EMD function to image and tried to get first Two IMFs and reconstruct the image with them. But got error in reshape step. Thanks in Advance if i solution in this.
%% Calculate First 2 IMFs from Image by 'emd' and reconstruct the image
clc
clear all
close all
% Test on 03.05.2023
% Read the image
img = imread('D:\Search Works\356-inputs.png');
% Convert the image to grayscale
img_gray = rgb2gray(img);
img_grey = im2double(img_gray);
% Reshape image into a 1D vector
img_vec = img_grey(:);
% Perform EMD
imf = emd(img_vec);
% Take only first two IMFs
imf = imf(1:2,:);
% Reshape the IMFs back into a 2D matrix
imf_mat = permute(imf, [2 1]);
imf_mat = reshape(imf_mat, [size(img_grey), size(imf,1)]);
% Display the first two IMFs
subplot(1,3,1), imshow(img_gray), title('Original Image');
subplot(1,3,2), imshow(imf_mat(:,:,1)), title('IMF 1');
subplot(1,3,3), imshow(imf_mat(:,:,2)), title('IMF 2');
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Denoising and Compression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!