Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork Sync: Update from parent repository #108

Merged
merged 8 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions cameraserver/src/main/native/include/cameraserver/CameraServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <span>
#include <string>
#include <string_view>
#include <vector>

#include <wpi/deprecated.h>

#include "cscore.h"
#include "cscore_cv.h"

namespace frc {
Expand Down Expand Up @@ -130,7 +130,9 @@ class CameraServer {
*/
template <typename T>
[[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]]
static cs::AxisCamera AddAxisCamera(std::initializer_list<T> hosts);
static cs::AxisCamera AddAxisCamera(std::initializer_list<T> hosts) {
return AddAxisCamera("Axis Camera", hosts);
}

/**
* Adds an Axis IP camera.
Expand Down Expand Up @@ -185,7 +187,14 @@ class CameraServer {
template <typename T>
[[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]]
static cs::AxisCamera AddAxisCamera(std::string_view name,
std::initializer_list<T> hosts);
std::initializer_list<T> hosts) {
std::vector<std::string> vec;
vec.reserve(hosts.size());
for (const auto& host : hosts) {
vec.emplace_back(host);
}
return AddAxisCamera(name, vec);
}
WPI_UNIGNORE_DEPRECATED

/**
Expand Down Expand Up @@ -316,5 +325,3 @@ class CameraServer {
};

} // namespace frc

#include "cameraserver/CameraServer.inc"
33 changes: 0 additions & 33 deletions cameraserver/src/main/native/include/cameraserver/CameraServer.inc

This file was deleted.

27 changes: 22 additions & 5 deletions cameraserver/src/main/native/include/vision/VisionRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <functional>
#include <memory>

#include "cscore.h"
#include "cscore_cv.h"
#include "vision/VisionPipeline.h"

Expand Down Expand Up @@ -81,17 +80,35 @@ class VisionRunnerBase {
template <typename T>
class VisionRunner : public VisionRunnerBase {
public:
/**
* Creates a new vision runner. It will take images from the {@code
* videoSource}, send them to the {@code pipeline}, and call the {@code
* listener} when the pipeline has finished to alert user code when it is safe
* to access the pipeline's outputs.
*
* @param videoSource The video source to use to supply images for the
* pipeline
* @param pipeline The vision pipeline to run
* @param listener A function to call after the pipeline has finished
* running
*/
VisionRunner(cs::VideoSource videoSource, T* pipeline,
std::function<void(T&)> listener);
std::function<void(T&)> listener)
: VisionRunnerBase(videoSource),
m_pipeline(pipeline),
m_listener(listener) {}

virtual ~VisionRunner() = default;

protected:
void DoProcess(cv::Mat& image) override;
void DoProcess(cv::Mat& image) override {
m_pipeline->Process(image);
m_listener(*m_pipeline);
}

private:
T* m_pipeline;
std::function<void(T&)> m_listener;
};
} // namespace frc

#include "VisionRunner.inc"
} // namespace frc
36 changes: 0 additions & 36 deletions cameraserver/src/main/native/include/vision/VisionRunner.inc

This file was deleted.

Loading
Loading