mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
51 lines
1.7 KiB
C++
51 lines
1.7 KiB
C++
/*----------------------------------------------------------------------------*/
|
|
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
/* the project. */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
#ifndef CSCORE_CVSOURCEIMPL_H_
|
|
#define CSCORE_CVSOURCEIMPL_H_
|
|
|
|
#include <atomic>
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "SourceImpl.h"
|
|
|
|
namespace cs {
|
|
|
|
class CvSourceImpl : public SourceImpl {
|
|
public:
|
|
CvSourceImpl(wpi::StringRef name, const VideoMode& mode);
|
|
~CvSourceImpl() override;
|
|
|
|
void Start();
|
|
|
|
bool SetVideoMode(const VideoMode& mode, CS_Status* status) override;
|
|
|
|
void NumSinksChanged() override;
|
|
void NumSinksEnabledChanged() override;
|
|
|
|
// OpenCV-specific functions
|
|
void PutFrame(cv::Mat& image);
|
|
void NotifyError(wpi::StringRef msg);
|
|
int CreateProperty(wpi::StringRef name, CS_PropertyKind kind, int minimum,
|
|
int maximum, int step, int defaultValue, int value);
|
|
int CreateProperty(wpi::StringRef name, CS_PropertyKind kind, int minimum,
|
|
int maximum, int step, int defaultValue, int value,
|
|
std::function<void(CS_Property property)> onChange);
|
|
void SetEnumPropertyChoices(int property, wpi::ArrayRef<std::string> choices,
|
|
CS_Status* status);
|
|
|
|
private:
|
|
std::atomic_bool m_connected{true};
|
|
};
|
|
|
|
} // namespace cs
|
|
|
|
#endif // CSCORE_CVSOURCEIMPL_H_
|