|
shun-iwasawa |
31accf |
#pragma once
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
#ifndef WEBCAM_H
|
|
shun-iwasawa |
31accf |
#define WEBCAM_H
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
#include "opencv2/opencv.hpp"
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
// Toonz Includes
|
|
shun-iwasawa |
31accf |
#include "traster.h"
|
|
shun-iwasawa |
31accf |
#include "toonzqt/gutil.h"
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
#include <qobject></qobject>
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
class QCamera;
|
|
shun-iwasawa |
31accf |
class QCameraInfo;
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
class Webcam : public QObject {
|
|
shun-iwasawa |
31accf |
Q_OBJECT
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
public:
|
|
shun-iwasawa |
31accf |
Webcam();
|
|
shun-iwasawa |
31accf |
~Webcam();
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
void setWebcamDeviceName(QString name) { m_webcamDeviceName = name; }
|
|
shun-iwasawa |
31accf |
QString getWebcamDeviceName() { return m_webcamDeviceName; }
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
void setWebcamDescription(QString desc) { m_webcamDescription = desc; }
|
|
shun-iwasawa |
31accf |
QString getWebcamDescription() { return m_webcamDescription; }
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
void setWebcamIndex(int index) { m_webcamIndex = index; }
|
|
shun-iwasawa |
31accf |
int getWebcamIndex() { return m_webcamIndex; }
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
int getWebcamWidth() { return m_webcamWidth; }
|
|
shun-iwasawa |
31accf |
int getWebcamHeight() { return m_webcamHeight; }
|
|
shun-iwasawa |
31accf |
void setWebcamWidth(int width) { m_webcamWidth = width; }
|
|
shun-iwasawa |
31accf |
void setWebcamHeight(int height) { m_webcamHeight = height; }
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
void releaseWebcam();
|
|
shun-iwasawa |
31accf |
void clearWebcam();
|
|
shun-iwasawa |
31accf |
QList<qcamerainfo> getWebcams();</qcamerainfo>
|
|
shun-iwasawa |
31accf |
QCamera* getWebcam() { return m_webcam; }
|
|
shun-iwasawa |
31accf |
void setWebcam(QCamera* camera);
|
|
shun-iwasawa |
31accf |
bool initWebcam(int index = 0);
|
|
shun-iwasawa |
31accf |
bool getWebcamImage(TRaster32P& tempImage);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
bool translateIndex(int index);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
QList<qsize> getWebcamResolutions() { return m_webcamResolutions; }</qsize>
|
|
shun-iwasawa |
31accf |
int getIndexOfResolution();
|
|
shun-iwasawa |
31accf |
void clearWebcamResolutions();
|
|
shun-iwasawa |
31accf |
void refreshWebcamResolutions();
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
void setUseMjpg(bool on);
|
|
shun-iwasawa |
31accf |
bool getUseMjpg() { return m_useMjpg; }
|
|
shun-iwasawa |
31accf |
bool getUseDirectShow() { return m_useDirectShow; }
|
|
shun-iwasawa |
31accf |
void setUseDirectShow(int state);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
bool getWebcamAutofocusStatus();
|
|
shun-iwasawa |
31accf |
void setWebcamAutofocusStatus(bool on);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
int getWebcamFocusValue();
|
|
shun-iwasawa |
31accf |
void setWebcamFocusValue(int value);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
int getWebcamExposureValue();
|
|
shun-iwasawa |
31accf |
void setWebcamExposureValue(int value);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
int getWebcamBrightnessValue();
|
|
shun-iwasawa |
31accf |
void setWebcamBrightnessValue(int value);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
int getWebcamContrastValue();
|
|
shun-iwasawa |
31accf |
void setWebcamContrastValue(int value);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
int getWebcamGainValue();
|
|
shun-iwasawa |
31accf |
void setWebcamGainValue(int value);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
int getWebcamSaturationValue();
|
|
shun-iwasawa |
31accf |
void setWebcamSaturationValue(int value);
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
void openSettingsWindow();
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
private:
|
|
shun-iwasawa |
31accf |
// Webcam Properties
|
|
shun-iwasawa |
31accf |
QList<qcamerainfo> m_webcams;</qcamerainfo>
|
|
shun-iwasawa |
31accf |
QCamera* m_webcam;
|
|
shun-iwasawa |
31accf |
cv::VideoCapture m_cvWebcam;
|
|
shun-iwasawa |
31accf |
QList<qsize> m_webcamResolutions;</qsize>
|
|
shun-iwasawa |
31accf |
// Webcam Public Properties
|
|
shun-iwasawa |
31accf |
QString m_webcamDeviceName;
|
|
shun-iwasawa |
31accf |
QString m_webcamDescription;
|
|
shun-iwasawa |
31accf |
int m_webcamIndex = -1;
|
|
shun-iwasawa |
31accf |
bool m_useDirectShow = true;
|
|
shun-iwasawa |
31accf |
int m_webcamWidth = 0;
|
|
shun-iwasawa |
31accf |
int m_webcamHeight = 0;
|
|
shun-iwasawa |
31accf |
bool m_useMjpg = true;
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
int m_webcamFocusValue = 0;
|
|
shun-iwasawa |
31accf |
bool m_webcamAutofocusStatus = true;
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
signals:
|
|
shun-iwasawa |
31accf |
void useMjpgSignal(bool);
|
|
shun-iwasawa |
31accf |
void useDirectShowSignal(bool);
|
|
shun-iwasawa |
31accf |
};
|
|
shun-iwasawa |
31accf |
|
|
shun-iwasawa |
31accf |
#endif // WEBCAM_H
|