- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVectorQuantizerController.java
More file actions
Latest commit
31 lines (24 loc) · 923 Bytes
/
Copy pathVectorQuantizerController.java
File metadata and controls
31 lines (24 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
importjava.util.ArrayList;
publicclassVectorQuantizerController {
privateintQuantizationLevels;
privateint[] vectorDim;
VectorQuantizerController( intQuantizationLevels, int[] vectorDim)
{
this.QuantizationLevels = QuantizationLevels;
this.vectorDim = vectorDim;
}
publicvoidcompress(StringimagePath, StringcompressedPath)
{
int[][] img = ImageHandler.readImage(imagePath);
LBGAlgorithmLBG = newLBGAlgorithm(QuantizationLevels, vectorDim);
ArrayList<ImageVector> codeBook = LBG.LBG(img);
Encoderenc = newEncoder(codeBook);
enc.encode(img, compressedPath);
}
publicstaticvoiddecompress(StringcompressedPath, StringimagePath)
{
Decoderdec = newDecoder(compressedPath);
int[][] img = dec.decode();
ImageHandler.writeImg(img, imagePath);
}
}