Error with Blkproc.m

I am getting error as follows how to solve it?
??? Subscripted assignment dimension mismatch.
Error in ==> blkproc at 89 aa(border(1)+(1:ma),border(2)+(1:na)) = a;
Error in ==> func_DCTJPEG at 35 Coef=blkproc(ImageSub,[8,8],'dct2(OriginalImage)');

回答 (2 件)

Lokesh Ravindranathan
Lokesh Ravindranathan 2013 年 7 月 23 日

0 投票

This solution http://www.mathworks.com/support/solutions/en/data/1-FA7L9M/?solution=1-FA7L9M explains the reason for the error message. In short, you are trying to execute something which shouldn't be allowed.
Jan
Jan 2013 年 7 月 23 日

0 投票

Check your code again:
Coef = blkproc(ImageSub, [8,8], 'dct2(OriginalImage)');
The provided function is a string, but blkproc expects a function handle. How could Matlab know, what "OriginalImage" is?
Please post the relevant part of the code to allow a more explicit help.

6 件のコメント

Pooja
Pooja 2013 年 7 月 23 日
if true
% x=imread('H:\lena.bmp');
figure(1);
subplot(121);
imshow(x);
Y=jpegencode(x,5);
X=jpegdecode(Y);
subplot(122);
imshow(X);
end
% code for Y=jpegencode(x,5);
if true
% function y=jpegencode(x,quality)
error(nargchk(1,2,nargin));
if nargin<2
quality=1;
end
x=double(x)-128;
[xm,xn]=size(x);
t=dctmtx(8);
y=blkproc(x,[8 8],'P1*x*P2',t,t');
end
I am getting error as
??? Subscripted assignment dimension mismatch.
Error in ==> blkproc at 89 aa(border(1)+(1:ma),border(2)+(1:na)) = a;
Error in ==> jpegencode at 9 y=blkproc(x,[8 8],'P1*x*P2',t,t');
Error in ==> jpeg at 6 Y=jpegencode(x,5);
blkproc.m used from inbuilt function.
Jan
Jan 2013 年 7 月 23 日
編集済み: Jan 2013 年 7 月 26 日
It looks strange: Your original question contained the string 'dct2(OriginalImage)' inside the blkproc call. I've explained, that you cannot provide the function as a string. The new code you post contains a new string 'P1*x*P2'. So there is still the same problem, but the code differs in exactly the point, which causes the error.
What do you think should 'P1*x*P2' do? What is P1, x and P2? Why do you use a string here as input for blkproc?
Pooja
Pooja 2013 年 7 月 26 日
Ok sir,P1 and P2 are there in the inbuilt functions of blocproc.Then what should i give instead of the string ?
Jan
Jan 2013 年 7 月 26 日
@Pooja: I do not understand what the string should achieve. I cannot find a corresponding explanation if the help text. In consequence I cannot suggest an alternative.
Pooja
Pooja 2013 年 7 月 27 日
Its for jpeg compression.I am also getting an error of using too many o/p arguments for another program.How to rectify that error?
Jan
Jan 2013 年 7 月 27 日
@Pooja: Even knowing the general purpose doe not allow to suggest a specific function.
Please open a new thread for a new question. Add the concerned code there and post a copy of the complete error message.

サインインしてコメントする。

カテゴリ

タグ

質問済み:

2013 年 7 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by