-
Notifications
You must be signed in to change notification settings - Fork 5.8k
FastCV Extension code for OpenCV 2ndpost-1 #3844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3f3f3a0
1c35506
1c5751b
5e82b14
dc02ae4
7554d15
b6f67e1
a749bd4
d0dc5f5
a7b9959
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef OPENCV_FASTCV_BLUR_HPP | ||
#define OPENCV_FASTCV_BLUR_HPP | ||
|
||
#include <opencv2/core.hpp> | ||
|
||
namespace cv { | ||
namespace fastcv { | ||
|
||
/** | ||
* @defgroup fastcv Module-wrapper for FastCV hardware accelerated functions | ||
*/ | ||
|
||
//! @addtogroup fastcv | ||
//! @{ | ||
|
||
/** | ||
* @brief Gaussian blur with sigma = 0 and square kernel size. The way of handling borders is different with cv::GaussianBlur, | ||
* leading to slight variations in the output. | ||
* @param _src Intput image with type CV_8UC1 | ||
* @param _dst Output image with type CV_8UC1 | ||
* @param kernel_size Filer kernel size. One of 3, 5, 11 | ||
* @param blur_border If set to true, border is blurred by 0-padding adjacent values.(A variant of the constant border) | ||
* If set to false, borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 case). | ||
* | ||
* @sa GaussianBlur | ||
*/ | ||
CV_EXPORTS_W void gaussianBlur(InputArray _src, OutputArray _dst, int kernel_size = 3, bool blur_border = true); | ||
|
||
/** | ||
* @brief NxN correlation with non-separable kernel. Borders up to half-kernel width are ignored | ||
* @param _src Intput image with type CV_8UC1 | ||
* @param _dst Output image with type CV_8UC1, CV_16SC1 or CV_32FC1 | ||
* @param ddepth The depth of output image | ||
* @param _kernel Filer kernel data | ||
* | ||
* @sa Filter2D | ||
*/ | ||
CV_EXPORTS_W void filter2D(InputArray _src, OutputArray _dst, int ddepth, InputArray _kernel); | ||
|
||
/** | ||
* @brief NxN correlation with separable kernel. If srcImg and dstImg point to the same address and srcStride equals to dstStride, | ||
* it will do in-place. Borders up to half-kernel width are ignored. | ||
* The way of handling overflow is different with OpenCV, this function will do right shift for | ||
* the intermediate results and final result. | ||
* @param _src Intput image with type CV_8UC1 | ||
* @param _dst Output image with type CV_8UC1, CV_16SC1 | ||
* @param ddepth The depth of output image | ||
* @param _kernelX Filer kernel data in x direction | ||
* @param _kernelY Filer kernel data in Y direction (For CV_16SC1, the kernelX and kernelY should be same) | ||
* | ||
* @sa sepFilter2D | ||
*/ | ||
CV_EXPORTS_W void sepFilter2D(InputArray _src, OutputArray _dst, int ddepth, InputArray _kernelX, InputArray _kernelY); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same question. |
||
//! @} | ||
|
||
} // fastcv:: | ||
} // cv:: | ||
|
||
#endif // OPENCV_FASTCV_BLUR_HPP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef OPENCV_EDGES_HPP | ||
#define OPENCV_EDGES_HPP | ||
|
||
#include "opencv2/core/mat.hpp" | ||
|
||
namespace cv { | ||
namespace fastcv { | ||
/** | ||
* @defgroup fastcv Module-wrapper for FastCV hardware accelerated functions | ||
*/ | ||
|
||
//! @addtogroup fastcv | ||
//! @{ | ||
|
||
/** | ||
* @brief Creates a 2D gradient image from source luminance data without normalization. | ||
* Calculate X direction 1 order derivative or Y direction 1 order derivative or both at the same time, . | ||
* @param _src Input image with type CV_8UC1 | ||
* @param _dx Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. | ||
* If NULL, the horizontal gradient will not be calculated. | ||
* @param _dy Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. | ||
* If NULL, the vertical gradient will not be calculated | ||
* @param kernel_size Sobel kernel size, support 3x3, 5x5, 7x7 | ||
* @param borderType Border type, support BORDER_CONSTANT, BORDER_REPLICATE | ||
* @param borderValue Border value for constant border | ||
*/ | ||
CV_EXPORTS_W void sobel(InputArray _src, OutputArray _dx, OutputArray _dy, int kernel_size, int borderType, int borderValue); | ||
|
||
/** | ||
* @brief Creates a 2D gradient image from source luminance data without normalization. | ||
* This function computes central differences on 3x3 neighborhood and then convolves the result with Sobel kernel, | ||
* borders up to half-kernel width are ignored. | ||
* @param _src Input image with type CV_8UC1 | ||
* @param _dst If _dsty is given, buffer to store horizontal gradient, otherwise, output 8-bit image of |dx|+|dy|. | ||
* Size of buffer is (srcwidth)*(srcheight) bytes | ||
* @param _dsty (Optional)Buffer to store vertical gradient. Must be (srcwidth)*(srcheight) in size. | ||
* @param ddepth The depth of output image CV_8SC1,CV_16SC1,CV_32FC1, | ||
* @param normalization If do normalization for the result | ||
*/ | ||
CV_EXPORTS_W void sobel3x3u8(InputArray _src, OutputArray _dst, OutputArray _dsty = noArray(), int ddepth = CV_8U, | ||
bool normalization = false); | ||
|
||
//! @} | ||
|
||
} | ||
} | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ namespace fastcv { | |
|
||
/** | ||
* @brief Performs Hough Line detection | ||
* | ||
* | ||
* @param src Input 8-bit image containing binary contour. Width and step should be divisible by 8 | ||
* @param lines Output array containing detected lines in a form of (x1, y1, x2, y2) where all numbers are 32-bit floats | ||
* @param threshold Controls the minimal length of a detected line. Value must be between 0.0 and 1.0 | ||
|
@@ -25,6 +25,27 @@ namespace fastcv { | |
*/ | ||
CV_EXPORTS_W void houghLines(InputArray src, OutputArray lines, double threshold = 0.25); | ||
|
||
|
||
/** | ||
* @brief Finds circles in a grayscale image using Hough transform. | ||
* The radius of circle varies from 0 to max(srcWidth, srcHeight). | ||
* | ||
* @param src Input 8-bit image containing binary contour. Step should be divisible by 8, data start should be 128-bit aligned | ||
* @param circles Output array containing detected circles in a form (x, y, r) where all numbers are 32-bit integers | ||
* @param minDist Minimum distance between the centers of the detected circles | ||
* @param cannyThreshold The higher threshold of the two passed to the Canny() edge detector | ||
* (the lower one is twice smaller). Default is 100. | ||
* @param accThreshold The accumulator threshold for the circle centers at the detection | ||
* stage. The smaller it is, the more false circles may be detected. | ||
* Circles, corresponding to the larger accumulator values, will be | ||
* returned first. Default is 100. | ||
* @param minRadius Minimum circle radius, default is 0 | ||
* @param maxRadius Maximum circle radius, default is 0 | ||
Comment on lines
+42
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I propose to move the note about radius here. Also it's not clear what zero means. |
||
*/ | ||
CV_EXPORTS_W void houghCircles(InputArray src, OutputArray circles, uint32_t minDist, | ||
uint32_t cannyThreshold = 100, uint32_t accThreshold = 100, | ||
uint32_t minRadius = 0, uint32_t maxRadius = 0); | ||
|
||
//! @} | ||
|
||
} // fastcv:: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef OPENCV_FASTCV_IPPTRANSFORM_HPP | ||
#define OPENCV_FASTCV_IPPTRANSFORM_HPP | ||
|
||
#include <opencv2/core.hpp> | ||
|
||
namespace cv { | ||
namespace fastcv { | ||
|
||
//! @addtogroup fastcv | ||
//! @{ | ||
|
||
/** | ||
* @brief This function performs 8x8 forward discrete Cosine transform on input image | ||
* accepts input of type 8-bit unsigned integer and produces output of type 16-bit signed integer | ||
* provides faster execution time than cv::dct on Qualcomm's processor | ||
* @param src Input image of type CV_8UC1 | ||
* @param dst Output image of type CV_16SC1 | ||
*/ | ||
CV_EXPORTS_W void DCT(InputArray src, OutputArray dst); | ||
|
||
/** | ||
* @brief This function performs 8x8 inverse discrete Cosine transform on input image | ||
* provides faster execution time than cv::dct in inverse case on Qualcomm's processor | ||
* @param src Input image of type CV_16SC1 | ||
* @param dst Output image of type CV_8UC1 | ||
*/ | ||
CV_EXPORTS_W void IDCT(InputArray src, OutputArray dst); | ||
|
||
//! @} | ||
|
||
} // fastcv:: | ||
} // cv:: | ||
|
||
#endif // OPENCV_FASTCV_IPPTRANSFORM_HPP |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,9 @@ namespace fastcv { | |
/** | ||
* @brief Calculates all of the moments up to the third order of the image pixels' intensities | ||
The results are returned in the structure cv::Moments. | ||
* @param _src Input image with type CV_8UC1, CV_32SC1, CV_32FC1 | ||
* @param binary If 1, binary image (0x00-black, oxff-white); if 0, grayscale image | ||
* @param _src Input image with type CV_8UC1, CV_32SC1, CV_32FC1 | ||
* @param binary If true, assumes the image to be binary (0x00 for black, 0xff for white), otherwise assumes the image to be | ||
* grayscale. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please mention a difference with cv::Moments. |
||
*/ | ||
CV_EXPORTS cv::Moments moments(InputArray _src, bool binary); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is difference with cv::Filter2d? Why it's not in HAL.