Skip to content

Commit 9975e70

Browse files
committed
refactor: rename resolution enum to model and update initialization method
1 parent 99125dd commit 9975e70

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

tools/include/retinify/tools/pipeline.hpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace retinify::tools
1313
{
1414
/// @brief
15-
/// The resolution options for stereo matching pipelines.
16-
enum class Resolution : std::uint8_t
15+
/// The model options for stereo matching pipelines.
16+
enum class Model : std::uint8_t
1717
{
1818
/// height=320, width=640
1919
SMALL,
@@ -36,12 +36,12 @@ class RETINIFY_API StereoMatchingPipeline
3636
auto operator=(StereoMatchingPipeline &&other) noexcept -> StereoMatchingPipeline & = delete;
3737

3838
/// @brief
39-
/// Initializes the stereo matching pipeline with the specified processing resolution.
40-
/// @param resolution
41-
/// The processing resolution to use for the stereo matching pipeline.
39+
/// Initializes the stereo matching pipeline with the specified processing model.
40+
/// @param model
41+
/// The processing model to use for the stereo matching pipeline.
4242
/// @return
4343
/// A Status object indicating whether initialization succeeded.
44-
[[nodiscard]] auto Initialize(Resolution resolution = Resolution::LARGE) noexcept -> Status;
44+
[[nodiscard]] auto Initialize(Model model = Model::LARGE) noexcept -> Status;
4545

4646
/// @brief
4747
/// Runs the stereo matching pipeline.
@@ -53,6 +53,9 @@ class RETINIFY_API StereoMatchingPipeline
5353
/// The output disparity map as a `cv::Mat`.
5454
/// @return
5555
/// A Status object indicating whether the operation succeeded.
56+
/// @note
57+
/// Input images are resized internally, so as long as the left and right
58+
/// images share the same dimensions, their original sizes don’t matter.
5659
[[nodiscard]] auto Run(const cv::Mat &leftImage, const cv::Mat &rightImage, cv::Mat &disparity) const noexcept -> Status;
5760

5861
/// @brief
@@ -68,6 +71,9 @@ class RETINIFY_API StereoMatchingPipeline
6871
/// If the value is less than or equal to 0, the check will be skipped.
6972
/// @return
7073
/// A Status object indicating whether the operation succeeded.
74+
/// @note
75+
/// Input images are resized internally, so as long as the left and right
76+
/// images share the same dimensions, their original sizes don’t matter.
7177
[[nodiscard]] auto RunWithLeftRightConsistencyCheck(const cv::Mat &leftImage, const cv::Mat &rightImage, cv::Mat &disparity, //
7278
float maxDisparityDifference = 1.0F) const noexcept -> Status;
7379

tools/src/pipeline.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,24 @@ static inline auto LRConsistencyCheck(const cv::Mat &leftDisparity, const cv::Ma
6262
return true;
6363
}
6464

65-
auto StereoMatchingPipeline::Initialize(Resolution resolution) noexcept -> Status
65+
auto StereoMatchingPipeline::Initialize(Model model) noexcept -> Status
6666
{
67-
switch (resolution)
67+
switch (model)
6868
{
69-
case Resolution::SMALL:
69+
case Model::SMALL:
7070
matchingHeight_ = 320;
7171
matchingWidth_ = 640;
7272
break;
73-
case Resolution::MEDIUM:
73+
case Model::MEDIUM:
7474
matchingHeight_ = 480;
7575
matchingWidth_ = 640;
7676
break;
77-
case Resolution::LARGE:
77+
case Model::LARGE:
7878
matchingHeight_ = 720;
7979
matchingWidth_ = 1280;
8080
break;
8181
default:
82-
LogError("Invalid resolution specified for LRConsistencyPipeline.");
82+
LogError("Invalid model specified for StereoMatchingPipeline.");
8383
return Status{StatusCategory::USER, StatusCode::INVALID_ARGUMENT};
8484
}
8585

tools/src/utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cv::Mat ColorizeDisparity(const cv::Mat &disparity, int maxDisparity)
1313
if (disparity.empty())
1414
{
1515
retinify::LogError("Disparity map is empty.");
16-
return cv::Mat::zeros(disparity.size(), CV_32FC1);
16+
return cv::Mat();
1717
}
1818

1919
cv::Mat coloredDisparity;

0 commit comments

Comments
 (0)