refactor(intrinsics): adjust intrinsics types
This commit is contained in:
@@ -190,6 +190,11 @@ class MYNTEYE_API API {
|
||||
* Get the intrinsics of stream.
|
||||
*/
|
||||
Intrinsics GetIntrinsics(const Stream &stream) const;
|
||||
/**
|
||||
* Get the intrinsics of stream.
|
||||
*/
|
||||
template<typename T>
|
||||
T GetIntrinsics(const Stream &from) const;
|
||||
/**
|
||||
* Get the extrinsics from one stream to another.
|
||||
*/
|
||||
@@ -202,11 +207,6 @@ class MYNTEYE_API API {
|
||||
* Get the extrinsics from one stream to motion.
|
||||
*/
|
||||
Extrinsics GetMotionExtrinsics(const Stream &from) const;
|
||||
/**
|
||||
* Get the intrinsics of stream.
|
||||
*/
|
||||
template<typename T>
|
||||
T GetIntrinsics(const Stream &from) const;
|
||||
|
||||
/**
|
||||
* Log all option infos.
|
||||
@@ -315,13 +315,6 @@ T API::GetIntrinsics(const Stream &from) const {
|
||||
return device_->GetIntrinsics<T>(from);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T Device::GetIntrinsics(const Stream &from) const {
|
||||
T res;
|
||||
printf("type %d\n", res.calib_model_);
|
||||
return res;
|
||||
}
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
#endif // MYNTEYE_API_API_H_
|
||||
|
||||
@@ -154,6 +154,11 @@ class MYNTEYE_API Device {
|
||||
* Get the intrinsics of stream.
|
||||
*/
|
||||
Intrinsics GetIntrinsics(const Stream &stream) const;
|
||||
/**
|
||||
* Get the intrinsics of stream.
|
||||
*/
|
||||
template<typename T>
|
||||
T GetIntrinsics(const Stream &from) const;
|
||||
/**
|
||||
* Get the extrinsics from one stream to another.
|
||||
*/
|
||||
@@ -203,12 +208,6 @@ class MYNTEYE_API Device {
|
||||
*/
|
||||
void SetMotionExtrinsics(const Stream &from, const Extrinsics &ex);
|
||||
|
||||
/**
|
||||
* Get the intrinsics of stream.
|
||||
*/
|
||||
template<typename T>
|
||||
T GetIntrinsics(const Stream &from) const;
|
||||
|
||||
/**
|
||||
* Log all option infos.
|
||||
*/
|
||||
@@ -366,6 +365,13 @@ class MYNTEYE_API Device {
|
||||
friend tools::DeviceWriter;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T Device::GetIntrinsics(const Stream &from) const {
|
||||
T res;
|
||||
printf("type %d\n", res.calib_model_);
|
||||
return res;
|
||||
}
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
#endif // MYNTEYE_DEVICE_DEVICE_H_
|
||||
|
||||
@@ -395,32 +395,35 @@ std::ostream &operator<<(std::ostream &os, const StreamRequest &request);
|
||||
* @brief Intrinsic and extrinsic properties.
|
||||
*/
|
||||
|
||||
/** different model of camera calibration */
|
||||
typedef enum CalibrationModel {
|
||||
/** pinhole camera */
|
||||
CALIB_MODEL_PINHOLE = 0,
|
||||
/** equidistant camera */
|
||||
CALIB_MODEL_KANNALA_BRANDT = 1,
|
||||
|
||||
CALIB_MODEL_UNKNOW,
|
||||
/**
|
||||
* @ingroup calibration
|
||||
* Camera calibration model.
|
||||
*/
|
||||
enum class CalibrationModel : std::uint8_t {
|
||||
/** Unknow */
|
||||
CALIB_MODEL_UNKNOW = 0,
|
||||
/** Pinhole */
|
||||
CALIB_MODEL_PINHOLE = 1,
|
||||
/** Equidistant: KANNALA_BRANDT */
|
||||
CALIB_MODEL_KANNALA_BRANDT = 2,
|
||||
// CALIB_MODEL_SCARAMUZZA,
|
||||
// CALIB_MODEL_MEI
|
||||
}CALIB_MODEL;
|
||||
// CALIB_MODEL_MEI,
|
||||
};
|
||||
|
||||
struct MYNTEYE_API IntrinsicsBase {
|
||||
IntrinsicsBase() {
|
||||
calib_model = CalibrationModel::CALIB_MODEL_UNKNOW;
|
||||
}
|
||||
CalibrationModel calib_model;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup calibration
|
||||
* Stream intrinsics,
|
||||
* Stream intrinsics (Pinhole)
|
||||
*/
|
||||
struct MYNTEYE_API IntrinsicsBase {
|
||||
IntrinsicsBase() {
|
||||
calib_model_ = CALIB_MODEL_UNKNOW;
|
||||
}
|
||||
CALIB_MODEL calib_model_;
|
||||
};
|
||||
|
||||
struct MYNTEYE_API Intrinsics : public IntrinsicsBase {
|
||||
Intrinsics() {
|
||||
calib_model_ = CALIB_MODEL_PINHOLE;
|
||||
struct MYNTEYE_API IntrinsicsPinhole : public IntrinsicsBase {
|
||||
IntrinsicsPinhole() {
|
||||
calib_model = CalibrationModel::CALIB_MODEL_PINHOLE;
|
||||
}
|
||||
/** The width of the image in pixels */
|
||||
std::uint16_t width;
|
||||
@@ -440,25 +443,22 @@ struct MYNTEYE_API Intrinsics : public IntrinsicsBase {
|
||||
double coeffs[5];
|
||||
};
|
||||
|
||||
/*
|
||||
model_type: KANNALA_BRANDT
|
||||
camera_name: KANNALA_BRANDT
|
||||
image_width: 640
|
||||
image_height: 400
|
||||
projection_parameters:
|
||||
k2: 4.9972342319338209e-01
|
||||
k3: 4.3314206872885375e-01
|
||||
k4: -9.2064699153680563e-01
|
||||
k5: 4.1211925379358533e-01
|
||||
mu: 2.0077513040612871e+02
|
||||
mv: 2.0099851605062454e+02
|
||||
u0: 3.1079403134153824e+02
|
||||
v0: 2.1225649273618896e+02
|
||||
*/
|
||||
MYNTEYE_API
|
||||
std::ostream &operator<<(std::ostream &os, const IntrinsicsPinhole &in);
|
||||
|
||||
struct MYNTEYE_API Intrinsics2 : public IntrinsicsBase {
|
||||
Intrinsics2() {
|
||||
calib_model_ = CALIB_MODEL_KANNALA_BRANDT;
|
||||
/**
|
||||
* @ingroup calibration
|
||||
* Stream intrinsics (Pinhole)
|
||||
*/
|
||||
using Intrinsics = IntrinsicsPinhole;
|
||||
|
||||
/**
|
||||
* @ingroup calibration
|
||||
* Stream intrinsics (Equidistant: KANNALA_BRANDT)
|
||||
*/
|
||||
struct MYNTEYE_API IntrinsicsEquidistant : public IntrinsicsBase {
|
||||
IntrinsicsEquidistant() {
|
||||
calib_model = CalibrationModel::CALIB_MODEL_KANNALA_BRANDT;
|
||||
}
|
||||
/** The width of the image in pixels */
|
||||
std::uint16_t width;
|
||||
@@ -475,33 +475,8 @@ struct MYNTEYE_API Intrinsics2 : public IntrinsicsBase {
|
||||
double v0;
|
||||
};
|
||||
|
||||
// union MYNTEYE_API CameraParameters {
|
||||
// struct IntrinsicsBase intrinsics_base;
|
||||
// struct Intrinsics intrinsics10;
|
||||
// struct Intrinsics2 intrinsics20;
|
||||
// unsigned char raw[];
|
||||
// CameraParameters(struct IntrinsicsBase& base) {
|
||||
// memset(raw, 0, sizeof(union CameraParameters));
|
||||
// switch (base.calib_model_) {
|
||||
// case CALIB_MODEL_10:
|
||||
// intrinsics10 = static_cast<struct Intrinsics&>(base);
|
||||
// break;
|
||||
// case CALIB_MODEL_20:
|
||||
// intrinsics20 = static_cast<struct Intrinsics2&>(base);
|
||||
// break;
|
||||
// default:
|
||||
// // warning!!! no impl!!!
|
||||
// intrinsics_base = base;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// CALIB_MODEL getModelType() {return intrinsics_base.calib_model_;}
|
||||
// };
|
||||
// MYNTEYE_API
|
||||
// std::ostream &operator<<(std::ostream &os, const CameraParameters &in);
|
||||
|
||||
MYNTEYE_API
|
||||
std::ostream &operator<<(std::ostream &os, const Intrinsics &in);
|
||||
std::ostream &operator<<(std::ostream &os, const IntrinsicsEquidistant &in);
|
||||
|
||||
/**
|
||||
* @ingroup calibration
|
||||
|
||||
Reference in New Issue
Block a user