提交 6056c849 编写于 作者: E Egor Pugin

[image] Mark PIX** cast explicit to prevent implicit bool checks in ternary operators.

上级 536112ce
...@@ -203,12 +203,12 @@ std::tuple<bool, Image, Image, Image> ImageThresholder::Threshold( ...@@ -203,12 +203,12 @@ std::tuple<bool, Image, Image, Image> ImageThresholder::Threshold(
int r; int r;
if (method == ThresholdMethod::Sauvola) { if (method == ThresholdMethod::Sauvola) {
r = pixSauvolaBinarizeTiled(pix_grey, 25, 0.40, 300, 300, pix_thresholds, r = pixSauvolaBinarizeTiled(pix_grey, 25, 0.40, 300, 300, (PIX**)pix_thresholds,
pix_binary); (PIX**)pix_binary);
} else { } else {
// AdaptiveOtsu. // AdaptiveOtsu.
r = pixOtsuAdaptiveThreshold(pix_grey, 300, 300, 0, 0, 0.1, r = pixOtsuAdaptiveThreshold(pix_grey, 300, 300, 0, 0, 0.1,
pix_thresholds, pix_binary); (PIX**)pix_thresholds, (PIX**)pix_binary);
} }
bool ok = (r == 0); bool ok = (r == 0);
......
...@@ -35,7 +35,7 @@ public: ...@@ -35,7 +35,7 @@ public:
bool operator!=(decltype(nullptr)) const { return pix_ != nullptr; } bool operator!=(decltype(nullptr)) const { return pix_ != nullptr; }
explicit operator bool() const { return pix_ != nullptr; } explicit operator bool() const { return pix_ != nullptr; }
operator Pix *() const { return pix_; } operator Pix *() const { return pix_; }
operator Pix **() { return &pix_; } explicit operator Pix **() { return &pix_; }
Pix *operator->() const { return pix_; } Pix *operator->() const { return pix_; }
// api // api
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册