34 #include <visp3/io/vpDiskGrabber.h>
39 : m_image_number(0), m_image_number_next(0), m_image_step(1), m_number_of_zero(0), m_directory(
"/tmp"),
40 m_base_name(
"I"), m_extension(
"pgm"), m_use_generic_name(false), m_generic_name(
"empty")
47 : m_image_number(0), m_image_number_next(0), m_image_step(1), m_number_of_zero(0), m_directory(
"/tmp"),
48 m_base_name(
"I"), m_extension(
"pgm"), m_use_generic_name(true), m_generic_name(generic_name)
54 unsigned int noz,
const std::string &ext)
55 : m_image_number(number), m_image_number_next(number), m_image_step(step), m_number_of_zero(noz), m_directory(dir),
56 m_base_name(basename), m_extension(ext), m_use_generic_name(false), m_generic_name(
"empty"), m_image_name()
109 m_image_number = m_image_number_next;
110 std::stringstream ss;
112 if (m_use_generic_name) {
113 char filename[FILENAME_MAX];
114 snprintf(filename, FILENAME_MAX, m_generic_name.c_str(), m_image_number);
118 ss << m_directory <<
"/" << m_base_name << std::setfill(
'0') << std::setw(m_number_of_zero) << m_image_number <<
"."
122 m_image_number_next += m_image_step;
123 m_image_name = ss.str();
132 m_image_number = m_image_number_next;
133 std::stringstream ss;
135 if (m_use_generic_name) {
136 char filename[FILENAME_MAX];
137 snprintf(filename, FILENAME_MAX, m_generic_name.c_str(), m_image_number);
141 ss << m_directory <<
"/" << m_base_name << std::setfill(
'0') << std::setw(m_number_of_zero) << m_image_number <<
"."
145 m_image_number_next += m_image_step;
146 m_image_name = ss.str();
155 m_image_number = m_image_number_next;
156 std::stringstream ss;
157 if (m_use_generic_name) {
158 char filename[FILENAME_MAX];
159 snprintf(filename, FILENAME_MAX, m_generic_name.c_str(), m_image_number);
163 ss << m_directory <<
"/" << m_base_name << std::setfill(
'0') << std::setw(m_number_of_zero) << m_image_number <<
"."
167 m_image_number_next += m_image_step;
177 m_image_number = image_number;
178 std::stringstream ss;
179 if (m_use_generic_name) {
180 char filename[FILENAME_MAX];
181 snprintf(filename, FILENAME_MAX, m_generic_name.c_str(), m_image_number);
185 ss << m_directory <<
"/" << m_base_name << std::setfill(
'0') << std::setw(m_number_of_zero) << m_image_number <<
"."
189 m_image_number_next = m_image_number + m_image_step;
199 m_image_number = image_number;
200 std::stringstream ss;
201 if (m_use_generic_name) {
202 char filename[FILENAME_MAX];
203 snprintf(filename, FILENAME_MAX, m_generic_name.c_str(), m_image_number);
207 ss << m_directory <<
"/" << m_base_name << std::setfill(
'0') << std::setw(m_number_of_zero) << m_image_number <<
"."
211 m_image_number_next = m_image_number + m_image_step;
221 m_image_number = m_image_number_next;
222 std::stringstream ss;
223 if (m_use_generic_name) {
224 char filename[FILENAME_MAX];
225 snprintf(filename, FILENAME_MAX, m_generic_name.c_str(), m_image_number);
229 ss << m_directory <<
"/" << m_base_name << std::setfill(
'0') << std::setw(m_number_of_zero) << image_number <<
"."
233 m_image_number_next += m_image_step;
243 m_image_number = number;
244 m_image_number_next = number;
249 m_generic_name = generic_name;
250 m_use_generic_name =
true;
void open(vpImage< unsigned char > &I)
void setGenericName(const std::string &genericName)
void setImageNumber(long number)
long getImageNumber() const
void acquire(vpImage< unsigned char > &I)
unsigned int height
Number of rows in the image.
bool init
Set to true if the frame grabber has been initialized.
unsigned int width
Number of columns in the image.
static void readPFM(vpImage< float > &I, const std::string &filename)
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
unsigned int getWidth() const
unsigned int getHeight() const