mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
@@ -13,6 +13,8 @@
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "wpi/cameraserver/CameraServerShared.hpp"
|
||||
#include "wpi/cs/VideoEvent.hpp"
|
||||
#include "wpi/cs/VideoListener.hpp"
|
||||
#include "wpi/nt/BooleanTopic.hpp"
|
||||
#include "wpi/nt/IntegerTopic.hpp"
|
||||
#include "wpi/nt/NetworkTable.hpp"
|
||||
@@ -247,17 +249,17 @@ void Instance::UpdateStreamValues() {
|
||||
}
|
||||
}
|
||||
|
||||
static std::string PixelFormatToString(int pixelFormat) {
|
||||
static std::string PixelFormatToString(wpi::util::PixelFormat pixelFormat) {
|
||||
switch (pixelFormat) {
|
||||
case cs::VideoMode::PixelFormat::kMJPEG:
|
||||
case wpi::util::PixelFormat::kMJPEG:
|
||||
return "MJPEG";
|
||||
case cs::VideoMode::PixelFormat::kYUYV:
|
||||
case wpi::util::PixelFormat::kYUYV:
|
||||
return "YUYV";
|
||||
case cs::VideoMode::PixelFormat::kRGB565:
|
||||
case wpi::util::PixelFormat::kRGB565:
|
||||
return "RGB565";
|
||||
case cs::VideoMode::PixelFormat::kBGR:
|
||||
case wpi::util::PixelFormat::kBGR:
|
||||
return "BGR";
|
||||
case cs::VideoMode::PixelFormat::kGray:
|
||||
case wpi::util::PixelFormat::kGray:
|
||||
return "Gray";
|
||||
default:
|
||||
return "Unknown";
|
||||
@@ -506,7 +508,7 @@ cs::UsbCamera CameraServer::StartAutomaticCapture(std::string_view name,
|
||||
cs::MjpegServer CameraServer::AddSwitchedCamera(std::string_view name) {
|
||||
auto& inst = ::GetInstance();
|
||||
// create a dummy CvSource
|
||||
cs::CvSource source{name, cs::VideoMode::PixelFormat::kMJPEG, 160, 120, 30};
|
||||
cs::CvSource source{name, wpi::util::PixelFormat::kMJPEG, 160, 120, 30};
|
||||
cs::MjpegServer server = StartAutomaticCapture(source);
|
||||
inst.m_fixedSources[server.GetHandle()] = source.GetHandle();
|
||||
|
||||
@@ -568,7 +570,7 @@ cs::CvSink CameraServer::GetVideo(const cs::VideoSource& camera) {
|
||||
}
|
||||
|
||||
cs::CvSink CameraServer::GetVideo(const cs::VideoSource& camera,
|
||||
cs::VideoMode::PixelFormat pixelFormat) {
|
||||
wpi::util::PixelFormat pixelFormat) {
|
||||
auto& inst = ::GetInstance();
|
||||
wpi::util::SmallString<64> name{"opencv_"};
|
||||
name += camera.GetName();
|
||||
@@ -611,7 +613,7 @@ cs::CvSink CameraServer::GetVideo(std::string_view name) {
|
||||
}
|
||||
|
||||
cs::CvSink CameraServer::GetVideo(std::string_view name,
|
||||
cs::VideoMode::PixelFormat pixelFormat) {
|
||||
wpi::util::PixelFormat pixelFormat) {
|
||||
auto& inst = ::GetInstance();
|
||||
cs::VideoSource source;
|
||||
{
|
||||
@@ -630,7 +632,7 @@ cs::CvSink CameraServer::GetVideo(std::string_view name,
|
||||
cs::CvSource CameraServer::PutVideo(std::string_view name, int width,
|
||||
int height) {
|
||||
::GetInstance();
|
||||
cs::CvSource source{name, cs::VideoMode::kMJPEG, width, height, 30};
|
||||
cs::CvSource source{name, wpi::util::PixelFormat::kMJPEG, width, height, 30};
|
||||
StartAutomaticCapture(source);
|
||||
return source;
|
||||
}
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "wpi/cs/cscore_cv.hpp"
|
||||
#include "wpi/cs/CvSink.hpp"
|
||||
#include "wpi/cs/CvSource.hpp"
|
||||
#include "wpi/cs/MjpegServer.hpp"
|
||||
#include "wpi/cs/UsbCamera.hpp"
|
||||
#include "wpi/util/PixelFormat.hpp"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
@@ -107,7 +108,7 @@ class CameraServer {
|
||||
* camera
|
||||
*/
|
||||
static cs::CvSink GetVideo(const cs::VideoSource& camera,
|
||||
cs::VideoMode::PixelFormat pixelFormat);
|
||||
wpi::util::PixelFormat pixelFormat);
|
||||
|
||||
/**
|
||||
* Get OpenCV access to the specified camera. This allows you to get
|
||||
@@ -126,7 +127,7 @@ class CameraServer {
|
||||
* camera
|
||||
*/
|
||||
static cs::CvSink GetVideo(std::string_view name,
|
||||
cs::VideoMode::PixelFormat pixelFormat);
|
||||
wpi::util::PixelFormat pixelFormat);
|
||||
|
||||
/**
|
||||
* Create a MJPEG stream with OpenCV input. This can be called to pass custom
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include "wpi/cs/cscore_cv.hpp"
|
||||
#include "wpi/cs/CvSink.hpp"
|
||||
#include "wpi/cs/VideoSource.hpp"
|
||||
#include "wpi/vision/VisionPipeline.hpp"
|
||||
|
||||
namespace wpi::vision {
|
||||
|
||||
Reference in New Issue
Block a user