Skip to content

Commit

Permalink
Support for newer OpenCV
Browse files Browse the repository at this point in the history
  • Loading branch information
lukacu committed Mar 16, 2023
1 parent dcc0022 commit 501e613
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions support/client/player.cpp
Expand Up @@ -150,7 +150,7 @@ Region get_region_interactive(const string& window, Mat& image) {

bool read_frame(VideoCapture& reader, int frame, Mat& image) {

int current = reader.get(CV_CAP_PROP_POS_FRAMES);
int current = reader.get(cv::CAP_PROP_POS_FRAMES);

if (frame < current) return false;

Expand Down Expand Up @@ -296,7 +296,7 @@ int main(int argc, char** argv) {

Mat cvimage;
VideoCapture reader(video_file);
int video_length = reader.get(CV_CAP_PROP_FRAME_COUNT);
int video_length = reader.get(cv::CAP_PROP_FRAME_COUNT);

print_debug("Video will be loaded from file %s.\n", video_file.c_str());

Expand Down
2 changes: 1 addition & 1 deletion support/opencv/interactive.cpp
Expand Up @@ -50,7 +50,7 @@ bool wait = false;

void on_mouse(int event, int x, int y, int, void* data) {

if( event == CV_EVENT_LBUTTONDOWN && wait ) {
if( event == cv::EVENT_LBUTTONDOWN && wait ) {

cv::Rect *rect = (cv::Rect *) data;

Expand Down
8 changes: 4 additions & 4 deletions support/opencv/opencv.cpp
Expand Up @@ -16,7 +16,7 @@ cv::Mat image_to_mat(const Image& image) {

switch (image.type()) {
case TRAX_IMAGE_PATH:
return cv::imread(image.get_path(), CV_LOAD_IMAGE_COLOR);
return cv::imread(image.get_path(), cv::IMREAD_COLOR);
case TRAX_IMAGE_MEMORY: {
int width, height, format;
image.get_memory_header(&width, &height, &format);
Expand All @@ -27,7 +27,7 @@ cv::Mat image_to_mat(const Image& image) {

cv::Mat result;

cv::cvtColor(tmp, result, CV_BGR2RGB);
cv::cvtColor(tmp, result, cv::COLOR_BGR2RGB);

return result;
}
Expand All @@ -38,7 +38,7 @@ cv::Mat image_to_mat(const Image& image) {
// This is problematic but we will just read from the buffer anyway ...
const cv::Mat mem(1, length, CV_8UC1, const_cast<char *>(buffer));

return cv::imdecode(mem, CV_LOAD_IMAGE_COLOR);
return cv::imdecode(mem, cv::IMREAD_COLOR);

}
}
Expand Down Expand Up @@ -100,7 +100,7 @@ Image mat_to_image(const cv::Mat& mat) {
Image image = Image::create_memory(mat.cols, mat.rows, format);
char* dst = image.write_memory_row(0);
cv::Mat tmp(mat.size(), mat.type(), dst);
cv::cvtColor(mat, tmp, CV_BGR2RGB);
cv::cvtColor(mat, tmp, cv::COLOR_BGR2RGB);

return image;
}
Expand Down

0 comments on commit 501e613

Please sign in to comment.