Skip to content
Merged
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
2 changes: 1 addition & 1 deletion detection/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ project(openmpf-cpp-component-api)

set(CMAKE_CXX_STANDARD 11)

find_package(OpenCV 3.4.7 EXACT REQUIRED PATHS /opt/opencv-3.4.7
find_package(OpenCV 4.5.0 EXACT REQUIRED PATHS /opt/opencv-4.5.0
COMPONENTS opencv_core opencv_imgcodecs opencv_imgproc opencv_videoio)


Expand Down
1 change: 0 additions & 1 deletion detection/api/include/MPFDetectionComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <map>
#include <string>
#include <vector>
#include <opencv2/core.hpp>

#include "MPFComponentInterface.h"
#include "MPFDetectionObjects.h"
Expand Down
16 changes: 12 additions & 4 deletions detection/api/test/test_detection_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,14 @@ TEST(AffineFrameTransformerTest, RotateFullFrame) {
}


bool isSameImage(const cv::Mat &im1, const cv::Mat &im2) {
if (im1.size() != im2.size()) {
return false;
}
return std::equal(im1.begin<Pixel>(), im1.end<Pixel>(), im2.begin<Pixel>());
}


TEST(AffineFrameTransformerTest, TestRotationThreshold) {
const auto *test_img_path = "test/test_imgs/rotation/hello-world.png";
auto original_img = cv::imread(test_img_path);
Expand All @@ -1315,14 +1323,14 @@ TEST(AffineFrameTransformerTest, TestRotationThreshold) {
{ {"ROTATION", "10"}, {"ROTATION_THRESHOLD", "10.001"} }, {});

auto img = MPFImageReader(job).GetImage();
ASSERT_EQ(0, cv::countNonZero(img != original_img));
ASSERT_TRUE(isSameImage(original_img, img));
}
{
MPFImageJob job("test", test_img_path,
{ {"ROTATION", "10"}, {"ROTATION_THRESHOLD", "9.99"} }, {});

auto img = MPFImageReader(job).GetImage();
ASSERT_NE(original_img.size(), img.size());
ASSERT_FALSE(isSameImage(original_img, img));
}
}

Expand All @@ -1337,13 +1345,13 @@ TEST(AffineFrameTransformerTest, TestRotationThresholdWithFeedForward) {
MPFImageJob job("test", test_img_path, ff_img_loc,
{ {"ROTATION_THRESHOLD", "5.12"}, {"FEED_FORWARD_TYPE", "REGION"} }, {});
auto img = MPFImageReader(job).GetImage();
ASSERT_EQ(0, cv::countNonZero(img != original_img));
ASSERT_TRUE(isSameImage(original_img, img));
}
{
MPFImageJob job("test", test_img_path, ff_img_loc,
{ {"ROTATION_THRESHOLD", "5.00"}, {"FEED_FORWARD_TYPE", "REGION"} }, {});
auto img = MPFImageReader(job).GetImage();
ASSERT_NE(0, cv::countNonZero(img != original_img));
ASSERT_FALSE(isSameImage(original_img, img));
}
}

Expand Down
2 changes: 1 addition & 1 deletion detection/examples/AudioOnlyComponent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include(../ComponentSetup.cmake)

find_package(mpfComponentInterface REQUIRED)
find_package(mpfDetectionComponentApi REQUIRED)
find_package(OpenCV 3.4.7 EXACT REQUIRED PATHS /opt/opencv-3.4.7 COMPONENTS opencv_core)
find_package(OpenCV 4.5.0 EXACT REQUIRED PATHS /opt/opencv-4.5.0 COMPONENTS opencv_core)


set(AUDIO_ONLY_COMPONENT_SOURCES AudioOnly.cpp AudioOnly.h)
Expand Down
4 changes: 2 additions & 2 deletions detection/examples/AudioOnlyComponent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BUILD

NOTE: To build and run this component, OpenCV 3.4.7
NOTE: To build and run this component, OpenCV 4.5.0
must be installed first.

NOTE: You must build the MPF Component API library before
Expand All @@ -10,7 +10,7 @@ NOTE: You must build the MPF Component API library before

Before you build, edit the src/CMakeLists.txt file, and change
the "find_package" command so that the PATHS option specifies
the root directory of your OpenCV 3.4.7 installation.
the root directory of your OpenCV 4.5.0 installation.

