Browse Source

Update `CameraSource` to support RPi camera

master
Krisjanis Rijnieks 9 years ago
parent
commit
23767bc409
  1. BIN
      example-camera/example-camera.xcodeproj/project.xcworkspace/xcuserdata/kr15h.xcuserdatad/UserInterfaceState.xcuserstate
  2. 10
      example-camera/src/CameraSource.cpp
  3. 11
      example-camera/src/CameraSource.h

BIN
example-camera/example-camera.xcodeproj/project.xcworkspace/xcuserdata/kr15h.xcuserdatad/UserInterfaceState.xcuserstate

Binary file not shown.

10
example-camera/src/CameraSource.cpp

@ -9,13 +9,13 @@ CameraSource::CameraSource(){
vector<ofVideoDevice> devices = _videoGrabber.listDevices();
_cameraFound = false;
for(int i = 0; i < devices.size(); i++){
if(devices[i].bAvailable){
ofLogNotice() << devices[i].id << ": " << devices[i].deviceName;
for(int i = 0; i < devices.size(); i++){
if(devices[i].bAvailable){
ofLogNotice() << devices[i].id << ": " << devices[i].deviceName;
_cameraFound = true;
break;
}
}
}
}
if(_cameraFound){
_videoGrabber.setDeviceID(0);

11
example-camera/src/CameraSource.h

@ -9,6 +9,10 @@
#include "ofMain.h"
#include "FboSource.h"
#ifdef TARGET_RASPBERRY_PI
#include "RPiVideoGrabber.h"
#endif
class CameraSource : public ofx::piMapper::FboSource {
public:
CameraSource();
@ -17,7 +21,12 @@ class CameraSource : public ofx::piMapper::FboSource {
void draw();
private:
ofVideoGrabber _videoGrabber;
#ifdef TARGET_RASPBERRY_PI
RPiVideoGrabber _videoGrabber;
#else
ofVideoGrabber _videoGrabber;
#endif
int _cameraWidth;
int _cameraHeight;
bool _cameraFound;

Loading…
Cancel
Save