Visual Servoing Platform  version 3.6.1 under development (2023-12-02)
vpImgproc.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See https://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Static functions for basic image processing functions.
32  */
33 
40 #ifndef _vpImgproc_h_
41 #define _vpImgproc_h_
42 
43 #include <visp3/core/vpImage.h>
44 #include <visp3/core/vpImageMorphology.h>
45 #include <visp3/imgproc/vpContours.h>
46 
47 #define USE_OLD_FILL_HOLE 0
48 
49 namespace vp
50 {
56 {
59  RETINEX_HIGH = 2
60 };
61 
65 typedef enum
66 {
93 
104 VISP_EXPORT void adjust(vpImage<unsigned char> &I, double alpha, double beta);
105 
117 VISP_EXPORT void adjust(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2, double alpha, double beta);
118 
129 VISP_EXPORT void adjust(vpImage<vpRGBa> &I, const double alpha, double beta);
130 
142 VISP_EXPORT void adjust(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, double alpha, double beta);
143 
173 VISP_EXPORT void clahe(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2, int blockRadius = 150,
174  int bins = 256, float slope = 3.0f, bool fast = true);
175 
203 VISP_EXPORT void clahe(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, int blockRadius = 150, int bins = 256,
204  float slope = 3.0f, bool fast = true);
205 
215 VISP_EXPORT void equalizeHistogram(vpImage<unsigned char> &I);
216 
227 VISP_EXPORT void equalizeHistogram(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2);
228 
242 VISP_EXPORT void equalizeHistogram(vpImage<vpRGBa> &I, bool useHSV = false);
243 
258 VISP_EXPORT void equalizeHistogram(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, bool useHSV = false);
259 
268 VISP_EXPORT void gammaCorrection(vpImage<unsigned char> &I, double gamma);
269 
279 VISP_EXPORT void gammaCorrection(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2, double gamma);
280 
289 VISP_EXPORT void gammaCorrection(vpImage<vpRGBa> &I, double gamma);
290 
300 VISP_EXPORT void gammaCorrection(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, double gamma);
301 
323 VISP_EXPORT void retinex(vpImage<vpRGBa> &I, int scale = 240, int scaleDiv = 3, int level = RETINEX_UNIFORM,
324  double dynamic = 1.2, int kernelSize = -1);
325 
348 VISP_EXPORT void retinex(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2, int scale = 240, int scaleDiv = 3,
349  int level = RETINEX_UNIFORM, double dynamic = 1.2, int kernelSize = -1);
350 
358 VISP_EXPORT void stretchContrast(vpImage<unsigned char> &I);
359 
368 VISP_EXPORT void stretchContrast(const vpImage<unsigned char> &I1, vpImage<unsigned char> &I2);
369 
377 VISP_EXPORT void stretchContrast(vpImage<vpRGBa> &I);
378 
387 VISP_EXPORT void stretchContrast(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2);
388 
397 VISP_EXPORT void stretchContrastHSV(vpImage<vpRGBa> &I);
398 
408 VISP_EXPORT void stretchContrastHSV(const vpImage<vpRGBa> &I1, vpImage<vpRGBa> &I2);
409 
419 VISP_EXPORT void unsharpMask(vpImage<unsigned char> &I, float sigma, double weight = 0.6);
420 
431 VISP_EXPORT void unsharpMask(const vpImage<unsigned char> &I, vpImage<unsigned char> &Ires, float sigma,
432  double weight = 0.6);
433 
443 VISP_EXPORT void unsharpMask(vpImage<vpRGBa> &I, float sigma, double weight = 0.6);
444 
455 VISP_EXPORT void unsharpMask(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &Ires, float sigma, double weight = 0.6);
456 
467 VISP_EXPORT void connectedComponents(const vpImage<unsigned char> &I, vpImage<int> &labels, int &nbComponents,
469 
477 VISP_EXPORT void fillHoles(vpImage<unsigned char> &I
478 #if USE_OLD_FILL_HOLE
479  ,
481 #endif
482 );
483 
495 VISP_EXPORT void floodFill(vpImage<unsigned char> &I, const vpImagePoint &seedPoint, const unsigned char oldValue,
496  const unsigned char newValue,
498 
517 VISP_EXPORT void reconstruct(const vpImage<unsigned char> &marker, const vpImage<unsigned char> &mask,
518  vpImage<unsigned char> &h_kp1 /*alias I */,
520 
531 VISP_EXPORT unsigned char autoThreshold(vpImage<unsigned char> &I, const vp::vpAutoThresholdMethod &method,
532  const unsigned char backgroundValue = 0,
533  const unsigned char foregroundValue = 255);
534 } // namespace vp
535 
536 #endif
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:82
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:196
VISP_EXPORT void adjust(vpImage< unsigned char > &I, double alpha, double beta)
Definition: vpImgproc.cpp:68
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:71
VISP_EXPORT void connectedComponents(const vpImage< unsigned char > &I, vpImage< int > &labels, int &nbComponents, const vpImageMorphology::vpConnexityType &connexity=vpImageMorphology::CONNEXITY_4)
VISP_EXPORT void stretchContrast(vpImage< unsigned char > &I)
Definition: vpImgproc.cpp:249
VISP_EXPORT void stretchContrastHSV(vpImage< vpRGBa > &I)
Definition: vpImgproc.cpp:360
VISP_EXPORT void gammaCorrection(vpImage< unsigned char > &I, double gamma)
Definition: vpImgproc.cpp:196
VISP_EXPORT void equalizeHistogram(vpImage< unsigned char > &I)
Definition: vpImgproc.cpp:111
VISP_EXPORT void fillHoles(vpImage< unsigned char > &I)
Definition: vpMorph.cpp:45
VISP_EXPORT void reconstruct(const vpImage< unsigned char > &marker, const vpImage< unsigned char > &mask, vpImage< unsigned char > &h_kp1, const vpImageMorphology::vpConnexityType &connexity=vpImageMorphology::CONNEXITY_4)
Definition: vpMorph.cpp:119
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:241
VISP_EXPORT void unsharpMask(vpImage< unsigned char > &I, float sigma, double weight=0.6)
Definition: vpImgproc.cpp:411
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
Enhances the bright regions of the image.
Definition: vpImgproc.h:59
@ RETINEX_LOW
Enhances dark regions of the image.
Definition: vpImgproc.h:58
@ RETINEX_UNIFORM
Tends to treat all image intensities similarly.
Definition: vpImgproc.h:57
vpAutoThresholdMethod
Definition: vpImgproc.h:66
@ AUTO_THRESHOLD_ISODATA
Definition: vpImgproc.h:75
@ AUTO_THRESHOLD_HUANG
Definition: vpImgproc.h:67
@ AUTO_THRESHOLD_INTERMODES
Definition: vpImgproc.h:71
@ AUTO_THRESHOLD_TRIANGLE
Definition: vpImgproc.h:87
@ AUTO_THRESHOLD_MEAN
Definition: vpImgproc.h:79
@ AUTO_THRESHOLD_OTSU
Definition: vpImgproc.h:83