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

Make code compatible with modern OpenCV (3.4-4.x) #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
8 changes: 4 additions & 4 deletions sources/lib/ds_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ DsImage::DsImage(const std::string& path, const int& inputH, const int& inputW)
m_ImageName()
{
m_ImageName = std::experimental::filesystem::path(path).stem().string();
m_OrigImage = cv::imread(path, CV_LOAD_IMAGE_COLOR);
m_OrigImage = cv::imread(path, cv::IMREAD_COLOR);

if (!m_OrigImage.data || m_OrigImage.cols <= 0 || m_OrigImage.rows <= 0)
{
Expand Down Expand Up @@ -91,7 +91,7 @@ DsImage::DsImage(const std::string& path, const int& inputH, const int& inputW)
m_LetterboxImage.convertTo(m_LetterboxImage, CV_32FC3, 1 / 255.0);
cv::threshold(m_LetterboxImage, m_LetterboxImage, 1.0, 1.0, cv::ThresholdTypes::THRESH_TRUNC);
// converting to RGB
cv::cvtColor(m_LetterboxImage, m_LetterboxImage, CV_BGR2RGB);
cv::cvtColor(m_LetterboxImage, m_LetterboxImage, cv::COLOR_BGR2RGB);
}

void DsImage::addBBox(BBoxInfo box, const std::string& labelName)
Expand All @@ -109,7 +109,7 @@ void DsImage::addBBox(BBoxInfo box, const std::string& labelName)
= cv::getTextSize(labelName, cv::FONT_HERSHEY_COMPLEX_SMALL, 0.5, 1, nullptr);
cv::rectangle(m_MarkedImage, cv::Rect(x, y, tsize.width + 3, tsize.height + 4), color, -1);
cv::putText(m_MarkedImage, labelName.c_str(), cv::Point(x, y + tsize.height),
cv::FONT_HERSHEY_COMPLEX_SMALL, 0.5, cv::Scalar(255, 255, 255), 1, CV_AA);
cv::FONT_HERSHEY_COMPLEX_SMALL, 0.5, cv::Scalar(255, 255, 255), 1, cv::LINE_AA);
}

void DsImage::showImage() const
Expand All @@ -122,4 +122,4 @@ void DsImage::showImage() const
void DsImage::saveImageJPEG(const std::string& dirPath) const
{
cv::imwrite(dirPath + m_ImageName + ".jpeg", m_MarkedImage);
}
}
1 change: 0 additions & 1 deletion sources/lib/trt_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ SOFTWARE.
#define __TRT_UTILS_H__

/* OpenCV headers */
#include <opencv/cv.h>
#include <opencv2/core/core.hpp>
#include <opencv2/dnn/dnn.hpp>
#include <opencv2/highgui/highgui.hpp>
Expand Down