public static void main(String[] args) { BufferedImage original = UtilImageIO.loadImage(UtilIO.pathExample("simple_objects.jpg")); Planar<GrayF32> input = new Planar<>(GrayF32.class, original.getWidth(),original.getHeight(),3); ConvertBufferedImage.convertFromPlanar(original,input,true,GrayF32.class); Planar<GrayF32> output = new Planar<>(GrayF32.class, original.getWidth()/3,original.getHeight()/3,3); Planar<GrayF32> output2 = new Planar<>(GrayF32.class, original.getWidth()/3,original.getHeight()/3,3); AverageDownSampleOps.down(input, output); new FDistort(input,output2).scaleExt().apply(); BufferedImage outputFull = ConvertBufferedImage.convertTo_F32(output, null, true); BufferedImage outputFull2 = ConvertBufferedImage.convertTo_F32(output2, null, true); ShowImages.showWindow(original,"Original"); ShowImages.showWindow(outputFull,"3x small average"); ShowImages.showWindow(outputFull2,"3x small bilinear"); } }
private void scaleUpLayers() { T l = pyramid.getLayer(0); if( upscale == null ) { interp = (InterpolatePixelS<T>) FactoryInterpolation.nearestNeighborPixelS(l.getClass()); upscale = (T)l.createNew(l.width,l.height); } else { upscale.reshape(l.width,l.height); } int N = pyramid.getNumLayers(); for( int i = 0; i < N; i++ ) { new FDistort(pyramid.getLayer(i),upscale).interpNN().scaleExt().apply(); BufferedImage b = ConvertBufferedImage.convertTo(upscale,null,true); if( showScales ) addImage(b,String.format("%5.2f",pyramid.getScale(i))); else addImage(b,String.format("%5.2f",pyramid.getSigma(i))); } } }
private void scaleUpLayers() { T l = pyramid.getLayer(0); if( upscale == null ) { interp = (InterpolatePixelS<T>) FactoryInterpolation.nearestNeighborPixelS(l.getClass()); upscale = (T)l.createNew(l.width,l.height); } else { upscale.reshape(l.width,l.height); } int N = pyramid.getNumLayers(); for( int i = 0; i < N; i++ ) { new FDistort(pyramid.getLayer(i),upscale).interpNN().scaleExt().apply(); BufferedImage b = ConvertBufferedImage.convertTo(upscale,null,true); if( showScales ) addImage(b,String.format("%5.2f",pyramid.getScale(i))); else addImage(b,String.format("%5.2f",pyramid.getSigma(i))); } } }
@Override public void setActiveAlgorithm(String name, Object cookie) { DerivType type = (DerivType)cookie; panel.reset(); for( int radius = 1; radius <= 40; radius += 2 ) { int maxOrder = Math.max(type.orderX,type.orderY); double sigma = FactoryKernelGaussian.sigmaForRadius(radius,maxOrder); Class typeKer1 = FactoryKernel.getKernelType(imageType,1); Kernel1D kerX = FactoryKernelGaussian.derivativeK(typeKer1,type.orderX,sigma,radius); Kernel1D kerY = FactoryKernelGaussian.derivativeK(typeKer1,type.orderY,sigma,radius); Kernel2D kernel = GKernelMath.convolve(kerY, kerX); T smallImg = GKernelMath.convertToImage(kernel); new FDistort(smallImg,largeImg).interpNN().scaleExt().apply(); double maxValue = GImageStatistics.maxAbs(largeImg); BufferedImage out = VisualizeImageData.colorizeSign(largeImg,null,maxValue); panel.addImage(out,String.format("%5d",radius)); } }
AverageDownSampleOps.down(inputGray,scaled); } else { new FDistort(inputGray,scaled).scaleExt().apply();
@Override public void setActiveAlgorithm(String name, Object cookie) { DisplayGaussianKernelApp.DerivType dt = (DisplayGaussianKernelApp.DerivType)cookie; // add basis SteerableKernel<K> steerable = createKernel(dt.orderX,dt.orderY); basisPanel.reset(); for( int i = 0; i < steerable.getBasisSize(); i++ ) { T smallImg = GKernelMath.convertToImage(steerable.getBasis(i)); new FDistort(smallImg,largeImg).scaleExt().interpNN().apply(); double maxValue = GImageStatistics.maxAbs(largeImg); BufferedImage out = VisualizeImageData.colorizeSign(largeImg,null,maxValue); basisPanel.addImage(out,"Basis "+i); } // add steered kernels steerPanel.reset(); for( int i = 0; i <= 20; i++ ) { double angle = Math.PI*i/20.0; K kernel = steerable.compute(angle); T smallImg = GKernelMath.convertToImage(kernel); new FDistort(smallImg,largeImg).scaleExt().interpNN().apply(); double maxValue = GImageStatistics.maxAbs(largeImg); BufferedImage out = VisualizeImageData.colorizeSign(largeImg,null,maxValue); steerPanel.addImage(out,String.format("%5d",(int)(180.0*angle/Math.PI))); } repaint(); }
new FDistort(featureImg,scaledIntensity).interpNN().scaleExt().apply();