Skip to content

Commit

Permalink
Merge pull request #2 from CodeLinaro/FastcvHAL_1stPost
Browse files Browse the repository at this point in the history
Fastcv ext changes for Opencv Acceleration
  • Loading branch information
sssanjee-quic authored Oct 25, 2024
2 parents b8b5757 + ddaff0f commit 25a572f
Show file tree
Hide file tree
Showing 29 changed files with 51 additions and 12 deletions.
28 changes: 16 additions & 12 deletions modules/fastcv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
set(the_description "FastCV extension module")
ocv_define_module(fastcv opencv_core opencv_imgproc opencv_features2d opencv_video WRAP python java)

if (FASTCV_DIR)
if(NOT ARM AND NOT AARCH64)
# the reason this warning is not fatal is to enable proper code analysis
# in your favourite IDE
message(WARNING "FastCV supports ARM platform only!")
endif()
if((ARM OR AARCH64) AND (ANDROID OR (UNIX AND NOT APPLE AND NOT IOS AND NOT XROS)))
set(the_description "FastCV extension module")
set(FCV_MODULE_HEADER_DIR "${CMAKE_CURRENT_BINARY_DIR}/inc")
set(FCV_MODULE_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs")

# here you can change the library to a specific one
set(FASTCV_LIB "/libs/Android/lib64/libfastcvopt.so")
set(FASTCV_LIB "${FCV_MODULE_LIB_DIR}/libfastcvopt.so")

if((NOT EXISTS ${FCV_MODULE_HEADER_DIR}) OR (NOT EXISTS ${FCV_MODULE_LIB_DIR}))
include("${CMAKE_CURRENT_SOURCE_DIR}/fastcv.cmake")
download_fastcv("${CMAKE_CURRENT_BINARY_DIR}")
endif()

ocv_module_include_directories("${FASTCV_DIR}/inc")
ocv_target_link_libraries(${the_module} LINK_PRIVATE "${FASTCV_DIR}/${FASTCV_LIB}")
ocv_define_module(fastcv opencv_core opencv_imgproc opencv_features2d opencv_video WRAP python java)
ocv_module_include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/include"
${FCV_MODULE_HEADER_DIR})
ocv_target_link_libraries(${the_module} ${FASTCV_LIB})
ocv_target_compile_definitions(${the_module} PRIVATE FAST_CV_FOUND)
else()
message(FATAL_ERROR "FastCV supports ARM Platform on Android and Linux only!")
endif()
35 changes: 35 additions & 0 deletions modules/fastcv/fastcv.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function(download_fastcv root_dir)

# Commit SHA in the opencv_3rdparty repo
set(FASTCV_COMMIT "65f40fc8f7a6aac44936ae9538e69edede6c4b15")

# Define actual FCV versions
if(ANDROID)
if(AARCH64)
set(FCV_PACKAGE_NAME "fastcv_android_aarch64_2024_10_24.tgz")
set(FCV_PACKAGE_HASH "8a259eea80064643bad20f72ba0b6066")
else()
set(FCV_PACKAGE_NAME "fastcv_android_arm32_2024_10_24.tgz")
set(FCV_PACKAGE_HASH "04d89219c44d54166b2b7f8c0ed5143b")
endif()
elseif(UNIX AND NOT APPLE AND NOT IOS AND NOT XROS)
message("FastCV: fastcv lib for Linux is not supported for now!")
endif(ANDROID)

# Download Package
set(OPENCV_FASTCV_URL "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${FASTCV_COMMIT}/fastcv/")

ocv_download( FILENAME ${FCV_PACKAGE_NAME}
HASH ${FCV_PACKAGE_HASH}
URL ${OPENCV_FASTCV_URL}
DESTINATION_DIR ${root_dir}
ID FASTCV
STATUS res
UNPACK
RELATIVE_URL)

if(NOT res)
message("FastCV: package download failed! Please download FastCV manually and put it at ${root_dir}.")
endif()

endfunction()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed modules/fastcv/misc/hough/kandinsky-circles.jpg
Diff not rendered.
Binary file removed modules/fastcv/misc/hough/kandinsky-circles_2.jpg
Diff not rendered.

0 comments on commit 25a572f

Please sign in to comment.