Visual Servoing Platform  version 3.6.1 under development (2024-04-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 
103 class VISP_EXPORT vpDiskGrabber : public vpFrameGrabber
104 {
105 private:
106  long m_image_number;
107  long m_image_number_next;
108  long m_image_step;
109  unsigned int m_number_of_zero;
111 
112  std::string m_directory;
113  std::string m_base_name;
114  std::string m_extension;
115 
116  bool m_use_generic_name;
117  std::string m_generic_name;
118  std::string m_image_name;
119 
120 public:
124  vpDiskGrabber();
125 
129  explicit vpDiskGrabber(const std::string &genericName);
130 
135  virtual ~vpDiskGrabber() { };
136 
147  explicit vpDiskGrabber(const std::string &dir, const std::string &basename, long number, int step, unsigned int noz,
148  const std::string &ext);
149 
157 
164  void acquire(vpImage<vpRGBa> &I);
165 
172  void acquire(vpImage<float> &I);
173 
181  void acquire(vpImage<unsigned char> &I, long image_number);
182 
190  void acquire(vpImage<vpRGBa> &I, long image_number);
191 
199  void acquire(vpImage<float> &I, long image_number);
200 
206  void close() { };
207 
211  inline long getImageNumber() const { return m_image_number; }
212 
216  inline std::string getImageName() const { return m_image_name; }
217 
222  void open(vpImage<unsigned char> &I);
223 
228  void open(vpImage<vpRGBa> &I);
229 
234  void open(vpImage<float> &I);
235 
239  void setBaseName(const std::string &name) { m_base_name = name; }
240 
244  void setDirectory(const std::string &dir) { m_directory = dir; }
245 
249  void setExtension(const std::string &ext) { m_extension = ext; }
250 
254  void setGenericName(const std::string &genericName);
255 
259  void setImageNumber(long number);
260 
264  void setNumberOfZero(unsigned int noz) { m_number_of_zero = noz; }
265 
269  void setStep(long step) { m_image_step = step; }
270 };
271 
272 #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