Run the following commands:
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"componentName": "AudioOnlyComponent",
"componentVersion": "5.1",
"middlewareVersion": "5.1",
"componentVersion": "6.0",
"middlewareVersion": "6.0",
"sourceLanguage": "c++",
"batchLibrary": "${MPF_HOME}/plugins/AudioOnlyComponent/lib/libmpfAudioOnly.so",
"environmentVariables": [
Expand Down
2 changes: 1 addition & 1 deletion detection/examples/GenericComponent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include(../ComponentSetup.cmake)

find_package(mpfComponentInterface REQUIRED)
find_package(mpfDetectionComponentApi REQUIRED)
find_package(OpenCV 3.4.7 EXACT REQUIRED PATHS /opt/opencv-3.4.7 COMPONENTS opencv_core)
find_package(OpenCV 4.5.0 EXACT REQUIRED PATHS /opt/opencv-4.5.0 COMPONENTS opencv_core)


set(GENERIC_COMPONENT_SOURCES GenericComponent.cpp GenericComponent.h)
Expand Down
4 changes: 2 additions & 2 deletions detection/examples/GenericComponent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BUILD

NOTE: To build and run this component, OpenCV 3.4.7
NOTE: To build and run this component, OpenCV 4.5.0
must be installed first.

NOTE: You must build the MPF Component API library before
Expand All @@ -10,7 +10,7 @@ NOTE: You must build the MPF Component API library before

Before you build, edit the src/CMakeLists.txt file, and change
the "find_package" command so that the PATHS option specifies
the root directory of your OpenCV 3.4.7 installation.
the root directory of your OpenCV 4.5.0 installation.

Run the following commands:
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"componentName": "GenericComponent",
"componentVersion": "5.1",
"middlewareVersion": "5.1",
"componentVersion": "6.0",
"middlewareVersion": "6.0",
"sourceLanguage": "c++",
"batchLibrary": "${MPF_HOME}/plugins/GenericComponent/lib/libmpfGeneric.so",
"environmentVariables": [
Expand Down
2 changes: 1 addition & 1 deletion detection/examples/HelloWorldComponent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include(../ComponentSetup.cmake)

find_package(mpfComponentInterface REQUIRED)
find_package(mpfDetectionComponentApi REQUIRED)
find_package(OpenCV 3.4.7 EXACT REQUIRED PATHS /opt/opencv-3.4.7 COMPONENTS opencv_core)
find_package(OpenCV 4.5.0 EXACT REQUIRED PATHS /opt/opencv-4.5.0 COMPONENTS opencv_core)
find_package(PkgConfig)
pkg_search_module(LOG4CXX REQUIRED liblog4cxx)

Expand Down
4 changes: 2 additions & 2 deletions detection/examples/HelloWorldComponent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BUILD

NOTE: To build and run this component, OpenCV 3.4.7
NOTE: To build and run this component, OpenCV 4.5.0
must be installed first.

NOTE: You must build the MPF Component API library before
Expand All @@ -10,7 +10,7 @@ NOTE: You must build the MPF Component API library before

Before you build, edit the src/CMakeLists.txt file, and change
the "find_package" command so that the PATHS option specifies
the root directory of your OpenCV 3.4.7 installation.
the root directory of your OpenCV 4.5.0 installation.

Run the following commands:
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"componentName": "HelloWorldComponent",
"componentVersion": "5.1",
"middlewareVersion": "5.1",
"componentVersion": "6.0",
"middlewareVersion": "6.0",
"sourceLanguage": "c++",
"batchLibrary": "${MPF_HOME}/plugins/HelloWorldComponent/lib/libmpfHelloWorld.so",
"streamLibrary": "${MPF_HOME}/plugins/HelloWorldComponent/lib/libmpfStreamingHelloWorld.so",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include(../ComponentSetup.cmake)

find_package(mpfComponentInterface REQUIRED)
find_package(mpfDetectionComponentApi REQUIRED)
find_package(OpenCV 3.4.7 EXACT REQUIRED PATHS /opt/opencv-3.4.7 COMPONENTS opencv_core opencv_highgui)
find_package(OpenCV 4.5.0 EXACT REQUIRED PATHS /opt/opencv-4.5.0 COMPONENTS opencv_core opencv_highgui)


set(IMAGE_TRANSFORMER_COMPONENT_SOURCES ImageTransformerComponent.h ImageTransformerComponent.cpp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ std::vector<MPFImageLocation> ImageTransformerComponent::GetDetections(const MPF
std::cout << "original image rows = " << original.rows << std::endl;
std::cout << "original image cols = " << original.cols << std::endl;
std::cout << std::endl << std::endl;
cv::namedWindow("Original", CV_WINDOW_AUTOSIZE);
cv::namedWindow("Original", cv::WINDOW_AUTOSIZE);
cv::imshow("Original", original);
cv::waitKey(500);

Expand Down Expand Up @@ -101,7 +101,7 @@ std::vector<MPFImageLocation> ImageTransformerComponent::GetDetections(const MPF

// Again, for illustration purposes only, we display the image after
// the transformation has been applied.
cv::namedWindow("Transformed", CV_WINDOW_AUTOSIZE);
cv::namedWindow("Transformed", cv::WINDOW_AUTOSIZE);
cv::imshow("Transformed", image_data);
cv::waitKey(0);

Expand Down
4 changes: 2 additions & 2 deletions detection/examples/ImageTransformerComponent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BUILD

NOTE: To build and run this component, OpenCV 3.4.7
NOTE: To build and run this component, OpenCV 4.5.0
must be installed first.

NOTE: You must build the MPF Component API library before
Expand All @@ -10,7 +10,7 @@ NOTE: You must build the MPF Component API library before

Before you build, edit the src/CMakeLists.txt file, and change
the "find_package" command so that the PATHS option specifies
the root directory of your OpenCV 3.4.7 installation.
the root directory of your OpenCV 4.5.0 installation.

Run the following commands:
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"componentName": "ImageTransformerComponent",
"componentVersion": "5.1",
"middlewareVersion": "5.1",
"componentVersion": "6.0",
"middlewareVersion": "6.0",
"sourceLanguage": "c++",
"batchLibrary": "${MPF_HOME}/plugins/ImageTransformerComponent/lib/libmpfImageTransformer.so",
"environmentVariables": [
Expand Down
2 changes: 1 addition & 1 deletion detection/examples/VideoCaptureComponent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include(../ComponentSetup.cmake)

find_package(mpfComponentInterface REQUIRED)
find_package(mpfDetectionComponentApi REQUIRED)
find_package(OpenCV 3.4.7 EXACT REQUIRED PATHS /opt/opencv-3.4.7 COMPONENTS opencv_core opencv_highgui)
find_package(OpenCV 4.5.0 EXACT REQUIRED PATHS /opt/opencv-4.5.0 COMPONENTS opencv_core opencv_highgui)


set(VIDEO_CAPTURE_COMPONENT_SOURCES VideoCaptureComponent.h VideoCaptureComponent.cpp)
Expand Down
4 changes: 2 additions & 2 deletions detection/examples/VideoCaptureComponent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BUILD

NOTE: To build and run this component, OpenCV 3.4.7 and
NOTE: To build and run this component, OpenCV 4.5.0 and
ffmpeg must be installed first.

NOTE: You must build the MPF Component API library before
Expand All @@ -10,7 +10,7 @@ NOTE: You must build the MPF Component API library before

Before you build, edit the src/CMakeLists.txt file, and change
the "find_package" command so that the PATHS option specifies
the root directory of your OpenCV 3.4.7 installation.
the root directory of your OpenCV 4.5.0 installation.

Run the following commands:
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"componentName": "VideoCaptureComponent",
"componentVersion": "5.1",
"middlewareVersion": "5.1",
"componentVersion": "6.0",
"middlewareVersion": "6.0",
"sourceLanguage": "c++",
"batchLibrary": "${MPF_HOME}/plugins/VideoCaptureComponent/lib/libmpfVideoCapture.so",
"environmentVariables": [
Expand Down
4 changes: 2 additions & 2 deletions detection/testUtils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ project(openmpf-cpp-component-test-utils)

set(CMAKE_CXX_STANDARD 11)

find_package(OpenCV 3.4.7 EXACT REQUIRED PATHS /opt/opencv-3.4.7
find_package(OpenCV 4.5.0 EXACT REQUIRED PATHS /opt/opencv-4.5.0
COMPONENTS opencv_core opencv_imgcodecs opencv_imgproc opencv_videoio opencv_highgui)

include_directories(include)
Expand All @@ -54,4 +54,4 @@ set(SOURCE_FILES
add_library(mpfComponentTestUtils SHARED ${SOURCE_FILES})
target_link_libraries(mpfComponentTestUtils ${OpenCV_LIBS})

export_mpf_lib(mpfComponentTestUtils)
export_mpf_lib(mpfComponentTestUtils)
6 changes: 3 additions & 3 deletions detection/testUtils/src/ImageGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace MPF { namespace COMPONENT {

Rect new_rect(x_pos, y_pos, rect.width, rect.height);

cv::rectangle(mask, new_rect, Scalar(255, 255, 255), CV_FILLED);
cv::rectangle(mask, new_rect, Scalar(255, 255, 255), cv::FILLED);

if (imshow_on) {
cv::imshow("random mask", mask);
Expand All @@ -98,7 +98,7 @@ namespace MPF { namespace COMPONENT {
int ImageGeneration::WriteDetectionOutputImage(const string image_in_uri,
const vector<MPFVideoTrack> &detections,
const string image_out_filepath) {
Mat input_image = cv::imread(image_in_uri.c_str(), CV_LOAD_IMAGE_IGNORE_ORIENTATION + CV_LOAD_IMAGE_COLOR);
Mat input_image = cv::imread(image_in_uri.c_str(), cv::IMREAD_IGNORE_ORIENTATION + cv::IMREAD_COLOR);
if (input_image.empty()) {
printf("Could not open the input image: %s\n", image_in_uri.c_str());
return -1;
Expand All @@ -120,7 +120,7 @@ namespace MPF { namespace COMPONENT {
int ImageGeneration::WriteDetectionOutputImage(const string image_in_uri,
const vector<MPFImageLocation> &detections,
const string image_out_filepath) {
Mat input_image = cv::imread(image_in_uri.c_str(), CV_LOAD_IMAGE_IGNORE_ORIENTATION + CV_LOAD_IMAGE_COLOR);
Mat input_image = cv::imread(image_in_uri.c_str(), cv::IMREAD_IGNORE_ORIENTATION + cv::IMREAD_COLOR);
if (input_image.empty()) {
printf("Could not open the input image: %s\n", image_in_uri.c_str());
return -1;
Expand Down
14 changes: 7 additions & 7 deletions detection/testUtils/src/VideoGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace MPF { namespace COMPONENT {

Rect new_rect(x_pos, y_pos, rect.width, rect.height);

cv::rectangle(mask, new_rect, Scalar(255, 255, 255), CV_FILLED);
cv::rectangle(mask, new_rect, Scalar(255, 255, 255), cv::FILLED);

if (imshow_on) {
cv::imshow("random mask", mask);
Expand All @@ -128,7 +128,7 @@ namespace MPF { namespace COMPONENT {
return Rect(0, 0, 0, 0);
}
else {
cv::rectangle(mask, new_rect, Scalar(255, 255, 255), CV_FILLED);
cv::rectangle(mask, new_rect, Scalar(255, 255, 255), cv::FILLED);
if (imshow_on) {
cv::imshow("random mask", mask);
cv::waitKey(5);
Expand Down Expand Up @@ -158,13 +158,13 @@ namespace MPF { namespace COMPONENT {
return -1;
}

Size size = Size(static_cast<int>(input_video.get(CV_CAP_PROP_FRAME_WIDTH)),
static_cast<int>(input_video.get(CV_CAP_PROP_FRAME_HEIGHT)));
Size size = Size(static_cast<int>(input_video.get(cv::CAP_PROP_FRAME_WIDTH)),
static_cast<int>(input_video.get(cv::CAP_PROP_FRAME_HEIGHT)));

VideoWriter output_video;

double fps = input_video.get(CV_CAP_PROP_FPS);
output_video.open(video_out_filepath, CV_FOURCC('M', 'J', 'P', 'G'), fps, size, true);
double fps = input_video.get(cv::CAP_PROP_FPS);
output_video.open(video_out_filepath, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'), fps, size, true);

if (!output_video.isOpened()) {
std::cout << "Could not open the output video for write: " << video_out_filepath << std::endl;
Expand Down Expand Up @@ -227,7 +227,7 @@ namespace MPF { namespace COMPONENT {
VideoWriter output_video;
double fps = 30;

output_video.open(video_out_filepath, CV_FOURCC('M', 'J', 'P', 'G'), fps, video_size, true);
output_video.open(video_out_filepath, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'), fps, video_size, true);
if (!output_video.isOpened()) {
std::cout << "Could not open the output video for write: " << video_out_filepath << std::endl;
return -1;
Expand Down
2 changes: 1 addition & 1 deletion detection/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ project(openmpf-cpp-component-utils)

set(CMAKE_CXX_STANDARD 11)

find_package(OpenCV 3.4.7 EXACT REQUIRED PATHS /opt/opencv-3.4.7
find_package(OpenCV 4.5.0 EXACT REQUIRED PATHS /opt/opencv-4.5.0
COMPONENTS opencv_core opencv_imgcodecs opencv_imgproc opencv_videoio)

find_package(PkgConfig)
Expand Down
2 changes: 1 addition & 1 deletion detection/utils/src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ namespace MPF { namespace COMPONENT { namespace Utils {
cv::Mat ConvertToGray(const cv::Mat &image) {
cv::Mat gray;
if (image.channels() == 3) {
cv::cvtColor(image, gray, CV_BGR2GRAY);
cv::cvtColor(image, gray, cv::COLOR_BGR2GRAY);
}
else if (image.channels() == 1) {
gray = image.clone();
Expand Down