本文整理汇总了Java中ij.process.FloatProcessor.convolve方法的典型用法代码示例。如果您正苦于以下问题:Java FloatProcessor.convolve方法的具体用法?Java FloatProcessor.convolve怎么用?Java FloatProcessor.convolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.process.FloatProcessor
的用法示例。
在下文中一共展示了FloatProcessor.convolve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gradientX
import ij.process.FloatProcessor; //导入方法依赖的package包/类
protected FloatProcessor gradientX(FloatProcessor fp) {
// Sobel-kernel for x-derivatives:
final float[] Hx = Matrix.multiply(1f/8, new float[] {
-1, 0, 1,
-2, 0, 2,
-1, 0, 1
});
FloatProcessor fpX = (FloatProcessor) fp.duplicate();
fpX.convolve(Hx, 3, 3);
return fpX;
}
示例2: gradientY
import ij.process.FloatProcessor; //导入方法依赖的package包/类
protected FloatProcessor gradientY(FloatProcessor fp) {
// Sobel-kernel for y-derivatives:
final float[] Hy = Matrix.multiply(1f/8, new float[] {
-1, -2, -1,
0, 0, 0,
1, 2, 1
});
FloatProcessor fpY = (FloatProcessor) fp.duplicate();
fpY.convolve(Hy, 3, 3);
return fpY;
}
示例3: applyToolToImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public Grid2D applyToolToImage(Grid2D imageProcessor) {
FloatProcessor revan = new FloatProcessor(imageProcessor.getWidth(), imageProcessor.getHeight());
revan.setPixels(imageProcessor.getBuffer());
if (!twoD){
float [] kernel = designKernel(nTimes);
if (horizontal)
revan.convolve(kernel, kernel.length, 1);
else
revan.convolve(kernel, 1, kernel.length);
revan.multiply(0.5/Configuration.getGlobalConfiguration().getGeometry().getPixelDimensionX());
} else {
FloatProcessor xDerivative = (FloatProcessor) revan.duplicate();
xDerivative.convolve(designKernelX(), nTimes, nTimes);
xDerivative.multiply(0.5/Configuration.getGlobalConfiguration().getGeometry().getPixelDimensionX());
xDerivative.sqr();
FloatProcessor yDerivative = (FloatProcessor) revan.duplicate();
yDerivative.convolve(designKernelY(), nTimes, nTimes);
yDerivative.sqr();
yDerivative.multiply(0.5/Configuration.getGlobalConfiguration().getGeometry().getPixelDimensionY());
ImageUtil.addProcessors(xDerivative, yDerivative);
xDerivative.sqrt();
revan = xDerivative;
}
Grid2D result = new Grid2D((float[]) revan.getPixels(), revan.getWidth(), revan.getHeight());
return result;
}
示例4: computeUVDerivative
import ij.process.FloatProcessor; //导入方法依赖的package包/类
private Grid2D computeUVDerivative(int index){
float [] kernel = {-1, 0, 1};
ImageProcessor revan = new FloatProcessor(inputQueue.get(index).getWidth(), inputQueue.get(index).getHeight());
// derivative in row direction
FloatProcessor uDev = new FloatProcessor(revan.getWidth(), revan.getHeight());
System.arraycopy(inputQueue.get(index).getBuffer(), 0, (float[]) uDev.getPixels(), 0, inputQueue.get(index).getBuffer().length);
uDev.convolve(kernel, 3, 1);
// derivative in column direction
ImageProcessor vDev = new FloatProcessor(revan.getWidth(), revan.getHeight());
System.arraycopy(inputQueue.get(index).getBuffer(), 0, (float[]) vDev.getPixels(), 0, inputQueue.get(index).getBuffer().length);
vDev.convolve(kernel, 1, 3);
// weight and add to result.
for(int i =0; i<uDev.getWidth(); i++){
for (int j=0; j< uDev.getHeight(); j++){
double u = uDev.getPixelValue(i, j);
u /= detectorElementSizeX * 2;
u *= uWeights[i];
uDev.putPixelValue(i, j, u);
double v = vDev.getPixelValue(i, j);
v *= vWeights[i][j];
v /= detectorElementSizeY * 2;
revan.putPixelValue(i, j, v+u);
}
}
//if (index == 1) VisualizationUtil.showImageProcessor(revan);
return new Grid2D((float[])revan.getPixels(), revan.getWidth(), revan.getHeight());
}