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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Denoising and Compression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!