Skip to content

Commit

Permalink
Rotation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HalfdanJ committed Jun 16, 2016
1 parent c9362d0 commit 45765da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ofxFaceTracker2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ bool ofxFaceTracker2::update(Mat image, cv::Rect _roi) {
}

// Update info object
if(info.inputWidth != image.cols || info.inputHeight != image.rows){
if(info.inputWidth != image.cols || info.inputHeight != image.rows || info.imageRotation != imageRotation){
info = ofxFaceTracker2InputInfo(image.cols, image.rows, im.cols, im.rows, imageRotation);
}

Expand Down
9 changes: 5 additions & 4 deletions src/ofxFaceTracker2Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ ofxFaceTracker2Landmarks & ofxFaceTracker2Instance::getLandmarks(){
}

ofRectangle ofxFaceTracker2Instance::getBoundingBox() const {
return ofRectangle(rectangle.left(),
rectangle.top(),
rectangle.width(),
rectangle.height());
ofVec3f tl = ofVec3f(rectangle.tl_corner().x(), rectangle.tl_corner().y(), 0) * info.rotationMatrix;
ofVec3f br = ofVec3f(rectangle.br_corner().x(), rectangle.br_corner().y(), 0) * info.rotationMatrix;
ofVec3f delta = br-tl;

return ofRectangle(tl.x, tl.y, delta.x, delta.y);
}

int ofxFaceTracker2Instance::getLabel(){
Expand Down

0 comments on commit 45765da

Please sign in to comment.