Skip to content

Commit

Permalink
Merge branch 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
asmorkalov committed Mar 26, 2024
2 parents 3f609aa + 9373b72 commit 37e63d4
Show file tree
Hide file tree
Showing 26 changed files with 830 additions and 124 deletions.
16 changes: 8 additions & 8 deletions modules/aruco/test/test_aruco_tutorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace opencv_test { namespace {

TEST(CV_ArucoTutorial, can_find_singlemarkersoriginal)
{
string img_path = cvtest::findDataFile("aruco/singlemarkersoriginal.jpg", false);
string img_path = cvtest::findDataFile("aruco/singlemarkersoriginal.jpg");
Mat image = imread(img_path);
aruco::ArucoDetector detector(aruco::getPredefinedDictionary(aruco::DICT_6X6_250));

Expand Down Expand Up @@ -44,9 +44,9 @@ TEST(CV_ArucoTutorial, can_find_singlemarkersoriginal)

TEST(CV_ArucoTutorial, can_find_gboriginal)
{
string imgPath = cvtest::findDataFile("aruco/gboriginal.jpg", false);
string imgPath = cvtest::findDataFile("aruco/gboriginal.jpg");
Mat image = imread(imgPath);
string dictPath = cvtest::findDataFile("aruco/tutorial_dict.yml", false);
string dictPath = cvtest::findDataFile("aruco/tutorial_dict.yml");
aruco::Dictionary dictionary;

FileStorage fs(dictPath, FileStorage::READ);
Expand Down Expand Up @@ -99,7 +99,7 @@ TEST(CV_ArucoTutorial, can_find_gboriginal)

TEST(CV_ArucoTutorial, can_find_choriginal)
{
string imgPath = cvtest::findDataFile("aruco/choriginal.jpg", false);
string imgPath = cvtest::findDataFile("aruco/choriginal.jpg");
Mat image = imread(imgPath);
aruco::ArucoDetector detector(aruco::getPredefinedDictionary(aruco::DICT_6X6_250));

Expand Down Expand Up @@ -138,7 +138,7 @@ TEST(CV_ArucoTutorial, can_find_choriginal)

TEST(CV_ArucoTutorial, can_find_chocclusion)
{
string imgPath = cvtest::findDataFile("aruco/chocclusion_original.jpg", false);
string imgPath = cvtest::findDataFile("aruco/chocclusion_original.jpg");
Mat image = imread(imgPath);
aruco::ArucoDetector detector(aruco::getPredefinedDictionary(aruco::DICT_6X6_250));

Expand Down Expand Up @@ -176,15 +176,15 @@ TEST(CV_ArucoTutorial, can_find_chocclusion)

TEST(CV_ArucoTutorial, can_find_diamondmarkers)
{
string imgPath = cvtest::findDataFile("aruco/diamondmarkers.jpg", false);
string imgPath = cvtest::findDataFile("aruco/diamondmarkers.jpg");
Mat image = imread(imgPath);

string dictPath = cvtest::findDataFile("aruco/tutorial_dict.yml", false);
string dictPath = cvtest::findDataFile("aruco/tutorial_dict.yml");
aruco::Dictionary dictionary;
FileStorage fs(dictPath, FileStorage::READ);
dictionary.aruco::Dictionary::readDictionary(fs.root()); // set marker from tutorial_dict.yml

string detectorPath = cvtest::findDataFile("aruco/detector_params.yml", false);
string detectorPath = cvtest::findDataFile("aruco/detector_params.yml");
fs = FileStorage(detectorPath, FileStorage::READ);
aruco::DetectorParameters detectorParams;
detectorParams.readDetectorParameters(fs.root());
Expand Down
6 changes: 6 additions & 0 deletions modules/cannops/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ ocv_include_directories(${CMAKE_SOURCE_DIR}/modules/ts/include)
ocv_add_accuracy_tests(DEPENDS_ON opencv_cannops)
ocv_add_perf_tests(DEPENDS_ON opencv_cannops)
ocv_add_samples(opencv_cannops)

# compile ascnedc kernels.
add_subdirectory(ascendc_kernels)
ocv_include_directories(${CMAKE_BINARY_DIR}/include/ascendc_kernels)
ocv_target_link_libraries(opencv_cannops PRIVATE ascendc_kernels)
ocv_target_link_libraries(opencv_test_cannops PRIVATE ascendc_kernels)
17 changes: 17 additions & 0 deletions modules/cannops/ascendc_kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set(SOC_VERSION "ascend310p3" CACHE STRING "system on chip type")
set(ASCEND_CANN_PACKAGE_PATH "/usr/local/Ascend/ascend-toolkit/latest" CACHE PATH "ASCEND CANN package installation directory")
set(RUN_MODE "npu" CACHE STRING "run mode: npu/sim/cpu")

if(EXISTS ${ASCEND_CANN_PACKAGE_PATH}/compiler/tikcpp/ascendc_kernel_cmake)
set(ASCENDC_CMAKE_DIR ${ASCEND_CANN_PACKAGE_PATH}/compiler/tikcpp/ascendc_kernel_cmake)
elseif(EXISTS ${ASCEND_CANN_PACKAGE_PATH}/ascendc_devkit/tikcpp/samples/cmake)
set(ASCENDC_CMAKE_DIR ${ASCEND_CANN_PACKAGE_PATH}/ascendc_devkit/tikcpp/samples/cmake)
else()
message(FATAL_ERROR "ascendc_kernel_cmake does not exist, please check whether the compiler package is installed.")
endif()

include(${ASCENDC_CMAKE_DIR}/ascendc.cmake)

ascendc_library(ascendc_kernels STATIC
threshold_opencv_kernel.cpp
)
22 changes: 22 additions & 0 deletions modules/cannops/ascendc_kernels/kernel_tiling_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef KERNEL_TILING_H
#define KERNEL_TILING_H

/*
* threshType:
* THRESH_BINARY = 0,
* THRESH_BINARY_INV = 1,
* THRESH_TRUNC = 2,
* THRESH_TOZERO = 3,
* THRESH_TOZERO_INV = 4,
*/
#pragma pack(push, 8)
struct ThresholdOpencvTilingData
{
float maxVal;
float thresh;
uint32_t totalLength;
uint8_t threshType;
uint8_t dtype;
};
#pragma pack(pop)
#endif // KERNEL_TILING_H
Loading

0 comments on commit 37e63d4

Please sign in to comment.