Skip to content
Open
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
12 changes: 10 additions & 2 deletions lib/src/detector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ std::vector<Face> MTCNNDetector::detect(const cv::Mat &img,

cv::Mat rgbImg;
if (img.channels() == 3) {
cv::cvtColor(img, rgbImg, CV_BGR2RGB);
if (CV_VERSION_MAJOR >= 4) {
cv::cvtColor(img, rgbImg, cv::COLOR_BGR2RGB);
} else {
cv::cvtColor(img, rgbImg, CV_BGR2RGB);
}
} else if (img.channels() == 4) {
cv::cvtColor(img, rgbImg, CV_BGRA2RGB);
if (CV_VERSION_MAJOR >= 4) {
cv::cvtColor(img, rgbImg, cv::COLOR_BGRA2RGB);
} else {
cv::cvtColor(img, rgbImg, CV_BGRA2RGB);
}
}
if (rgbImg.empty()) {
return std::vector<Face>();
Expand Down
2 changes: 1 addition & 1 deletion sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set (SAMPLE_INCLUDE_PATH "${SAMPLE_PATH}/include")
find_package(OpenCV REQUIRED)

set(Boost_USE_STATIC_LIBS ON)
FIND_PACKAGE(Boost 1.58 COMPONENTS filesystem timer REQUIRED)
FIND_PACKAGE(Boost 1.58 COMPONENTS filesystem timer REQUIRED chrono)

#set includes
include_directories (
Expand Down