3 #include <opencv2/core/core.hpp>
4 #include <opencv2/imgcodecs.hpp>
5 #include <opencv2/imgproc/imgproc.hpp>
7 #include <SimoxUtility/algorithm/string.h>
8 #include <SimoxUtility/filesystem/list_directory.h>
9 #include <SimoxUtility/json.h>
10 #include <SimoxUtility/shapes/AxisAlignedBoundingBox.h>
11 #include <SimoxUtility/shapes/OrientedBox.h>
18 #include <VisionX/libraries/armem_human/aron/Profile.aron.generated.h>
23 namespace fs = std::filesystem;
26 const path& absPackageDataDir,
27 const path& relativePath,
28 const std::string&
id) :
29 _packageName(packageName),
30 _absPackageDataDir(absPackageDataDir),
31 _relativePath(relativePath),
55 Info::_relativeProfileDirectory()
const
57 return _relativePath / _id;
61 Info::file(
const std::string& _extension,
const std::string& suffix)
const
63 std::string extension = _extension;
64 if (extension.at(0) !=
'.')
66 extension =
"." + extension;
68 std::string
filename = _id + suffix + extension;
77 std::string name = _id + suffix;
78 return PackagePath(_packageName, _relativeProfileDirectory() / name);
93 std::vector<PackagePath>
98 std::vector<PackagePath> imageFiles;
100 for (
const fs::path&
path : simox::fs::list_directory(directory.
toSystemPath(), local))
102 for (
const std::string& ext : extensions)
107 _relativeProfileDirectory() / (_id +
"_faces-images") /
109 imageFiles.push_back(imageFile);
116 std::optional<Info::Profile>
122 j = nlohmann::read_json(
profileJson().toSystemPath());
124 catch (
const std::exception& e)
137 cv::imread(imagePath.toSystemPath().string(), cv::ImreadModes::IMREAD_COLOR);
138 cv::cvtColor(image, image, cv::ColorConversionCodes::COLOR_BGR2RGB);
140 armarx::arondto::PackagePath packagePath;
141 toAron(packagePath, imagePath);
143 armarx::human::arondto::FaceImage faceImage;
144 faceImage.filepath = packagePath;
145 faceImage.image = image;
146 toAron(profile.faceImages.emplace_back(), faceImage);
154 namespace fs = std::filesystem;
157 if (!fs::is_regular_file(
profileJson().toSystemPath()))
161 ARMARX_WARNING <<
"Expected simox object file for object " << *
this <<
": "
175 return os << rhs.
id();