Returns the image resulting from the point by point Hartley division of this image by the specified image. Both images are assumed to be in the frequency domain. Division in the frequency domain is equivalent to deconvolution in the space domain.
(FHT fht)
| 607 | the frequency domain. Division in the frequency domain is equivalent |
| 608 | to deconvolution in the space domain. */ |
| 609 | public FHT divide(FHT fht) { |
| 610 | int rowMod, cMod, colMod; |
| 611 | double mag, h2e, h2o; |
| 612 | float[] h1 = (float[])getPixels(); |
| 613 | float[] h2 = (float[])fht.getPixels(); |
| 614 | float[] out = new float[maxN*maxN]; |
| 615 | for (int r=0; r<maxN; r++) { |
| 616 | rowMod = (maxN - r) % maxN; |
| 617 | for (int c=0; c<maxN; c++) { |
| 618 | colMod = (maxN - c) % maxN; |
| 619 | mag =h2[r*maxN+c] * h2[r*maxN+c] + h2[rowMod*maxN+colMod] * h2[rowMod*maxN+colMod]; |
| 620 | if (mag<1e-20) |
| 621 | mag = 1e-20; |
| 622 | h2e = (h2[r*maxN+c] + h2[rowMod*maxN+colMod]); |
| 623 | h2o = (h2[r*maxN+c] - h2[rowMod*maxN+colMod]); |
| 624 | double tmp = (h1[r*maxN+c] * h2e - h1[rowMod*maxN+colMod] * h2o); |
| 625 | out[r*maxN+c] = (float)(tmp/mag); |
| 626 | } |
| 627 | } |
| 628 | FHT fht2 = new FHT(new FloatProcessor(maxN, maxN, out, null)); |
| 629 | fht2.isFrequencyDomain = true; |
| 630 | return fht2; |
| 631 | } |
| 632 | |
| 633 | /** Enables/disables display of the progress bar during transforms. */ |
| 634 | public void setShowProgress(boolean showProgress) { |
no test coverage detected