# Linde-Buzo-Gray (LBG) Algorithm

**Linde-Buzo-Gray (LBG) Algorithm** is used for designing of Codebook efficiently which has minimum distortion and error.

LBG algorithm was proposed by Yoseph Linde, Andres Buzo and Robert M. Gray in 1980. It is the most common algorithm for Code Generation that generates a codebook with minimum error from a training set.

Training sets are a set of vectors that are derived from image vectors. The code vectors must minimize the distortion.

LBG algorithm assumes the codeword length to be fixed.

It is an iterative procedure and the basic idea is to divide the group of training vectors and use it to find the most representative vector from one group. These representative vectors from each group are gathered to form the codebook.

**Procedure for LBG Algorithm:**

- Divide the given image into blocks, so that each block appears as a d-dimensional vector.

For example, if image size is 712×712 and block size is 4×4, then the number of blocks is equal to (712*712)/(4*4)=31684.

And each block is a 16 dimension vector. - Initial codebook is chosen randomly.
- The initial chosen codebook is set as the centroid and the other vectors are grouped according to the nearest distance with the centroid similar to the k-mean clustering.
- Find the new centroid of every group to get a new codebook iterative. Repeat the steps 2 & 3 till the convergence of the centroid of every group.

**Flow Diagram of LBG Algorithm:**

## Recommended Posts:

- Liang-Barsky Algorithm
- Boundary Fill Algorithm
- Election algorithm and distributed processing
- Flood fill algorithm using C graphics
- Box Blur Algorithm - With Python implementation
- Midpoint ellipse drawing algorithm
- Bresenham's Algorithm for 3-D Line Drawing
- Mid-Point Circle Drawing Algorithm
- Bresenham’s circle drawing algorithm
- Bresenham’s Line Generation Algorithm
- Mid-Point Line Generation Algorithm
- Neighbors of a point on a circle using Bresenham's algorithm
- Line Clipping | Set 1 (Cohen–Sutherland Algorithm)
- Polygon Clipping | Sutherland–Hodgman Algorithm
- Comparions between DDA and Bresenham Line Drawing algorithm

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.