I tried to apply 'emd' function on image to get output image with IMFs selected. But got stuck at the errors. Thanks in Advance.
조회 수: 4 (최근 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!