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
1 change: 1 addition & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SET(${PARENT}_SUBMODULE_CONFIG_READER ON CACHE BOOL "" FORCE)
if (${PARENT}_SUBMODULE_CONFIG_READER)
SET(${PARENT}_CONFIG_READER ON CACHE BOOL "" FORCE)
SET(${PARENT}_CONFIG_READER_EXAMPLES OFF CACHE BOOL "" FORCE)
SET(${PARENT}_CONFIG_READER_TESTS OFF CACHE BOOL "" FORCE)
endif()


Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/ConfigReader
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# **ObjectDetector interface C++ library**

**v1.7.3**
**v1.8.0**



Expand Down Expand Up @@ -67,6 +67,7 @@
| 1.7.1 | 25.03.2024 | - Frame class updated.<br />- ConfigReader class updated.<br />- Documentation updated. |
| 1.7.2 | 20.05.2024 | - Frame class updated.<br />- ConfigReader class updated.<br />- Documentation updated. |
| 1.7.3 | 23.07.2024 | - CMake structure updated. |
| 1.8.0 | 02.10.2026 | - Submodules updated.<br />- Compiler warnings fixed. |



Expand Down Expand Up @@ -180,7 +181,7 @@ cout << "ObjectDetector class version: " << ObjectDetector::getVersion();
Console output:

```bash
ObjectDetector class version: 1.7.3
ObjectDetector class version: 1.8.0
```


Expand Down Expand Up @@ -682,6 +683,12 @@ public:
numThreads, type, enable, custom1, custom2, custom3,
classNames);

/// Default constructor.
ObjectDetectorParams() = default;

/// Copy constructor.
ObjectDetectorParams(const ObjectDetectorParams& src) = default;

/// Copy operator.
ObjectDetectorParams& operator= (const ObjectDetectorParams& src);

Expand Down
6 changes: 5 additions & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
###############################################################################
target_link_libraries(${PROJECT_NAME} ObjectDetector)


if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()
4 changes: 2 additions & 2 deletions example/CustomObjectDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@ bool cr::detector::CustomObjectDetector::executeCommand(ObjectDetectorCommand id



bool cr::detector::CustomObjectDetector::detect(cr::video::Frame& frame)
bool cr::detector::CustomObjectDetector::detect([[maybe_unused]] cr::video::Frame& frame)
{
return true;
}



bool cr::detector::CustomObjectDetector::setMask(cr::video::Frame mask)
bool cr::detector::CustomObjectDetector::setMask([[maybe_unused]] cr::video::Frame mask)
{
return true;
}
Expand Down
10 changes: 8 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.13)
## LIBRARY-PROJECT
## name and version
###############################################################################
project(ObjectDetector VERSION 1.7.3 LANGUAGES CXX)
project(ObjectDetector VERSION 1.8.0 LANGUAGES CXX)



Expand Down Expand Up @@ -52,4 +52,10 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
## linking all dependencies
###############################################################################
target_link_libraries(${PROJECT_NAME} Frame)
target_link_libraries(${PROJECT_NAME} ConfigReader)
target_link_libraries(${PROJECT_NAME} ConfigReader)

