refactor(intrinsics): apply base intrinsics
This commit is contained in:
@@ -187,14 +187,18 @@ class MYNTEYE_API API {
|
||||
std::string GetInfo(const Info &info) const;
|
||||
|
||||
/**
|
||||
* Get the intrinsics of stream.
|
||||
* @deprecated Get the intrinsics (pinhole) of stream.
|
||||
*/
|
||||
Intrinsics GetIntrinsics(const Stream &stream) const;
|
||||
IntrinsicsPinhole GetIntrinsics(const Stream &stream) const;
|
||||
/**
|
||||
* Get the intrinsics of stream.
|
||||
*/
|
||||
template<typename T>
|
||||
T GetIntrinsics(const Stream &from) const;
|
||||
template <typename T>
|
||||
T GetIntrinsics(const Stream &stream) const;
|
||||
/**
|
||||
* Get the intrinsics base of stream.
|
||||
*/
|
||||
std::shared_ptr<IntrinsicsBase> GetIntrinsicsBase(const Stream &stream) const;
|
||||
/**
|
||||
* Get the extrinsics from one stream to another.
|
||||
*/
|
||||
@@ -311,8 +315,9 @@ class MYNTEYE_API API {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T API::GetIntrinsics(const Stream &from) const {
|
||||
return device_->GetIntrinsics<T>(from);
|
||||
T API::GetIntrinsics(const Stream &stream) const {
|
||||
auto in = GetIntrinsicsBase(stream);
|
||||
return *std::dynamic_pointer_cast<T>(in);
|
||||
}
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace device {
|
||||
|
||||
typedef struct ImgParams {
|
||||
bool ok;
|
||||
Intrinsics in_left;
|
||||
Intrinsics in_right;
|
||||
std::shared_ptr<IntrinsicsBase> in_left;
|
||||
std::shared_ptr<IntrinsicsBase> in_right;
|
||||
Extrinsics ex_right_to_left;
|
||||
} img_params_t;
|
||||
|
||||
|
||||
@@ -153,12 +153,7 @@ 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;
|
||||
std::shared_ptr<IntrinsicsBase> GetIntrinsics(const Stream &stream) const;
|
||||
/**
|
||||
* Get the extrinsics from one stream to another.
|
||||
*/
|
||||
@@ -175,7 +170,8 @@ class MYNTEYE_API Device {
|
||||
/**
|
||||
* Get the intrinsics of stream.
|
||||
*/
|
||||
Intrinsics GetIntrinsics(const Stream &stream, bool *ok) const;
|
||||
std::shared_ptr<IntrinsicsBase> GetIntrinsics(
|
||||
const Stream &stream, bool *ok) const;
|
||||
/**
|
||||
* Get the extrinsics from one stream to another.
|
||||
*/
|
||||
@@ -193,7 +189,8 @@ class MYNTEYE_API Device {
|
||||
/**
|
||||
* Set the intrinsics of stream.
|
||||
*/
|
||||
void SetIntrinsics(const Stream &stream, const Intrinsics &in);
|
||||
void SetIntrinsics(const Stream &stream,
|
||||
const std::shared_ptr<IntrinsicsBase> &in);
|
||||
/**
|
||||
* Set the extrinsics from one stream to another.
|
||||
*/
|
||||
@@ -332,7 +329,7 @@ class MYNTEYE_API Device {
|
||||
std::map<Resolution, device::img_params_t> all_img_params_;
|
||||
device::imu_params_t imu_params_;
|
||||
|
||||
std::map<Stream, Intrinsics> stream_intrinsics_;
|
||||
std::map<Stream, std::shared_ptr<IntrinsicsBase>> stream_intrinsics_;
|
||||
std::map<Stream, std::map<Stream, Extrinsics>> stream_from_extrinsics_;
|
||||
|
||||
std::shared_ptr<MotionIntrinsics> motion_intrinsics_;
|
||||
@@ -365,13 +362,6 @@ 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_
|
||||
|
||||
@@ -414,6 +414,7 @@ struct MYNTEYE_API IntrinsicsBase {
|
||||
IntrinsicsBase() {
|
||||
calib_model = CalibrationModel::CALIB_MODEL_UNKNOW;
|
||||
}
|
||||
virtual ~IntrinsicsBase() {}
|
||||
CalibrationModel calib_model;
|
||||
};
|
||||
|
||||
@@ -447,8 +448,7 @@ MYNTEYE_API
|
||||
std::ostream &operator<<(std::ostream &os, const IntrinsicsPinhole &in);
|
||||
|
||||
/**
|
||||
* @ingroup calibration
|
||||
* Stream intrinsics (Pinhole)
|
||||
* @deprecated Replaced by IntrinsicsPinhole.
|
||||
*/
|
||||
using Intrinsics = IntrinsicsPinhole;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user