From: Walter Roberson on
Leena Silvoster wrote:
> On Jun 5, 12:59 am, "yigit ozsahin" <yigitozsa...(a)gmail.com> wrote:
>> I wrote this code
>> --------------------------------------------------------------------------------------------------
>> load lena512.mat %loads lena 512 to workspace
>> I=lena512; % I become lena512
>> fun = @dct2; %dct2 is assigned as function
>> J = blkproc(I,[8 8],fun); % blkproc function subblocks the image by 8-8 and usign dct2 function
>> figure
>> imshow(uint8(J)) % plot the subblocked image
>> title('lena512 subblocked to 8x8 using dct2 function') %title of the code
>> ------------------------------------------------------------------------------------------------
>> but i dont know how to do step
>> 3. For each subblock, keep only a fixed set of 10 coefficients and set others to zero (Same set of coefficients should be kept for all subblocks).

MaskMatrix = zeros(8,8);
MaskMatrix(round(linspace(1,64,10))) = 1;
fun = @(B) dct2(B) .* MaskMatrix;

Why _those_ 10 coefficients, linspace(1,64,10), instead of something
else? Only because they together span the 8x8 space. If you really
wanted, you could do (64 Choose 10) different sets of coefficients and
find the set that reconstructs the best for your test image; the best
set would probably be different for other images. (64 Choose 10) is only
151473214816 possibilities: if you start now, you could be finished...
ummm, before some New Years or other.
First  |  Prev  | 
Pages: 1 2
Prev: neural network
Next: Identify colors in an RGB image