Visual Servoing Platform  version 3.5.1 under development (2023-06-04)
vpImgproc.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Static functions for basic image processing functions.
33  *
34  * Authors:
35  * Souriya Trinh
36  *
37  *****************************************************************************/
38 
45 #ifndef _vpImgproc_h_
46 #define _vpImgproc_h_
47 
48 #include <visp3/core/vpImage.h>
49 #include <visp3/core/vpImageMorphology.h>
50 #include <visp3/imgproc/vpContours.h>
51 
52 #define USE_OLD_FILL_HOLE 0
53 
54 namespace vp
55 {
57 
58 typedef enum {
85 
86 VISP_EXPORT void adjust(vpImage<unsigned char> &I, double alpha, double beta);
87 VISP_EXPORT void adjust(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2, double alpha, double beta);
88 VISP_EXPORT void adjust(vpImage<vpRGBa> &I, const double alpha, double beta);
89 VISP_EXPORT void adjust(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, double alpha, double beta);
90 
91 VISP_EXPORT void clahe(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2, int blockRadius = 150,
92  int bins = 256, float slope = 3.0f, bool fast = true);
93 VISP_EXPORT void clahe(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, int blockRadius = 150, int bins = 256,
94  float slope = 3.0f, bool fast = true);
95 
96 VISP_EXPORT void equalizeHistogram(vpImage<unsigned char> &I);
97 VISP_EXPORT void equalizeHistogram(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2);
98 VISP_EXPORT void equalizeHistogram(vpImage<vpRGBa> &I, bool useHSV = false);
99 VISP_EXPORT void equalizeHistogram(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, bool useHSV = false);
100 
101 VISP_EXPORT void gammaCorrection(vpImage<unsigned char> &I, double gamma);
102 VISP_EXPORT void gammaCorrection(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2, double gamma);
103 VISP_EXPORT void gammaCorrection(vpImage<vpRGBa> &I, double gamma);
104 VISP_EXPORT void gammaCorrection(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, double gamma);
105 
106 VISP_EXPORT void retinex(vpImage<vpRGBa> &I, int scale = 240, int scaleDiv = 3, int level = RETINEX_UNIFORM,
107  double dynamic = 1.2, int kernelSize = -1);
108 VISP_EXPORT void retinex(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, int scale = 240, int scaleDiv = 3,
109  int level = RETINEX_UNIFORM, double dynamic = 1.2, int kernelSize = -1);
110 
111 VISP_EXPORT void stretchContrast(vpImage<unsigned char> &I);
112 VISP_EXPORT void stretchContrast(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2);
113 VISP_EXPORT void stretchContrast(vpImage<vpRGBa> &I);
114 VISP_EXPORT void stretchContrast(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2);
115 
116 VISP_EXPORT void stretchContrastHSV(vpImage<vpRGBa> &I);
117 VISP_EXPORT void stretchContrastHSV(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2);
118 
119 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
124 vp_deprecated VISP_EXPORT void unsharpMask(vpImage<unsigned char> &I, unsigned int size = 7, double weight = 0.6);
125 vp_deprecated VISP_EXPORT void unsharpMask(const vpImage<unsigned char> &I, vpImage<unsigned char> &Ires,
126  unsigned int size = 7, double weight = 0.6);
127 vp_deprecated VISP_EXPORT void unsharpMask(vpImage<vpRGBa> &I, unsigned int size = 7, double weight = 0.6);
128 vp_deprecated VISP_EXPORT void unsharpMask(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &Ires, unsigned int size = 7,
129  double weight = 0.6);
131 #endif
132 
133 VISP_EXPORT void unsharpMask(vpImage<unsigned char> &I, float sigma, double weight = 0.6);
134 VISP_EXPORT void unsharpMask(const vpImage<unsigned char> &I, vpImage<unsigned char> &Ires, float sigma,
135  double weight = 0.6);
136 VISP_EXPORT void unsharpMask(vpImage<vpRGBa> &I, float sigma, double weight = 0.6);
137 VISP_EXPORT void unsharpMask(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &Ires, float sigma, double weight = 0.6);
138 
139 VISP_EXPORT void
140 connectedComponents(const vpImage<unsigned char> &I, vpImage<int> &labels, int &nbComponents,
142 
143 VISP_EXPORT void fillHoles(vpImage<unsigned char> &I
144 #if USE_OLD_FILL_HOLE
145  ,
147 #endif
148 );
149 
150 VISP_EXPORT void floodFill(vpImage<unsigned char> &I, const vpImagePoint &seedPoint, const unsigned char oldValue,
151  const unsigned char newValue,
153 
154 VISP_EXPORT void reconstruct(const vpImage<unsigned char> &marker, const vpImage<unsigned char> &mask,
157 
158 VISP_EXPORT unsigned char autoThreshold(vpImage<unsigned char> &I, const vp::vpAutoThresholdMethod &method,
159  const unsigned char backgroundValue = 0,
160  const unsigned char foregroundValue = 255);
161 } // namespace vp
162 
163 #endif
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:89
VISP_EXPORT void clahe(const vpImage< unsigned char > &I1, vpImage< unsigned char > &I2, int blockRadius=150, int bins=256, float slope=3.0f, bool fast=true)
Definition: vpCLAHE.cpp:228
VISP_EXPORT void adjust(vpImage< unsigned char > &I, double alpha, double beta)
Definition: vpImgproc.cpp:81
VISP_EXPORT void stretchContrast(vpImage< unsigned char > &I)
Definition: vpImgproc.cpp:419
VISP_EXPORT void stretchContrastHSV(vpImage< vpRGBa > &I)
Definition: vpImgproc.cpp:556
VISP_EXPORT void gammaCorrection(vpImage< unsigned char > &I, double gamma)
Definition: vpImgproc.cpp:335
VISP_EXPORT void equalizeHistogram(vpImage< unsigned char > &I)
Definition: vpImgproc.cpp:165
VISP_EXPORT void retinex(vpImage< vpRGBa > &I, int scale=240, int scaleDiv=3, int level=RETINEX_UNIFORM, double dynamic=1.2, int kernelSize=-1)
Definition: vpRetinex.cpp:263
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)
Definition: vpMorph.cpp:145
vp_deprecated VISP_EXPORT void unsharpMask(vpImage< unsigned char > &I, unsigned int size=7, double weight=0.6)
Definition: vpImgproc.cpp:718
VISP_EXPORT void fillHoles(vpImage< unsigned char > &I)
Definition: vpMorph.cpp:54
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)
Definition: vpFloodFill.cpp:85
VISP_EXPORT void connectedComponents(const vpImage< unsigned char > &I, vpImage< int > &labels, int &nbComponents, const vpImageMorphology::vpConnexityType &connexity=vpImageMorphology::CONNEXITY_4)
VISP_EXPORT unsigned char autoThreshold(vpImage< unsigned char > &I, const vp::vpAutoThresholdMethod &method, const unsigned char backgroundValue=0, const unsigned char foregroundValue=255)
RETINEX_LEVEL
Definition: vpImgproc.h:56
@ RETINEX_HIGH
Definition: vpImgproc.h:56
@ RETINEX_LOW
Definition: vpImgproc.h:56
@ RETINEX_UNIFORM
Definition: vpImgproc.h:56
vpAutoThresholdMethod
Definition: vpImgproc.h:58
@ AUTO_THRESHOLD_ISODATA
Definition: vpImgproc.h:67
@ AUTO_THRESHOLD_HUANG
Definition: vpImgproc.h:59
@ AUTO_THRESHOLD_INTERMODES
Definition: vpImgproc.h:63
@ AUTO_THRESHOLD_TRIANGLE
Definition: vpImgproc.h:79
@ AUTO_THRESHOLD_MEAN
Definition: vpImgproc.h:71
@ AUTO_THRESHOLD_OTSU
Definition: vpImgproc.h:75