Hi guys,
I’m new to the forum but not in using OF. I’m starting making some experiment using a Realsense camera and I would like to get the infrared frame from it.
I’m using the HiroMTB ofxRealsense2 addon.
after some struggling with the realsense 2.50 library itself, I was eventually able to enable color and depth streams and to make some post-processing on the acquired data.
But when it comes to enable the IR stream, my application is complaining of an execution error just after enabling the stream:
terminate called after throwing an instance of 'rs2::error'
what(): Couldn't resolve requests
This is the my ofApp.h
file:
#pragma once
#include "ofMain.h"
#include <librealsense2/rs.hpp>
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
// REALSENSE STUFF
rs2::pipeline pipe;
rs2::config config;
};
This is the my ofApp.cpp
file:
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup() {
ofSetFrameRate(30);
ofSetVerticalSync(true);
ofSetLogLevel(OF_LOG_NOTICE);
ofEnableAlphaBlending();
ofLogNotice() << "abilito lo stream infrared";
config.enable_stream(RS2_STREAM_INFRARED, 848, 480, RS2_FORMAT_Y8, 15);
ofLogNotice() << "dopo abilitato lo stream infrared";
pipe.start( config );
}
//--------------------------------------------------------------
void ofApp::update(){
auto framesSet = pipe.wait_for_frames();
auto infraredFrame = framesSet.get_infrared_frame(0);
if( !infraredFrame ) { return; }
}
//--------------------------------------------------------------
void ofApp::draw() {
ofBackground(200);
ofDrawBitmapStringHighlight("FPS: " + ofToString(ofGetFrameRate(), 0), ofGetWidth()-100, 20);
}
Anyone had experience the same error before?
How can I solve this issue?
I’ve found some working example inside the Perevalovds ofxRealSense addon but I suspect that an old version of the library is being used and, anyway, I can’t understand how, even if I follow similar configuration steps, it can’t get the infrared stream to work.
Thank you so much for your support