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) 12 #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)) 21 std::string input_filename =
"Crayfish-low-contrast.ppm";
24 int blockRadius = 150;
27 unsigned int size = 11;
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]) ==
"--size" && i + 1 < argc) {
40 size = (
unsigned int)atoi(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>] [--bins <nb " 47 "histogram bins for CLAHE>] [--slope <slope for CLAHE>]" 48 " [--size <Gaussian kernel size>] [--weight <unsharp mask " 63 #elif defined(VISP_HAVE_GDI) 65 #elif defined(VISP_HAVE_OPENCV) 68 d.
init(I_color, 0, 0,
"Input color image");
74 d2.
init(I_stretch, I_color.
getWidth(), 10,
"Stretch contrast");
80 d3.
init(I_stretch_hsv, 0, I_color.
getHeight() + 80,
"Stretch contrast HSV");
90 vp::clahe(I_color, I_clahe, blockRadius, bins, slope);
92 d5.
init(I_clahe, 0, 2 * I_color.
getHeight() + 80,
"Histogram equalization");
VISP_EXPORT void unsharpMask(vpImage< unsigned char > &I, const unsigned int size=7, const double weight=0.6)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
unsigned int getWidth() const
Display for windows using GDI (available on any windows 32 platform).
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
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 winx=-1, int winy=-1, const std::string &title="")
static void flush(const vpImage< unsigned char > &I)
VISP_EXPORT void stretchContrast(vpImage< unsigned char > &I)
VISP_EXPORT void stretchContrastHSV(vpImage< vpRGBa > &I)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
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)
static void read(vpImage< unsigned char > &I, const std::string &filename)
VISP_EXPORT void equalizeHistogram(vpImage< unsigned char > &I)
unsigned int getHeight() const