File Exchange

image thumbnail

IMAGE COMPRESSION USING LBG ALGORITHM

version 1.0.0.0 (85.2 KB) by AARATHY M
Vector Quantization (VQ), a well-known compression technique, which has been widely used ...

3 Downloads

Updated 21 Mar 2006

No License

Linde, Buzo, and Gray (LBG) proposed a VQ design algorithm based on a training sequence. The use of a training sequence bypasses the need for multi-dimensional integration. The LBG algorithm is of iterative type and in each iteration a large set of vectors, generally referred to as training set, is needed to be processed. Usually, vectors sampled from a group of typical signals to be encoded altogether construct a training set T={x1,x 2,?.x M} ,where xi represents a sampled training vector and M represents the size of training set which is far greater than the codebook size N.

Comments and Ratings (41)

kushi rana

Hello
Anyone help me!!
I want vector quantization codebook for wavelet packet transform

Shan Sha

I am in need of vector quantization code to quantize my texture features into texture codes.please if u know the coding please help me

kushi rana

Hello plz anyone send me vector quantization using wavelet packet transform

any one send me the code for interval arithmetic vector quantization using Equitz nearest neighbour(ENN)

ashima garg

sonam sharma

good evening please i'm the biginner on Matlab.i want to compress image with LBG or kmeans algorithm. I need matlab code of them. please help me

abhishek

I am working on an IEEE paper. For which i searched and found a coe for LBG algorithm. But code showing some error. First of all i am not understanding its first error. It continue to show errors. .tiff is not attaching please use any image.

clc
clear all
close all
%*****************************************

tic
block_size=8;

inp=imread('Lena.tiff');
inp=rgb2gray(inp);
[ro,co]=size(inp);
Np=(ro/block_size)*(co/block_size); % number of Xi

Nc=Np/2;
L=block_size^2;
C=randi([0,255],Nc,L);
X=zeros(Np,L);

k=1;
for i=1:block_size:ro
for j=1:block_size:co
tem=inp(i:i+block_size-1,j:j+block_size-1);
X(k,:)=tem(:);
k=k+1;
end
end

for j=1:L
min_X=min(X(:,j));
max_X=max(X(:,j));
C(C(:,j)<min_X,j)=min_X;
C(C(:,j)>max_X,j)=max_X;
end

lim=50;
for m=1:lim
U=zeros(Np,Nc);

for i=1:Np
for j=1:Nc
T=(X(i,:)-C(j,:));
dis(1,j)=sqrt(T*T');
end
coo=find(dis==min(dis));
U(i,coo(1,1))=1;
end

fg=C;

for j=1:Nc
sig=0;
Usig=sum(U(:,j));
if Usig~=0
for i=1:Np
Ind=X(i,:).*U(i,j);
sig=sig+Ind;
end
C(j,:)=sig/Usig;
end
end
dif=fg-C;
deff(m)=sqrt(sum(sum(dif.^2)));
end
C=round(C);
i=1:lim;
plot(i,deff)

% constructed_image=zeros(ro,co);
% j=1;
% k=1;
% for i=1:Np
% tem=reshape(X(i,:),block_size,block_size);
% constructed_image(j:j+block_size-1,k:k+block_size-1)=tem;
% k=k+block_size;
% if k>co
% j=j+block_size;
% k=1;
% end
% end
% imshow(constructed_image,[])

[r,c]=find(U==1);

Xx=zeros(size(X));
for i=1:Np
Xx(r(i),:)=C(c(i),:);
end

constructed_image=zeros(ro,co);
j=1;
k=1;
for i=1:Np
tem=reshape(Xx(i,:),block_size,block_size);
constructed_image(j:j+block_size-1,k:k+block_size-1)=tem;
k=k+block_size;
if k>co
j=j+block_size;
k=1;
end
end
figure;
imshow(constructed_image,[])

abhishek

anybody having the code after removing error please mail me @ abhishekdixit011@gmail.com

Mayuri

I have not understood how to create a codebook to use it in compressing an image. Will you please mail a doc explaining me the LVQ.m file.

Brian Tsaer

nur adibah

hi...just wanna ask,what the size of original image and image after compression??and image after compression in which type of file??

Sona

getting foll. error:

??? Error using ==> trainlvq
Not enough arguments.

Error in ==> main at 14
[v]=trainlvq(x,0);

can u help me out

sunita

in this following site i found same codes as u ve composed:::pudn.com,LBG.zip,LBG vector quantization source code (2007-02-07, matlab, 85KB, Downloads 48)

sunita

it 's useful

dipak

ok i get it, for study of this lbg algo , any specific book ,

wherer i can get , psnr , error,find wight details.

dipak

i am not able to run this code any help , how to run this code

i am getting following error
Warning: TRAINLVQ is an obsolete function.
> In nntobsf at 18
In trainlvq at 7
In main at 14
Use NNT2LVQ and TRAIN to update and train your network.

??? Error using ==> trainlvq at 35
Not enough arguments.

Error in ==> main at 14
[v]=trainlvq(x,0);

dear author
i am beginner for the matlab and ur code is Learning vector quantization or vector quantization. will i get the reply means really helpful to proceed my project with ur code.

expecting ur reply soon,

my email id is r_nagu127@yahoo.com
with regards
nagendran

Karthick Ramanathan

Thanks a lot for the code. Just what we wanted. But there are a few errors that need to be looked into.

yamihamad Al Yami

nagendran ranganathan

i am beginner to the code can u explain the code and algorithm. and can we modify this to fuzzy c means algorithm

Kazi Mazhar

dd hh

i'm bigener in matlab, i didn't know how to deal with the code , it doesn't work

Sudipto Roy

very good

Lin ruolin

nice

kiavi narayanan

gud

Arief Sukmawan

MA Tsunghan

Thanks.I Love You

muthu lakshmi

its good

manpreet singh

how to open the .m files?

RUPESH KAMBLE

IT VERY GOOD AND IT HELPED ME FOR MY PROJECT WORK

yuehengli yue

giri babu kande

Dapeng Wu

stefan gavat

good

shenba vel

jercy M

vishal R

nashreen L

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux