MATLAB Answers

0

DCT example gives me an error when using a different picture

Asked by Yiannis Hadjicharalambous on 8 Dec 2018 at 18:47
Latest activity Commented on by Yiannis Hadjicharalambous on 8 Dec 2018 at 21:09
Hello, I've been trying to compress an image using the DCT example provided here , but when I put my own images it gives me this error:
BLOCKPROC encountered an error while evaluating the user-supplied function handle, FUN.
The cause of the error was:
Error using *
Arguments must be 2-D, or at least one argument must be scalar. Use TIMES (.*) for elementwise multiplication.
Error in ImageCompression>@(block_struct)T*block_struct.data*T'
Error in blockprocFunDispatcher (line 13)
output_block = fun(block_struct);
Error in blockprocInMemory (line 80)
[ul_output fun_nargout] = blockprocFunDispatcher(fun,block_struct,...
Error in blockproc (line 243)
result_image = blockprocInMemory(source,fun,options);
Error in ImageCompression (line 6)
B = blockproc(I,[8 8],dct);

  0 Comments

Sign in to comment.

Products


Release

R2018b

1 Answer

Answer by Walter Roberson
on 8 Dec 2018 at 21:01

You are probably passing in rgb images .
Note that although jpg in theory can handle greyscale images in practice greyscale jpg are very rare and nearly all grey appearing jpg are stored as rgb

  1 Comment

Yeah I'm passing in RGB images. Is there another example that can do image compression with RGB images?

Sign in to comment.