Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
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, const double alpha, const double beta);
87 VISP_EXPORT void adjust(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2, const double alpha,
88  const double beta);
89 VISP_EXPORT void adjust(vpImage<vpRGBa> &I, const double alpha, const double beta);
90 VISP_EXPORT void adjust(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, const double alpha, const double beta);
91 
92 VISP_EXPORT void clahe(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2, const int blockRadius = 150,
93  const int bins = 256, const float slope = 3.0f, const bool fast = true);
94 VISP_EXPORT void clahe(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, const int blockRadius = 150,
95  const int bins = 256, const float slope = 3.0f, const bool fast = true);
96 
97 VISP_EXPORT void equalizeHistogram(vpImage<unsigned char> &I);
98 VISP_EXPORT void equalizeHistogram(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2);
99 VISP_EXPORT void equalizeHistogram(vpImage<vpRGBa> &I, const bool useHSV = false);
100 VISP_EXPORT void equalizeHistogram(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, const bool useHSV = false);
101 
102 VISP_EXPORT void gammaCorrection(vpImage<unsigned char> &I, const double gamma);
103 VISP_EXPORT void gammaCorrection(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2, const double gamma);
104 VISP_EXPORT void gammaCorrection(vpImage<vpRGBa> &I, const double gamma);
105 VISP_EXPORT void gammaCorrection(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, const double gamma);
106 
107 VISP_EXPORT void retinex(vpImage<vpRGBa> &I, const int scale = 240, const int scaleDiv = 3,
108  const int level = RETINEX_UNIFORM, const double dynamic = 1.2, const int kernelSize = -1);
109 VISP_EXPORT void retinex(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, const int scale = 240, const int scaleDiv = 3,
110  const int level = RETINEX_UNIFORM, const double dynamic = 1.2, const int kernelSize = -1);
111 
112 VISP_EXPORT void stretchContrast(vpImage<unsigned char> &I);
113 VISP_EXPORT void stretchContrast(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2);
114 VISP_EXPORT void stretchContrast(vpImage<vpRGBa> &I);
115 VISP_EXPORT void stretchContrast(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2);
116 
117 VISP_EXPORT void stretchContrastHSV(vpImage<vpRGBa> &I);
118 VISP_EXPORT void stretchContrastHSV(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2);
119 
120 VISP_EXPORT void unsharpMask(vpImage<unsigned char> &I, const unsigned int size = 7, const double weight = 0.6);
121 VISP_EXPORT void unsharpMask(const vpImage<unsigned char> &I, vpImage<unsigned char> &Ires, const unsigned int size = 7,
122  const double weight = 0.6);
123 VISP_EXPORT void unsharpMask(vpImage<vpRGBa> &I, const unsigned int size = 7, const double weight = 0.6);
124 VISP_EXPORT void unsharpMask(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &Ires, const unsigned int size = 7,
125  const double weight = 0.6);
126 
127 VISP_EXPORT void
128 connectedComponents(const vpImage<unsigned char> &I, vpImage<int> &labels, int &nbComponents,
130 
131 VISP_EXPORT void fillHoles(vpImage<unsigned char> &I
132 #if USE_OLD_FILL_HOLE
133  ,
135 #endif
136 );
137 
138 VISP_EXPORT void floodFill(vpImage<unsigned char> &I, const vpImagePoint &seedPoint, const unsigned char oldValue,
139  const unsigned char newValue,
141 
142 VISP_EXPORT void reconstruct(const vpImage<unsigned char> &marker, const vpImage<unsigned char> &mask,
145 
146 VISP_EXPORT unsigned char autoThreshold(vpImage<unsigned char> &I, const vp::vpAutoThresholdMethod &method,
147  const unsigned char backgroundValue = 0,
148  const unsigned char foregroundValue = 255);
149 }
150 
151 #endif
VISP_EXPORT void unsharpMask(vpImage< unsigned char > &I, const unsigned int size=7, const double weight=0.6)
Definition: vpImgproc.cpp:624
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
VISP_EXPORT void adjust(vpImage< unsigned char > &I, const double alpha, const double beta)
Definition: vpImgproc.cpp:80
VISP_EXPORT void connectedComponents(const vpImage< unsigned char > &I, vpImage< int > &labels, int &nbComponents, const vpImageMorphology::vpConnexityType &connexity=vpImageMorphology::CONNEXITY_4)
VISP_EXPORT void gammaCorrection(vpImage< unsigned char > &I, const double gamma)
Definition: vpImgproc.cpp:334
VISP_EXPORT void fillHoles(vpImage< unsigned char > &I)
Definition: vpMorph.cpp:54
VISP_EXPORT void stretchContrast(vpImage< unsigned char > &I)
Definition: vpImgproc.cpp:418
VISP_EXPORT void stretchContrastHSV(vpImage< vpRGBa > &I)
Definition: vpImgproc.cpp:555
Definition: vpContours.h:157
RETINEX_LEVEL
Definition: vpImgproc.h:56
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
vpAutoThresholdMethod
Definition: vpImgproc.h:58
VISP_EXPORT void clahe(const vpImage< unsigned char > &I1, vpImage< unsigned char > &I2, const int blockRadius=150, const int bins=256, const float slope=3.0f, const bool fast=true)
Definition: vpCLAHE.cpp:228
VISP_EXPORT unsigned char autoThreshold(vpImage< unsigned char > &I, const vp::vpAutoThresholdMethod &method, const unsigned char backgroundValue=0, const unsigned char foregroundValue=255)
VISP_EXPORT void equalizeHistogram(vpImage< unsigned char > &I)
Definition: vpImgproc.cpp:164
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
VISP_EXPORT void retinex(vpImage< vpRGBa > &I, const int scale=240, const int scaleDiv=3, const int level=RETINEX_UNIFORM, const double dynamic=1.2, const int kernelSize=-1)
Definition: vpRetinex.cpp:258