Skip to content

Connected component labelling bug  #21783

@JeanLucLeCalvez

Description

@JeanLucLeCalvez
System information (version)
  • OpenCV => 4.x
Detailed description

Analyzing the code for connected component labelling, to understand the Grana method, I think I have found an issue in one of the condition defined to to check if the pixels are foreground, without going outside the image limits:

The extract from the cpp code is
#define condition_b c-1>=0 && r-2>=0 && img_row_prev_prev[c-1]>0
#define condition_c r-2>=0 && img_row_prev_prev[c]>0
#define condition_d c+1<w&& r-2>=0 && img_row_prev_prev[c+1]>0
#define condition_e c+2<w && r-1>=0 && img_row_prev[c-1]>0

but condition_e should be
#define condition_e c+2<w && r-1>=0 && img_row_prev_prev[c+2]>0

as pixel e is 2 rows above and 2 columns right of analyzed pixel o

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions