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 = suffix + extension;
77 std::string name = suffix;
78 return PackagePath(_packageName, _relativeProfileDirectory() / name);
84 return file(
".json",
"profile");
94 std::vector<PackagePath>
99 std::vector<PackagePath> imageFiles;
101 for (
const fs::path&
path : simox::fs::list_directory(directory.
toSystemPath(), local))
103 for (
const std::string& ext : extensions)
108 _relativeProfileDirectory() /
"faces-images" /
110 imageFiles.push_back(imageFile);
117 std::optional<Info::Profile>
123 j = nlohmann::read_json(
profileJson().toSystemPath());
125 catch (
const std::exception& e)
138 cv::imread(imagePath.toSystemPath().string(), cv::ImreadModes::IMREAD_COLOR);
139 cv::cvtColor(image, image, cv::ColorConversionCodes::COLOR_BGR2RGB);
141 armarx::arondto::PackagePath packagePath;
142 toAron(packagePath, imagePath);
144 armarx::human::arondto::FaceImage faceImage;
145 faceImage.filepath = packagePath;
146 faceImage.image = image;
147 toAron(profile.faceImages.emplace_back(), faceImage);
155 namespace fs = std::filesystem;
158 if (!fs::is_regular_file(
profileJson().toSystemPath()))
162 ARMARX_WARNING <<
"Expected simox object file for object " << *
this <<
": "
176 return os << rhs.
id();