5 #include <visp3/core/vpImage.h>
6 #include <visp3/gui/vpDisplayGDI.h>
7 #include <visp3/gui/vpDisplayOpenCV.h>
8 #include <visp3/gui/vpDisplayX.h>
9 #include <visp3/io/vpImageIo.h>
11 #if defined(VISP_HAVE_MODULE_IMGPROC)
13 #include <visp3/imgproc/vpImgproc.h>
17 int main(
int argc,
const char **argv)
20 #if defined(VISP_HAVE_MODULE_IMGPROC) && (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV))
23 std::string input_filename =
"Crayfish-low-contrast.png";
24 int blockRadius = 150;
30 for (
int i = 1; i < argc; i++) {
31 if (std::string(argv[i]) ==
"--input" && i + 1 < argc) {
32 input_filename = std::string(argv[i + 1]);
33 }
else if (std::string(argv[i]) ==
"--blockRadius" && i + 1 < argc) {
34 blockRadius = atoi(argv[i + 1]);
35 }
else if (std::string(argv[i]) ==
"--bins" && i + 1 < argc) {
36 bins = atoi(argv[i + 1]);
37 }
else if (std::string(argv[i]) ==
"--slope" && i + 1 < argc) {
38 slope = (float)atof(argv[i + 1]);
39 }
else if (std::string(argv[i]) ==
"--sigma" && i + 1 < argc) {
40 sigma = (float)atof(argv[i + 1]);
41 }
else if (std::string(argv[i]) ==
"--weight" && i + 1 < argc) {
42 weight = atof(argv[i + 1]);
43 }
else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
44 std::cout <<
"Usage: " << argv[0]
45 <<
" [--input <input image>]"
46 " [--blockRadius <block radius for CLAHE>] "
47 " [--bins <nb histogram bins for CLAHE>] [--slope <slope for CLAHE>]"
48 " [--sigma <Gaussian kernel standard deviation>] [--weight <unsharp mask weighting>]"
62 #elif defined(VISP_HAVE_GDI)
64 #elif defined(HAVE_OPENCV_HIGHGUI)
67 d.
init(I_color, 0, 0,
"Input color image");
73 d2.
init(I_stretch, I_color.
getWidth(), 10,
"Stretch contrast");
79 d3.
init(I_stretch_hsv, 0, I_color.
getHeight() + 80,
"Stretch contrast HSV");
89 vp::clahe(I_color, I_clahe, blockRadius, bins, slope);
Display for windows using GDI (available on any windows 32 platform).
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
void init(vpImage< unsigned char > &I, int win_x=-1, int win_y=-1, const std::string &win_title="")
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
unsigned int getWidth() const
unsigned int getHeight() const
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)
VISP_EXPORT void stretchContrast(vpImage< unsigned char > &I)
VISP_EXPORT void stretchContrastHSV(vpImage< vpRGBa > &I)
VISP_EXPORT void equalizeHistogram(vpImage< unsigned char > &I)
vp_deprecated VISP_EXPORT void unsharpMask(vpImage< unsigned char > &I, unsigned int size=7, double weight=0.6)