Harmos274/ImageCompressor

Incorrect precision, strange convergence limit behavior

Harmos274 opened this issue · 0 comments

Invalid output for ./imageCompressor 4 0.1 exampleIn

--
(255,18,109)
-
(1,4) (255,18,109)
--
(34,20,112)
-
(1,3) (33,18,109)
(1,2) (33,18,109)
(1,1) (33,28,119)
(1,0) (33,18,109)
(0,5) (43,28,109)
(0,4) (34,18,129)
(0,3) (33,18,109)
(0,2) (33,21,109)
(0,0) (33,18,109)
--
(33,80,109)
-
(0,1) (33,80,109)
--
(0,0,0)
-

Create an empty cluster, which is invalid in the context.

Also, the convergence limit seems to be weirdly considered by the compressor algorithm.

./imageCompressor 4 1000000 exampleIn output :

--
(33,18,109)
-
(1,4) (255,18,109)
(1,3) (33,18,109)
(1,2) (33,18,109)
(1,0) (33,18,109)
(0,4) (34,18,129)
(0,3) (33,18,109)
(0,0) (33,18,109)
--
(33,18,109)
-
--
(33,21,109)
-
(1,1) (33,28,119)
(0,5) (43,28,109)
(0,2) (33,21,109)
--
(33,80,109)
-
(0,1) (33,80,109)

There's an empty cluster in second position which not contain any pixel.

for exampleIn :

cat exampleIn
(0,0) (33,18,109)
(0,1) (33,80,109)
(0,2) (33,21,109)
(0,3) (33,18,109)
(0,4) (34,18,129)
(0,5) (43,28,109)
(1,0) (33,18,109)
(1,1) (33,28,119)
(1,2) (33,18,109)
(1,3) (33,18,109)
(1,4) (255,18,109)