Exemplo n.º 1
0
float Motion::getOrientation(){

    //Vamos a fijar una sola orientación
    float rho = float(atan(double(-(motionMat(0,1)))/double(motionMat(0,0))));

    return rho;

}
Exemplo n.º 2
0
cv::Point2f Motion::getTraslation(){

    cv::Point2f translation;

    translation.x = motionMat(0,2);
    translation.y = motionMat(1,2);

    return translation;

}
Exemplo n.º 3
0
float Motion::getScale(){

    float angle = getOrientation();

    float sX = motionMat(0,0) / cos(angle);

    float sY = motionMat(1,1) / cos(angle);

    std::cout << std::endl << "ESCALAS (X e Y): " << sX << "\t" << sY;

    float s = (sX + sY) / float(2);

    return s;
}
Exemplo n.º 4
0
// update the design matrix for a new timepoint
// NOTE: this should be called after all events and  artifacts have been
// added (through addEvent and addArtifact) and motion has been added to the
// datastore for this timepoint. usually this function will be called from
// RtModelFit::process()
//  in
//   tr of the timepoint to update for
bool RtDesignMatrix::updateAtTr(unsigned int thisTr) {

  if (!isBuilt()) {
    cerr << "WARNING: can't update() a design matrix that hasn't been build()t."
         << endl;
    return false;
  }

  // check bounds
  if (thisTr >= numMeas) {
    cerr
        << "WARNING: RtDesignMatrix::update trying to process tr out of range ("
        << thisTr << ")" << endl;
    return false;
  }

  // copy the motion parameters
  if (modelMotionParameters) {
    RtDataID motID(templateDataID);
    motID.setModuleID("motion");

    RtMotion *mot = static_cast<RtMotion*> (getDataStore().getData(motID));

    if (mot != NULL) {
      unsigned int motionCol = getNumConditionBases() + maxTrendOrder;
      vnl_matrix<double> motionMat(mot->getMotion(), 1, NUM_MOTION_DIMENSIONS);
      update(motionMat, thisTr, motionCol);
    }
  }

  return true;
}
Exemplo n.º 5
0
Motion::Motion()
{
    motionMat(0,0) = 1;
    motionMat(0,1) = 0;
    motionMat(0,2) = 0;
    motionMat(1,0) = 0;
    motionMat(1,1) = 1;
    motionMat(1,2) = 0;

}