vendor: OpenCV 5.0.0 snapshot at 755e50675d97db9b7d449d8bd6b09888646f6c6e

This commit is contained in:
Gitea Mirror Bot
2026-08-22 00:11:13 +08:00
commit 12022378a3
3872 changed files with 2513409 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#include "call.hpp"
#include <atomic>
namespace cvv
{
namespace impl
{
size_t newCallId()
{
static std::atomic_size_t nextId (1);
return nextId++;
}
Call::Call() : metaData_{}, id{ newCallId() }, calltype{}
{
}
Call::Call(impl::CallMetaData callData, QString type, QString description,
QString requestedView)
: metaData_{ std::move(callData) }, id{ newCallId() },
calltype{ std::move(type) }, description_{ std::move(description) },
requestedView_{ std::move(requestedView) }
{
}
}
} // namespaces cvv::impl
+113
View File
@@ -0,0 +1,113 @@
#ifndef CVVISUAL_CALL_HPP
#define CVVISUAL_CALL_HPP
#include <utility>
#include <QString>
#include "opencv2/core.hpp"
#include "opencv2/features.hpp"
#include "opencv2/cvv/call_meta_data.hpp"
namespace cvv
{
namespace impl
{
/**
* @brief Returns a new, unique id for calls.
*/
size_t newCallId();
/**
* @brief Baseclass for all calls. Provides access to the common functionality.
*/
class Call
{
public:
virtual ~Call()
{
}
/**
* @brief Returns the unique id of the call.
*/
size_t getId() const
{
return id;
}
/**
* Returns a string that identifies what kind of call this is.
*/
const QString &type() const
{
return calltype;
}
/**
* @brief Returns the number of images that are part of the call.
*/
virtual size_t matrixCount() const = 0;
/**
* Returns the n'th matrix that is involved in the call.
*
* @throws std::out_of_range if index is higher then matrixCount().
*/
virtual const cv::Mat &matrixAt(size_t index) const = 0;
/**
* @brief provides a description of the call.
*/
const QString &description() const
{
return description_;
}
/**
* @brief Returns a string which view was requested by the caller of the
* API.
*/
const QString &requestedView() const
{
return requestedView_;
}
/**
* @brief Provides read-access to the meta-data of the call (from where
* it came).
*/
const CallMetaData &metaData() const
{
return metaData_;
}
protected:
/**
* @brief Default-construcs a new Call with a new, unique ID.
*/
Call();
/**
* @brief Construcs a new Call with a new, unique ID and the provided
* data.
*/
Call(impl::CallMetaData callData, QString type, QString description,
QString requestedView);
Call(const Call &) = default;
Call(Call &&) = default;
impl::CallMetaData metaData_;
size_t id;
QString calltype;
QString description_;
QString requestedView_;
};
}
} // namespaces
#endif
+116
View File
@@ -0,0 +1,116 @@
#include "data_controller.hpp"
#include <stdexcept>
namespace cvv
{
namespace impl
{
namespace
{
class CallEquality
{
public:
CallEquality(size_t Id) : Id{ Id }
{
}
bool operator()(const std::unique_ptr<Call> &call) const
{
return call->getId() == Id;
}
private:
size_t Id;
};
}
void DataController::addCall(std::unique_ptr<Call> call)
{
auto ref = util::makeRef(*call);
calls.push_back(std::move(call));
viewController.addCall(ref);
callUI();
}
void DataController::removeCall(size_t Id)
{
auto it = std::find_if(calls.begin(), calls.end(), CallEquality{ Id });
if (it == calls.end())
{
throw std::invalid_argument{ "there is no call with this id" };
}
calls.erase(it);
}
const Call &DataController::getCall(size_t Id) const
{
auto it = std::find_if(calls.begin(), calls.end(), CallEquality{ Id });
if (it == calls.end())
{
throw std::invalid_argument{ "there is no call with this id" };
}
return **it;
}
Call &DataController::getCall(size_t Id)
{
auto it = std::find_if(calls.begin(), calls.end(), CallEquality{ Id });
if (it == calls.end())
{
throw std::invalid_argument{ "there is no call with this id" };
}
return **it;
}
bool DataController::hasCall(size_t Id)
{
auto it = std::find_if(calls.begin(), calls.end(), CallEquality{ Id });
return it != calls.end();
}
size_t DataController::numCalls() const
{
return calls.size();
}
void DataController::callUI()
{
viewController.exec();
}
void DataController::lastCall()
{
viewController.showExitProgramButton();
callUI();
}
/**
* @brief Actual implementation of the global DataController.
*
* This is required to be able to delete it.
*/
static std::unique_ptr<DataController> &realSingleton()
{
static std::unique_ptr<DataController> var = nullptr;
return var;
}
void deleteDataController()
{
realSingleton().reset();
}
DataController &dataController()
{
auto& controller = realSingleton();
if(!realSingleton().get())
{
controller = util::make_unique<DataController>();
}
return *controller;
}
}
} // namespaces cvv::impl
+94
View File
@@ -0,0 +1,94 @@
#ifndef CVVISUAL_DATA_CONTROLLER_HPP
#define CVVISUAL_DATA_CONTROLLER_HPP
#include <memory>
#include <vector>
#include "opencv2/core.hpp"
#include "call.hpp"
#include "../controller/view_controller.hpp"
namespace cvv
{
namespace impl
{
/**
* @brief The central controller of the debug-framework that owns all the
* calldata.
*/
class DataController
{
public:
DataController() = default;
~DataController()
{
}
/**
* Add a new call to the calls-list.
*/
void addCall(std::unique_ptr<Call> call);
/**
* Remove a call.
* @throws std::invalid_argument if no such call exists
*/
void removeCall(size_t Id);
/**
* Get read-access to a certain call.
*/
const Call &getCall(size_t Id) const;
/**
* Get read/write-access to a certain call.
*/
Call &getCall(size_t Id);
bool hasCall(size_t Id);
/**
* Get the number of currently managed calls.
*/
size_t numCalls() const;
/**
* Passes control to the View-controller.
*
* Returns when the ViewController signals that normal program-execution
*shall continue.
*
*/
void callUI();
/**
* @brief Replace the continue-buttons with close-buttons and show the
*UI.
*
* This function is intended to be called directly before main returns
*after all the actual
* work is done.
*/
void lastCall();
private:
std::vector<std::unique_ptr<Call>> calls;
controller::ViewController viewController;
};
/**
* @brief Destructs the global Singleton.
*/
void deleteDataController();
/**
* Provides access to a global DataController that is created upon the first
* call.
*/
DataController &dataController();
}
} // namespaces cvv::impl
#endif
+22
View File
@@ -0,0 +1,22 @@
#include "opencv2/cvv/dmatch.hpp"
#include "opencv2/cvv/call_meta_data.hpp"
#include "match_call.hpp"
namespace cvv
{
namespace impl
{
void debugDMatch(cv::InputArray img1, std::vector<cv::KeyPoint> keypoints1,
cv::InputArray img2, std::vector<cv::KeyPoint> keypoints2,
std::vector<cv::DMatch> matches, const CallMetaData &data,
const char *description, const char *view,
bool useTrainDescriptor)
{
debugMatchCall(img1, std::move(keypoints1), img2, std::move(keypoints2),
std::move(matches), data, description, view,
useTrainDescriptor);
}
}
} // namespaces
+18
View File
@@ -0,0 +1,18 @@
#include "opencv2/cvv/filter.hpp"
#include "opencv2/cvv/call_meta_data.hpp"
#include "filter_call.hpp"
namespace cvv
{
namespace impl
{
void debugFilter(cv::InputArray original, cv::InputArray result,
const CallMetaData &data, const char *description,
const char *view)
{
debugFilterCall(original, result, data, description, view, "filter");
}
}
} // namespaces
+45
View File
@@ -0,0 +1,45 @@
#include "filter_call.hpp"
#include "data_controller.hpp"
#include "../util/util.hpp"
namespace cvv
{
namespace impl
{
FilterCall::FilterCall(cv::InputArray in, cv::InputArray out,
impl::CallMetaData data, QString type,
QString description, QString requestedView)
: Call( data, std::move(type),
std::move(description), std::move(requestedView) ),
input_{ in.getMat().clone() }, output_{ out.getMat().clone() }
{
}
const cv::Mat &FilterCall::matrixAt(size_t index) const
{
switch (index)
{
case 0:
return original();
case 1:
return result();
default:
throw std::out_of_range{ "" };
}
}
void debugFilterCall(cv::InputArray original, cv::InputArray result,
const CallMetaData &data, const char *description,
const char *view, const char *filter)
{
dataController().addCall(util::make_unique<FilterCall>(
original, result, data, filter,
description ? QString::fromLocal8Bit(description)
: QString{ "<no description>" },
view ? QString::fromLocal8Bit(view) : QString{}));
}
}
} // namespaces cvv::impl
+66
View File
@@ -0,0 +1,66 @@
#ifndef CVVISUAL_FILTER_CALL_HPP
#define CVVISUAL_FILTER_CALL_HPP
#include <QString>
#include "call.hpp"
#include "opencv2/core.hpp"
namespace cvv
{
namespace impl
{
/**
* All data of a filter-call: Location, original image and result.
*/
class FilterCall : public Call
{
public:
/**
* @brief Constructs a FilterCall.
*/
FilterCall(cv::InputArray in, cv::InputArray out,
impl::CallMetaData data, QString type, QString description,
QString requestedView);
size_t matrixCount() const override
{
return 2;
}
const cv::Mat &matrixAt(size_t index) const override;
/**
* @returns the original image
*/
const cv::Mat &original() const
{
return input_;
}
/**
* @returns the filtered image
*/
const cv::Mat &result() const
{
return output_;
}
private:
// TODO: in case we REALLY want to support several input-images: make
// this a std::vector
// TODO: those are typedefs for references, make it clean:
cv::Mat input_;
cv::Mat output_;
};
/**
* Constructs a FilterCall and adds it to the global data-controller.
*/
void debugFilterCall(cv::InputArray original, cv::InputArray result,
const CallMetaData &data, const char *description,
const char *view, const char *filter);
}
} // namespaces
#endif
+20
View File
@@ -0,0 +1,20 @@
#include "opencv2/cvv/final_show.hpp"
#include "data_controller.hpp"
namespace cvv
{
namespace impl
{
void finalShow()
{
auto &controller = impl::dataController();
if (controller.numCalls() != 0)
{
controller.lastCall();
}
impl::deleteDataController();
}
}
} // namespaces cvv::impl
+108
View File
@@ -0,0 +1,108 @@
#include "init.hpp"
// filters
#include "../qtutil/filterselectorwidget.hpp"
#include "../qtutil/filter/grayfilterwidget.hpp"
#include "../qtutil/filter/sobelfilterwidget.hpp"
#include "../qtutil/filter/channelreorderfilter.hpp"
#include "../qtutil/filter/diffFilterWidget.hpp"
#include "../qtutil/filter/overlayfilterwidget.hpp"
#include "../qtutil/filter/changed_pixels_widget.hpp"
#include "../gui/filter_call_tab.hpp"
#include "../view/filter_view.hpp"
#include "../view/defaultfilterview.hpp"
#include "../view/dual_filter_view.hpp"
#include "../view/singlefilterview.hpp"
#include "../gui/match_call_tab.hpp"
#include "../view/match_view.hpp"
#include "../view/linematchview.hpp"
#include "../view/rawview.hpp"
#include "../view/translationsmatchview.hpp"
#include "../view/pointmatchview.hpp"
#include "../qtutil/matchview/matchselectionselector.hpp"
#include "../qtutil/matchview/matchintervallselection.hpp"
#include "../qtutil/matchview/matchportionselector.hpp"
#include "../qtutil/matchview/matchsettingsselector.hpp"
#include "../qtutil/matchview/singlecolormatchpen.hpp"
#include "../qtutil/matchview/falsecolormatchpen.hpp"
#include "../qtutil/matchview/matchshowsetting.hpp"
#include "../qtutil/matchview/keypointselectionselector.hpp"
#include "../qtutil/matchview/keypointintervallselection.hpp"
#include "../qtutil/matchview/keypointportionselector.hpp"
#include "../qtutil/matchview/keypointsettingsselector.hpp"
#include "../qtutil/matchview/singlecolorkeypointpen.hpp"
#include "../qtutil/matchview/falsecolorkeypointpen.hpp"
#include "../qtutil/matchview/keypointshowsetting.hpp"
namespace cvv
{
namespace impl
{
void initializeFilterAndViews()
{
static bool alreadyCalled = false;
if (alreadyCalled)
{
return;
}
alreadyCalled = true;
// filter for filter-selector-widget
qtutil::registerFilter<1, 1, qtutil::GrayFilterWidget>("Gray filter");
qtutil::registerFilter<1, 1, qtutil::SobelFilterWidget>("Sobel");
qtutil::registerFilter<1, 1, qtutil::ChannelReorderFilter>(
"Reorder channels");
qtutil::registerFilter<2, 1, qtutil::DiffFilterFunction>("Difference");
qtutil::registerFilter<2, 1, qtutil::OverlayFilterWidget>("Overlay");
qtutil::registerFilter<2, 1, qtutil::ChangedPixelsWidget>("Changed Pixels");
// filter-views:
cvv::gui::FilterCallTab::registerFilterView<
cvv::view::DefaultFilterView> ("DefaultFilterView");
cvv::gui::FilterCallTab::registerFilterView<cvv::view::DualFilterView> (
"DualFilterView");
cvv::gui::FilterCallTab::registerFilterView<
cvv::view::SingleFilterView>("SingleFilterView");
// match-views:
cvv::gui::MatchCallTab::registerMatchView<cvv::view::LineMatchView>(
"LineMatchView");
cvv::gui::MatchCallTab::registerMatchView<
cvv::view::TranslationMatchView>("TranslationMatchView");
cvv::gui::MatchCallTab::registerMatchView<cvv::view::PointMatchView>(
"PointMatchView");
cvv::gui::MatchCallTab::registerMatchView<cvv::view::Rawview>(
"RawView");
//match Settings
cvv::qtutil::registerMatchSettings<cvv::qtutil::SingleColorMatchPen>("Single Color");
cvv::qtutil::registerMatchSettings<cvv::qtutil::FalseColorMatchPen>("False Color");
//cvv::qtutil::registerMatchSettings<cvv::qtutil::MatchShowSetting>("Show/Hide");
//match Selector
cvv::qtutil::registerMatchSelection<cvv::qtutil::MatchIntervallSelector>("Intervall Selector");
cvv::qtutil::registerMatchSelection<cvv::qtutil::MatchPortionSelection>("Portion Selector");
//keypoint Settings
cvv::qtutil::registerKeyPointSetting<cvv::qtutil::SingleColorKeyPen>("Single Color");
cvv::qtutil::registerKeyPointSetting<cvv::qtutil::FalseColorKeyPointPen>("False Color");
//cvv::qtutil::registerKeyPointSetting<cvv::qtutil::KeyPointShowSetting>("Show/Hide");
//keypoint Selection
cvv::qtutil::registerKeyPointSelection<cvv::qtutil::KeyPointIntervallSelector>("Intervall Selector");
cvv::qtutil::registerKeyPointSelection<cvv::qtutil::KeyPointPortionSelection>("Portion Selector");
}
}
}
+14
View File
@@ -0,0 +1,14 @@
#ifndef CVVISUAL_INIT_HPP
#define CVVISUAL_INIT_HPP
namespace cvv
{
namespace impl
{
/**
* @brief Initializes filters and views.
*/
void initializeFilterAndViews();
}
}
#endif // CVVISUAL_INIT_HPP
+57
View File
@@ -0,0 +1,57 @@
#include "match_call.hpp"
#include <stdexcept>
#include <QString>
#include "data_controller.hpp"
#include "../util/util.hpp"
namespace cvv
{
namespace impl
{
MatchCall::MatchCall(cv::InputArray img1, std::vector<cv::KeyPoint> keypoints1,
cv::InputArray img2, std::vector<cv::KeyPoint> keypoints2,
std::vector<cv::DMatch> matches, impl::CallMetaData data,
QString type, QString description, QString requestedView,
bool useTrainDescriptor)
: Call( data, std::move(type),
std::move(description), std::move(requestedView) ),
img1_{ img1.getMat().clone() }, keypoints1_{ std::move(keypoints1) },
img2_{ img2.getMat().clone() }, keypoints2_{ std::move(keypoints2) },
matches_{ std::move(matches) }, usesTrainDescriptor_{ useTrainDescriptor }
{
}
const cv::Mat &MatchCall::matrixAt(size_t index) const
{
switch (index)
{
case 0:
return img1();
case 1:
return img2();
default:
throw std::out_of_range{ "" };
}
}
void debugMatchCall(cv::InputArray img1, std::vector<cv::KeyPoint> keypoints1,
cv::InputArray img2, std::vector<cv::KeyPoint> keypoints2,
std::vector<cv::DMatch> matches, const CallMetaData &data,
const char *description, const char *view,
bool useTrainDescriptor)
{
dataController().addCall(util::make_unique<MatchCall>(
img1, std::move(keypoints1), img2, std::move(keypoints2),
std::move(matches), data, "match",
description ? QString::fromLocal8Bit(description)
: QString{ "<no description>" },
view ? QString::fromLocal8Bit(view) : QString{},
useTrainDescriptor));
}
}
} // namespaces cvv::impl
+104
View File
@@ -0,0 +1,104 @@
#ifndef CVVISUAL_MATCH_CALL_HPP
#define CVVISUAL_MATCH_CALL_HPP
#include <vector>
#include <utility>
#include <type_traits>
#include "opencv2/core.hpp"
#include "opencv2/features.hpp"
#include "call.hpp"
namespace cvv
{
namespace impl
{
/**
* Contains all the calldata (= location, images and their keypoints).
*/
class MatchCall : public Call
{
public:
/**
* @brief Constructs a MatchCall.
*/
MatchCall(cv::InputArray img1, std::vector<cv::KeyPoint> keypoints1,
cv::InputArray img2, std::vector<cv::KeyPoint> keypoints2,
std::vector<cv::DMatch> matches, impl::CallMetaData data,
QString type, QString description, QString requestedView,
bool useTrainDescriptor);
size_t matrixCount() const override
{
return 2;
}
const cv::Mat &matrixAt(size_t index) const override;
/**
* @brief Returns the first Mat.
*/
const cv::Mat &img1() const
{
return img1_;
}
/**
* @brief Returns the second Mat.
*/
const cv::Mat &img2() const
{
return img2_;
}
/**
* @brief Returns the keypoints for the first Mat.
*/
const std::vector<cv::KeyPoint> &keyPoints1() const
{
return keypoints1_;
}
/**
* @brief Returns the keypoints for the second Mat.
*/
const std::vector<cv::KeyPoint> &keyPoints2() const
{
return keypoints2_;
}
/**
* @brief Returns the matches.
*/
const std::vector<cv::DMatch> &matches() const
{
return matches_;
}
bool usesTrainDescriptor() const
{
return usesTrainDescriptor_;
}
private:
cv::Mat img1_;
std::vector<cv::KeyPoint> keypoints1_;
cv::Mat img2_;
std::vector<cv::KeyPoint> keypoints2_;
std::vector<cv::DMatch> matches_;
bool usesTrainDescriptor_;
};
/**
* Constructs a MatchCall and adds it to the global data-controller.
*/
void debugMatchCall(cv::InputArray img1, std::vector<cv::KeyPoint> keypoints1,
cv::InputArray img2, std::vector<cv::KeyPoint> keypoints2,
std::vector<cv::DMatch> matches, const CallMetaData &data,
const char *description, const char *view,
bool useTrainDescriptor);
}
} // namespaces cvv::impl
#endif
+17
View File
@@ -0,0 +1,17 @@
#include "opencv2/cvv/show_image.hpp"
#include "opencv2/cvv/call_meta_data.hpp"
#include "single_image_call.hpp"
namespace cvv
{
namespace impl
{
void showImage(cv::InputArray img, const CallMetaData &data,
const char *description, const char *view)
{
debugSingleImageCall(img, data, description, view, "singleImage");
}
}
} // namespaces
@@ -0,0 +1,42 @@
#include "single_image_call.hpp"
#include <QString>
#include "data_controller.hpp"
#include "../util/util.hpp"
namespace cvv
{
namespace impl
{
SingleImageCall::SingleImageCall(cv::InputArray img, impl::CallMetaData data,
QString type, QString description,
QString requestedView)
: Call( data, std::move(type),
std::move(description), std::move(requestedView) ),
img{ img.getMat().clone() }
{
}
const cv::Mat &SingleImageCall::matrixAt(size_t index) const
{
if (index)
{
throw std::out_of_range{ "" };
}
return img;
}
void debugSingleImageCall(cv::InputArray img, const CallMetaData &data,
const char *description, const char *view,
const char *filter)
{
dataController().addCall(util::make_unique<SingleImageCall>(
img, data, filter, description ? QString::fromLocal8Bit(description)
: QString{ "<no description>" },
view ? QString::fromLocal8Bit(view) : QString{}));
}
}
} // namespaces cvv::impl
@@ -0,0 +1,55 @@
#ifndef CVVISUAL_SINGLE_IMAGE_CALL_HPP
#define CVVISUAL_SINGLE_IMAGE_CALL_HPP
#include "call.hpp"
#include <QString>
#include "opencv2/core.hpp"
namespace cvv
{
namespace impl
{
/**
* All data of a filter-call: Location, original image and result.
*/
class SingleImageCall : public Call
{
public:
/**
* @brief Constructs a SingleImageCall.
*/
SingleImageCall(cv::InputArray img, impl::CallMetaData data,
QString type, QString description,
QString requestedView);
size_t matrixCount() const override
{
return 1;
}
const cv::Mat &matrixAt(size_t index) const override;
/**
* @returns the original image
*/
const cv::Mat &mat() const
{
return img;
}
private:
cv::Mat img;
};
/**
* Constructs a SingleImageCall and adds it to the global data-controller.
*/
void debugSingleImageCall(cv::InputArray img, const CallMetaData &data,
const char *description, const char *view,
const char *filter);
}
} // namespaces
#endif