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
+26
View File
@@ -0,0 +1,26 @@
#ifndef __OPENCV_CVV_HPP__
#define __OPENCV_CVV_HPP__
/**
@defgroup cvv GUI for Interactive Visual Debugging of Computer Vision Programs
Namespace for all functions is **cvv**, i.e. *cvv::showImage()*.
Compilation:
- For development, i.e. for cvv GUI to show up, compile your code using cvv with
*g++ -DCVVISUAL_DEBUGMODE*.
- For release, i.e. cvv calls doing nothing, compile your code without above flag.
See cvv tutorial for a commented example application using cvv.
*/
#include <opencv2/cvv/call_meta_data.hpp>
#include <opencv2/cvv/debug_mode.hpp>
#include <opencv2/cvv/dmatch.hpp>
#include <opencv2/cvv/filter.hpp>
#include <opencv2/cvv/final_show.hpp>
#include <opencv2/cvv/show_image.hpp>
#endif //__OPENCV_CVV_HPP__
@@ -0,0 +1,67 @@
#ifndef CVVISUAL_CALL_DATA_HPP
#define CVVISUAL_CALL_DATA_HPP
#include <string>
#include <cstddef>
#include <utility>
namespace cvv
{
//! @addtogroup cvv
//! @{
namespace impl
{
/**
* @brief Optional information about a location in Code.
*/
struct CallMetaData
{
public:
/**
* @brief Creates an unknown location.
*/
CallMetaData()
: file(nullptr), line(0), function(nullptr), isKnown(false)
{
}
/**
* @brief Creates the provided location.
*
* Argument should be self-explaining.
*/
CallMetaData(const char *file, size_t line, const char *function)
: file(file), line(line), function(function), isKnown(true)
{
}
operator bool()
{
return isKnown;
}
// self-explaining:
const char *file;
const size_t line;
const char *function;
/**
* @brief Whether *this holds actual data.
*/
const bool isKnown;
};
}
//! @}
} // namespaces
/**
* @brief Creates an instance of CallMetaData with the location of the macro as
* value.
*/
#define CVVISUAL_LOCATION ::cvv::impl::CallMetaData(__FILE__, __LINE__, CV_Func)
#endif
+5
View File
@@ -0,0 +1,5 @@
#ifdef __OPENCV_BUILD
#error this is a compatibility header which should not be used inside the OpenCV library
#endif
#include "opencv2/cvv.hpp"
@@ -0,0 +1,51 @@
#ifndef CVVISUAL_DEBUG_MODE_HPP
#define CVVISUAL_DEBUG_MODE_HPP
#if __cplusplus >= 201103L && defined CVVISUAL_USE_THREAD_LOCAL
#define CVVISUAL_THREAD_LOCAL thread_local
#else
#define CVVISUAL_THREAD_LOCAL
#endif
namespace cvv
{
//! @addtogroup cvv
//! @{
namespace impl
{
/**
* The debug-flag-singleton
*/
static inline bool &getDebugFlag()
{
CVVISUAL_THREAD_LOCAL static bool flag = true;
return flag;
}
} // namespace impl
/** @brief Returns whether debug-mode is active for this TU and thread.
*/
static inline bool debugMode()
{
return impl::getDebugFlag();
}
/** @brief Enable or disable cvv for current translation unit and thread
(disabled this way has higher - but still low - overhead compared to using the compile flags).
@param active
*/
static inline void setDebugFlag(bool active)
{
impl::getDebugFlag() = active;
}
//! @}
} // namespace cvv
#endif
+100
View File
@@ -0,0 +1,100 @@
#ifndef CVVISUAL_DEBUG_DMATCH_HPP
#define CVVISUAL_DEBUG_DMATCH_HPP
#include <string>
#include "opencv2/core.hpp"
#include "opencv2/features.hpp"
#include "call_meta_data.hpp"
#include "debug_mode.hpp"
#ifdef CV_DOXYGEN
#define CVVISUAL_DEBUGMODE
#endif
namespace cvv
{
//! @addtogroup cvv
//! @{
namespace impl
{
CV_EXPORTS 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);
} // namespace impl
#ifdef CVVISUAL_DEBUGMODE
/** @brief Add a filled in DMatch \<dmatch\> to debug GUI.
The matches can are visualized for interactive inspection in different GUI views (one similar to an
interactive :draw_matches:drawMatches\<\>).
@param img1 First image used in DMatch \<dmatch\>.
@param keypoints1 Keypoints of first image.
@param img2 Second image used in DMatch.
@param keypoints2 Keypoints of second image.
@param matches
@param data See showImage
@param description See showImage
@param view See showImage
@param useTrainDescriptor Use DMatch \<dmatch\>'s train descriptor index instead of query
descriptor index.
*/
static inline void
debugDMatch(cv::InputArray img1, std::vector<cv::KeyPoint> keypoints1,
cv::InputArray img2, std::vector<cv::KeyPoint> keypoints2,
std::vector<cv::DMatch> matches, const impl::CallMetaData &data,
const char *description = nullptr, const char *view = nullptr,
bool useTrainDescriptor = true)
{
if (debugMode())
{
impl::debugDMatch(img1, std::move(keypoints1), img2,
std::move(keypoints2), std::move(matches),
data, description, view, useTrainDescriptor);
}
}
/** @overload */
static inline void
debugDMatch(cv::InputArray img1, std::vector<cv::KeyPoint> keypoints1,
cv::InputArray img2, std::vector<cv::KeyPoint> keypoints2,
std::vector<cv::DMatch> matches, const impl::CallMetaData &data,
const std::string &description, const std::string &view,
bool useTrainDescriptor = true)
{
if (debugMode())
{
impl::debugDMatch(img1, std::move(keypoints1), img2,
std::move(keypoints2), std::move(matches),
data, description.c_str(), view.c_str(),
useTrainDescriptor);
}
}
#else
static inline void debugDMatch(cv::InputArray, std::vector<cv::KeyPoint>,
cv::InputArray, std::vector<cv::KeyPoint>,
std::vector<cv::DMatch>,
const impl::CallMetaData &,
const char * = nullptr, const char * = nullptr,
bool = true)
{
}
static inline void debugDMatch(cv::InputArray, std::vector<cv::KeyPoint>,
cv::InputArray, std::vector<cv::KeyPoint>,
std::vector<cv::DMatch>,
const impl::CallMetaData &, const std::string &,
const std::string &, bool = true)
{
}
#endif
//! @}
} // namespace cvv
#endif
@@ -0,0 +1,76 @@
#ifndef CVVISUAL_DEBUG_FILTER_HPP
#define CVVISUAL_DEBUG_FILTER_HPP
#include <string>
#include "opencv2/core.hpp"
#include "call_meta_data.hpp"
#include "debug_mode.hpp"
#ifdef CV_DOXYGEN
#define CVVISUAL_DEBUGMODE
#endif
namespace cvv
{
//! @addtogroup cvv
//! @{
namespace impl
{
// implementation outside API
CV_EXPORTS void debugFilter(cv::InputArray original, cv::InputArray result,
const CallMetaData &data, const char *description,
const char *view);
} // namespace impl
#ifdef CVVISUAL_DEBUGMODE
/**
* @brief Use the debug-framework to compare two images (from which the second
* is intended to be the result of
* a filter applied to the first).
*/
static inline void
debugFilter(cv::InputArray original, cv::InputArray result,
impl::CallMetaData metaData = impl::CallMetaData(),
const char *description = nullptr, const char *view = nullptr)
{
if (debugMode())
{
impl::debugFilter(original, result, metaData, description,
view);
}
}
/** @overload */
static inline void debugFilter(cv::InputArray original, cv::InputArray result,
impl::CallMetaData metaData,
const ::std::string &description,
const ::std::string &view = "")
{
if (debugMode())
{
impl::debugFilter(original, result, metaData,
description.c_str(), view.c_str());
}
}
#else
static inline void debugFilter(cv::InputArray, cv::InputArray,
impl::CallMetaData = impl::CallMetaData(),
const char * = nullptr, const char * = nullptr)
{
}
static inline void debugFilter(cv::InputArray, cv::InputArray,
impl::CallMetaData, const ::std::string &,
const ::std::string &)
{
}
#endif
//! @}
} // namespace cvv
#endif
@@ -0,0 +1,52 @@
#ifndef CVVISUAL_FINAL_SHOW_HPP
#define CVVISUAL_FINAL_SHOW_HPP
#include "opencv2/core.hpp"
#include "debug_mode.hpp"
namespace cvv
{
//! @addtogroup cvv
//! @{
namespace impl
{
CV_EXPORTS void finalShow();
}
/** @brief Passes the control to the debug-window for a last time.
This function **must** be called *once* *after* all cvv calls if any. As an alternative create an
instance of FinalShowCaller, which calls finalShow() in its destructor (RAII-style).
*/
inline void finalShow()
{
#ifdef CVVISUAL_DEBUGMODE
if (debugMode())
{
impl::finalShow();
}
#endif
}
/**
* @brief RAII-class to call finalShow() in it's dtor.
*/
class FinalShowCaller
{
public:
/**
* @brief Calls finalShow().
*/
~FinalShowCaller()
{
finalShow();
}
};
//! @}
}
#endif
@@ -0,0 +1,75 @@
#ifndef CVVISUAL_DEBUG_SHOW_IMAGE_HPP
#define CVVISUAL_DEBUG_SHOW_IMAGE_HPP
#include <string>
#include "opencv2/core.hpp"
#include "call_meta_data.hpp"
#include "debug_mode.hpp"
#ifdef CV_DOXYGEN
#define CVVISUAL_DEBUGMODE
#endif
namespace cvv
{
//! @addtogroup cvv
//! @{
namespace impl
{
// implementation outside API
CV_EXPORTS void showImage(cv::InputArray img, const CallMetaData &data,
const char *description, const char *view);
} // namespace impl
#ifdef CVVISUAL_DEBUGMODE
/** @brief Add a single image to debug GUI (similar to imshow \<\>).
@param img Image to show in debug GUI.
@param metaData Properly initialized CallMetaData struct, i.e. information about file, line and
function name for GUI. Use CVVISUAL_LOCATION macro.
@param description Human readable description to provide context to image.
@param view Preselect view that will be used to visualize this image in GUI. Other views can still
be selected in GUI later on.
*/
static inline void showImage(cv::InputArray img,
impl::CallMetaData metaData = impl::CallMetaData(),
const char *description = nullptr,
const char *view = nullptr)
{
if (debugMode())
{
impl::showImage(img, metaData, description, view);
}
}
/** @overload */
static inline void showImage(cv::InputArray img, impl::CallMetaData metaData,
const ::std::string &description,
const ::std::string &view = "")
{
if (debugMode())
{
impl::showImage(img, metaData, description.c_str(),
view.c_str());
}
}
#else
static inline void showImage(cv::InputArray,
impl::CallMetaData = impl::CallMetaData(),
const char * = nullptr, const char * = nullptr)
{
}
static inline void showImage(cv::InputArray, impl::CallMetaData,
const ::std::string &, const ::std::string &)
{
}
#endif
//! @}
} // namespace cvv
#endif