2

My main field of interest is biomedical image processing. I have set of biomedical images and I need find phase between them.

For computing phase between images, I am using phase correlation, but I am not sure of way how I am doing it. I am using "Java Advanced Imaging" library and my code is:

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] + ")"); 

Test images and Image result of Phase Correlation

My questions are:

  1. Are steps of Phase Correlation in JAI correct?
  2. How can I get phase size from image result in JAI?

Thank you

UPDATE

Point 2. Solved

int deltaX = maxLocation[0] - (conv.getWidth() / 2);
int deltaY = maxLocation[1] - (conv.getHeight() / 2);
  • Looking at wikipedia (http://en.wikipedia.org/wiki/Phase_correlation), it doesn't really look like you're following the method described. What method are you trying to apply? –  Feb 24 '13 at 12:11
  • Hello, why do you think it doesn't look like (en.wikipedia.org/wiki/Phase_correlation)? Thank you – Radek Kuzník Feb 24 '13 at 16:04

0 Answers0