#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxSquaredDistance (HxImageRep im1, HxImageRep im2) |
| Squared distance. More... | |
|
||||||||||||
|
Squared distance. The function computes the squared distance of all corresponding pixels in the input images via a binary pixel operation. Implementation specifics : The pixel functor : HxBpoSqrDst. The image functor instantiator : HxInstantiatorSqrDst.
00103 {
00104 HxString fname("HxSquaredDistance");
00105
00106 if (im1.isNull())
00107 {
00108 HxGlobalError::instance()->reportError(fname, im1.name(), "null image", HxGlobalError::HX_GE_INVALID);
00109 return HxImageRep();
00110 }
00111 if (im2.isNull())
00112 {
00113 HxGlobalError::instance()->reportError(fname, im2.name(), "null image", HxGlobalError::HX_GE_INVALID);
00114 return HxImageRep();
00115 }
00116
00117 if (im1.dimensionality() != im2.dimensionality())
00118 {
00119 HxGlobalError::instance()->reportError(fname, "unequal image dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00120 return HxImageRep();
00121 }
00122 if (im1.pixelDimensionality() != im2.pixelDimensionality())
00123 {
00124 HxGlobalError::instance()->reportError(fname, "unequal pixel dimensionality", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00125 return HxImageRep();
00126 }
00127
00128 if (im1.sizes().x() != im2.sizes().x())
00129 {
00130 HxGlobalError::instance()->reportError(fname, "unequal image widths", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00131 return HxImageRep();
00132 }
00133
00134 if (im1.sizes().y() != im2.sizes().y())
00135 {
00136 HxGlobalError::instance()->reportError(fname, "unequal image heights", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00137 return HxImageRep();
00138 }
00139 if (im1.dimensionality() > 2)
00140 {
00141 if (im1.sizes().z() != im2.sizes().z())
00142 {
00143 HxGlobalError::instance()->reportError(fname, "unequal image depths", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00144 return HxImageRep();
00145 }
00146 }
00147
00148 // call HxImageRep member function to do the image processing
00149 return im1.binaryPixOp(im2, "sqrDst");
00150 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001