Skip to content

Instantly share code, notes, and snippets.

@madc
Last active May 4, 2019 14:53
Show Gist options
  • Save madc/6242291 to your computer and use it in GitHub Desktop.
Save madc/6242291 to your computer and use it in GitHub Desktop.
Find cam by device name instead of id. (openFrameworks)
string deviceName = "Logitech Camera";
vector<ofVideoDevice> devices = vidGrabber.listDevices();
for(vector<ofVideoDevice>::iterator it = devices.begin(); it != devices.end(); ++it) {
if(it->deviceName == deviceName) {
vidGrabber.setDeviceID(it->id);
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment