Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpDirectShowGrabber.cpp
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 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 * DirectShow framegrabber.
32 *
33 * Authors:
34 * Bruno Renier
35 * Anthony Saunier
36 */
37
38#include <visp3/core/vpConfig.h>
39#if (defined(VISP_HAVE_DIRECTSHOW))
40
41#include <visp3/sensor/vpDirectShowGrabber.h>
42#include <visp3/sensor/vpDirectShowGrabberImpl.h>
43
48unsigned int vpDirectShowGrabber::getHeight() { return grabber->getHeight(); }
49
53unsigned int vpDirectShowGrabber::getWidth() { return grabber->getWidth(); }
54
59vpDirectShowGrabber::vpDirectShowGrabber() { grabber = new vpDirectShowGrabberImpl(); }
60
69void vpDirectShowGrabber::open() { grabber->open(); }
70
76
81void vpDirectShowGrabber::open(vpImage<vpRGBa> &I) { grabber->open(); }
82
92
101void vpDirectShowGrabber::acquire(vpImage<vpRGBa> &I) { grabber->acquire(I); }
102
106void vpDirectShowGrabber::close() { grabber->close(); }
107
112unsigned int vpDirectShowGrabber::getDeviceNumber() { return grabber->getDeviceNumber(); }
113
120bool vpDirectShowGrabber::setDevice(unsigned int id) { return grabber->setDevice(id); }
121
125void vpDirectShowGrabber::displayDevices() { grabber->displayDevices(); }
133bool vpDirectShowGrabber::setImageSize(unsigned int width, unsigned int height)
134{
135 return grabber->setImageSize(width, height);
136}
137
143bool vpDirectShowGrabber::setFramerate(double framerate) { return grabber->setFramerate(framerate); }
152bool vpDirectShowGrabber::setFormat(unsigned int width, unsigned int height, double framerate)
153{
154 return grabber->setFormat(width, height, framerate);
155}
156/*
157 Get capture format
158 \param width : Pointer to a variable that receives the width in pixel
159 \param height : Pointer to a variable that receives the height in
160 pixel \param framerate : Pointer to a variable that receives the framerate
161 in fps
162*/
163void vpDirectShowGrabber::getFormat(unsigned int &width, unsigned int &height, double &framerate)
164{
165 grabber->getFormat(width, height, framerate);
166}
167
173bool vpDirectShowGrabber::getStreamCapabilities() { return grabber->getStreamCapabilities(); }
174
182bool vpDirectShowGrabber::setMediaType(int mediaTypeID) { return grabber->setMediaType(mediaTypeID); }
183
184/*
185 Get current capture MediaType
186
187 \return the current mediaTypeID
188*/
189int vpDirectShowGrabber::getMediaType() { return grabber->getMediaType(); }
190END_VISP_NAMESPACE
191#elif !defined(VISP_BUILD_SHARED_LIBS)
192// Work around to avoid warning: libvisp_sensor.a(vpDirectShowGrabber.cpp.o)
193// has no symbols
194void dummy_vpDirectShowGrabber() { }
195#endif
void acquire(vpImage< unsigned char > &I)
void getFormat(unsigned int &width, unsigned int &height, double &framerate)
bool setDevice(unsigned int id)
bool setImageSize(unsigned int width, unsigned int height)
bool setMediaType(int mediaTypeID)
bool setFramerate(double framerate)
bool setFormat(unsigned int width, unsigned int height, double framerate)
unsigned int height
Number of rows in the image.
unsigned int width
Number of columns in the image.
Definition of the vpImage class member functions.
Definition vpImage.h:131