if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()
4 changes: 2 additions & 2 deletions src/ObjectDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ bool cr::detector::ObjectDetectorParams::encode(
pos += static_cast<int>(initString.size()) + 1;

// Iterate through all of the class names and add them to the data.
for (int i = 0; i < classNames.size(); ++i)
for (size_t i = 0; i < classNames.size(); ++i)
{
// Add size + 1 of init string to data to recognize it on decode with null terminator.
memcpy(&data[pos], &classNames[i][0], classNames[i].size() + 1);
Expand Down Expand Up @@ -325,7 +325,7 @@ bool cr::detector::ObjectDetectorParams::encode(
if (mask->classNames)
{
// Iterate through all of the class names and add them to the data.
for (int i = 0; i < classNames.size(); ++i)
for (size_t i = 0; i < classNames.size(); ++i)
{
// Add size + 1 of init string to data to recognize it on decode with null terminator.
memcpy(&data[pos], &classNames[i][0], classNames[i].size() + 1);
Expand Down
11 changes: 11 additions & 0 deletions src/ObjectDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ class ObjectDetectorParams
numThreads, type, enable, custom1, custom2, custom3,
classNames);

/**
* @brief Default constructor.
*/
ObjectDetectorParams() = default;

/**
* @brief Copy constructor.
* @param src Source object.
*/
ObjectDetectorParams(const ObjectDetectorParams& src) = default;

/**
* @brief Copy operator.
* @param src Source object.
Expand Down
6 changes: 3 additions & 3 deletions src/ObjectDetectorVersion.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define OBJECT_DETECTOR_MAJOR_VERSION 1
#define OBJECT_DETECTOR_MINOR_VERSION 7
#define OBJECT_DETECTOR_PATCH_VERSION 3
#define OBJECT_DETECTOR_MINOR_VERSION 8
#define OBJECT_DETECTOR_PATCH_VERSION 0

#define OBJECT_DETECTOR_VERSION "1.7.3"
#define OBJECT_DETECTOR_VERSION "1.8.0"
6 changes: 6 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ endif()
## linking all dependencies
################################################################################
target_link_libraries(${PROJECT_NAME} ObjectDetector)

if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()
34 changes: 26 additions & 8 deletions test/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <array>
#include <iostream>
#include "ObjectDetector.h"

Expand Down Expand Up @@ -36,42 +37,59 @@ int main(void)
cout << "#####################################" << endl;
cout << endl;

bool allPassed = true;

cout << "Copy test:" << endl;
if (copyTest())
cout << "OK" << endl;
else
{
cout << "ERROR" << endl;
allPassed = false;
}
cout << endl;

cout << "Encode/Decode test:" << endl;
if (encodeDecodeTest())
cout << "OK" << endl;
else
{
cout << "ERROR" << endl;
allPassed = false;
}
cout << endl;

cout << "Encode/Decode test with params mask:" << endl;
if (encodeDecodeWithMaskTest())
cout << "OK" << endl;
else
{
cout << "ERROR" << endl;
allPassed = false;
}
cout << endl;

cout << "Encode/Decode commands test:" << endl;
if (encodeDecodeCommandsTest())
cout << "OK" << endl;
else
{
cout << "ERROR" << endl;
allPassed = false;
}
cout << endl;

cout << "JSON read/write test:" << endl;
if (jsonReadWriteTest())
cout << "OK" << endl;
else
{
cout << "ERROR" << endl;
allPassed = false;
}
cout << endl;

return 1;
return allPassed ? 0 : 1;
}


Expand Down Expand Up @@ -243,7 +261,7 @@ bool copyTest()
cout << "in.objects.size()" << endl;
return false;
}
for (int i = 0; i < in.objects.size(); ++i)
for (size_t i = 0; i < in.objects.size(); ++i)
{
if (in.objects[i].id != out.objects[i].id)
{
Expand Down Expand Up @@ -306,7 +324,7 @@ bool copyTest()
cout << "in.classNames.size()" << endl;
return false;
}
for (int i = 0; i < in.classNames.size(); ++i)
for (size_t i = 0; i < in.classNames.size(); ++i)
{
if (in.classNames[i] != out.classNames[i])
{
Expand Down Expand Up @@ -506,7 +524,7 @@ bool encodeDecodeTest()
cout << "in.objects.size()" << endl;
return false;
}
for (int i = 0; i < in.objects.size(); ++i)
for (size_t i = 0; i < in.objects.size(); ++i)
{
if (in.objects[i].id != out.objects[i].id)
{
Expand Down Expand Up @@ -569,7 +587,7 @@ bool encodeDecodeTest()
cout << "in.classNames.size()" << endl;
return false;
}
for (int i = 0; i < in.classNames.size(); ++i)
for (size_t i = 0; i < in.classNames.size(); ++i)
{
if (in.classNames[i] != out.classNames[i])
{
Expand Down Expand Up @@ -827,7 +845,7 @@ bool jsonReadWriteTest()
cout << "in.classNames.size()" << endl;
return false;
}
for (int i = 0; i < in.classNames.size(); ++i)
for (size_t i = 0; i < in.classNames.size(); ++i)
{
if (in.classNames[i] != out.classNames[i])
{
Expand Down Expand Up @@ -1053,7 +1071,7 @@ bool encodeDecodeWithMaskTest()
cout << "in.objects.size()" << endl;
return false;
}
for (int i = 0; i < in.objects.size(); ++i)
for (size_t i = 0; i < in.objects.size(); ++i)
{
if (in.objects[i].id != out.objects[i].id)
{
Expand Down Expand Up @@ -1111,7 +1129,7 @@ bool encodeDecodeWithMaskTest()
cout << "in.classNames.size()" << endl;
return false;
}
for (int i = 0; i < in.classNames.size(); ++i)
for (size_t i = 0; i < in.classNames.size(); ++i)
{
if (in.classNames[i] != out.classNames[i])
{
Expand Down
Loading