Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

template<class DstArrayT, class SrcArrayT>
void Impala::Core::Array::Pattern::PatGeometricOp ( DstArrayT *&  dst,
SrcArrayT *  src,
Matrix::Mat *  func,
bool  isForward,
Geometry::GeoIntType  gi,
bool  adjustSize,
typename DstArrayT::ArithType  background 
) [inline]

Definition at line 30 of file PatGeometricOp.h.

References ArrayBH(), ArrayBW(), ArrayCH(), ArrayCW(), Impala::Core::Array::Element::E2Inf(), Impala::Core::Array::Element::E2Sup(), FuncGeometricOp(), Impala::Core::Matrix::MatCopy(), Impala::Core::Matrix::MatInverse(), Impala::Core::Matrix::MatMulVec(), Impala::Core::Matrix::MatNrCol(), Impala::Core::Matrix::MatNrRow(), Impala::Core::Array::PAR_FULL, Impala::Core::Array::PAR_PART, PxArrayForceNonDistributed(), PxArrayPD(), PxArrayPostStateTrans(), PxArrayPreStateTrans(), PxLclStartX(), PxLclStartY(), PxLclStartZ(), PxMyCPU(), PxRunLazyParallel(), PxRunParallel(), STRONG, and WEAK.

Referenced by Impala::Core::Array::Rotate(), and Impala::Core::Array::Scale().

00033 {
00034     if ((Matrix::MatNrRow(func) != 3) || (Matrix::MatNrCol(func) != 3))
00035     {
00036         std::cout << "PatGeometricOp: matrix needs to be 3x3" << std::endl;
00037         return;
00038     }
00039 
00040     Matrix::Mat* fForw = (isForward) ? Matrix::MatCopy(func) : Matrix::MatInverse(func);
00041     Matrix::Mat* fBack = (isForward) ? Matrix::MatInverse(func) : Matrix::MatCopy(func);
00042 
00043     int sW = ArrayCW(src);
00044     int sH = ArrayCH(src);
00045     int reqW = (dst) ? ArrayCW(dst) : sW;
00046     int reqH = (dst) ? ArrayCH(dst) : sH;
00047 
00048     Vec3Real64 translate(0, 0, 0);
00049 
00050     if (adjustSize)
00051     {
00052         Vec3Real64 ulP = Matrix::MatMulVec(fForw, Vec3Real64(0,  0,  1));
00053         Vec3Real64 llP = Matrix::MatMulVec(fForw, Vec3Real64(0,  sH, 1));
00054         Vec3Real64 urP = Matrix::MatMulVec(fForw, Vec3Real64(sW, 0,  1));
00055         Vec3Real64 lrP = Matrix::MatMulVec(fForw, Vec3Real64(sW, sH, 1));
00056 
00057         //homogeneous coordinates
00058         ulP /= Vec3Real64(ulP.Z(), ulP.Z(), ulP.Z());
00059         llP /= Vec3Real64(llP.Z(), ulP.Z(), ulP.Z());
00060         urP /= Vec3Real64(urP.Z(), ulP.Z(), ulP.Z());
00061         lrP /= Vec3Real64(lrP.Z(), ulP.Z(), ulP.Z());
00062 
00063         Vec3Real64 maerB = E2Inf(E2Inf(E2Inf(ulP,llP),urP),lrP);
00064         Vec3Real64 maerE = E2Sup(E2Sup(E2Sup(ulP,llP),urP),lrP);
00065         reqW = int(maerE.X() - maerB.X() + 0.5);
00066         reqH = int(maerE.Y() - maerB.Y() + 0.5);
00067         translate = Vec3Real64(maerB.X(), maerB.Y(), 0);
00068     }
00069 
00070     if (dst == 0)
00071     {
00072         dst = ArrayCreate<DstArrayT>(reqW, reqH,
00073                                      ArrayBW(src), ArrayBH(src));
00074     }
00075     else
00076         if ((ArrayCW(dst) != reqW) || (ArrayCH(dst) != reqH))
00077         {
00078             delete dst;
00079             dst = ArrayCreate<DstArrayT>(reqW, reqH,
00080                                          ArrayBW(src), ArrayBH(src));
00081         }
00082 
00083 #ifdef PX_HORUS_USED
00084     if (!PxRunParallel()) {                         // run sequential
00085 #endif
00086         FuncGeometricOp(dst, src, fBack, gi, translate, background);
00087 
00088 #ifdef PX_HORUS_USED
00089     } else {                                        // run parallel
00090         PxArrayPreStateTrans(src, PAR_FULL, STRONG);
00091         PxArrayPreStateTrans(dst, PAR_PART, WEAK);
00092         translate += Vec3Real64(PxLclStartX(PxMyCPU()),
00093                         PxLclStartY(PxMyCPU()), PxLclStartZ(PxMyCPU()));
00094         FuncGeometricOp(PxArrayPD(dst), PxArrayPD(src),
00095                           fBack, gi, translate, background);
00096         PxArrayPostStateTrans(dst);
00097 
00098         if (!PxRunLazyParallel()) {
00099             PxArrayForceNonDistributed(src);
00100             PxArrayForceNonDistributed(dst);
00101         }
00102     }
00103 #endif
00104 
00105     delete fForw;
00106     delete fBack;
00107 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:01:54 2010 for ImpalaSrc by  doxygen 1.5.1