-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implementation of new Kmeans API, optimizations
- Loading branch information
1 parent
ffc1da9
commit 07c3431
Showing
9 changed files
with
140 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,18 @@ | ||
package XIS.sections.compression; | ||
|
||
import pl.ksitarski.simplekmeans.KMeansData; | ||
|
||
import java.util.List; | ||
|
||
class IntKMeans implements KMeansData { | ||
|
||
private int val; | ||
|
||
public IntKMeans(int val) { | ||
this.val = val; | ||
} | ||
|
||
public int getVal() { | ||
return val; | ||
} | ||
|
||
public void setVal(int val) { | ||
this.val = val; | ||
} | ||
|
||
@Override | ||
public double distanceTo(KMeansData kMeansData) { | ||
return Math.abs(val - ((IntKMeans)kMeansData).getVal()); | ||
class IntKMeans { | ||
public static double distance(int a, int b) { | ||
return Math.abs(a - b); | ||
} | ||
|
||
@Override | ||
public KMeansData meanOfList(List<KMeansData> list) { | ||
public static int meanOfList(List<Integer> list) { | ||
int a = 0; | ||
for (var val : list) { | ||
a += ((IntKMeans) val).getVal(); | ||
a += val; | ||
} | ||
a = a / list.size(); | ||
return new IntKMeans(a); | ||
return a; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
src/main/java/XIS/sections/scanprocessing/quantization/RgbContainer.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.