mirror of
https://gitcode.com/gh_mirrors/ope/OpenFace.git
synced 2026-05-16 04:08:00 +00:00
Adding camera enumerator project for getting ready for GUI
This commit is contained in:
36
lib/3rdParty/CameraEnumerator/OpenCVDeviceEnumerator.cpp
vendored
Normal file
36
lib/3rdParty/CameraEnumerator/OpenCVDeviceEnumerator.cpp
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
|
||||
#include "DeviceEnumerator.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
/*
|
||||
The id field of the Device struct can be used with an OpenCV VideoCapture object
|
||||
*/
|
||||
|
||||
DeviceEnumerator de;
|
||||
|
||||
// Audio Devices
|
||||
std::map<int, Device> devices = de.getAudioDevicesMap();
|
||||
|
||||
// Print information about the devices
|
||||
for (auto const &device : devices) {
|
||||
std::cout << "== AUDIO DEVICE (id:" << device.first << ") ==" << std::endl;
|
||||
std::cout << "Name: " << device.second.deviceName << std::endl;
|
||||
std::cout << "Path: " << device.second.devicePath << std::endl;
|
||||
}
|
||||
|
||||
// Video Devices
|
||||
devices = de.getVideoDevicesMap();
|
||||
|
||||
// Print information about the devices
|
||||
for (auto const &device : devices) {
|
||||
std::cout << "== VIDEO DEVICE (id:" << device.first << ") ==" << std::endl;
|
||||
std::cout << "Name: " << device.second.deviceName << std::endl;
|
||||
std::cout << "Path: " << device.second.devicePath << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user