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

2 visualizzazioni (ultimi 30 giorni)
%% 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

Risposte (1)

Cris LaPierre
Cris LaPierre il 24 Giu 2021
Modificato: Cris LaPierre il 24 Giu 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.

Categorie

Scopri di più su Encryption / Cryptography in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by