1#include <visp3/core/vpConfig.h>
2#include <visp3/core/vpHSV.h>
3#include <visp3/io/vpImageIo.h>
4#include <visp3/core/vpImageConvert.h>
5#include <visp3/core/vpImageTools.h>
6#include <visp3/gui/vpDisplayFactory.h>
10#ifdef ENABLE_VISP_NAMESPACE
20 int h = 14,
s = 255,
v = 209;
22 int h_low = std::max<int>(0, h - offset), h_high = std::min<int>(h + offset, 255);
23 int s_low = std::max<int>(0, s - offset), s_high = std::min<int>(s + offset, 255);
24 int v_low = std::max<int>(0, v - offset), v_high = std::min<int>(v + offset, 255);
25 std::vector<int> hsv_range;
26 hsv_range.push_back(h_low);
27 hsv_range.push_back(h_high);
28 hsv_range.push_back(s_low);
29 hsv_range.push_back(s_high);
30 hsv_range.push_back(v_low);
31 hsv_range.push_back(v_high);
34#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
53 unsigned int width = I.getWidth();
54 unsigned int height = I.getHeight();
60 reinterpret_cast<unsigned char *
>(H.bitmap),
61 reinterpret_cast<unsigned char *
>(S.bitmap),
62 reinterpret_cast<unsigned char *
>(V.bitmap), I.getSize());
66 reinterpret_cast<unsigned char *
>(S.bitmap),
67 reinterpret_cast<unsigned char *
>(V.bitmap),
69 reinterpret_cast<unsigned char *
>(mask.bitmap),
76#if defined(VISP_HAVE_DISPLAY)
77#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
82 std::shared_ptr<vpDisplay> d_I_segmented_hsv =
vpDisplayFactory::createDisplay(I_segmented_from_HSV, 2*mask.getWidth()+80, mask.getHeight() + 80,
"Segmented frame using vpHSV");
95#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
103#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
104 if (d_I !=
nullptr) {
108 if (d_mask !=
nullptr) {
112 if (d_I_segmented !=
nullptr) {
113 delete d_I_segmented;
Class that defines generic functionalities for display.
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 RGBaToHSV(const unsigned char *rgba, double *hue, double *saturation, double *value, unsigned int size)
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
Definition of the vpImage class member functions.
std::shared_ptr< vpDisplay > createDisplay()
Return a smart pointer vpDisplay specialization if a GUI library is available or nullptr otherwise.
vpDisplay * allocateDisplay()
Return a newly allocated vpDisplay specialization if a GUI library is available or nullptr otherwise.