Reconstructing the image from specific number of coefficicents

Hi there!
Alright, so I've been working on this little piece of code to construct an image using specific coefficicents and there's this error I'm getting:
Subscripted assignment dimension mismatch.
So the code goes this way:
j0=128;
M = 2^(-j0);
m=sqrt(M);
I = imread('lena.png');
J = perform_wavelet_transf(I,j0,+1);
n = size(I,1);
J1 = zeros(n);
J1(1:n/4,1:n/4) = J(1:m,1:m);
result = perform_wavelet_transf(J1,j0,-1);
imshow(result,[]);
I'm getting the error at this line: J1(1:n/4,1:n/4) = J(1:m,1:m);
What do you think?
And yes, Thanks alot!!! for your help in advance :)

2 件のコメント

Amit
Amit 2014 年 1 月 19 日
attach the image please
Amit
Amit 2014 年 1 月 19 日
I meant, can you upload lena.png here. That way I can test it.

回答 (1 件)

Amit
Amit 2014 年 1 月 19 日

0 投票

One thing I see first is that M = 2^(-128) = 2.93e-39 and thus m = 5.42e-20 m is not an integer, thus J(1:m,1:m) would not work and give you atleast one error.

8 件のコメント

Ayesha
Ayesha 2014 年 1 月 19 日
I tried setting j0 to zero but its still not giving the proper result.
Amit
Amit 2014 年 1 月 19 日
To make this work, m should be equal to n/4.
when you are J1(1:n/4,1:n/4) = J(1:m,1:m), you are copying an mxm matrix to a n/4xn/4 matrix. That would be only possible if m = n/4.
Ayesha
Ayesha 2014 年 1 月 19 日
you mean the size because I've been wondering if there's any point of equalizing both the terms and then copy one's matrix onto the other. What do you think?
Amit
Amit 2014 年 1 月 19 日
I dont have the image lena on my matlab.
The problem is when you define j0 = 0, m will become 1. That means J(1:m,1:m) is an scalar.
Given n/4 is an positive integer (you need to make sure that), J1(1:n/4,1:n/4) = J(1:m,1:m); will store J(1:m,1:m) scalar in all n/4xn/4 matrix in J1. I am quite certain this is not what you're looking for. I think somewhere in your algorithm (code), something is missing.
Amit
Amit 2014 年 1 月 19 日
Also attach the perform_wavelet_transf function. This is not a inbuilt function in matlab.
Amit
Amit 2014 年 1 月 19 日
perform_wavelet_trasf has many dependencies which you did not posted.
I am sorry, this is just frustrating.
Amit
Amit 2014 年 1 月 19 日
its alright. In a nut shell, I think there is a problem at M = 2^(-j0) which you use to define m = sqrt(M).
Please double check the algorithm that you must be following that this is the correct way to do this.
Ayesha
Ayesha 2014 年 1 月 19 日
I've been doing the same since long. Anyways, Thanks.

この質問は閉じられています。

質問済み:

2014 年 1 月 19 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by