Skip to content

Commit

Permalink
test push
Browse files Browse the repository at this point in the history
  • Loading branch information
ben committed Apr 5, 2024
1 parent f1ee4b7 commit 792cc27
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 24 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Windows build check

on:
pull_request:
branches: [ "master" ]
#on:
# pull_request:
# branches: [ "master" ]

jobs:
build-windows:
Expand All @@ -11,18 +11,21 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install packages
run: sudo apt -y install git g++ cmake libsqlite3-dev gcovr libjpeg-dev
shell: bash

- name: Clone aquamarine repo
run: git clone --branch ${{ github.head_ref }} https://github.com/MaksymT17/aquamarine.git
shell: bash

- name: Build artifacts with Cmake
run: |
cd aquamarine
./build.sh
echo "removing existing build folder..."
rm -rf build/ &&
mkdir build &&
echo "preparing new build with cmake..." &&
cd build/ &&
cmake .. &&
cmake --build . &&
echo "Build complete!"
shell: bash

- name: Run unit tests
Expand Down
6 changes: 4 additions & 2 deletions AmApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include "analyze/algorithm/ImagePair.h"
#include <sstream>

#ifdef __unix__
#include <jpeglib.h>
#endif
namespace am
{
using namespace common::types;
Expand Down Expand Up @@ -39,15 +41,15 @@ namespace am
obj.getMaxHeight());
}

#ifdef __unix__
if(dbcPtr)
{
std::stringstream ss;
ss << "'" << am::common::get_datetime() << "', '" << base_img << "', '" << cmp_img << "', " << objects.size();
#ifdef __unix__
dbcPtr->add_results_table(); // if already exists - it produces a warning
dbcPtr->insert_records2results({ss.str()});
#endif
}
#endif
drawer.save(out_diff_img);
}

Expand Down
4 changes: 4 additions & 0 deletions AmApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include "configuration/ConfigurationReader.hpp"
#include "common/Logger.hpp"
#include "extraction/MultipleExtractor.h"
#ifdef __unix__
#include "database/DataBaseCommunicator.h"
#endif

namespace am
{
Expand All @@ -26,7 +28,9 @@ namespace am

std::string base_img_path;
std::string cmp_img_path;
#ifdef __unix__
std::unique_ptr<database::DataBaseCommunicator> dbcPtr;
#endif
std::shared_ptr<configuration::Configuration> configuration;
};
}
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project (aquamarine)

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
elseif (MSVC_VERSION GREATER_EQUAL "1900")
add_compile_options("/std:c++17")
endif()

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
Expand Down Expand Up @@ -35,12 +37,11 @@ set(AM_SOURCE_FILES
extraction/BmpExtractor.cpp
extraction/MultipleExtractor.cpp
common/Timers.hpp
database/DataBaseCommunicator.cpp
AmApi.cpp
)

IF (UNIX)
add_library(aquamarine_lib STATIC ${AM_SOURCE_FILES} ${JPEG_LIBRARIES} extraction/JpgExtractor.cpp)
add_library(aquamarine_lib STATIC ${AM_SOURCE_FILES} ${JPEG_LIBRARIES} database/DataBaseCommunicator.cpp extraction/JpgExtractor.cpp)
ELSE()
add_library(aquamarine_lib STATIC ${AM_SOURCE_FILES} ${JPEG_LIBRARIES})
ENDIF()
Expand Down
14 changes: 7 additions & 7 deletions analyze/algorithm/ObjectDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,20 @@ namespace am::analyze::algorithm
mThreadsCount);

// threadpool could be replaced with std::async calls
am::common::ThreadPool pool;
//am::common::ThreadPool pool;
for (size_t rowId = 0; rowId < mThreadsCount - 1; ++rowId)
{
ImageRowSegment row{rowId * rowHeight, rowId * rowHeight + rowHeight};
// futures.emplace_back(std::async(std::launch::async, startObjectsSearchInPair,
// pair, row, *mConfiguration));
futures.emplace_back(std::async(std::launch::async, startObjectsSearchInPair,
pair, row, *mConfiguration));

futures.emplace_back(pool.run(std::bind(&startObjectsSearchInPair, pair, row, *mConfiguration)));
//futures.emplace_back(pool.run(std::bind(&startObjectsSearchInPair, pair, row, *mConfiguration)));
}

ImageRowSegment final_row{(mThreadsCount - 1) * rowHeight, pair.getHeight()};
// futures.emplace_back(std::async(std::launch::async, startObjectsSearchInPair,
// pair, final_row, *mConfiguration));
futures.emplace_back(pool.run(std::bind(&startObjectsSearchInPair, pair, final_row, *mConfiguration)));
futures.emplace_back(std::async(std::launch::async, startObjectsSearchInPair,
pair, final_row, *mConfiguration));
//futures.emplace_back(pool.run(std::bind(&startObjectsSearchInPair, pair, final_row, *mConfiguration)));
for (auto &e : futures)
{
res.emplace_back(e.get());
Expand Down
1 change: 1 addition & 0 deletions extraction/BmpExtractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "common/types/Matrix.hpp"
#include "common/types/Color24b.hpp"
#include <memory>
#include <string>

namespace am::extraction
{
Expand Down
10 changes: 5 additions & 5 deletions thirdparty/bitmap_reader/bitmap_image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ class bitmap_image
case red_plane: return 0;
case green_plane: return 1;
case blue_plane: return 2;
default: return std::numeric_limits<unsigned int>::max();
default: return (std::numeric_limits<unsigned int>::max)();
}
}

Expand All @@ -1253,11 +1253,11 @@ class bitmap_image
case red_plane: return 2;
case green_plane: return 1;
case blue_plane: return 0;
default: return std::numeric_limits<unsigned int>::max();
default: return (std::numeric_limits<unsigned int>::max)();
}
}

default: return std::numeric_limits<unsigned int>::max();
default: return (std::numeric_limits<unsigned int>::max)();
}
}

Expand Down Expand Up @@ -2939,7 +2939,7 @@ inline rgb_t find_nearest_color(const rgb_t& c, const Iterator begin, const Iter
if (0 == std::distance(begin, end))
return c;

double min_d = std::numeric_limits<double>::max();
double min_d = (std::numeric_limits<double>::max)();
rgb_t result = *begin;

for (Iterator itr = begin; itr != end; ++itr)
Expand Down Expand Up @@ -2979,7 +2979,7 @@ inline double find_nearest_wave_length(const rgb_t& c, const double increment =
const double max_wave_length = 800.0; //800nm

double min_wave_length = 0.0;
double min_d = std::numeric_limits<double>::max();
double min_d = (std::numeric_limits<double>::max)();

for (double i = 0.0; i < max_wave_length; i += increment)
{
Expand Down

0 comments on commit 792cc27

Please sign in to comment.