Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions modules/fastcv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ FastCV extension for OpenCV

This module provides wrappers for several FastCV functions not covered by the corresponding HAL in OpenCV or have implementation incompatible with OpenCV.
Please note that:
1. This module supports ARM architecture only. This means that CMake script aborts configuration under x86 platform even if you don't want to build binaries for your machine and just want to build docs or enable code analysis in your IDE. In that case you should fix CMakeLists.txt file as told inside it.
2. Test data is stored in misc folder. Before running tests on a device you should copy the content of `misc/` folder to `$YOUR_TESTDATA_PATH/fastcv/` folder on a device.
1. This module supports ARM architecture only. This means that CMake script will not configure or build under x86 platform.
8 changes: 7 additions & 1 deletion modules/fastcv/include/opencv2/fastcv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,29 @@

#include "opencv2/fastcv/arithm.hpp"
#include "opencv2/fastcv/bilateralFilter.hpp"
#include "opencv2/fastcv/blur.hpp"
#include "opencv2/fastcv/cluster.hpp"
#include "opencv2/fastcv/draw.hpp"
#include "opencv2/fastcv/edges.hpp"
#include "opencv2/fastcv/fast10.hpp"
#include "opencv2/fastcv/fft.hpp"
#include "opencv2/fastcv/hough.hpp"
#include "opencv2/fastcv/ipptransform.hpp"
#include "opencv2/fastcv/moments.hpp"
#include "opencv2/fastcv/mser.hpp"
#include "opencv2/fastcv/pyramid.hpp"
#include "opencv2/fastcv/remap.hpp"
#include "opencv2/fastcv/scale.hpp"
#include "opencv2/fastcv/shift.hpp"
#include "opencv2/fastcv/smooth.hpp"
#include "opencv2/fastcv/thresh.hpp"
#include "opencv2/fastcv/tracking.hpp"
#include "opencv2/fastcv/warp.hpp"

/**
* @defgroup fastcv Module-wrapper for FastCV hardware accelerated functions
* @{
* @}
*/

#endif // OPENCV_FASTCV_ARITHM_HPP
#endif // OPENCV_FASTCV_HPP
55 changes: 55 additions & 0 deletions modules/fastcv/include/opencv2/fastcv/blur.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#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
* @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 Blur border or not
*
* @sa GaussianBlur
*/
CV_EXPORTS_W void gaussianBlur(cv::InputArray _src, cv::OutputArray _dst, int kernel_size = 3, bool blur_border = true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference with HAL version?


/**
* @brief Filter an image with non-separable kernel
* @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);
Copy link
Contributor

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.


/**
* @brief sepFilter an image with separable kernel.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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same question.

//! @}

} // fastcv::
} // cv::

#endif // OPENCV_FASTCV_BLUR_HPP
2 changes: 1 addition & 1 deletion modules/fastcv/include/opencv2/fastcv/cluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace fastcv {

/**
* @brief Clusterizes N input points in D-dimensional space into K clusters
*
*
* @param points Points array of type 8u, each row represets a point.
* Size is N rows by D columns, can be non-continuous.
* @param clusterCenters Initial cluster centers array of type 32f, each row represents a center.
Expand Down
42 changes: 42 additions & 0 deletions modules/fastcv/include/opencv2/fastcv/edges.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#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 Sobel filter with return dx and dy separately
* @param _src Input image with type CV_8UC1
* @param _dx X direction 1 order derivative with type CV_16SC1.
* @param _dy Y direction 1 order derivative with type CV_16SC1 (same size with _dx).
* @param kernel_size Sobel kernel size, support 3x3, 5x5, 7x7
* @param borderType Border type
* @param borderValue Border value for constant border
*/
CV_EXPORTS_W void sobel(cv::InputArray _src, cv::OutputArray _dx, cv::OutputArray _dy, int kernel_size, int borderType,
int borderValue);

/**
* @brief 3x3 Sobel filter without border
* @param _src Input image with type CV_8UC1
* @param _dst If _dsty is not needed, will store 8-bit result of |dx|+|dy|,
* otherwise will store the result of X direction 1 order derivative
* @param _dsty If this param is needed, will store the result of Y direction 1 order derivative
* @param normalization If do normalization for the result
*/
CV_EXPORTS_W void sobel3x3u8(cv::InputArray _src, cv::OutputArray _dst, cv::OutputArray _dsty = noArray(), int ddepth = CV_8U,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HAL?

bool normalization = false);

//! @}

}
}

#endif
23 changes: 22 additions & 1 deletion modules/fastcv/include/opencv2/fastcv/hough.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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::
Expand Down
38 changes: 38 additions & 0 deletions modules/fastcv/include/opencv2/fastcv/ipptransform.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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
*
* @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
*
* @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
5 changes: 3 additions & 2 deletions modules/fastcv/include/opencv2/fastcv/moments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The 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);

Expand Down
Loading
Loading