mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-09-14 12:00:19 +08:00
feat: add support for Y12C4 format in OBFormatFromString and OBFormatToString functions
This commit is contained in:
+15
-12
@@ -340,6 +340,8 @@ OBFormat OBFormatFromString(const std::string &format) {
|
||||
return OB_FORMAT_BYR2;
|
||||
} else if (fixed_format == "RW16") {
|
||||
return OB_FORMAT_RW16;
|
||||
} else if (fixed_format == "Y12C4") {
|
||||
return OB_FORMAT_Y12C4;
|
||||
}
|
||||
// else if (fixed_format == "DISP16") {
|
||||
// return OB_FORMAT_DISP16;
|
||||
@@ -417,6 +419,8 @@ std::string OBFormatToString(const OBFormat &format) {
|
||||
return "BYR2";
|
||||
case OB_FORMAT_RW16:
|
||||
return "RW16";
|
||||
case OB_FORMAT_Y12C4:
|
||||
return "Y12C4";
|
||||
// case OB_FORMAT_DISP16:
|
||||
// return "DISP16";
|
||||
default:
|
||||
@@ -935,19 +939,18 @@ std::string getDistortionModels(OBCameraDistortion distortion) {
|
||||
}
|
||||
|
||||
std::string calcMD5(const std::string &data) {
|
||||
unsigned char digest[EVP_MAX_MD_SIZE];
|
||||
unsigned int digest_len = 0;
|
||||
unsigned char digest[EVP_MAX_MD_SIZE];
|
||||
unsigned int digest_len = 0;
|
||||
|
||||
EVP_MD_CTX* ctx = EVP_MD_CTX_new();
|
||||
EVP_DigestInit_ex(ctx, EVP_md5(), nullptr);
|
||||
EVP_DigestUpdate(ctx, data.data(), data.size());
|
||||
EVP_DigestFinal_ex(ctx, digest, &digest_len);
|
||||
EVP_MD_CTX_free(ctx);
|
||||
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
|
||||
EVP_DigestInit_ex(ctx, EVP_md5(), nullptr);
|
||||
EVP_DigestUpdate(ctx, data.data(), data.size());
|
||||
EVP_DigestFinal_ex(ctx, digest, &digest_len);
|
||||
EVP_MD_CTX_free(ctx);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << std::hex << std::setfill('0');
|
||||
for (unsigned int i = 0; i < digest_len; ++i)
|
||||
ss << std::setw(2) << (int)digest[i];
|
||||
return ss.str();
|
||||
std::stringstream ss;
|
||||
ss << std::hex << std::setfill('0');
|
||||
for (unsigned int i = 0; i < digest_len; ++i) ss << std::setw(2) << (int)digest[i];
|
||||
return ss.str();
|
||||
}
|
||||
} // namespace orbbec_camera
|
||||
|
||||
Reference in New Issue
Block a user