Skip to content
Snippets Groups Projects
Commit fbf1f25f authored by Walt Mankowski's avatar Walt Mankowski
Browse files

tweaked types to try to account for roundoff and conversion errors

parent 344c2789
No related branches found
No related tags found
No related merge requests found
......@@ -68,17 +68,22 @@ public class Demo_Pixel_Replication implements PlugInFilter {
for (int y=r.y; y<(r.y+r.height); y++) {
for (int x=r.x; x<(r.x+r.width); x++) {
int n = (int) Math.round(distMatIdx.get(y,x));
long n = (int) Math.round(distMatIdx.get(y,x));
if (n > 0) {
Point2f p = new Point2f(x, y);
UniqPts.add(p);
for (int i = 0; i < n; i++) {
// long rep = Math.round((double)n/10.0);
long rep = 1;
if (rep == 0) rep = 1;
for (int i = 0; i < rep; i++) {
PrPts.add(p);
}
}
}
}
IJ.log(String.format("%d unique points, %d pixel rep points", UniqPts.size(), PrPts.size()));
// compute the gmm
EM em = computeGMM(k);
......@@ -182,7 +187,8 @@ public class Demo_Pixel_Replication implements PlugInFilter {
em.set("maxIters", 1000);
em.set("epsilon", 1e-6);
Mat emMat = PrPts2Mat(PrPts, 0.10);
// Mat emMat = PrPts2Mat(PrPts, 0.10);
Mat emMat = PrPts2Mat(PrPts);
Mat initMeans = randomInitMeans(k);
// em.trainE(emMat, initMeans, noArray());
em.trainE(emMat, initMeans, new Mat(), new Mat(), logLikelihoods, labels, new Mat());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment