MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / m_camera

Function m_camera

plugins/videobasedtracker/com_osvr_VideoBasedHMDTracker.cpp:93–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 int devNumber = 0)
92#ifndef VBHMD_FAKE_IMAGES
93 : m_camera(std::move(camera))
94#endif
95 {
96 // Set the number of threads for OpenCV to use.
97 cv::setNumThreads(1);
98
99 // Initialize things from parameters and from defaults. Do it here
100 // rather than in an initialization list so that we're independent of
101 // member order declaration.
102 m_channel = 0;
103 m_type = Unknown;
104
105 /// Create the initialization options
106 OSVR_DeviceInitOptions opts = osvrDeviceCreateInitOptions(ctx);
107
108 // Configure the tracker interface.
109 osvrDeviceTrackerConfigure(opts, &m_tracker);
110
111 /// Come up with a device name
112 std::ostringstream os;
113 os << "TrackedCamera" << devNumber << "_" << m_channel;
114
115 /// Create an asynchronous (threaded) device
116 m_dev.initAsync(ctx, os.str(), opts);
117
118 /// Send JSON descriptor
119 m_dev.sendJsonDescriptor(com_osvr_VideoBasedHMDTracker_json);
120
121 /// Register update callback
122 m_dev.registerUpdateCallback(this);
123
124 //===============================================
125 // Figure out what type of HMD we're using.
126 int height = 0;
127 int width = 0;
128#ifdef VBHMD_FAKE_IMAGES
129 // Read a vector of images, which we'll loop through.
130 int imageNum = 1;
131 do {
132 std::ostringstream fileName;
133 fileName << VBHMD_FAKE_IMAGES << "/";
134 fileName << std::setfill('0') << std::setw(4) << imageNum++;
135 fileName << ".tif";
136 cv::Mat image;
137#ifdef VBHMD_DEBUG
138 std::cout << "Trying to read image from " << fileName.str()
139 << std::endl;
140#endif
141 image = cv::imread(fileName.str().c_str(), CV_LOAD_IMAGE_COLOR);
142 if (!image.data) {
143 break;
144 }
145 m_images.push_back(image);
146 } while (true);
147 m_currentImage = 0;
148
149 if (m_images.size() == 0) {
150 std::cerr << "Could not read any images from " << VBHMD_FAKE_IMAGES

Callers

nothing calls this directly

Calls 15

createHDKLedIdentifierFunction · 0.85
initAsyncMethod · 0.80
strMethod · 0.80
sendJsonDescriptorMethod · 0.80
addSensorMethod · 0.80
read_image_to_memoryMethod · 0.80
isOpenedMethod · 0.80
read_rangeMethod · 0.80
addOculusSensorMethod · 0.80

Tested by

no test coverage detected