Created
October 8, 2014 14:45
-
-
Save ofTheo/c7de2672736bf246fa3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------- | |
void testApp::setup(){ | |
vector <AlliedCamera::CameraInfo> cameras = AlliedCamera::ListDevices(); | |
if( cameras.size() ){ | |
//true means block until the camera is opened and frames are coming in. | |
if( camera.openCamera(0, true) ){ | |
cout << " camera opened " << endl; | |
} | |
} | |
//this is a control panel we are using to display sliders | |
panel.setup("camera", 0, 0, 1920, 1000); | |
panel.addDrawableRect("view", &texture, 640, 480); | |
panel.setWhichColumn(1); | |
//get a list of camera params - the CameraParam object uses different variables based on the param type | |
vector <AlliedCamera::CameraParam> params = camera.getCameraParameters(); | |
//here is an example of querying the params | |
for(int i = 0; i < params.size(); i++){ | |
if( params[i].getType() == ePvDatatypeFloat32 ){ | |
panel.addSlider(params[i].getName(), params[i].getValueF(), params[i].getMinValueF(), params[i].getMaxValueF()); | |
} | |
else if( params[i].getType() == ePvDatatypeUint32 ){ | |
if(paramInclude[j] == "ExposureValue"){ | |
panel.addSliderInt(params[i].getName(), params[i].getValueUL(), params[i].getMinValueUL(), params[i].getMaxValueUL()/100); | |
}else{ | |
panel.addSliderInt(params[i].getName(), params[i].getValueUL(), params[i].getMinValueUL(), params[i].getMaxValueUL()); | |
} | |
} | |
else if( params[i].getType() == ePvDatatypeEnum ){ | |
panel.addTextDropDown(params[i].getName(), params[i].getEnumSelected(), params[i].getEnumValues()); | |
} | |
else if( params[i].getType() == ePvDatatypeString ){ | |
panel.addLabel(params[i].getName() + ": " + params[i].getValueS()); | |
} | |
} | |
} | |
//-------------------------------------------------------------- | |
void testApp::update(){ | |
panel.update(); | |
camera.update(); | |
if( camera.isFrameNew() ){ | |
//cout << " frame new !!!! " << endl; | |
ofPixels pix = camera.getPixelsRef(); | |
texture.loadData(pix); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment