67 #include <visp3/imgproc/vpImgproc.h>
76 if (oldValue == newValue || I.
getSize() == 0) {
80 std::queue<vpImagePoint> seed_queue;
83 seed_queue.push(seedPoint);
85 while (!seed_queue.empty()) {
89 unsigned int x = (
unsigned int)current_seed.
get_j();
90 unsigned int y = (
unsigned int)current_seed.
get_i();
94 while (x1 >= 0 && I[y][x1] == oldValue) {
99 bool spanAbove =
false, spanBelow =
false;
101 while (x1 < (
int)I.
getWidth() && I[y][x1] == oldValue) {
104 if (!spanAbove && y > 0) {
105 if (I[y - 1][x1] == oldValue) {
112 if (x1 > 0 && I[y - 1][x1 - 1] == oldValue) {
117 if (x1 < (
int)I.
getWidth() - 1 && I[y - 1][x1 + 1] == oldValue) {
124 else if (spanAbove && y > 0 && I[y - 1][x1] != oldValue) {
128 if (!spanBelow && y < I.
getHeight() - 1) {
129 if (I[y + 1][x1] == oldValue) {
136 if (x1 > 0 && I[y + 1][x1 - 1] == oldValue) {
141 if (x1 < (
int)I.
getWidth() - 1 && I[y + 1][x1 + 1] == oldValue) {
148 else if (spanBelow && y < I.
getHeight() - 1 && I[y + 1][x1] != oldValue) {
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
unsigned int getWidth() const
unsigned int getSize() const
unsigned int getHeight() const
VISP_EXPORT void floodFill(vpImage< unsigned char > &I, const vpImagePoint &seedPoint, const unsigned char oldValue, const unsigned char newValue, const vpImageMorphology::vpConnexityType &connexity=vpImageMorphology::CONNEXITY_4)