mirror of
https://github.com/YutaItoh/3D-Eye-Tracker.git
synced 2025-11-04 15:39:41 +08:00
Initial commit
Handles the stereo Pupil Labs cameras over a single USB. Requires. Libuvc and Pupil Capture: github.com/themrx/PupilCapture
This commit is contained in:
parent
4afddd55e6
commit
f4f0bd902c
56
main/pupil_stereo_cameras.h
Normal file
56
main/pupil_stereo_cameras.h
Normal file
@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
/*
|
||||
example file for use of the pupil cam interface
|
||||
|
||||
Copyright
|
||||
Alexander Plopski
|
||||
NAIST Interactive Media Design Laboratory
|
||||
12.01.2017
|
||||
|
||||
Last modified by Jason Orlosky
|
||||
Osaka University, Cybermedia Center
|
||||
Augusta 29th, 2018
|
||||
*/
|
||||
|
||||
#include <pupilcam/FrameGrabber.hpp>
|
||||
|
||||
const int exposure_max = (int)((1.f / 3) / 0.0001); //convert from seconds into multiple of 0.1ms
|
||||
|
||||
PupilCamera::Camera_Manager *manager;
|
||||
std::vector<std::string> cameras;
|
||||
cv::Mat tmp2;
|
||||
cv::RotatedRect tmp;
|
||||
std::vector<int> exposure;
|
||||
|
||||
void initialize() {
|
||||
manager = new PupilCamera::Camera_Manager();
|
||||
manager->init();
|
||||
manager->update(cameras);
|
||||
std::cout << "number of cameras:" << cameras.size() << "\n";
|
||||
if (cameras.empty())
|
||||
{
|
||||
delete manager;
|
||||
std::cout << "no cameras present. Press any key to exit." << std::endl;
|
||||
std::cin.get();
|
||||
}
|
||||
for (int i = 0; i < cameras.size(); ++i)
|
||||
{
|
||||
PupilCamera::PupilCameraResults status = manager->openCamera(i);
|
||||
if (status != PupilCamera::PupilCameraResults::SUCCESS)
|
||||
{
|
||||
std::cout << "failed to open camera" << i << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
manager->startStream(i, 480, 640, 60, 3);
|
||||
}
|
||||
}
|
||||
exposure.resize(cameras.size(), exposure_max);
|
||||
}
|
||||
|
||||
/*
|
||||
* fetches the frame for left (0) or right (1) camera
|
||||
*/
|
||||
void fetchFrame(cv::Mat &frame, int cameraNum) {
|
||||
manager->grabFrame(cameraNum, frame);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user