예제 #1
0
 public static Kernel2D convertToKernel(ImageSingleBand image) {
   if (image.getDataType().isInteger()) {
     return KernelMath.convertToKernel((ImageInteger) image);
   } else {
     return KernelMath.convertToKernel((ImageFloat32) image);
   }
 }
예제 #2
0
 public static <T extends ImageSingleBand> T convertToImage(Kernel2D kernel) {
   if (kernel.isInteger()) {
     return (T) KernelMath.convertToImage((Kernel2D_I32) kernel);
   } else {
     return (T) KernelMath.convertToImage((Kernel2D_F32) kernel);
   }
 }
예제 #3
0
  public static Kernel2D convolve(Kernel1D a, Kernel1D b) {
    if (a.isInteger() != b.isInteger())
      throw new IllegalArgumentException("But input kernels must be of the same type.");

    if (a.isInteger()) {
      return KernelMath.convolve2D((Kernel1D_I32) a, (Kernel1D_I32) b);
    } else {
      return KernelMath.convolve2D((Kernel1D_F32) a, (Kernel1D_F32) b);
    }
  }
예제 #4
0
 public static Kernel2D transpose(Kernel2D a) {
   if (a instanceof Kernel2D_F32) return KernelMath.transpose((Kernel2D_F32) a);
   else return KernelMath.transpose((Kernel2D_I32) a);
 }