We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7744da9 commit 025689fCopy full SHA for 025689f
ccmain/thresholder.cpp
@@ -181,8 +181,11 @@ void ImageThresholder::SetImage(const Pix* pix) {
181
// Caller must use pixDestroy to free the created Pix.
182
void ImageThresholder::ThresholdToPix(PageSegMode pageseg_mode, Pix** pix) {
183
if (pix_channels_ == 0) {
184
- // We have a binary image, so it just has to be cloned.
185
- *pix = GetPixRect();
+ // We have a binary image, but it still has to be copied, as this API
+ // allows the caller to modify the output.
186
+ Pix* original = GetPixRect();
187
+ *pix = pixCopy(nullptr, original);
188
+ pixDestroy(&original);
189
} else {
190
OtsuThresholdRectToPix(pix_, pix);
191
}
0 commit comments