Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JAI相位相关_Java_Correlation_Jai_Phase - Fatal编程技术网

Java JAI相位相关

Java JAI相位相关,java,correlation,jai,phase,Java,Correlation,Jai,Phase,我的主要兴趣领域是生物医学图像处理。我有一组生物医学图像,我需要找到它们之间的相位 对于计算图像之间的相位,我使用相位相关,但我不确定我是如何做到这一点的。我正在使用“Java高级图像”库,我的代码是: BufferedImage first = grayscale(first); BufferedImage second = grayscale(second); RenderedOp dftFirst = DFTDescriptor.create(PlanarImage.wrapRende

我的主要兴趣领域是生物医学图像处理。我有一组生物医学图像,我需要找到它们之间的相位

对于计算图像之间的相位,我使用相位相关,但我不确定我是如何做到这一点的。我正在使用“Java高级图像”库,我的代码是:

BufferedImage first = grayscale(first); 
BufferedImage second = grayscale(second);

RenderedOp dftFirst = DFTDescriptor.create(PlanarImage.wrapRenderedImage(first), DFTDescriptor.SCALING_NONE, DFTDescriptor.REAL_TO_COMPLEX, null); 
RenderedOp dftSecond = DFTDescriptor.create(PlanarImage.wrapRenderedImage(second), DFTDescriptor.SCALING_NONE, DFTDescriptor.REAL_TO_COMPLEX, null); 

RenderedOp conj = ConjugateDescriptor.create(dftSecond, null);  
RenderedOp conv = MultiplyComplexDescriptor.create(dftFirst, conj, null); 

RenderedOp abs = AbsoluteDescriptor.create(conv, null);
RenderedOp R = DivideComplexDescriptor.create(conv, abs, null);

RenderedOp idft = IDFTDescriptor.create(R, IDFTDescriptor.SCALING_DIMENSIONS, IDFTDescriptor.COMPLEX_TO_COMPLEX, null); 
RenderedOp magnitude = MagnitudeDescriptor.create(idft, null); 
RenderedOp shift = PeriodicShiftDescriptor.create(magnitude, new Integer(magnitude.getWidth() / 2), new Integer(magnitude.getHeight() / 2), null); 

RenderedOp opExtrema = ExtremaDescriptor.create(shift, new ROIShape(shift.getBounds()), 1, 1, Boolean.TRUE, 1, null); 
int[] maxLocation = (int[])((List[])opExtrema.getProperty("maxLocations"))[0].get(0); 
double[][] extrema = (double[][])opExtrema.getProperty("extrema"); 
double c = 255.0 / (extrema[1][0] - extrema[0][0]); 
double o = -extrema[0][0] * c; 

System.out.println("Maximum value " + extrema[1][0] + " found at (" + maxLocation[0] + "," + maxLocation[1] + ")"); 

我的问题是:

  • JAI中的相位相关步骤正确吗
  • 如何从JAI中的图像结果获取相位大小 多谢各位

    更新 第2点。解决

    int deltaX = maxLocation[0] - (conv.getWidth() / 2);
    int deltaY = maxLocation[1] - (conv.getHeight() / 2);
    

    查看wikipedia(),看起来您并没有真正遵循所描述的方法。你想用什么方法?你好,为什么你认为它看起来不像(en.wikipedia.org/wiki/Phase_correlation)?非常感谢。