i have written a code to get the probability of pixels value as '1' for implementing huffman compression
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!