2011-10-25 15:48:19 +00:00
|
|
|
/*
|
2014-08-06 13:43:29 +00:00
|
|
|
Copyright (c) 2011-2014, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
|
* Neither the name of the Universite de Sherbrooke nor the
|
|
|
|
|
names of its contributors may be used to endorse or promote products
|
|
|
|
|
derived from this software without specific prior written permission.
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
2014-08-11 15:49:53 +00:00
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
2014-08-06 13:43:29 +00:00
|
|
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*/
|
2011-10-25 15:48:19 +00:00
|
|
|
|
|
|
|
|
#ifndef CAMERA_H_
|
|
|
|
|
#define CAMERA_H_
|
|
|
|
|
|
2021-11-20 13:23:29 -05:00
|
|
|
#include <find_object/Header.h>
|
2014-07-31 20:11:46 +00:00
|
|
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
2011-10-25 15:48:19 +00:00
|
|
|
#include <opencv2/highgui/highgui.hpp>
|
|
|
|
|
#include <QtCore/QObject>
|
2011-11-23 16:44:14 +00:00
|
|
|
#include <QtCore/QTimer>
|
2014-05-21 21:31:42 +00:00
|
|
|
#include <QtGui/QImage>
|
2011-10-25 15:48:19 +00:00
|
|
|
|
2014-08-06 13:43:29 +00:00
|
|
|
namespace find_object {
|
|
|
|
|
|
2014-08-02 06:09:27 +00:00
|
|
|
class CameraTcpServer;
|
2014-07-31 20:11:46 +00:00
|
|
|
|
|
|
|
|
class FINDOBJECT_EXP Camera : public QObject {
|
2011-10-25 15:48:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2011-11-23 16:44:14 +00:00
|
|
|
Camera(QObject * parent = 0);
|
2011-10-25 15:48:19 +00:00
|
|
|
virtual ~Camera();
|
|
|
|
|
|
2011-11-23 16:44:14 +00:00
|
|
|
virtual bool start();
|
|
|
|
|
virtual void stop();
|
2011-11-24 00:00:37 +00:00
|
|
|
virtual bool isRunning() {return cameraTimer_.isActive();}
|
2011-10-25 15:48:19 +00:00
|
|
|
|
2012-01-30 03:16:30 +00:00
|
|
|
void pause();
|
2012-08-28 20:06:43 +00:00
|
|
|
int getTotalFrames();
|
|
|
|
|
int getCurrentFrameIndex();
|
2014-08-02 06:09:27 +00:00
|
|
|
int getPort();
|
2012-08-28 20:06:43 +00:00
|
|
|
void moveToFrame(int frame);
|
2012-01-30 03:16:30 +00:00
|
|
|
|
2014-07-08 19:55:03 +00:00
|
|
|
Q_SIGNALS:
|
2011-11-23 16:44:14 +00:00
|
|
|
void imageReceived(const cv::Mat & image);
|
2021-11-20 13:23:29 -05:00
|
|
|
void imageReceived(const cv::Mat & image, const find_object::Header & header, const cv::Mat & depth, float depthConstant);
|
2014-08-03 22:40:37 +00:00
|
|
|
void finished();
|
2011-10-25 15:48:19 +00:00
|
|
|
|
2014-07-08 19:55:03 +00:00
|
|
|
public Q_SLOTS:
|
2011-11-24 00:00:37 +00:00
|
|
|
virtual void updateImageRate();
|
|
|
|
|
virtual void takeImage();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void startTimer();
|
|
|
|
|
void stopTimer();
|
2011-10-25 15:48:19 +00:00
|
|
|
|
|
|
|
|
private:
|
2012-05-16 01:42:10 +00:00
|
|
|
cv::VideoCapture capture_;
|
2011-11-23 16:44:14 +00:00
|
|
|
QTimer cameraTimer_;
|
2012-08-28 20:06:43 +00:00
|
|
|
QList<std::string> images_;
|
|
|
|
|
unsigned int currentImageIndex_;
|
2014-08-02 06:09:27 +00:00
|
|
|
CameraTcpServer * cameraTcpServer_;
|
2011-10-25 15:48:19 +00:00
|
|
|
};
|
|
|
|
|
|
2014-08-06 13:43:29 +00:00
|
|
|
} // namespace find_object
|
|
|
|
|
|
2011-10-25 15:48:19 +00:00
|
|
|
#endif /* CAMERA_H_ */
|