I am finding the following error while running this code in MATLAB R2021a. Please help.

1 view (last 30 days)
%% Golomb coding/decoding for grayscale images
I=imread('N17.jpg');
I=double(I);
[size_x,size_y]=size(I);
I_dec=zeros(size_x,size_y); %decoded image will be stored in this matrix
m=randi(size_x,size_y,[1,max(max(I(:,:)))]); % generate a random set of coding parameters
% Encoding/Decoding for image
for i=1:1:size_x
for j=1:1:size_y
x = golomb_enco(I(i,j),m(i,j));
I_dec(i,j) = golomb_deco(x, m(i,j));
end
end
% Test to verify correct decoding
if isequal(I_dec,I)
fprintf('Decoding successful');
end
Error using randi
Size inputs must be scalar.
Error in golombexec (line 40)
m=randi(size_x,[1,max(max(I(:,:)))],size_y); % generate a random
set of coding parameters

Answers (1)

Cris LaPierre
Cris LaPierre on 24 Jun 2021
Edited: Cris LaPierre on 24 Jun 2021
It looks like MATLAB has determined you are trying to use this syntax:
Consult the documentation if that is not the syntax you intended to use.

Categories

Find more on Encryption / Cryptography in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!