Skip to content

Conversation

bertsky
Copy link
Contributor

@bertsky bertsky commented Jun 12, 2025

The error I got by calling cvtColor as it was:

OpenCV(4.8.0) /io/opencv/modules/imgproc/src/color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function 'cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<1>; VDcn = cv::impl::{anonymous}::Set<3, 4>; VDepth = cv::impl::{anonymous}::Set<0, 2, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = cv::impl::<unnamed>::NONE; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]'
> Invalid number of channels in input image:
>     'VScn::contains(scn)'
> where
>     'scn' is 2

Removing the alpha channel in advance avoids the problem.

But perhaps we should not naively drop the channel, but use it (somehow) to mask the image? (I.e. for segmentation: no layout analysis in fully transparent zones, for binarization: pure background)

@cneud cneud requested a review from vahidrezanezhad June 13, 2025 07:14
@vahidrezanezhad
Copy link
Member

vahidrezanezhad commented Aug 28, 2025

@bertsky @kba @cneud Even without any changes, including this PR, Eynollah (which I tested using my latest PR ) works correctly on this image with an alpha channel
. It seems this issue happens with other images with alpha channel. can you provide me images with alpha channel that this issue happens @bertsky ?

@kba
Copy link
Contributor

kba commented Sep 26, 2025

If we decide to move ahead with this, we should backport that to OCR-D/core whence I took it originally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants