44 #include <visp3/core/vpImageTools.h> 45 #include <visp3/imgproc/vpImgproc.h> 76 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
77 for (
unsigned int j = 0; j < I.
getWidth(); j++) {
78 mask[i + 1][j + 1] = 255 - I[i][j];
84 for (
unsigned int i = 0; i < marker.getHeight(); i++) {
85 if (i == 0 || i == marker.getHeight() - 1) {
86 for (
unsigned int j = 0; j < marker.getWidth(); j++) {
91 marker[i][marker.getWidth() - 1] = 255;
96 reconstruct(marker, mask, I_reconstruct, connexity);
98 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
99 for (
unsigned int j = 0; j < I.
getWidth(); j++) {
100 I[i][j] = 255 - I_reconstruct[i + 1][j + 1];
107 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
108 memcpy(flood_fill_mask[i + 1] + 1, I[i],
sizeof(
unsigned char) * I.
getWidth());
116 for (
unsigned int i = 0; i < mask.getHeight(); i++) {
117 memcpy(mask[i], flood_fill_mask[i + 1] + 1,
sizeof(
unsigned char) * mask.getWidth());
149 std::cerr <<
"marker.getHeight() != mask.getHeight() || " 150 "marker.getWidth() != mask.getWidth()" 156 std::cerr <<
"Input images are empty!" << std::endl;
168 for (
unsigned int i = 0; i < h_kp1.
getHeight(); i++) {
169 for (
unsigned int j = 0; j < h_kp1.
getWidth(); j++) {
170 h_kp1[i][j] = std::min(h_kp1[i][j], mask[i][j]);
VISP_EXPORT void reconstruct(const vpImage< unsigned char > &marker, const vpImage< unsigned char > &mask, vpImage< unsigned char > &I, const vpImageMorphology::vpConnexityType &connexity=vpImageMorphology::CONNEXITY_4)
static void dilatation(vpImage< Type > &I, Type value, Type value_out, vpConnexityType connexity=CONNEXITY_4)
VISP_EXPORT void fillHoles(vpImage< unsigned char > &I)
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)
unsigned int getHeight() const
unsigned int getSize() const
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
unsigned int getWidth() const