Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need a help in my project

Status
Not open for further replies.

Shyam Joe

Junior Member level 3
Junior Member level 3
Joined
Aug 21, 2013
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
322
I need a MATLAB code to compress a 256X256 image into 16X16 image and convert it into binary image. I have obtained the following code from the net. Whether any modifications in the code can generate a 16X16 image?? If not pls suggest some other code

Code:
clc
close all
im=imread('cameraman.tif');
im = double(im)/255;
subplot(2,2,1)
imshow(im)
title('Original image');
img_dct=dct2(im);
img_pow=(img_dct).^2;
img_pow=img_pow(:);
[B,index]=sort(img_pow);%no zig-zag
B=flipud(B);
index=flipud(index);
compressed_dct=zeros(size(im));
coeff = 20000;% maybe change the value
for k=1:coeff
compressed_dct(index(k))=img_dct(index(k));
end
im_dct=idct2(compressed_dct);
im_bin=im2bw(im_dct);
subplot(2,2,2)
imshow(im_dct)
title('DCT Compress Image');
subplot(2,2,3)
imshow(im_bin)
title('DCT Binary Image');
 
Last edited by a moderator:

use blockproc function from the image toolbox to divide the image to 8x8 or 16x16 blocks....are u doing dct2 of a color image??...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top