Noobie Go Pro Camera unwanted noise


#1

Hello dear List,

noobie and first time poster,

I’m having trouble with some unwanted jitter and a lot of noise, I’m using a Go Pro Hero 6 Camera through an AGPTek USB 3.0 Game Capture / Live Streaming Card, I do not have this problem when using MaxMSP / Jitter , here is a portion of the code, could you please point me to my mistakes?

#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup(){

    ofSetFrameRate(60);
    ofDirectory dir;

    int nFiles = dir.listDir("goyas");
    if(nFiles) {
        for(int i=0; i<dir.size(); i++) {

            // add the image to the vector
            string filePath = dir.getPath(i);
            images.push_back(ofImage());
            images.back().load(filePath);
        }
    }
    else ofLog(OF_LOG_WARNING) << "Could not find folder";

    gui.setup("Parameters", "settings.xml");
    globalGroup.setup("Global");
    globalGroup.add(Background.setup("Background", 0, 0, 255));
    gui.add(& globalGroup);
    mixerGroup.setup("Mixer");
    mixerGroup.setHeaderBackgroundColor(ofColor::darkRed);
    mixerGroup.setBorderColor(ofColor::darkRed);
    mixerGroup.add(image1Alpha.setup("image1", 100, 0, 255));
    mixerGroup.add(image2Alpha.setup("image2", 100, 0, 255));
    mixerGroup.add(image3Alpha.setup("image3", 100, 0, 255));
    mixerGroup.add(videoAlpha.setup("video", 200, 0, 255));
    mixerGroup.add(cameraAlpha.setup("camera", 100, 0, 255));
    gui.add( &mixerGroup);

    bHide = false;


}

//--------------------------------------------------------------
void ofApp::update(){
    //  video.update();
    if( camera.isInitialized()) camera.update();

}

//--------------------------------------------------------------
void ofApp::draw(){
    ofBackground(Background);
    // sequencial controlado con flechas
    //images[abs(num%3)].draw(0, 0, ofGetWidth(), ofGetHeight());
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    ofDisableSmoothing();
    ofSetColor(255, image1Alpha);
    images[0].draw(0, 0, ofGetWidth(), ofGetHeight());
    ofSetColor(255, image2Alpha);
    images[1].draw(0, 0, ofGetWidth(), ofGetHeight());
    ofSetColor(255, image3Alpha);
    images[2].draw(0, 0, ofGetWidth(), ofGetHeight());

    ofSetColor(255, cameraAlpha);
    camera.draw(0, 0, ofGetWidth(), ofGetHeight());

    if(!bHide) {
        gui.draw();
    }

}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    // hide gui
    if(key == 'h') {
        bHide = !bHide;
    }
    if (key == OF_KEY_RIGHT) {
        num++;
        // cout << abs(num%3) << endl;
    }
    if (key == OF_KEY_LEFT) {
        abs(num--);
        //   cout << abs(num%3) << endl;
    }
    if ( key == 'c') {
        camera.setDeviceID(1);
        camera.setDesiredFrameRate(30);
        camera.initGrabber(1280, 720);
    }


}

Many thanks in advance!!

Jorge.