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.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(VISP_HAVE_OPENCV) 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);
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
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, int blockRadius=150, int bins=256, float slope=3.0f, bool fast=true)
unsigned int getHeight() const
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)
unsigned int getWidth() const