Visual Servoing Platform  version 3.6.1 under development (2024-07-27)
vpDiskGrabber.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2024 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 VP_DISK_GRABBER_H
39 #define VP_DISK_GRABBER_H
40 
41 #include <string>
42 
43 #include <visp3/core/vpFrameGrabber.h>
44 #include <visp3/core/vpRGBa.h>
45 #include <visp3/io/vpImageIo.h>
46 
48 
108 class VISP_EXPORT vpDiskGrabber : public vpFrameGrabber
109 {
110 private:
111  long m_image_number;
112  long m_image_number_next;
113  long m_image_step;
114  unsigned int m_number_of_zero;
116 
117  std::string m_directory;
118  std::string m_base_name;
119  std::string m_extension;
120 
121  bool m_use_generic_name;
122  std::string m_generic_name;
123  std::string m_image_name;
124 
125 public:
129  vpDiskGrabber();
130 
134  VP_EXPLICIT vpDiskGrabber(const std::string &genericName);
135 
140  virtual ~vpDiskGrabber() { };
141 
152  VP_EXPLICIT vpDiskGrabber(const std::string &dir, const std::string &basename, long number, int step, unsigned int noz,
153  const std::string &ext);
154 
162 
169  void acquire(vpImage<vpRGBa> &I);
170 
177  void acquire(vpImage<float> &I);
178 
186  void acquire(vpImage<unsigned char> &I, long image_number);
187 
195  void acquire(vpImage<vpRGBa> &I, long image_number);
196 
204  void acquire(vpImage<float> &I, long image_number);
205 
211  void close() { };
212 
216  inline long getImageNumber() const { return m_image_number; }
217 
221  inline std::string getImageName() const { return m_image_name; }
222 
227  void open(vpImage<unsigned char> &I);
228 
233  void open(vpImage<vpRGBa> &I);
234 
239  void open(vpImage<float> &I);
240 
244  void setBaseName(const std::string &name) { m_base_name = name; }
245 
249  void setDirectory(const std::string &dir) { m_directory = dir; }
250 
254  void setExtension(const std::string &ext) { m_extension = ext; }
255 
259  void setGenericName(const std::string &genericName);
260 
264  void setImageNumber(long number);
265 
269  void setNumberOfZero(unsigned int noz) { m_number_of_zero = noz; }
270 
274  void setStep(long step) { m_image_step = step; }
275 };
276 
277 END_VISP_NAMESPACE
278 
279 #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