Rotate Texture/Facetracking/Camera picture

Hey there lovely people!

I am a little bit stuck in a rut with an opencv / facetracking project and I hope that maybe one of you can help me out a little bit? That would make my day/week and month!

Here it goes:
For an installation I am using an external screen in portrait (and not landscape) view, attached is also a webcam in portrait mode. Now I am running into the problem that I have to rotate both, the camera picture, the face-tracker and the resulting image.
I tried going through past forum entries - but so far nothing has quite helped.

Maybe one of you guys and gals can help me out?

I will attach the code , even it it might be a bit lengthy.
Thank you so much for reading!
Best,
Anna

#include "ofApp.h"

using namespace ofxCv;
using namespace cv;

float smileFactor = 0;

void ofApp::setup() {
    //ofBackground(0,0,0);     background color to black
	ofSetVerticalSync(true);
	ofSetFrameRate(60);
	finder.setup("haarcascade_frontalface_default.xml");
	finder.setPreset(ObjectFinder::Fast);
	finder.getTracker().setSmoothingRate(.3);
	cam.setup(640, 480);
    sunglasses.load("Smiling_Face_Emoji_large.png");
    slightlysmiling.load("Confused_Face_Emoji_large.png");
	ofEnableAlphaBlending();
    smile.setup();
}

void ofApp::update() {
	cam.update();
	if(cam.isFrameNew()) {
        ofTexture tex = cam.getTexture();  //  ->This needs to be rotated I think
	finder.update(cam);   //  ->This needs to be rotated I think
        smile.update(cam);  //  ->This needs to be rotated I think
        if(smile.getFaceFound()){
            float cur = smile.getSmileAmount();
            graph.add(cur);
            ofLog() << graph.getNormalized(cur);
            smileFactor  = graph.getNormalized(cur);
          
        }
	}
}

void ofApp::draw() {
    ofSetColor(255);
	cam.draw(0, 0);  //  ->This needs to be rotated I think, too


	for(int i = 0; i < finder.size(); i++) {
		ofRectangle object = finder.getObjectSmoothed(i);
        
        slightlysmiling.setAnchorPercent(0.5, 0.5);
        sunglasses.setAnchorPercent(0.5, 0.5);
		float scaleAmount = 1.3 * object.width / slightlysmiling.getWidth();
		ofPushMatrix();
		ofTranslate(object.x + object.width /2., object.y + object.height * .42);
		ofScale(scaleAmount, scaleAmount);
        if (smileFactor >= 0.2){
            sunglasses.draw(0, 0);
        } else{
            slightlysmiling.draw(0, 0);}
        

    
		ofTranslate(object.getPosition());

		ofDrawBitmapStringHighlight(ofToString(finder.getLabel(i)), 0, 0);
		ofDrawLine(ofVec2f(), toOf(finder.getVelocity(i)) * 10);
		ofPopMatrix();
	}

}

void ofApp::keyPressed(int key){
    if(key == 's'){
        grabbed.setFromPixels(cam.getPixels());
        grabbed.save("test.jpg");
    }
}

I would use https://github.com/HalfdanJ/ofxFaceTracker2 and just set setFaceOrientation(ofOrientation orientation) or setFaceRotation(..). Then place your camera in “portrait mode” to match your TV.