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) && \ 21 (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)) && \ 22 (defined(VISP_HAVE_PNG) || defined(VISP_HAVE_OPENCV)) 23 std::string input_filename =
"Sample_low_brightness.png";
26 double alpha = 10.0, beta = 50.0;
28 int scale = 240, scaleDiv = 3, level = 0, kernelSize = -1;
31 for (
int i = 1; i < argc; i++) {
32 if (std::string(argv[i]) ==
"--input" && i + 1 < argc) {
33 input_filename = std::string(argv[i + 1]);
34 }
else if (std::string(argv[i]) ==
"--alpha" && i + 1 < argc) {
35 alpha = atof(argv[i + 1]);
36 }
else if (std::string(argv[i]) ==
"--beta" && i + 1 < argc) {
37 beta = atof(argv[i + 1]);
38 }
else if (std::string(argv[i]) ==
"--gamma" && i + 1 < argc) {
39 gamma = atof(argv[i + 1]);
40 }
else if (std::string(argv[i]) ==
"--scale" && i + 1 < argc) {
41 scale = atoi(argv[i + 1]);
42 }
else if (std::string(argv[i]) ==
"--scaleDiv" && i + 1 < argc) {
43 scaleDiv = atoi(argv[i + 1]);
44 }
else if (std::string(argv[i]) ==
"--level" && i + 1 < argc) {
45 level = atoi(argv[i + 1]);
46 }
else if (std::string(argv[i]) ==
"--kernelSize" && i + 1 < argc) {
47 kernelSize = atoi(argv[i + 1]);
48 }
else if (std::string(argv[i]) ==
"--dynamic" && i + 1 < argc) {
49 dynamic = atof(argv[i + 1]);
50 }
else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
51 std::cout <<
"Usage: " << argv[0]
52 <<
" [--input <input image>]" 53 " [--alpha <alpha for vp::adjust()>] [--beta <beta for " 55 " [--gamma <gamma for vp::gammaCorrection()>]" 56 " [--scale <scale for vp::retinex()> [--scaleDiv for " 58 " [--level <level for vp::retinex()> [--kernelSize " 59 "<kernelSize for vp::retinex()>]" 60 " [--dynamic <dynamic for vp::retinex()>] [--help]" 73 #elif defined(VISP_HAVE_GDI) 75 #elif defined(VISP_HAVE_OPENCV) 81 vp::adjust(I_color, I_color_adjust, alpha, beta);
85 ss <<
"Sample_low_brightness_alpha=" << alpha <<
"_beta=" << beta <<
".png";
99 ss <<
"Sample_low_brightness_gamma=" << gamma <<
".png";
113 ss <<
"Sample_low_brightness_eqHist.png";
123 vp::retinex(I_color, I_color_retinex, scale, scaleDiv, level, dynamic, kernelSize);
128 ss <<
"Sample_low_brightness_scale=" << scale <<
"_scaleDiv=" << scaleDiv <<
"_level=" << level
129 <<
"_dynamic=" << dynamic <<
"_kernelSize=" << kernelSize <<
".png";
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...
static void flush(const vpImage< unsigned char > &I)
static void write(const vpImage< unsigned char > &I, const std::string &filename)
VISP_EXPORT void adjust(vpImage< unsigned char > &I, double alpha, double beta)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
void insert(const vpImage< Type > &src, const vpImagePoint &topLeft)
unsigned int getHeight() const
static void read(vpImage< unsigned char > &I, const std::string &filename)
VISP_EXPORT void equalizeHistogram(vpImage< unsigned char > &I)
VISP_EXPORT void gammaCorrection(vpImage< unsigned char > &I, double gamma)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
VISP_EXPORT void retinex(vpImage< vpRGBa > &I, int scale=240, int scaleDiv=3, int level=RETINEX_UNIFORM, double dynamic=1.2, int kernelSize=-1)
unsigned int getWidth() const