mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-20 00:05:41 -05:00
Split macro-condition-video.cpp UI into per-widget files
This makes it easier to conditionally exclude video-edit-object.cpp from the build when OpenCV >= 5 drops CascadeClassifier support.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "opencv-helpers.hpp"
|
||||
|
||||
#include <log-helper.hpp>
|
||||
#include "log-helper.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
@@ -135,29 +134,6 @@ double MatchPattern(QImage &img, QImage &pattern, double threshold,
|
||||
matchColor);
|
||||
}
|
||||
|
||||
std::vector<cv::Rect> MatchObject(QImage &img, cv::CascadeClassifier &cascade,
|
||||
double scaleFactor, int minNeighbors,
|
||||
const cv::Size &minSize,
|
||||
const cv::Size &maxSize)
|
||||
{
|
||||
if (img.isNull() || cascade.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto image = QImageToMat(img);
|
||||
cv::Mat frameGray;
|
||||
cv::cvtColor(image, frameGray, cv::COLOR_RGBA2GRAY);
|
||||
cv::equalizeHist(frameGray, frameGray);
|
||||
std::vector<cv::Rect> objects;
|
||||
try {
|
||||
cascade.detectMultiScale(frameGray, objects, scaleFactor,
|
||||
minNeighbors, 0, minSize, maxSize);
|
||||
} catch (const std::exception &e) {
|
||||
vblog(LOG_INFO, "detectMultiScale failed: %s", e.what());
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
uchar GetAvgBrightness(QImage &img)
|
||||
{
|
||||
if (img.isNull()) {
|
||||
|
||||
Reference in New Issue
Block a user