i have written a code to get the probability of pixels value as '1' for implementing huffman compression
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
A = imread('lena1.jpg');
A = reshape(uint8(A), [1 512*512*3]);
s = size(A);
[rows columns numberOfColorBands] = size(A);
col1 = 1;
col2 = floor(columns/2);
col3 = col2 + 1;
row1 = 1;
row2 = floor(rows/2);
row3 = row2 + 1;
% Now crop
upperLeft = imcrop(A, [col1 row1 col2 row2]);
count = zeros(1,256);
for i =1:s(1)
for j =1:s(2)
count(uint8(A(i,j)+1)) = count(uint8(A(i,j)+1))+1;
end
end
count = double(count) /(512*512*3);
sumofprob=sum((count))
plot(count)
its working fine with the lena image ,,am getting the desired probability as 1
but if the change to any other image am not getting the probability as 'one'
i want to write a general code which works on all images
please help anyone to get the prob as '1'.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!