how to perform integerr to integer wavelet transform on a image

조회 수: 15 (최근 30일)
Obuli Yuvaraj
Obuli Yuvaraj 2013년 4월 2일
댓글: alisha ahmad 2017년 11월 17일
I have followed the steps in the lwr2 page of documentation but i hace error
My image size is 512 x 512
j=imread('F:\MAT WORK\COVER OBJECT\cranial scan.jpg');
>> haarint=liftwave('haar','int2int');
>> [cA cH cV cD]=lwt2(j,haarint);
??? Error using ==> plus
Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> lsupdate at 43 y = y + t(:,1:sx(2),:);
Error in ==> lwt2 at 106 case 'd' , H = H + lsupdate('r',L,liftFILT,DF,sH,LStype);

채택된 답변

HyperionZhou
HyperionZhou 2017년 3월 15일
편집: HyperionZhou 2017년 3월 15일
Hi! I met the same problem. I found that data in image is uint8. And when we process lwt2, data must be double. Also, ' plus Integers can only be combined with integers of the same class, or scalar doubles.' shows that the problem lies in the type of data. So you just need to add these code:
j = double(j); [cA cH cV cD]=lwt2(j,haarint);
Also, cA, cH, cV, and cD are double. If you need process them in unsigned int, add this code:
cA = uint8(cA);
uint8() and double() won't change the data's value. However, if you try to use im2double, you will find that it changes. I am not sure about the reason, but I guess it just change the way to read the data instead keeping the value.
  댓글 수: 1
alisha ahmad
alisha ahmad 2017년 11월 17일
Dear HyperionZhou ! Thankyou so much for providing such a good explanation.It worked.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Wayne King
Wayne King 2013년 4월 2일
You should tell us more about your image. What is it's size and class?
Does the following work for you? It should.
liftscheme = liftwave('haar','int2int');
imdata = imread('ngc6543a.jpg');
[cA cH cV cD]=lwt2(imdata,liftscheme);
  댓글 수: 3
Obuli Yuvaraj
Obuli Yuvaraj 2013년 4월 2일
I'm sorry Wayne
Your answer again provides the same bug
??? Error using ==> plus Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> lsupdate at 43 y = y + t(:,1:sx(2),:);
Error in ==> lwt2 at 106 case 'd' , H = H + lsupdate('r',L,liftFILT,DF,sH,LStype);
Inference: I don't understand what is cell type and whether it is of standard 3 x 3 array
My Objective: Transform the 512 x 512 medical image of uint8 class using the DWT (dwt2 matlab command). this results in double type co-efficients.But the images gets degraded after the transformation.In orrder to get the co-efficients in integer form i ought to use Integer wavelet transform.
Please do clarify...!
Walter Roberson
Walter Roberson 2013년 4월 8일
Please show
class(imdata)
class(liftscheme)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by