/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static float mean( GrayF32 img ) { return sum(img)/(float)(img.width*img.height); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( InterleavedF64 img ) { return sum(img)/(double)(img.width*img.height*img.numBands); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( GrayS8 img ) { return sum(img)/(double)(img.width*img.height); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( InterleavedS8 img ) { return sum(img)/(double)(img.width*img.height*img.numBands); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( GrayU16 img ) { return sum(img)/(double)(img.width*img.height); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( InterleavedS16 img ) { return sum(img)/(double)(img.width*img.height*img.numBands); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( GrayS32 img ) { return sum(img)/(double)(img.width*img.height); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( GrayU8 img ) { return sum(img)/(double)(img.width*img.height); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( InterleavedU8 img ) { return sum(img)/(double)(img.width*img.height*img.numBands); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( GrayS16 img ) { return sum(img)/(double)(img.width*img.height); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( InterleavedU16 img ) { return sum(img)/(double)(img.width*img.height*img.numBands); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( InterleavedS32 img ) { return sum(img)/(double)(img.width*img.height*img.numBands); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( GrayS64 img ) { return sum(img)/(double)(img.width*img.height); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( InterleavedS64 img ) { return sum(img)/(double)(img.width*img.height*img.numBands); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static float mean( InterleavedF32 img ) { return sum(img)/(float)(img.width*img.height*img.numBands); }
/** * Returns the mean pixel intensity value. * * @param img Input image. Not modified. * @return Mean pixel intensity value */ public static double mean( GrayF64 img ) { return sum(img)/(double)(img.width*img.height); }
return ImageStatistics.sum((GrayU8) input); } else if (GrayS8.class == input.getClass()) { return ImageStatistics.sum((GrayS8) input); } else if (GrayU16.class == input.getClass()) { return ImageStatistics.sum((GrayU16) input); } else if (GrayS16.class == input.getClass()) { return ImageStatistics.sum((GrayS16) input); } else if (GrayS32.class == input.getClass()) { return ImageStatistics.sum((GrayS32) input); } else if (GrayS64.class == input.getClass()) { return ImageStatistics.sum((GrayS64) input); } else if (GrayF32.class == input.getClass()) { return ImageStatistics.sum((GrayF32) input); } else if (GrayF64.class == input.getClass()) { return ImageStatistics.sum((GrayF64) input); } else { throw new IllegalArgumentException("Unknown image Type"); return ImageStatistics.sum((InterleavedU8) input); } else if (InterleavedS8.class == input.getClass()) { return ImageStatistics.sum((InterleavedS8) input); } else if (InterleavedU16.class == input.getClass()) { return ImageStatistics.sum((InterleavedU16) input); } else if (InterleavedS16.class == input.getClass()) { return ImageStatistics.sum((InterleavedS16) input); } else if (InterleavedS32.class == input.getClass()) { return ImageStatistics.sum((InterleavedS32) input); } else if (InterleavedS64.class == input.getClass()) { return ImageStatistics.sum((InterleavedS64) input);
private double computeEdgeMSE(GrayF32 imageInv) { GrayF32 edge = new GrayF32(imageInv.width,imageInv.height); LaplacianEdge.process(image,edge); PixelMath.abs(edge,edge); float max = ImageStatistics.maxAbs(edge); PixelMath.divide(edge,max,edge); float total = ImageStatistics.sum(edge); double error = 0; for( int y = 0; y < image.height; y++ ) { for( int x = 0; x < image.width; x++ ) { double w = edge.get(x,y)/total; double e = (image.get(x,y)-imageInv.get(x,y)); error += (e*e)*w; } } return error; }