Visual Servoing Platform  version 3.6.1 under development (2024-06-18)
vpDiskGrabber.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See https://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Disk framegrabber.
32  */
33 
38 #ifndef vpDiskGrabber_hh
39 #define vpDiskGrabber_hh
40 
41 #include <string>
42 
43 #include <visp3/core/vpDebug.h>
44 #include <visp3/core/vpFrameGrabber.h>
45 #include <visp3/core/vpRGBa.h>
46 #include <visp3/io/vpImageIo.h>
47 
49 
105 class VISP_EXPORT vpDiskGrabber : public vpFrameGrabber
106 {
107 private:
108  long m_image_number;
109  long m_image_number_next;
110  long m_image_step;
111  unsigned int m_number_of_zero;
113 
114  std::string m_directory;
115  std::string m_base_name;
116  std::string m_extension;
117 
118  bool m_use_generic_name;
119  std::string m_generic_name;
120  std::string m_image_name;
121 
122 public:
126  vpDiskGrabber();
127 
131  explicit vpDiskGrabber(const std::string &genericName);
132 
137  virtual ~vpDiskGrabber() { };
138 
149  explicit vpDiskGrabber(const std::string &dir, const std::string &basename, long number, int step, unsigned int noz,
150  const std::string &ext);
151 
159 
166  void acquire(vpImage<vpRGBa> &I);
167 
174  void acquire(vpImage<float> &I);
175 
183  void acquire(vpImage<unsigned char> &I, long image_number);
184 
192  void acquire(vpImage<vpRGBa> &I, long image_number);
193 
201  void acquire(vpImage<float> &I, long image_number);
202 
208  void close() { };
209 
213  inline long getImageNumber() const { return m_image_number; }
214 
218  inline std::string getImageName() const { return m_image_name; }
219 
224  void open(vpImage<unsigned char> &I);
225 
230  void open(vpImage<vpRGBa> &I);
231 
236  void open(vpImage<float> &I);
237 
241  void setBaseName(const std::string &name) { m_base_name = name; }
242 
246  void setDirectory(const std::string &dir) { m_directory = dir; }
247 
251  void setExtension(const std::string &ext) { m_extension = ext; }
252 
256  void setGenericName(const std::string &genericName);
257 
261  void setImageNumber(long number);
262 
266  void setNumberOfZero(unsigned int noz) { m_number_of_zero = noz; }
267 
271  void setStep(long step) { m_image_step = step; }
272 };
273 
275 
276 #endif
Class to grab (ie. read) images from the disk.
void setStep(long step)
void setDirectory(const std::string &dir)
void setExtension(const std::string &ext)
std::string getImageName() const
virtual ~vpDiskGrabber()
void setNumberOfZero(unsigned int noz)
void setBaseName(const std::string &name)
long getImageNumber() const
Base class for all video devices. It is designed to provide a front end to video sources.
virtual void open(vpImage< unsigned char > &I)=0
virtual void acquire(vpImage< unsigned char > &I)=0