Clear Filters
Clear Filters

How to resolve the error : Subscribed assignment dimension mismatch

2 views (last 30 days)
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

Answers (1)

Walter Roberson
Walter Roberson on 22 Jun 2015
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.

Categories

Find more on Discrete Multiresolution Analysis in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!