Author | Message |
---|---|
yzhao52
Posts: 32
|
Posted 03:33 Apr 18, 2020 |
First, both the vectors from the color image and the codebook are defined as 2-D arrays: each row in vectors is from one 2x2 block while each row in codebook is the centroid of one cluster; both has 12 columns, which corresponding the dimension of the VQ.
To generate initial codebook, you may choose one of the tow following approaches:
To train the codebook, we follow the K-means clustering algorithm:
Last edited by yzhao52 at
03:34 Apr 18, 2020.
|
ccorra15
Posts: 12
|
Posted 10:13 Apr 18, 2020 |
Last edited by ccorra15 at
10:32 Apr 18, 2020.
|
ilopezd
Posts: 16
|
Posted 13:07 Apr 18, 2020 |
I attached an example image. The clusters are the divisions shown while the centroid is the points in the middle. in our case we have 256 different clusters, hence 256 centroids. It is almost impossible for two centroids to have the same 12 RGB values if you assign each value randomly, using the random space method. ( we have 12 numbers and each is randomly choosing between 0 to 255.) Hope my response was helpful. |
ccorra15
Posts: 12
|
Posted 13:51 Apr 18, 2020 |
So each rgb value is randomly chosen to create a vector to represent a cluster? My program chooses a random vector (from the original image) and uses that as a cluster. Am I doing this wrong? I heard the professor say that our answers might be a little different due to the randomization and my answer compared to his sample result are very close. |
ilopezd
Posts: 16
|
Posted 13:56 Apr 18, 2020 |
He said we can either use random space which is randomly choosing the 12 RGB values for each or use a random sample, which randomly choosing one of the blocks and copies it for the centroid. It sounds like you used a random sample, either one works fine as long as your K-means clustering is working. I'm not sure which the proff. used to implement his program. Last edited by ilopezd at
13:57 Apr 18, 2020.
|
ccorra15
Posts: 12
|
Posted 14:25 Apr 18, 2020 |
Thank you for your response it was very helpful, although I am still confused on how to approach the decoding process |
yzhao52
Posts: 32
|
Posted 18:48 Apr 18, 2020 |
When choosing initial centroid randomly from samples, it's quite possible that two centroid having the same values. One simple approach to handle this issue is as follows: for the current cluster k, assign one random sample as its initial centroid ck, then compare ck with all previous clusters' centroids, re-assign a new random sample if it's the same as one previous centroid until reaching one re-assignment attempt limit (e.g. 5/10 times). The purpoe of this limit is to avoid infinite loop, i.e. the whole image only has a few different patterns. From the sample results, you could see I actually implemented both approaches when generating initial codebook. :-) Last edited by yzhao52 at
18:53 Apr 18, 2020.
|
yzhao52
Posts: 32
|
Posted 19:08 Apr 18, 2020 |
The VQ decoding process is extremely straightforward:
|