12 #include <mrpt/3rdparty/do_opencv_includes.h> 17 #if MRPT_HAS_MYNTEYE_D 18 #include <mynteyed/camera.h> 19 #include <mynteyed/utils.h> 27 #if MRPT_HAS_MYNTEYE_D 29 std::make_shared<mynteyed::Camera>();
30 mynteyed::DeviceInfo dev_info;
34 #if MRPT_HAS_MYNTEYE_D 46 for (
int k = 0; k < 5; k++) p.
dist[k] = i.coeffs[k];
56 #if MRPT_HAS_MYNTEYE_D 61 mynteyed::util::print_stream_infos(
65 params.color_mode = mynteyed::ColorMode::COLOR_RECTIFIED;
66 params.stream_mode = mynteyed::StreamMode::STREAM_1280x720;
69 mynteyed::StreamMode stream_mode =
params.stream_mode;
71 std::cout << std::endl;
76 std::cout <<
"[CMyntEyeCamera] Open device successful.\n";
78 mynteyed::StreamIntrinsics si =
79 m_capture->cam->GetStreamIntrinsics(stream_mode);
84 std::cout <<
"LEFT camera intrinsics:\n" 86 std::cout <<
"RIGHT camera intrinsics:\n" 89 std::cout <<
"Waiting for streams...\n";
91 std::cout <<
"Streams started OK.\n";
105 #if MRPT_HAS_MYNTEYE_D && MRPT_HAS_OPENCV 108 mynteyed::StreamData image_color, image_depth;
110 for (
int nRetries = 0; nRetries < 100; nRetries++)
112 if (!image_color.img)
113 image_color =
m_capture->cam->GetStreamData(
114 mynteyed::ImageType::IMAGE_LEFT_COLOR);
116 if (!image_depth.img)
118 m_capture->cam->GetStreamData(mynteyed::ImageType::IMAGE_DEPTH);
120 if (image_color.img && image_depth.img)
124 std::this_thread::sleep_for(std::chrono::milliseconds(1));
131 if (!image_color.img && !image_depth.img)
return false;
139 auto i = image_color.img->To(mynteyed::ImageFormat::COLOR_BGR);
142 i->data_size(),
static_cast<size_t>(i->width() * i->height() * 3));
144 cv::Mat m(i->height(), i->width(), CV_8UC3, i->data());
146 out.hasIntensityImage =
true;
154 auto i = image_depth.img->To(mynteyed::ImageFormat::DEPTH_RAW);
156 const auto h = i->height(), w = i->width();
158 out.hasRangeImage =
true;
161 out.range_is_depth =
true;
163 out.rangeImage_setSize(h, w);
164 out.rangeUnits = 1e-3f;
167 i->data_size(),
static_cast<size_t>(i->width() * i->height() * 2));
168 cv::Mat m(i->height(), i->width(), CV_16UC1, i->data());
170 for (
int r = 0; r < h; r++)
172 for (
int c = 0; c < w; c++)
174 const uint16_t v = m.at<uint16_t>(r, c);
175 out.rangeImage.coeffRef(r, c) = v;
bool m_bInitialized
Set to false if we could not initialize the camera.
#define THROW_EXCEPTION(msg)
double fx() const
Get the value of the focal length x-value (in pixels).
#define MRPT_LOAD_CONFIG_VAR_CS(variableName, variableType)
Shortcut for MRPT_LOAD_CONFIG_VAR() for config file object named c and section string named s ...
double fy() const
Get the value of the focal length y-value (in pixels).
A range or depth 3D scan measurement, as from a time-of-flight range camera or a structured-light dep...
Contains classes for various device interfaces.
mrpt::vision::TStereoCalibParams params
std::string dumpAsText() const
Dumps all the parameters as a multi-line string, with the same format than saveToConfigFile.
CMyntEyeCamera(const TMyntEyeCameraParameters ¶ms)
static time_point now() noexcept
Returns the current time using the currently selected Clock source.
#define ASSERT_(f)
Defines an assertion mechanism.
This class allows loading and storing values and vectors of different types from a configuration text...
double cy() const
Get the value of the principal point y-coordinate (in pixels).
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
bool getObservation(mrpt::obs::CObservation3DRangeScan &out)
Grab an image from the opened camera.
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
Parameters for the Brown-Conrady camera lens distortion model.
std::array< double, 8 > dist
[k1 k2 t1 t2 k3 k4 k5 k6] -> k_i: parameters of radial distortion, t_i: parameters of tangential dist...
Open parameters for CMyntEyeCamera.
double cx() const
Get the value of the principal point x-coordinate (in pixels).
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::uint8_t ir_intensity
IR (Infrared), range [0,10], default 0.
mrpt::vision::TStereoCalibResults out
Deep copy: the copied object has a duplicate of all data, becoming independent.
mrpt::img::TCamera m_intrinsics_right
mrpt::pimpl< Impl > m_capture
pimpl< T > make_impl(Args &&... args)
uint32_t ncols
Camera resolution.
Wrapper on MYNT-EYE-D cameras.
virtual ~CMyntEyeCamera()
mrpt::img::TCamera m_intrinsics_left