How to resolve the error : Subscribed assignment dimension mismatch

2 次查看(过去 30 天)
I am trying to run a code of DWT of an image. The code is given below:
tic
clc
[File_Name, Path_Name] = uigetfile('*.jpg;*.bmp;*.gif;*.png', 'Pick an Image File');
I = imread([Path_Name,File_Name]);
input_image=imnoise(I,'speckle',.01);
figure;
imshow(input_image);
%I=imread('Forged.jpg');
%Red Component of Colour Image
Red_Input_Image=I(:,:,1);
%Green Component of Colour Image
Green_Input_Image=I(:,:,2);
%Blue Component of Colour Image
Blue_Input_Image=I(:,:,3);
%Apply Two Dimensional Discrete Wavelet Transform
[LLr,LHr,HLr,HHr]=dwt2(Red_Input_Image,'haar');
[LLg,LHg,HLg,HHg]=dwt2(Green_Input_Image,'haar');
[LLb,LHb,HLb,HHb]=dwt2(Blue_Input_Image,'haar');
%First_Level_Decomposition(:,:,1)=repmat([LLr,LHr;HLr,HHr]);
First_Level_Decomposition(:,:,1)=[LLr,LHr;HLr,HHr];
First_Level_Decomposition(:,:,2)=[LLg,LHg;HLg,HHg];
First_Level_Decomposition(:,:,3)=[LLb,LHb;HLb,HHb];
First_Level_Decomposition=uint8(First_Level_Decomposition);
%Display Image
figure,subplot(1,2,1);imshow(I);title('Originalimage');
subplot(1,2,2);imshow(First_Level_Decomposition);title('Decomposition');
toc;
The above code runs for some images, while gives the following error on other images.:
Subscribed assignment dimension mismatch.
Error in DWT (line 24)
First_Level_Decomposition(:,:,1)=[LLr,LHr;HLr,HHr];
One image is also attached on which it gave this error. Please suggest the solution

回答(1 个)

Walter Roberson
Walter Roberson 2015-6-22
You do not resize the images to a common size, so your code would fail if your images are not all exactly the same size.

类别

Help CenterFile Exchange 中查找有关 Discrete Multiresolution Analysis 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by