Skip to content

core: move dims() check to the top in copyMakeBorder() - #13193

Merged
alalek merged 1 commit into
opencv:3.4from
berak:core_copyMakeBorder
Nov 17, 2018
Merged

alalek merged 1 commit into
opencv:3.4from
berak:core_copyMakeBorder

Conversation

@berak

@berak berak commented Nov 17, 2018

Copy link
Copy Markdown
Contributor

resolves #13180

since none of the implemented branches can handle more than 2 dimensions,
move the dims() check from the CV_OCL_RUN up, so it gets checked for all of them

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

Comment thread modules/core/src/copy.cpp
CV_INSTRUMENT_REGION();

CV_Assert( top >= 0 && bottom >= 0 && left >= 0 && right >= 0 );
CV_Assert( top >= 0 && bottom >= 0 && left >= 0 && right >= 0 && _src.dims() <= 2);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

BTW,

It is better to avoid complex assertion conditions, because they doesn't help debugging problems.
Consider using CV_Check*() macros instead.

@alalek
alalek merged commit 96c99c7 into opencv:3.4 Nov 17, 2018
@berak
berak deleted the core_copyMakeBorder branch November 17, 2018 10:24
@alalek alalek mentioned this pull request Nov 17, 2018
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants