Skip to content

Commit

Permalink
Fix ImageThresholder::OtsuThresholdRectToPix for OpenCL
Browse files Browse the repository at this point in the history
The ThresholdRectToPix OpenCL kernel only supports 4 channels.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Aug 1, 2018
1 parent c044b8c commit 8af80b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ccmain/thresholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ void ImageThresholder::OtsuThresholdRectToPix(Pix* src_pix,
// only use opencl if compiled w/ OpenCL and selected device is opencl
#ifdef USE_OPENCL
OpenclDevice od;
if ((num_channels == 4 || num_channels == 1) &&
od.selectedDeviceIsOpenCL() && rect_top_ == 0 && rect_left_ == 0 ) {
if (num_channels == 4 &&
od.selectedDeviceIsOpenCL() && rect_top_ == 0 && rect_left_ == 0) {
od.ThresholdRectToPixOCL((unsigned char*)pixGetData(src_pix), num_channels,
pixGetWpl(src_pix) * 4, thresholds, hi_values,
out_pix /*pix_OCL*/, rect_height_, rect_width_,
Expand Down

0 comments on commit 8af80b7

Please sign in to comment.