feat(samples): modified get_img_params for default intrinsics

This commit is contained in:
Osenberg 2019-08-06 20:23:22 +08:00
parent 2260f5c582
commit acabe04a92
3 changed files with 31 additions and 0 deletions

View File

@ -369,6 +369,8 @@ class MYNTEYE_API API {
*/ */
bool ConfigDisparityFromFile(const std::string& config_file); bool ConfigDisparityFromFile(const std::string& config_file);
bool IsDefaultIntrinsics();
private: private:
std::shared_ptr<Device> device_; std::shared_ptr<Device> device_;

View File

@ -53,5 +53,16 @@ int main(int argc, char *argv[]) {
LOG(INFO) << *info; LOG(INFO) << *info;
} }
if (api->IsDefaultIntrinsics()) {
LOG(WARNING) << "Default intrinsics are currently being used.";
LOG(WARNING) << "Image params not found, but we need it to process the "
"images. Please `make tools` and use `img_params_writer` "
"to write the image params. If you update the SDK from "
"1.x, the `SN*.conf` is the file contains them. Besides, "
"you could also calibrate them by yourself. Read the guide "
"doc (https://github.com/slightech/MYNT-EYE-SDK-2-Guide) "
"to learn more.";
}
return 0; return 0;
} }

View File

@ -589,4 +589,22 @@ bool API::ConfigDisparityFromFile(const std::string& config_file) {
return synthetic_->ConfigDisparityFromFile(config_file); return synthetic_->ConfigDisparityFromFile(config_file);
} }
bool API::IsDefaultIntrinsics() {
if (device_ != nullptr) {
return device_->CheckImageParams();
if (device_->CheckImageParams()) {
LOG(WARNING) << "Default intrinsics are currently being used.";
LOG(FATAL) << "Image params not found, but we need it to process the "
"images. Please `make tools` and use `img_params_writer` "
"to write the image params. If you update the SDK from "
"1.x, the `SN*.conf` is the file contains them. Besides, "
"you could also calibrate them by yourself. Read the guide "
"doc (https://github.com/slightech/MYNT-EYE-SDK-2-Guide) "
"to learn more.";
}
}
return false;
}
MYNTEYE_END_NAMESPACE MYNTEYE_END_NAMESPACE