Примеры с cv2.imshow требуют сборки OpenCV с GUI. В ноутбуке с headless-версией используйте вывод изображений через Matplotlib.
Building OpenCV with FastCV
Compatibility
OpenCV >= 4.11.0
This document scope is to guide the Developers to enable OpenCV Acceleration with FastCV for the Qualcomm chipsets with ARM64 architecture. Entablement of OpenCV with FastCV back-end on non-Qualcomm chipsets or Linux platforms other than Qualcomm Linux is currently out of scope.
About FastCV
FastCV provides two main features to computer vision application developers:
A library of frequently used computer vision (CV) functions, optimized to run efficiently on a wide variety of Qualcomm’s Snapdragon devices.
A clean processor-agnostic hardware acceleration API, under which chipset vendors can hardware accelerate FastCV functions on Qualcomm’s Snapdragon hardware.
FastCV is released as a unified binary, a single binary containing two implementations of the algorithms:
Generic implementation runs on Arm® architecture and is referred to as FastCV for Arm architecture.
Implementation runs only on Qualcomm® Snapdragon™ chipsets and is called FastCV for Snapdragon.
FastCV library is Qualcomm proprietary and provides faster implementation of CV algorithms on various hardware as compared to other CV libraries.
OpenCV Acceleration with FastCV HAL and Extensions
OpenCV and FastCV integration is implemented in two ways:
FastCV-based HAL for basic computer vision and arithmetic algorithms acceleration.
FastCV module in opencv_contrib with custom algorithms and FastCV function wrappers that do not fit generic OpenCV interface or behaviour.
Once the OpenCV repository code is cloned into the workspace, please add -DWITH_FASTCV=ON flag to cmake vars as below to arm64 entry in opencv/platforms/android/default.config.py or create new one with the option to enable FastCV HAL and/or extenstions compilation:
Push the OpenCV libraries, test binaries and test data on to the target. Execute the OpenCV conformance or performance tests. During runtime, If libwebp.so.7 lib is missing, find the lib in the below Path and push it on the target
These OpenCV extension APIs are implemented under the cv::fastcv namespace.
OpenCV Extension APIs
Underlying FastCV API for OpenCV acceleration
matmuls8s32
fcvMatrixMultiplys8s32
clusterEuclidean
fcvClusterEuclideanu8
FAST10
fcvCornerFast10InMaskScoreu8
fcvCornerFast10InMasku8
fcvCornerFast10Scoreu8
fcvCornerFast10u8
FFT
fcvFFTu8
IFFT
fcvIFFTf32
fillConvexPoly
fcvFillConvexPolyu8
houghLines
fcvHoughLineu8
moments
fcvImageMomentsu8
fcvImageMomentss32
fcvImageMomentsf32
runMSER
fcvMserInit
fcvMserNN8Init
fcvMserExtu8_v3
fcvMserExtNN8u8
fcvMserNN8u8
fcvMserRelease
remap
fcvRemapu8_v2
remapRGBA
fcvRemapRGBA8888BLu8
fcvRemapRGBA8888NNu8
resizeDown
fcvScaleDownBy2u8_v2
fcvScaleDownBy4u8_v2
fcvScaleDownMNInterleaveu8
fcvScaleDownMNu8
meanShift
fcvMeanShiftu8
fcvMeanShifts32
fcvMeanShiftf32
bilateralRecursive
fcvBilateralFilterRecursiveu8
thresholdRange
fcvFilterThresholdRangeu8_v2
bilateralFilter
fcvBilateralFilter5x5u8_v3
fcvBilateralFilter7x7u8_v3
fcvBilateralFilter9x9u8_v3
calcHist
fcvImageIntensityHistogram
gaussianBlur
fcvFilterGaussian3x3u8_v4
fcvFilterGaussian5x5u8_v3
fcvFilterGaussian5x5s16_v3
fcvFilterGaussian5x5s32_v3
fcvFilterGaussian11x11u8_v2
filter2D
fcvFilterCorrNxNu8
fcvFilterCorrNxNu8s16
fcvFilterCorrNxNu8f32
sepFilter2D
fcvFilterCorrSepMxNu8
fcvFilterCorrSep9x9s16_v2
fcvFilterCorrSep11x11s16_v2
fcvFilterCorrSep13x13s16_v2
fcvFilterCorrSep15x15s16_v2
fcvFilterCorrSep17x17s16_v2
fcvFilterCorrSepNxNs16
sobel3x3u8
fcvImageGradientSobelPlanars8_v2
sobel3x3u8
fcvImageGradientSobelPlanars16_v2
sobel3x3u8
fcvImageGradientSobelPlanars16_v3
sobel3x3u8
fcvImageGradientSobelPlanarf32_v2
sobel3x3u8
fcvImageGradientSobelPlanarf32_v3
sobel
fcvFilterSobel3x3u8_v2
fcvFilterSobel3x3u8s16
fcvFilterSobel5x5u8s16
fcvFilterSobel7x7u8s16
DCT
fcvDCTu8
iDCT
fcvIDCTs16
sobelPyramid
fcvPyramidAllocate
fcvPyramidAllocate_v2
fcvPyramidAllocate_v3
fcvPyramidSobelGradientCreatei8
fcvPyramidSobelGradientCreatei16
fcvPyramidSobelGradientCreatef32
fcvPyramidDelete
fcvPyramidDelete_v2
fcvPyramidCreatef32_v2
fcvPyramidCreateu8_v4
trackOpticalFlowLK
fcvTrackLKOpticalFlowu8_v3
fcvTrackLKOpticalFlowu8
warpPerspective2Plane
fcv2PlaneWarpPerspectiveu8
warpPerspective
fcvWarpPerspectiveu8_v5
arithmetic_op
fcvAddu8
fcvAdds16_v2
fcvAddf32
fcvSubtractu8
fcvSubtracts16
integrateYUV
fcvIntegrateImageYCbCr420PseudoPlanaru8
normalizeLocalBox
fcvNormalizeLocalBoxu8
fcvNormalizeLocalBoxf32
merge
fcvChannelCombine2Planesu8
fcvChannelCombine3Planesu8
fcvChannelCombine4Planesu8
split
fcvDeinterleaveu8
fcvChannelExtractu8
warpAffine
fcvTransformAffineu8_v2
fcvTransformAffineClippedu8_v3
fcv3ChannelTransformAffineClippedBCu8
FastCV QDSP based OpenCV Extension APIs list : These OpenCV extension APIs are implemented under the cv::fastcv::dsp namespace. This namespace provides optimized implementations that leverage QDSP (Qualcomm's Digital Signal Processor) acceleration using FastCV's Q-suffixed APIs. These functions require DSP initialization (fcvQ6Init).
OpenCV Extension APIs
Underlying FastCV API for OpenCV acceleration
filter2D
fcvFilterCorr3x3s8_v2Q
fcvFilterCorrNxNu8Q
fcvFilterCorrNxNu8s16Q
fcvFilterCorrNxNu8f32Q
FFT
fcvFFTu8Q
IFFT
fcvIFFTf32Q
fcvdspinit
fcvQ6Init
fcvdspdeinit
fcvQ6DeInit
Canny
fcvFilterCannyu8Q
sumOfAbsoluteDiffs
fcvSumOfAbsoluteDiffs8x8u8_v2Q
thresholdOtsu
fcvFilterThresholdOtsuu8Q
How to Use FastCV QDSP based OpenCV Extension APIs
This section outlines the essential steps required to use OpenCV Extension APIs that are accelerated using FastCV on QDSP(Qualcomm's Digital Signal Processor).
Example: cv::Mat src; src.allocator = cv::fastcv::getQcAllocator(); **// Set Qualcomm's memory allocator** \ After setting Qualcomm's memory allocator, any buffer created using methods like src.create(...), cv::imread(...) etc., will have its memory allocated using Qualcomm's memory allocator.
Example: cv::fastcv::dsp::thresholdOtsu(src, dst, binaryType); where 'src' and 'dst' are 'cv::Mat' objects with the Qualcomm's memory allocator, and 'binaryType' is a boolean indicating the thresholding mode.