Skip to content

Mask support with CV_Bool in remaining modules - #25951

Open
asmorkalov wants to merge 1 commit into
opencv:5.xfrom
asmorkalov:as/bool_mask
Open

asmorkalov wants to merge 1 commit into
opencv:5.xfrom
asmorkalov:as/bool_mask

Conversation

@asmorkalov

@asmorkalov asmorkalov commented Jul 25, 2024 •

Copy link
Copy Markdown
Contributor

Partially address #25895
Continues #25902

Also:

  • added remap and resize for CV_Bool to support pyramids and masks warping;

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov asmorkalov added this to the 4.11.0 milestone Jul 25, 2024
@asmorkalov asmorkalov added the pr: needs test New functionality requires minimal tests set label Jul 25, 2024
@asmorkalov asmorkalov removed the pr: needs test New functionality requires minimal tests set label Jul 26, 2024
@asmorkalov

Copy link
Copy Markdown
Contributor Author

@opencv-alalek @mshabunin @vpisarev Please review.

0,
0,
0,
resize_bitExact<uchar, interpolationLinear<uchar> >, /* resize bool as uchar */

@mshabunin mshabunin Jul 30, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand CV_Bool should have 255 as true value. How will resize work in this case? Wouldn't it create true values with other values than 255. Perhaps test would be useful to check this.

( i < cols / 2 ? ((i / 128) * (85 - j / 256 * 40) * ((j / 128) % 2) + (7 - i / 128) * (85 - j / 256 * 40) * ((j / 128 + 1) % 2)) :
((uchar)rnd) ) ;
if ((depth == CV_8U) || (depth == CV_Bool))
line[i*cn + c] = (uint8_t)val;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be 0 or 255 for CV_Bool?

}
}
if ((depth == CV_8U) || (depth == CV_Bool))
eval4< uint8_t, fixedShiftU8>(xcoeff0, xcoeff1, ycoeff0, ycoeff1, c, src_pt00, src_pt01, src_pt10, src_pt11, dst_pt);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should check that all values in the result image are either 0 or 255 for CV_Bool.

@asmorkalov asmorkalov modified the milestones: 5.0-release, 5.1 May 22, 2026
@asmorkalov asmorkalov modified the milestones: 5.1, 5.2 Sep 17, 2026

@codex-abhishek-gola codex-abhishek-gola Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Status: 🔴 Red

Verdict: Refactor before merge.

Audit every mask consumer for CV_Bool; several paths still construct Mat_, and 0/1 versus 0/255 semantics need an explicit contract.

Please address this in the current PR and add focused regression coverage where applicable.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants