feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
19
3rdparty/opencv-4.5.4/modules/imgproc/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
set(the_description "Image Processing")
|
||||
ocv_add_dispatched_file(accum SSE4_1 AVX AVX2)
|
||||
ocv_add_dispatched_file(bilateral_filter SSE2 AVX2)
|
||||
ocv_add_dispatched_file(box_filter SSE2 SSE4_1 AVX2)
|
||||
ocv_add_dispatched_file(filter SSE2 SSE4_1 AVX2)
|
||||
ocv_add_dispatched_file(color_hsv SSE2 SSE4_1 AVX2)
|
||||
ocv_add_dispatched_file(color_rgb SSE2 SSE4_1 AVX2)
|
||||
ocv_add_dispatched_file(color_yuv SSE2 SSE4_1 AVX2)
|
||||
ocv_add_dispatched_file(median_blur SSE2 SSE4_1 AVX2)
|
||||
ocv_add_dispatched_file(morph SSE2 SSE4_1 AVX2)
|
||||
ocv_add_dispatched_file(smooth SSE2 SSE4_1 AVX2)
|
||||
ocv_add_dispatched_file(sumpixels SSE2 AVX2 AVX512_SKX)
|
||||
ocv_define_module(imgproc opencv_core WRAP java objc python js)
|
||||
|
||||
ocv_check_environment_variables(OPENCV_IPP_GAUSSIAN_BLUR)
|
||||
option(OPENCV_IPP_GAUSSIAN_BLUR "Enable IPP optimizations for GaussianBlur (+8Mb in binary size)" OFF)
|
||||
if(OPENCV_IPP_GAUSSIAN_BLUR)
|
||||
ocv_append_source_file_compile_definitions(${CMAKE_CURRENT_SOURCE_DIR}/src/smooth.dispatch.cpp "ENABLE_IPP_GAUSSIAN_BLUR=1")
|
||||
endif()
|
||||
166
3rdparty/opencv-4.5.4/modules/imgproc/doc/colors.markdown
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
Color conversions {#imgproc_color_conversions}
|
||||
=================
|
||||
See cv::cvtColor and cv::ColorConversionCodes
|
||||
@todo document other conversion modes
|
||||
|
||||
@anchor color_convert_rgb_gray
|
||||
RGB \f$\leftrightarrow\f$ GRAY
|
||||
------------------------------
|
||||
Transformations within RGB space like adding/removing the alpha channel, reversing the channel
|
||||
order, conversion to/from 16-bit RGB color (R5:G6:B5 or R5:G5:B5), as well as conversion
|
||||
to/from grayscale using:
|
||||
\f[\text{RGB[A] to Gray:} \quad Y \leftarrow 0.299 \cdot R + 0.587 \cdot G + 0.114 \cdot B\f]
|
||||
and
|
||||
\f[\text{Gray to RGB[A]:} \quad R \leftarrow Y, G \leftarrow Y, B \leftarrow Y, A \leftarrow \max (ChannelRange)\f]
|
||||
The conversion from a RGB image to gray is done with:
|
||||
@code
|
||||
cvtColor(src, bwsrc, cv::COLOR_RGB2GRAY);
|
||||
@endcode
|
||||
More advanced channel reordering can also be done with cv::mixChannels.
|
||||
@see cv::COLOR_BGR2GRAY, cv::COLOR_RGB2GRAY, cv::COLOR_GRAY2BGR, cv::COLOR_GRAY2RGB
|
||||
|
||||
@anchor color_convert_rgb_xyz
|
||||
RGB \f$\leftrightarrow\f$ CIE XYZ.Rec 709 with D65 white point
|
||||
--------------------------------------------------------------
|
||||
\f[\begin{bmatrix} X \\ Y \\ Z
|
||||
\end{bmatrix} \leftarrow \begin{bmatrix} 0.412453 & 0.357580 & 0.180423 \\ 0.212671 & 0.715160 & 0.072169 \\ 0.019334 & 0.119193 & 0.950227
|
||||
\end{bmatrix} \cdot \begin{bmatrix} R \\ G \\ B
|
||||
\end{bmatrix}\f]
|
||||
\f[\begin{bmatrix} R \\ G \\ B
|
||||
\end{bmatrix} \leftarrow \begin{bmatrix} 3.240479 & -1.53715 & -0.498535 \\ -0.969256 & 1.875991 & 0.041556 \\ 0.055648 & -0.204043 & 1.057311
|
||||
\end{bmatrix} \cdot \begin{bmatrix} X \\ Y \\ Z
|
||||
\end{bmatrix}\f]
|
||||
\f$X\f$, \f$Y\f$ and \f$Z\f$ cover the whole value range (in case of floating-point images, \f$Z\f$ may exceed 1).
|
||||
|
||||
@see cv::COLOR_BGR2XYZ, cv::COLOR_RGB2XYZ, cv::COLOR_XYZ2BGR, cv::COLOR_XYZ2RGB
|
||||
|
||||
@anchor color_convert_rgb_ycrcb
|
||||
RGB \f$\leftrightarrow\f$ YCrCb JPEG (or YCC)
|
||||
---------------------------------------------
|
||||
\f[Y \leftarrow 0.299 \cdot R + 0.587 \cdot G + 0.114 \cdot B\f]
|
||||
\f[Cr \leftarrow (R-Y) \cdot 0.713 + delta\f]
|
||||
\f[Cb \leftarrow (B-Y) \cdot 0.564 + delta\f]
|
||||
\f[R \leftarrow Y + 1.403 \cdot (Cr - delta)\f]
|
||||
\f[G \leftarrow Y - 0.714 \cdot (Cr - delta) - 0.344 \cdot (Cb - delta)\f]
|
||||
\f[B \leftarrow Y + 1.773 \cdot (Cb - delta)\f]
|
||||
where
|
||||
\f[delta = \left \{ \begin{array}{l l} 128 & \mbox{for 8-bit images} \\ 32768 & \mbox{for 16-bit images} \\ 0.5 & \mbox{for floating-point images} \end{array} \right .\f]
|
||||
Y, Cr, and Cb cover the whole value range.
|
||||
@see cv::COLOR_BGR2YCrCb, cv::COLOR_RGB2YCrCb, cv::COLOR_YCrCb2BGR, cv::COLOR_YCrCb2RGB
|
||||
|
||||
@anchor color_convert_rgb_hsv
|
||||
RGB \f$\leftrightarrow\f$ HSV
|
||||
-----------------------------
|
||||
In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and
|
||||
scaled to fit the 0 to 1 range.
|
||||
|
||||
\f[V \leftarrow max(R,G,B)\f]
|
||||
\f[S \leftarrow \fork{\frac{V-min(R,G,B)}{V}}{if \(V \neq 0\)}{0}{otherwise}\f]
|
||||
\f[H \leftarrow \forkfour{{60(G - B)}/{(V-min(R,G,B))}}{if \(V=R\)}
|
||||
{{120+60(B - R)}/{(V-min(R,G,B))}}{if \(V=G\)}
|
||||
{{240+60(R - G)}/{(V-min(R,G,B))}}{if \(V=B\)}
|
||||
{0}{if \(R=G=B\)}\f]
|
||||
If \f$H<0\f$ then \f$H \leftarrow H+360\f$ . On output \f$0 \leq V \leq 1\f$, \f$0 \leq S \leq 1\f$,
|
||||
\f$0 \leq H \leq 360\f$ .
|
||||
|
||||
The values are then converted to the destination data type:
|
||||
- 8-bit images: \f$V \leftarrow 255 V, S \leftarrow 255 S, H \leftarrow H/2 \text{(to fit to 0 to 255)}\f$
|
||||
- 16-bit images: (currently not supported) \f$V <- 65535 V, S <- 65535 S, H <- H\f$
|
||||
- 32-bit images: H, S, and V are left as is
|
||||
|
||||
@see cv::COLOR_BGR2HSV, cv::COLOR_RGB2HSV, cv::COLOR_HSV2BGR, cv::COLOR_HSV2RGB
|
||||
|
||||
@anchor color_convert_rgb_hls
|
||||
RGB \f$\leftrightarrow\f$ HLS
|
||||
-----------------------------
|
||||
In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and
|
||||
scaled to fit the 0 to 1 range.
|
||||
|
||||
\f[V_{max} \leftarrow {max}(R,G,B)\f]
|
||||
\f[V_{min} \leftarrow {min}(R,G,B)\f]
|
||||
\f[L \leftarrow \frac{V_{max} + V_{min}}{2}\f]
|
||||
\f[S \leftarrow \fork { \frac{V_{max} - V_{min}}{V_{max} + V_{min}} }{if \(L < 0.5\) }
|
||||
{ \frac{V_{max} - V_{min}}{2 - (V_{max} + V_{min})} }{if \(L \ge 0.5\) }\f]
|
||||
\f[H \leftarrow \forkfour {{60(G - B)}/{(V_{max}-V_{min})}}{if \(V_{max}=R\) }
|
||||
{{120+60(B - R)}/{(V_{max}-V_{min})}}{if \(V_{max}=G\) }
|
||||
{{240+60(R - G)}/{(V_{max}-V_{min})}}{if \(V_{max}=B\) }
|
||||
{0}{if \(R=G=B\) }\f]
|
||||
If \f$H<0\f$ then \f$H \leftarrow H+360\f$ . On output \f$0 \leq L \leq 1\f$, \f$0 \leq S \leq
|
||||
1\f$, \f$0 \leq H \leq 360\f$ .
|
||||
|
||||
The values are then converted to the destination data type:
|
||||
- 8-bit images: \f$V \leftarrow 255 \cdot V, S \leftarrow 255 \cdot S, H \leftarrow H/2 \; \text{(to fit to 0 to 255)}\f$
|
||||
- 16-bit images: (currently not supported) \f$V <- 65535 \cdot V, S <- 65535 \cdot S, H <- H\f$
|
||||
- 32-bit images: H, S, V are left as is
|
||||
|
||||
@see cv::COLOR_BGR2HLS, cv::COLOR_RGB2HLS, cv::COLOR_HLS2BGR, cv::COLOR_HLS2RGB
|
||||
|
||||
@anchor color_convert_rgb_lab
|
||||
RGB \f$\leftrightarrow\f$ CIE L\*a\*b\*
|
||||
---------------------------------------
|
||||
In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and
|
||||
scaled to fit the 0 to 1 range.
|
||||
|
||||
\f[\vecthree{X}{Y}{Z} \leftarrow \vecthreethree{0.412453}{0.357580}{0.180423}{0.212671}{0.715160}{0.072169}{0.019334}{0.119193}{0.950227} \cdot \vecthree{R}{G}{B}\f]
|
||||
\f[X \leftarrow X/X_n, \text{where} X_n = 0.950456\f]
|
||||
\f[Z \leftarrow Z/Z_n, \text{where} Z_n = 1.088754\f]
|
||||
\f[L \leftarrow \fork{116*Y^{1/3}-16}{for \(Y>0.008856\)}{903.3*Y}{for \(Y \le 0.008856\)}\f]
|
||||
\f[a \leftarrow 500 (f(X)-f(Y)) + delta\f]
|
||||
\f[b \leftarrow 200 (f(Y)-f(Z)) + delta\f]
|
||||
where
|
||||
\f[f(t)= \fork{t^{1/3}}{for \(t>0.008856\)}{7.787 t+16/116}{for \(t\leq 0.008856\)}\f]
|
||||
and
|
||||
\f[delta = \fork{128}{for 8-bit images}{0}{for floating-point images}\f]
|
||||
|
||||
This outputs \f$0 \leq L \leq 100\f$, \f$-127 \leq a \leq 127\f$, \f$-127 \leq b \leq 127\f$ . The values
|
||||
are then converted to the destination data type:
|
||||
- 8-bit images: \f$L \leftarrow L*255/100, \; a \leftarrow a + 128, \; b \leftarrow b + 128\f$
|
||||
- 16-bit images: (currently not supported)
|
||||
- 32-bit images: L, a, and b are left as is
|
||||
|
||||
@see cv::COLOR_BGR2Lab, cv::COLOR_RGB2Lab, cv::COLOR_Lab2BGR, cv::COLOR_Lab2RGB
|
||||
|
||||
@anchor color_convert_rgb_luv
|
||||
RGB \f$\leftrightarrow\f$ CIE L\*u\*v\*
|
||||
---------------------------------------
|
||||
In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and
|
||||
scaled to fit 0 to 1 range.
|
||||
|
||||
\f[\vecthree{X}{Y}{Z} \leftarrow \vecthreethree{0.412453}{0.357580}{0.180423}{0.212671}{0.715160}{0.072169}{0.019334}{0.119193}{0.950227} \cdot \vecthree{R}{G}{B}\f]
|
||||
\f[L \leftarrow \fork{116*Y^{1/3} - 16}{for \(Y>0.008856\)}{903.3 Y}{for \(Y\leq 0.008856\)}\f]
|
||||
\f[u' \leftarrow 4*X/(X + 15*Y + 3 Z)\f]
|
||||
\f[v' \leftarrow 9*Y/(X + 15*Y + 3 Z)\f]
|
||||
\f[u \leftarrow 13*L*(u' - u_n) \quad \text{where} \quad u_n=0.19793943\f]
|
||||
\f[v \leftarrow 13*L*(v' - v_n) \quad \text{where} \quad v_n=0.46831096\f]
|
||||
|
||||
This outputs \f$0 \leq L \leq 100\f$, \f$-134 \leq u \leq 220\f$, \f$-140 \leq v \leq 122\f$ .
|
||||
|
||||
The values are then converted to the destination data type:
|
||||
- 8-bit images: \f$L \leftarrow 255/100 L, \; u \leftarrow 255/354 (u + 134), \; v \leftarrow 255/262 (v + 140)\f$
|
||||
- 16-bit images: (currently not supported)
|
||||
- 32-bit images: L, u, and v are left as is
|
||||
|
||||
Note that when converting integer Luv images to RGB the intermediate X, Y and Z values are truncated to \f$ [0, 2] \f$ range to fit white point limitations. It may lead to incorrect representation of colors with odd XYZ values.
|
||||
|
||||
The above formulae for converting RGB to/from various color spaces have been taken from multiple
|
||||
sources on the web, primarily from the Charles Poynton site <http://www.poynton.com/ColorFAQ.html>
|
||||
|
||||
@see cv::COLOR_BGR2Luv, cv::COLOR_RGB2Luv, cv::COLOR_Luv2BGR, cv::COLOR_Luv2RGB
|
||||
|
||||
@anchor color_convert_bayer
|
||||
Bayer \f$\rightarrow\f$ RGB
|
||||
---------------------------
|
||||
The Bayer pattern is widely used in CCD and CMOS cameras. It enables you to get color pictures
|
||||
from a single plane where R,G, and B pixels (sensors of a particular component) are interleaved
|
||||
as follows:
|
||||
|
||||

|
||||
|
||||
The output RGB components of a pixel are interpolated from 1, 2, or 4 neighbors of the pixel
|
||||
having the same color. There are several modifications of the above pattern that can be achieved
|
||||
by shifting the pattern one pixel left and/or one pixel up. The two letters \f$C_1\f$ and \f$C_2\f$ in
|
||||
the conversion constants CV_Bayer \f$C_1 C_2\f$ 2BGR and CV_Bayer \f$C_1 C_2\f$ 2RGB indicate the
|
||||
particular pattern type. These are components from the second row, second and third columns,
|
||||
respectively. For example, the above pattern has a very popular "BG" type.
|
||||
|
||||
@see cv::COLOR_BayerBG2BGR, cv::COLOR_BayerGB2BGR, cv::COLOR_BayerRG2BGR, cv::COLOR_BayerGR2BGR, cv::COLOR_BayerBG2RGB, cv::COLOR_BayerGB2RGB, cv::COLOR_BayerRG2RGB, cv::COLOR_BayerGR2RGB
|
||||
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/backprojectpatch.png
vendored
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/bayer.png
vendored
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/boundingrect.png
vendored
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/building.jpg
vendored
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/building_lsd.png
vendored
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_autumn.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_bone.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_cividis.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_cool.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_deepgreen.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_hot.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_hsv.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_inferno.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_jet.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_magma.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_mkpj1.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_mkpj2.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_ocean.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_parula.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_pink.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_plasma.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_rainbow.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_spring.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_summer.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_turbo.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_twilight.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_twilight_shifted.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_viridis.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/colormaps/colorscale_winter.jpg
vendored
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/contoursecarea.png
vendored
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/cornersubpix.png
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/defects.png
vendored
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/delaunay_voronoi.png
vendored
Normal file
|
After Width: | Height: | Size: 14 KiB |
1156
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/ellipse.svg
vendored
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/houghp.png
vendored
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/integral.png
vendored
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/intersection.png
vendored
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/inv_logpolar.jpg
vendored
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/logpolar.jpg
vendored
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/minareabox.png
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/minenclosingtriangle.png
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/pointpolygon.png
vendored
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/polar_remap_doc.png
vendored
Normal file
|
After Width: | Height: | Size: 285 KiB |
3297
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/polar_remap_doc.svg
vendored
Normal file
|
After Width: | Height: | Size: 325 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/quadedge.png
vendored
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/subdiv.png
vendored
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
3rdparty/opencv-4.5.4/modules/imgproc/doc/pics/threshold.png
vendored
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
4947
3rdparty/opencv-4.5.4/modules/imgproc/include/opencv2/imgproc.hpp
vendored
Normal file
34
3rdparty/opencv-4.5.4/modules/imgproc/include/opencv2/imgproc/bindings.hpp
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#ifndef OPENCV_IMGPROC_BINDINGS_HPP
|
||||
#define OPENCV_IMGPROC_BINDINGS_HPP
|
||||
|
||||
// This file contains special overloads for OpenCV bindings
|
||||
// No need to use these functions in C++ code.
|
||||
|
||||
namespace cv {
|
||||
|
||||
/** @brief Finds lines in a binary image using the standard Hough transform and get accumulator.
|
||||
*
|
||||
* @note This function is for bindings use only. Use original function in C++ code
|
||||
*
|
||||
* @sa HoughLines
|
||||
*/
|
||||
CV_WRAP static inline
|
||||
void HoughLinesWithAccumulator(
|
||||
InputArray image, OutputArray lines,
|
||||
double rho, double theta, int threshold,
|
||||
double srn = 0, double stn = 0,
|
||||
double min_theta = 0, double max_theta = CV_PI
|
||||
)
|
||||
{
|
||||
std::vector<Vec3f> lines_acc;
|
||||
HoughLines(image, lines_acc, rho, theta, threshold, srn, stn, min_theta, max_theta);
|
||||
Mat(lines_acc).copyTo(lines);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // OPENCV_IMGPROC_BINDINGS_HPP
|
||||
395
3rdparty/opencv-4.5.4/modules/imgproc/include/opencv2/imgproc/detail/gcgraph.hpp
vendored
Normal file
@ -0,0 +1,395 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef OPENCV_IMGPROC_DETAIL_GCGRAPH_HPP
|
||||
#define OPENCV_IMGPROC_DETAIL_GCGRAPH_HPP
|
||||
|
||||
//! @cond IGNORED
|
||||
|
||||
namespace cv { namespace detail {
|
||||
template <class TWeight> class GCGraph
|
||||
{
|
||||
public:
|
||||
GCGraph();
|
||||
GCGraph( unsigned int vtxCount, unsigned int edgeCount );
|
||||
~GCGraph();
|
||||
void create( unsigned int vtxCount, unsigned int edgeCount );
|
||||
int addVtx();
|
||||
void addEdges( int i, int j, TWeight w, TWeight revw );
|
||||
void addTermWeights( int i, TWeight sourceW, TWeight sinkW );
|
||||
TWeight maxFlow();
|
||||
bool inSourceSegment( int i );
|
||||
private:
|
||||
class Vtx
|
||||
{
|
||||
public:
|
||||
Vtx *next; // initialized and used in maxFlow() only
|
||||
int parent;
|
||||
int first;
|
||||
int ts;
|
||||
int dist;
|
||||
TWeight weight;
|
||||
uchar t;
|
||||
};
|
||||
class Edge
|
||||
{
|
||||
public:
|
||||
int dst;
|
||||
int next;
|
||||
TWeight weight;
|
||||
};
|
||||
|
||||
std::vector<Vtx> vtcs;
|
||||
std::vector<Edge> edges;
|
||||
TWeight flow;
|
||||
};
|
||||
|
||||
template <class TWeight>
|
||||
GCGraph<TWeight>::GCGraph()
|
||||
{
|
||||
flow = 0;
|
||||
}
|
||||
template <class TWeight>
|
||||
GCGraph<TWeight>::GCGraph( unsigned int vtxCount, unsigned int edgeCount )
|
||||
{
|
||||
create( vtxCount, edgeCount );
|
||||
}
|
||||
template <class TWeight>
|
||||
GCGraph<TWeight>::~GCGraph()
|
||||
{
|
||||
}
|
||||
template <class TWeight>
|
||||
void GCGraph<TWeight>::create( unsigned int vtxCount, unsigned int edgeCount )
|
||||
{
|
||||
vtcs.reserve( vtxCount );
|
||||
edges.reserve( edgeCount + 2 );
|
||||
flow = 0;
|
||||
}
|
||||
|
||||
template <class TWeight>
|
||||
int GCGraph<TWeight>::addVtx()
|
||||
{
|
||||
Vtx v;
|
||||
memset( &v, 0, sizeof(Vtx));
|
||||
vtcs.push_back(v);
|
||||
return (int)vtcs.size() - 1;
|
||||
}
|
||||
|
||||
template <class TWeight>
|
||||
void GCGraph<TWeight>::addEdges( int i, int j, TWeight w, TWeight revw )
|
||||
{
|
||||
CV_Assert( i>=0 && i<(int)vtcs.size() );
|
||||
CV_Assert( j>=0 && j<(int)vtcs.size() );
|
||||
CV_Assert( w>=0 && revw>=0 );
|
||||
CV_Assert( i != j );
|
||||
|
||||
if( !edges.size() )
|
||||
edges.resize( 2 );
|
||||
|
||||
Edge fromI, toI;
|
||||
fromI.dst = j;
|
||||
fromI.next = vtcs[i].first;
|
||||
fromI.weight = w;
|
||||
vtcs[i].first = (int)edges.size();
|
||||
edges.push_back( fromI );
|
||||
|
||||
toI.dst = i;
|
||||
toI.next = vtcs[j].first;
|
||||
toI.weight = revw;
|
||||
vtcs[j].first = (int)edges.size();
|
||||
edges.push_back( toI );
|
||||
}
|
||||
|
||||
template <class TWeight>
|
||||
void GCGraph<TWeight>::addTermWeights( int i, TWeight sourceW, TWeight sinkW )
|
||||
{
|
||||
CV_Assert( i>=0 && i<(int)vtcs.size() );
|
||||
|
||||
TWeight dw = vtcs[i].weight;
|
||||
if( dw > 0 )
|
||||
sourceW += dw;
|
||||
else
|
||||
sinkW -= dw;
|
||||
flow += (sourceW < sinkW) ? sourceW : sinkW;
|
||||
vtcs[i].weight = sourceW - sinkW;
|
||||
}
|
||||
|
||||
template <class TWeight>
|
||||
TWeight GCGraph<TWeight>::maxFlow()
|
||||
{
|
||||
CV_Assert(!vtcs.empty());
|
||||
CV_Assert(!edges.empty());
|
||||
const int TERMINAL = -1, ORPHAN = -2;
|
||||
Vtx stub, *nilNode = &stub, *first = nilNode, *last = nilNode;
|
||||
int curr_ts = 0;
|
||||
stub.next = nilNode;
|
||||
Vtx *vtxPtr = &vtcs[0];
|
||||
Edge *edgePtr = &edges[0];
|
||||
|
||||
std::vector<Vtx*> orphans;
|
||||
|
||||
// initialize the active queue and the graph vertices
|
||||
for( int i = 0; i < (int)vtcs.size(); i++ )
|
||||
{
|
||||
Vtx* v = vtxPtr + i;
|
||||
v->ts = 0;
|
||||
if( v->weight != 0 )
|
||||
{
|
||||
last = last->next = v;
|
||||
v->dist = 1;
|
||||
v->parent = TERMINAL;
|
||||
v->t = v->weight < 0;
|
||||
}
|
||||
else
|
||||
v->parent = 0;
|
||||
}
|
||||
first = first->next;
|
||||
last->next = nilNode;
|
||||
nilNode->next = 0;
|
||||
|
||||
// run the search-path -> augment-graph -> restore-trees loop
|
||||
for(;;)
|
||||
{
|
||||
Vtx* v, *u;
|
||||
int e0 = -1, ei = 0, ej = 0;
|
||||
TWeight minWeight, weight;
|
||||
uchar vt;
|
||||
|
||||
// grow S & T search trees, find an edge connecting them
|
||||
while( first != nilNode )
|
||||
{
|
||||
v = first;
|
||||
if( v->parent )
|
||||
{
|
||||
vt = v->t;
|
||||
for( ei = v->first; ei != 0; ei = edgePtr[ei].next )
|
||||
{
|
||||
if( edgePtr[ei^vt].weight == 0 )
|
||||
continue;
|
||||
u = vtxPtr+edgePtr[ei].dst;
|
||||
if( !u->parent )
|
||||
{
|
||||
u->t = vt;
|
||||
u->parent = ei ^ 1;
|
||||
u->ts = v->ts;
|
||||
u->dist = v->dist + 1;
|
||||
if( !u->next )
|
||||
{
|
||||
u->next = nilNode;
|
||||
last = last->next = u;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if( u->t != vt )
|
||||
{
|
||||
e0 = ei ^ vt;
|
||||
break;
|
||||
}
|
||||
|
||||
if( u->dist > v->dist+1 && u->ts <= v->ts )
|
||||
{
|
||||
// reassign the parent
|
||||
u->parent = ei ^ 1;
|
||||
u->ts = v->ts;
|
||||
u->dist = v->dist + 1;
|
||||
}
|
||||
}
|
||||
if( e0 > 0 )
|
||||
break;
|
||||
}
|
||||
// exclude the vertex from the active list
|
||||
first = first->next;
|
||||
v->next = 0;
|
||||
}
|
||||
|
||||
if( e0 <= 0 )
|
||||
break;
|
||||
|
||||
// find the minimum edge weight along the path
|
||||
minWeight = edgePtr[e0].weight;
|
||||
CV_Assert( minWeight > 0 );
|
||||
// k = 1: source tree, k = 0: destination tree
|
||||
for( int k = 1; k >= 0; k-- )
|
||||
{
|
||||
for( v = vtxPtr+edgePtr[e0^k].dst;; v = vtxPtr+edgePtr[ei].dst )
|
||||
{
|
||||
if( (ei = v->parent) < 0 )
|
||||
break;
|
||||
weight = edgePtr[ei^k].weight;
|
||||
minWeight = MIN(minWeight, weight);
|
||||
CV_Assert( minWeight > 0 );
|
||||
}
|
||||
weight = fabs(v->weight);
|
||||
minWeight = MIN(minWeight, weight);
|
||||
CV_Assert( minWeight > 0 );
|
||||
}
|
||||
|
||||
// modify weights of the edges along the path and collect orphans
|
||||
edgePtr[e0].weight -= minWeight;
|
||||
edgePtr[e0^1].weight += minWeight;
|
||||
flow += minWeight;
|
||||
|
||||
// k = 1: source tree, k = 0: destination tree
|
||||
for( int k = 1; k >= 0; k-- )
|
||||
{
|
||||
for( v = vtxPtr+edgePtr[e0^k].dst;; v = vtxPtr+edgePtr[ei].dst )
|
||||
{
|
||||
if( (ei = v->parent) < 0 )
|
||||
break;
|
||||
edgePtr[ei^(k^1)].weight += minWeight;
|
||||
if( (edgePtr[ei^k].weight -= minWeight) == 0 )
|
||||
{
|
||||
orphans.push_back(v);
|
||||
v->parent = ORPHAN;
|
||||
}
|
||||
}
|
||||
|
||||
v->weight = v->weight + minWeight*(1-k*2);
|
||||
if( v->weight == 0 )
|
||||
{
|
||||
orphans.push_back(v);
|
||||
v->parent = ORPHAN;
|
||||
}
|
||||
}
|
||||
|
||||
// restore the search trees by finding new parents for the orphans
|
||||
curr_ts++;
|
||||
while( !orphans.empty() )
|
||||
{
|
||||
Vtx* v2 = orphans.back();
|
||||
orphans.pop_back();
|
||||
|
||||
int d, minDist = INT_MAX;
|
||||
e0 = 0;
|
||||
vt = v2->t;
|
||||
|
||||
for( ei = v2->first; ei != 0; ei = edgePtr[ei].next )
|
||||
{
|
||||
if( edgePtr[ei^(vt^1)].weight == 0 )
|
||||
continue;
|
||||
u = vtxPtr+edgePtr[ei].dst;
|
||||
if( u->t != vt || u->parent == 0 )
|
||||
continue;
|
||||
// compute the distance to the tree root
|
||||
for( d = 0;; )
|
||||
{
|
||||
if( u->ts == curr_ts )
|
||||
{
|
||||
d += u->dist;
|
||||
break;
|
||||
}
|
||||
ej = u->parent;
|
||||
d++;
|
||||
if( ej < 0 )
|
||||
{
|
||||
if( ej == ORPHAN )
|
||||
d = INT_MAX-1;
|
||||
else
|
||||
{
|
||||
u->ts = curr_ts;
|
||||
u->dist = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
u = vtxPtr+edgePtr[ej].dst;
|
||||
}
|
||||
|
||||
// update the distance
|
||||
if( ++d < INT_MAX )
|
||||
{
|
||||
if( d < minDist )
|
||||
{
|
||||
minDist = d;
|
||||
e0 = ei;
|
||||
}
|
||||
for( u = vtxPtr+edgePtr[ei].dst; u->ts != curr_ts; u = vtxPtr+edgePtr[u->parent].dst )
|
||||
{
|
||||
u->ts = curr_ts;
|
||||
u->dist = --d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( (v2->parent = e0) > 0 )
|
||||
{
|
||||
v2->ts = curr_ts;
|
||||
v2->dist = minDist;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* no parent is found */
|
||||
v2->ts = 0;
|
||||
for( ei = v2->first; ei != 0; ei = edgePtr[ei].next )
|
||||
{
|
||||
u = vtxPtr+edgePtr[ei].dst;
|
||||
ej = u->parent;
|
||||
if( u->t != vt || !ej )
|
||||
continue;
|
||||
if( edgePtr[ei^(vt^1)].weight && !u->next )
|
||||
{
|
||||
u->next = nilNode;
|
||||
last = last->next = u;
|
||||
}
|
||||
if( ej > 0 && vtxPtr+edgePtr[ej].dst == v2 )
|
||||
{
|
||||
orphans.push_back(u);
|
||||
u->parent = ORPHAN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return flow;
|
||||
}
|
||||
|
||||
template <class TWeight>
|
||||
bool GCGraph<TWeight>::inSourceSegment( int i )
|
||||
{
|
||||
CV_Assert( i>=0 && i<(int)vtcs.size() );
|
||||
return vtcs[i].t == 0;
|
||||
}
|
||||
|
||||
}} // namespace detail, cv
|
||||
|
||||
|
||||
//! @endcond
|
||||
|
||||
#endif // OPENCV_IMGPROC_DETAIL_GCGRAPH_HPP
|
||||
246
3rdparty/opencv-4.5.4/modules/imgproc/include/opencv2/imgproc/hal/hal.hpp
vendored
Normal file
@ -0,0 +1,246 @@
|
||||
#ifndef CV_IMGPROC_HAL_HPP
|
||||
#define CV_IMGPROC_HAL_HPP
|
||||
|
||||
#include "opencv2/core/cvdef.h"
|
||||
#include "opencv2/core/cvstd.hpp"
|
||||
#include "opencv2/core/hal/interface.h"
|
||||
|
||||
namespace cv { namespace hal {
|
||||
|
||||
//! @addtogroup imgproc_hal_functions
|
||||
//! @{
|
||||
|
||||
//---------------------------
|
||||
//! @cond IGNORED
|
||||
|
||||
struct CV_EXPORTS Filter2D
|
||||
{
|
||||
CV_DEPRECATED static Ptr<hal::Filter2D> create(uchar * , size_t , int ,
|
||||
int , int ,
|
||||
int , int ,
|
||||
int , int ,
|
||||
int , double ,
|
||||
int , int ,
|
||||
bool , bool );
|
||||
virtual void apply(uchar * , size_t ,
|
||||
uchar * , size_t ,
|
||||
int , int ,
|
||||
int , int ,
|
||||
int , int ) = 0;
|
||||
virtual ~Filter2D() {}
|
||||
};
|
||||
|
||||
struct CV_EXPORTS SepFilter2D
|
||||
{
|
||||
CV_DEPRECATED static Ptr<hal::SepFilter2D> create(int , int , int ,
|
||||
uchar * , int ,
|
||||
uchar * , int ,
|
||||
int , int ,
|
||||
double , int );
|
||||
virtual void apply(uchar * , size_t ,
|
||||
uchar * , size_t ,
|
||||
int , int ,
|
||||
int , int ,
|
||||
int , int ) = 0;
|
||||
virtual ~SepFilter2D() {}
|
||||
};
|
||||
|
||||
|
||||
struct CV_EXPORTS Morph
|
||||
{
|
||||
CV_DEPRECATED static Ptr<hal::Morph> create(int , int , int , int , int ,
|
||||
int , uchar * , size_t ,
|
||||
int , int ,
|
||||
int , int ,
|
||||
int , const double *,
|
||||
int , bool , bool );
|
||||
virtual void apply(uchar * , size_t , uchar * , size_t , int , int ,
|
||||
int , int , int , int ,
|
||||
int , int , int , int ) = 0;
|
||||
virtual ~Morph() {}
|
||||
};
|
||||
|
||||
//! @endcond
|
||||
//---------------------------
|
||||
|
||||
CV_EXPORTS void filter2D(int stype, int dtype, int kernel_type,
|
||||
uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int full_width, int full_height,
|
||||
int offset_x, int offset_y,
|
||||
uchar * kernel_data, size_t kernel_step,
|
||||
int kernel_width, int kernel_height,
|
||||
int anchor_x, int anchor_y,
|
||||
double delta, int borderType,
|
||||
bool isSubmatrix);
|
||||
|
||||
CV_EXPORTS void sepFilter2D(int stype, int dtype, int ktype,
|
||||
uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int full_width, int full_height,
|
||||
int offset_x, int offset_y,
|
||||
uchar * kernelx_data, int kernelx_len,
|
||||
uchar * kernely_data, int kernely_len,
|
||||
int anchor_x, int anchor_y,
|
||||
double delta, int borderType);
|
||||
|
||||
CV_EXPORTS void morph(int op, int src_type, int dst_type,
|
||||
uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int roi_width, int roi_height, int roi_x, int roi_y,
|
||||
int roi_width2, int roi_height2, int roi_x2, int roi_y2,
|
||||
int kernel_type, uchar * kernel_data, size_t kernel_step,
|
||||
int kernel_width, int kernel_height, int anchor_x, int anchor_y,
|
||||
int borderType, const double borderValue[4],
|
||||
int iterations, bool isSubmatrix);
|
||||
|
||||
|
||||
CV_EXPORTS void resize(int src_type,
|
||||
const uchar * src_data, size_t src_step, int src_width, int src_height,
|
||||
uchar * dst_data, size_t dst_step, int dst_width, int dst_height,
|
||||
double inv_scale_x, double inv_scale_y, int interpolation);
|
||||
|
||||
CV_EXPORTS void warpAffine(int src_type,
|
||||
const uchar * src_data, size_t src_step, int src_width, int src_height,
|
||||
uchar * dst_data, size_t dst_step, int dst_width, int dst_height,
|
||||
const double M[6], int interpolation, int borderType, const double borderValue[4]);
|
||||
|
||||
CV_EXPORTS void warpPerspective(int src_type,
|
||||
const uchar * src_data, size_t src_step, int src_width, int src_height,
|
||||
uchar * dst_data, size_t dst_step, int dst_width, int dst_height,
|
||||
const double M[9], int interpolation, int borderType, const double borderValue[4]);
|
||||
|
||||
CV_EXPORTS void cvtBGRtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int scn, int dcn, bool swapBlue);
|
||||
|
||||
CV_EXPORTS void cvtBGRtoBGR5x5(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int scn, bool swapBlue, int greenBits);
|
||||
|
||||
CV_EXPORTS void cvtBGR5x5toBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int dcn, bool swapBlue, int greenBits);
|
||||
|
||||
CV_EXPORTS void cvtBGRtoGray(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int scn, bool swapBlue);
|
||||
|
||||
CV_EXPORTS void cvtGraytoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int dcn);
|
||||
|
||||
CV_EXPORTS void cvtBGR5x5toGray(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int greenBits);
|
||||
|
||||
CV_EXPORTS void cvtGraytoBGR5x5(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int greenBits);
|
||||
CV_EXPORTS void cvtBGRtoYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int scn, bool swapBlue, bool isCbCr);
|
||||
|
||||
CV_EXPORTS void cvtYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int dcn, bool swapBlue, bool isCbCr);
|
||||
|
||||
CV_EXPORTS void cvtBGRtoXYZ(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int scn, bool swapBlue);
|
||||
|
||||
CV_EXPORTS void cvtXYZtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int dcn, bool swapBlue);
|
||||
|
||||
CV_EXPORTS void cvtBGRtoHSV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int scn, bool swapBlue, bool isFullRange, bool isHSV);
|
||||
|
||||
CV_EXPORTS void cvtHSVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int dcn, bool swapBlue, bool isFullRange, bool isHSV);
|
||||
|
||||
CV_EXPORTS void cvtBGRtoLab(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int scn, bool swapBlue, bool isLab, bool srgb);
|
||||
|
||||
CV_EXPORTS void cvtLabtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int dcn, bool swapBlue, bool isLab, bool srgb);
|
||||
|
||||
CV_EXPORTS void cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx);
|
||||
|
||||
//! Separate Y and UV planes
|
||||
CV_EXPORTS void cvtTwoPlaneYUVtoBGR(const uchar * y_data, const uchar * uv_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx);
|
||||
|
||||
CV_EXPORTS void cvtTwoPlaneYUVtoBGR(const uchar * y_data, size_t y_step, const uchar * uv_data, size_t uv_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx);
|
||||
|
||||
CV_EXPORTS void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx);
|
||||
|
||||
CV_EXPORTS void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int scn, bool swapBlue, int uIdx);
|
||||
|
||||
//! Separate Y and UV planes
|
||||
CV_EXPORTS void cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * y_data, uchar * uv_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int scn, bool swapBlue, int uIdx);
|
||||
|
||||
CV_EXPORTS void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int dcn, bool swapBlue, int uIdx, int ycn);
|
||||
|
||||
CV_EXPORTS void cvtRGBAtoMultipliedRGBA(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height);
|
||||
|
||||
CV_EXPORTS void cvtMultipliedRGBAtoRGBA(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height);
|
||||
|
||||
CV_EXPORTS void integral(int depth, int sdepth, int sqdepth,
|
||||
const uchar* src, size_t srcstep,
|
||||
uchar* sum, size_t sumstep,
|
||||
uchar* sqsum, size_t sqsumstep,
|
||||
uchar* tilted, size_t tstep,
|
||||
int width, int height, int cn);
|
||||
|
||||
//! @}
|
||||
|
||||
}}
|
||||
|
||||
#endif // CV_IMGPROC_HAL_HPP
|
||||
46
3rdparty/opencv-4.5.4/modules/imgproc/include/opencv2/imgproc/hal/interface.h
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef OPENCV_IMGPROC_HAL_INTERFACE_H
|
||||
#define OPENCV_IMGPROC_HAL_INTERFACE_H
|
||||
|
||||
//! @addtogroup imgproc_hal_interface
|
||||
//! @{
|
||||
|
||||
//! @name Interpolation modes
|
||||
//! @sa cv::InterpolationFlags
|
||||
//! @{
|
||||
#define CV_HAL_INTER_NEAREST 0
|
||||
#define CV_HAL_INTER_LINEAR 1
|
||||
#define CV_HAL_INTER_CUBIC 2
|
||||
#define CV_HAL_INTER_AREA 3
|
||||
#define CV_HAL_INTER_LANCZOS4 4
|
||||
//! @}
|
||||
|
||||
//! @name Morphology operations
|
||||
//! @sa cv::MorphTypes
|
||||
//! @{
|
||||
#define CV_HAL_MORPH_ERODE 0
|
||||
#define CV_HAL_MORPH_DILATE 1
|
||||
//! @}
|
||||
|
||||
//! @name Threshold types
|
||||
//! @sa cv::ThresholdTypes
|
||||
//! @{
|
||||
#define CV_HAL_THRESH_BINARY 0
|
||||
#define CV_HAL_THRESH_BINARY_INV 1
|
||||
#define CV_HAL_THRESH_TRUNC 2
|
||||
#define CV_HAL_THRESH_TOZERO 3
|
||||
#define CV_HAL_THRESH_TOZERO_INV 4
|
||||
#define CV_HAL_THRESH_MASK 7
|
||||
#define CV_HAL_THRESH_OTSU 8
|
||||
#define CV_HAL_THRESH_TRIANGLE 16
|
||||
//! @}
|
||||
|
||||
//! @name Adaptive threshold algorithm
|
||||
//! @sa cv::AdaptiveThresholdTypes
|
||||
//! @{
|
||||
#define CV_HAL_ADAPTIVE_THRESH_MEAN_C 0
|
||||
#define CV_HAL_ADAPTIVE_THRESH_GAUSSIAN_C 1
|
||||
//! @}
|
||||
|
||||
//! @}
|
||||
|
||||
#endif
|
||||
48
3rdparty/opencv-4.5.4/modules/imgproc/include/opencv2/imgproc/imgproc.hpp
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifdef __OPENCV_BUILD
|
||||
#error this is a compatibility header which should not be used inside the OpenCV library
|
||||
#endif
|
||||
|
||||
#include "opencv2/imgproc.hpp"
|
||||
1177
3rdparty/opencv-4.5.4/modules/imgproc/include/opencv2/imgproc/imgproc_c.h
vendored
Normal file
141
3rdparty/opencv-4.5.4/modules/imgproc/include/opencv2/imgproc/segmentation.hpp
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#ifndef OPENCV_IMGPROC_SEGMENTATION_HPP
|
||||
#define OPENCV_IMGPROC_SEGMENTATION_HPP
|
||||
|
||||
#include "opencv2/imgproc.hpp"
|
||||
|
||||
namespace cv {
|
||||
|
||||
namespace segmentation {
|
||||
|
||||
//! @addtogroup imgproc_segmentation
|
||||
//! @{
|
||||
|
||||
|
||||
/** @brief Intelligent Scissors image segmentation
|
||||
*
|
||||
* This class is used to find the path (contour) between two points
|
||||
* which can be used for image segmentation.
|
||||
*
|
||||
* Usage example:
|
||||
* @snippet snippets/imgproc_segmentation.cpp usage_example_intelligent_scissors
|
||||
*
|
||||
* Reference: <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.138.3811&rep=rep1&type=pdf">"Intelligent Scissors for Image Composition"</a>
|
||||
* algorithm designed by Eric N. Mortensen and William A. Barrett, Brigham Young University
|
||||
* @cite Mortensen95intelligentscissors
|
||||
*/
|
||||
class CV_EXPORTS_W_SIMPLE IntelligentScissorsMB
|
||||
{
|
||||
public:
|
||||
CV_WRAP
|
||||
IntelligentScissorsMB();
|
||||
|
||||
/** @brief Specify weights of feature functions
|
||||
*
|
||||
* Consider keeping weights normalized (sum of weights equals to 1.0)
|
||||
* Discrete dynamic programming (DP) goal is minimization of costs between pixels.
|
||||
*
|
||||
* @param weight_non_edge Specify cost of non-edge pixels (default: 0.43f)
|
||||
* @param weight_gradient_direction Specify cost of gradient direction function (default: 0.43f)
|
||||
* @param weight_gradient_magnitude Specify cost of gradient magnitude function (default: 0.14f)
|
||||
*/
|
||||
CV_WRAP
|
||||
IntelligentScissorsMB& setWeights(float weight_non_edge, float weight_gradient_direction, float weight_gradient_magnitude);
|
||||
|
||||
/** @brief Specify gradient magnitude max value threshold
|
||||
*
|
||||
* Zero limit value is used to disable gradient magnitude thresholding (default behavior, as described in original article).
|
||||
* Otherwize pixels with `gradient magnitude >= threshold` have zero cost.
|
||||
*
|
||||
* @note Thresholding should be used for images with irregular regions (to avoid stuck on parameters from high-contract areas, like embedded logos).
|
||||
*
|
||||
* @param gradient_magnitude_threshold_max Specify gradient magnitude max value threshold (default: 0, disabled)
|
||||
*/
|
||||
CV_WRAP
|
||||
IntelligentScissorsMB& setGradientMagnitudeMaxLimit(float gradient_magnitude_threshold_max = 0.0f);
|
||||
|
||||
/** @brief Switch to "Laplacian Zero-Crossing" edge feature extractor and specify its parameters
|
||||
*
|
||||
* This feature extractor is used by default according to article.
|
||||
*
|
||||
* Implementation has additional filtering for regions with low-amplitude noise.
|
||||
* This filtering is enabled through parameter of minimal gradient amplitude (use some small value 4, 8, 16).
|
||||
*
|
||||
* @note Current implementation of this feature extractor is based on processing of grayscale images (color image is converted to grayscale image first).
|
||||
*
|
||||
* @note Canny edge detector is a bit slower, but provides better results (especially on color images): use setEdgeFeatureCannyParameters().
|
||||
*
|
||||
* @param gradient_magnitude_min_value Minimal gradient magnitude value for edge pixels (default: 0, check is disabled)
|
||||
*/
|
||||
CV_WRAP
|
||||
IntelligentScissorsMB& setEdgeFeatureZeroCrossingParameters(float gradient_magnitude_min_value = 0.0f);
|
||||
|
||||
/** @brief Switch edge feature extractor to use Canny edge detector
|
||||
*
|
||||
* @note "Laplacian Zero-Crossing" feature extractor is used by default (following to original article)
|
||||
*
|
||||
* @sa Canny
|
||||
*/
|
||||
CV_WRAP
|
||||
IntelligentScissorsMB& setEdgeFeatureCannyParameters(
|
||||
double threshold1, double threshold2,
|
||||
int apertureSize = 3, bool L2gradient = false
|
||||
);
|
||||
|
||||
/** @brief Specify input image and extract image features
|
||||
*
|
||||
* @param image input image. Type is #CV_8UC1 / #CV_8UC3
|
||||
*/
|
||||
CV_WRAP
|
||||
IntelligentScissorsMB& applyImage(InputArray image);
|
||||
|
||||
/** @brief Specify custom features of imput image
|
||||
*
|
||||
* Customized advanced variant of applyImage() call.
|
||||
*
|
||||
* @param non_edge Specify cost of non-edge pixels. Type is CV_8UC1. Expected values are `{0, 1}`.
|
||||
* @param gradient_direction Specify gradient direction feature. Type is CV_32FC2. Values are expected to be normalized: `x^2 + y^2 == 1`
|
||||
* @param gradient_magnitude Specify cost of gradient magnitude function: Type is CV_32FC1. Values should be in range `[0, 1]`.
|
||||
* @param image **Optional parameter**. Must be specified if subset of features is specified (non-specified features are calculated internally)
|
||||
*/
|
||||
CV_WRAP
|
||||
IntelligentScissorsMB& applyImageFeatures(
|
||||
InputArray non_edge, InputArray gradient_direction, InputArray gradient_magnitude,
|
||||
InputArray image = noArray()
|
||||
);
|
||||
|
||||
/** @brief Prepares a map of optimal paths for the given source point on the image
|
||||
*
|
||||
* @note applyImage() / applyImageFeatures() must be called before this call
|
||||
*
|
||||
* @param sourcePt The source point used to find the paths
|
||||
*/
|
||||
CV_WRAP void buildMap(const Point& sourcePt);
|
||||
|
||||
/** @brief Extracts optimal contour for the given target point on the image
|
||||
*
|
||||
* @note buildMap() must be called before this call
|
||||
*
|
||||
* @param targetPt The target point
|
||||
* @param[out] contour The list of pixels which contains optimal path between the source and the target points of the image. Type is CV_32SC2 (compatible with `std::vector<Point>`)
|
||||
* @param backward Flag to indicate reverse order of retrived pixels (use "true" value to fetch points from the target to the source point)
|
||||
*/
|
||||
CV_WRAP void getContour(const Point& targetPt, OutputArray contour, bool backward = false) const;
|
||||
|
||||
#ifndef CV_DOXYGEN
|
||||
struct Impl;
|
||||
inline Impl* getImpl() const { return impl.get(); }
|
||||
protected:
|
||||
std::shared_ptr<Impl> impl;
|
||||
#endif
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
} // namespace segmentation
|
||||
} // namespace cv
|
||||
|
||||
#endif // OPENCV_IMGPROC_SEGMENTATION_HPP
|
||||
659
3rdparty/opencv-4.5.4/modules/imgproc/include/opencv2/imgproc/types_c.h
vendored
Normal file
@ -0,0 +1,659 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef OPENCV_IMGPROC_TYPES_C_H
|
||||
#define OPENCV_IMGPROC_TYPES_C_H
|
||||
|
||||
#include "opencv2/core/core_c.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup imgproc_c
|
||||
@{
|
||||
*/
|
||||
|
||||
/** Connected component structure */
|
||||
typedef struct CvConnectedComp
|
||||
{
|
||||
double area; /**<area of the connected component */
|
||||
CvScalar value; /**<average color of the connected component */
|
||||
CvRect rect; /**<ROI of the component */
|
||||
CvSeq* contour; /**<optional component boundary
|
||||
(the contour might have child contours corresponding to the holes)*/
|
||||
}
|
||||
CvConnectedComp;
|
||||
|
||||
/** Image smooth methods */
|
||||
enum SmoothMethod_c
|
||||
{
|
||||
/** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all 1's). If
|
||||
you want to smooth different pixels with different-size box kernels, you can use the integral
|
||||
image that is computed using integral */
|
||||
CV_BLUR_NO_SCALE =0,
|
||||
/** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all
|
||||
1's) with subsequent scaling by \f$1/(\texttt{size1}\cdot\texttt{size2})\f$ */
|
||||
CV_BLUR =1,
|
||||
/** linear convolution with a \f$\texttt{size1}\times\texttt{size2}\f$ Gaussian kernel */
|
||||
CV_GAUSSIAN =2,
|
||||
/** median filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture */
|
||||
CV_MEDIAN =3,
|
||||
/** bilateral filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture, color
|
||||
sigma= sigma1 and spatial sigma= sigma2. If size1=0, the aperture square side is set to
|
||||
cvRound(sigma2\*1.5)\*2+1. See cv::bilateralFilter */
|
||||
CV_BILATERAL =4
|
||||
};
|
||||
|
||||
/** Filters used in pyramid decomposition */
|
||||
enum
|
||||
{
|
||||
CV_GAUSSIAN_5x5 = 7
|
||||
};
|
||||
|
||||
/** Special filters */
|
||||
enum
|
||||
{
|
||||
CV_SCHARR =-1,
|
||||
CV_MAX_SOBEL_KSIZE =7
|
||||
};
|
||||
|
||||
/** Constants for color conversion */
|
||||
enum
|
||||
{
|
||||
CV_BGR2BGRA =0,
|
||||
CV_RGB2RGBA =CV_BGR2BGRA,
|
||||
|
||||
CV_BGRA2BGR =1,
|
||||
CV_RGBA2RGB =CV_BGRA2BGR,
|
||||
|
||||
CV_BGR2RGBA =2,
|
||||
CV_RGB2BGRA =CV_BGR2RGBA,
|
||||
|
||||
CV_RGBA2BGR =3,
|
||||
CV_BGRA2RGB =CV_RGBA2BGR,
|
||||
|
||||
CV_BGR2RGB =4,
|
||||
CV_RGB2BGR =CV_BGR2RGB,
|
||||
|
||||
CV_BGRA2RGBA =5,
|
||||
CV_RGBA2BGRA =CV_BGRA2RGBA,
|
||||
|
||||
CV_BGR2GRAY =6,
|
||||
CV_RGB2GRAY =7,
|
||||
CV_GRAY2BGR =8,
|
||||
CV_GRAY2RGB =CV_GRAY2BGR,
|
||||
CV_GRAY2BGRA =9,
|
||||
CV_GRAY2RGBA =CV_GRAY2BGRA,
|
||||
CV_BGRA2GRAY =10,
|
||||
CV_RGBA2GRAY =11,
|
||||
|
||||
CV_BGR2BGR565 =12,
|
||||
CV_RGB2BGR565 =13,
|
||||
CV_BGR5652BGR =14,
|
||||
CV_BGR5652RGB =15,
|
||||
CV_BGRA2BGR565 =16,
|
||||
CV_RGBA2BGR565 =17,
|
||||
CV_BGR5652BGRA =18,
|
||||
CV_BGR5652RGBA =19,
|
||||
|
||||
CV_GRAY2BGR565 =20,
|
||||
CV_BGR5652GRAY =21,
|
||||
|
||||
CV_BGR2BGR555 =22,
|
||||
CV_RGB2BGR555 =23,
|
||||
CV_BGR5552BGR =24,
|
||||
CV_BGR5552RGB =25,
|
||||
CV_BGRA2BGR555 =26,
|
||||
CV_RGBA2BGR555 =27,
|
||||
CV_BGR5552BGRA =28,
|
||||
CV_BGR5552RGBA =29,
|
||||
|
||||
CV_GRAY2BGR555 =30,
|
||||
CV_BGR5552GRAY =31,
|
||||
|
||||
CV_BGR2XYZ =32,
|
||||
CV_RGB2XYZ =33,
|
||||
CV_XYZ2BGR =34,
|
||||
CV_XYZ2RGB =35,
|
||||
|
||||
CV_BGR2YCrCb =36,
|
||||
CV_RGB2YCrCb =37,
|
||||
CV_YCrCb2BGR =38,
|
||||
CV_YCrCb2RGB =39,
|
||||
|
||||
CV_BGR2HSV =40,
|
||||
CV_RGB2HSV =41,
|
||||
|
||||
CV_BGR2Lab =44,
|
||||
CV_RGB2Lab =45,
|
||||
|
||||
CV_BayerBG2BGR =46,
|
||||
CV_BayerGB2BGR =47,
|
||||
CV_BayerRG2BGR =48,
|
||||
CV_BayerGR2BGR =49,
|
||||
|
||||
CV_BayerBG2RGB =CV_BayerRG2BGR,
|
||||
CV_BayerGB2RGB =CV_BayerGR2BGR,
|
||||
CV_BayerRG2RGB =CV_BayerBG2BGR,
|
||||
CV_BayerGR2RGB =CV_BayerGB2BGR,
|
||||
|
||||
CV_BGR2Luv =50,
|
||||
CV_RGB2Luv =51,
|
||||
CV_BGR2HLS =52,
|
||||
CV_RGB2HLS =53,
|
||||
|
||||
CV_HSV2BGR =54,
|
||||
CV_HSV2RGB =55,
|
||||
|
||||
CV_Lab2BGR =56,
|
||||
CV_Lab2RGB =57,
|
||||
CV_Luv2BGR =58,
|
||||
CV_Luv2RGB =59,
|
||||
CV_HLS2BGR =60,
|
||||
CV_HLS2RGB =61,
|
||||
|
||||
CV_BayerBG2BGR_VNG =62,
|
||||
CV_BayerGB2BGR_VNG =63,
|
||||
CV_BayerRG2BGR_VNG =64,
|
||||
CV_BayerGR2BGR_VNG =65,
|
||||
|
||||
CV_BayerBG2RGB_VNG =CV_BayerRG2BGR_VNG,
|
||||
CV_BayerGB2RGB_VNG =CV_BayerGR2BGR_VNG,
|
||||
CV_BayerRG2RGB_VNG =CV_BayerBG2BGR_VNG,
|
||||
CV_BayerGR2RGB_VNG =CV_BayerGB2BGR_VNG,
|
||||
|
||||
CV_BGR2HSV_FULL = 66,
|
||||
CV_RGB2HSV_FULL = 67,
|
||||
CV_BGR2HLS_FULL = 68,
|
||||
CV_RGB2HLS_FULL = 69,
|
||||
|
||||
CV_HSV2BGR_FULL = 70,
|
||||
CV_HSV2RGB_FULL = 71,
|
||||
CV_HLS2BGR_FULL = 72,
|
||||
CV_HLS2RGB_FULL = 73,
|
||||
|
||||
CV_LBGR2Lab = 74,
|
||||
CV_LRGB2Lab = 75,
|
||||
CV_LBGR2Luv = 76,
|
||||
CV_LRGB2Luv = 77,
|
||||
|
||||
CV_Lab2LBGR = 78,
|
||||
CV_Lab2LRGB = 79,
|
||||
CV_Luv2LBGR = 80,
|
||||
CV_Luv2LRGB = 81,
|
||||
|
||||
CV_BGR2YUV = 82,
|
||||
CV_RGB2YUV = 83,
|
||||
CV_YUV2BGR = 84,
|
||||
CV_YUV2RGB = 85,
|
||||
|
||||
CV_BayerBG2GRAY = 86,
|
||||
CV_BayerGB2GRAY = 87,
|
||||
CV_BayerRG2GRAY = 88,
|
||||
CV_BayerGR2GRAY = 89,
|
||||
|
||||
//YUV 4:2:0 formats family
|
||||
CV_YUV2RGB_NV12 = 90,
|
||||
CV_YUV2BGR_NV12 = 91,
|
||||
CV_YUV2RGB_NV21 = 92,
|
||||
CV_YUV2BGR_NV21 = 93,
|
||||
CV_YUV420sp2RGB = CV_YUV2RGB_NV21,
|
||||
CV_YUV420sp2BGR = CV_YUV2BGR_NV21,
|
||||
|
||||
CV_YUV2RGBA_NV12 = 94,
|
||||
CV_YUV2BGRA_NV12 = 95,
|
||||
CV_YUV2RGBA_NV21 = 96,
|
||||
CV_YUV2BGRA_NV21 = 97,
|
||||
CV_YUV420sp2RGBA = CV_YUV2RGBA_NV21,
|
||||
CV_YUV420sp2BGRA = CV_YUV2BGRA_NV21,
|
||||
|
||||
CV_YUV2RGB_YV12 = 98,
|
||||
CV_YUV2BGR_YV12 = 99,
|
||||
CV_YUV2RGB_IYUV = 100,
|
||||
CV_YUV2BGR_IYUV = 101,
|
||||
CV_YUV2RGB_I420 = CV_YUV2RGB_IYUV,
|
||||
CV_YUV2BGR_I420 = CV_YUV2BGR_IYUV,
|
||||
CV_YUV420p2RGB = CV_YUV2RGB_YV12,
|
||||
CV_YUV420p2BGR = CV_YUV2BGR_YV12,
|
||||
|
||||
CV_YUV2RGBA_YV12 = 102,
|
||||
CV_YUV2BGRA_YV12 = 103,
|
||||
CV_YUV2RGBA_IYUV = 104,
|
||||
CV_YUV2BGRA_IYUV = 105,
|
||||
CV_YUV2RGBA_I420 = CV_YUV2RGBA_IYUV,
|
||||
CV_YUV2BGRA_I420 = CV_YUV2BGRA_IYUV,
|
||||
CV_YUV420p2RGBA = CV_YUV2RGBA_YV12,
|
||||
CV_YUV420p2BGRA = CV_YUV2BGRA_YV12,
|
||||
|
||||
CV_YUV2GRAY_420 = 106,
|
||||
CV_YUV2GRAY_NV21 = CV_YUV2GRAY_420,
|
||||
CV_YUV2GRAY_NV12 = CV_YUV2GRAY_420,
|
||||
CV_YUV2GRAY_YV12 = CV_YUV2GRAY_420,
|
||||
CV_YUV2GRAY_IYUV = CV_YUV2GRAY_420,
|
||||
CV_YUV2GRAY_I420 = CV_YUV2GRAY_420,
|
||||
CV_YUV420sp2GRAY = CV_YUV2GRAY_420,
|
||||
CV_YUV420p2GRAY = CV_YUV2GRAY_420,
|
||||
|
||||
//YUV 4:2:2 formats family
|
||||
CV_YUV2RGB_UYVY = 107,
|
||||
CV_YUV2BGR_UYVY = 108,
|
||||
//CV_YUV2RGB_VYUY = 109,
|
||||
//CV_YUV2BGR_VYUY = 110,
|
||||
CV_YUV2RGB_Y422 = CV_YUV2RGB_UYVY,
|
||||
CV_YUV2BGR_Y422 = CV_YUV2BGR_UYVY,
|
||||
CV_YUV2RGB_UYNV = CV_YUV2RGB_UYVY,
|
||||
CV_YUV2BGR_UYNV = CV_YUV2BGR_UYVY,
|
||||
|
||||
CV_YUV2RGBA_UYVY = 111,
|
||||
CV_YUV2BGRA_UYVY = 112,
|
||||
//CV_YUV2RGBA_VYUY = 113,
|
||||
//CV_YUV2BGRA_VYUY = 114,
|
||||
CV_YUV2RGBA_Y422 = CV_YUV2RGBA_UYVY,
|
||||
CV_YUV2BGRA_Y422 = CV_YUV2BGRA_UYVY,
|
||||
CV_YUV2RGBA_UYNV = CV_YUV2RGBA_UYVY,
|
||||
CV_YUV2BGRA_UYNV = CV_YUV2BGRA_UYVY,
|
||||
|
||||
CV_YUV2RGB_YUY2 = 115,
|
||||
CV_YUV2BGR_YUY2 = 116,
|
||||
CV_YUV2RGB_YVYU = 117,
|
||||
CV_YUV2BGR_YVYU = 118,
|
||||
CV_YUV2RGB_YUYV = CV_YUV2RGB_YUY2,
|
||||
CV_YUV2BGR_YUYV = CV_YUV2BGR_YUY2,
|
||||
CV_YUV2RGB_YUNV = CV_YUV2RGB_YUY2,
|
||||
CV_YUV2BGR_YUNV = CV_YUV2BGR_YUY2,
|
||||
|
||||
CV_YUV2RGBA_YUY2 = 119,
|
||||
CV_YUV2BGRA_YUY2 = 120,
|
||||
CV_YUV2RGBA_YVYU = 121,
|
||||
CV_YUV2BGRA_YVYU = 122,
|
||||
CV_YUV2RGBA_YUYV = CV_YUV2RGBA_YUY2,
|
||||
CV_YUV2BGRA_YUYV = CV_YUV2BGRA_YUY2,
|
||||
CV_YUV2RGBA_YUNV = CV_YUV2RGBA_YUY2,
|
||||
CV_YUV2BGRA_YUNV = CV_YUV2BGRA_YUY2,
|
||||
|
||||
CV_YUV2GRAY_UYVY = 123,
|
||||
CV_YUV2GRAY_YUY2 = 124,
|
||||
//CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY,
|
||||
CV_YUV2GRAY_Y422 = CV_YUV2GRAY_UYVY,
|
||||
CV_YUV2GRAY_UYNV = CV_YUV2GRAY_UYVY,
|
||||
CV_YUV2GRAY_YVYU = CV_YUV2GRAY_YUY2,
|
||||
CV_YUV2GRAY_YUYV = CV_YUV2GRAY_YUY2,
|
||||
CV_YUV2GRAY_YUNV = CV_YUV2GRAY_YUY2,
|
||||
|
||||
// alpha premultiplication
|
||||
CV_RGBA2mRGBA = 125,
|
||||
CV_mRGBA2RGBA = 126,
|
||||
|
||||
CV_RGB2YUV_I420 = 127,
|
||||
CV_BGR2YUV_I420 = 128,
|
||||
CV_RGB2YUV_IYUV = CV_RGB2YUV_I420,
|
||||
CV_BGR2YUV_IYUV = CV_BGR2YUV_I420,
|
||||
|
||||
CV_RGBA2YUV_I420 = 129,
|
||||
CV_BGRA2YUV_I420 = 130,
|
||||
CV_RGBA2YUV_IYUV = CV_RGBA2YUV_I420,
|
||||
CV_BGRA2YUV_IYUV = CV_BGRA2YUV_I420,
|
||||
CV_RGB2YUV_YV12 = 131,
|
||||
CV_BGR2YUV_YV12 = 132,
|
||||
CV_RGBA2YUV_YV12 = 133,
|
||||
CV_BGRA2YUV_YV12 = 134,
|
||||
|
||||
// Edge-Aware Demosaicing
|
||||
CV_BayerBG2BGR_EA = 135,
|
||||
CV_BayerGB2BGR_EA = 136,
|
||||
CV_BayerRG2BGR_EA = 137,
|
||||
CV_BayerGR2BGR_EA = 138,
|
||||
|
||||
CV_BayerBG2RGB_EA = CV_BayerRG2BGR_EA,
|
||||
CV_BayerGB2RGB_EA = CV_BayerGR2BGR_EA,
|
||||
CV_BayerRG2RGB_EA = CV_BayerBG2BGR_EA,
|
||||
CV_BayerGR2RGB_EA = CV_BayerGB2BGR_EA,
|
||||
|
||||
CV_BayerBG2BGRA =139,
|
||||
CV_BayerGB2BGRA =140,
|
||||
CV_BayerRG2BGRA =141,
|
||||
CV_BayerGR2BGRA =142,
|
||||
|
||||
CV_BayerBG2RGBA =CV_BayerRG2BGRA,
|
||||
CV_BayerGB2RGBA =CV_BayerGR2BGRA,
|
||||
CV_BayerRG2RGBA =CV_BayerBG2BGRA,
|
||||
CV_BayerGR2RGBA =CV_BayerGB2BGRA,
|
||||
|
||||
CV_COLORCVT_MAX = 143
|
||||
};
|
||||
|
||||
|
||||
/** Sub-pixel interpolation methods */
|
||||
enum
|
||||
{
|
||||
CV_INTER_NN =0,
|
||||
CV_INTER_LINEAR =1,
|
||||
CV_INTER_CUBIC =2,
|
||||
CV_INTER_AREA =3,
|
||||
CV_INTER_LANCZOS4 =4
|
||||
};
|
||||
|
||||
/** ... and other image warping flags */
|
||||
enum
|
||||
{
|
||||
CV_WARP_FILL_OUTLIERS =8,
|
||||
CV_WARP_INVERSE_MAP =16
|
||||
};
|
||||
|
||||
/** Shapes of a structuring element for morphological operations
|
||||
@see cv::MorphShapes, cv::getStructuringElement
|
||||
*/
|
||||
enum MorphShapes_c
|
||||
{
|
||||
CV_SHAPE_RECT =0,
|
||||
CV_SHAPE_CROSS =1,
|
||||
CV_SHAPE_ELLIPSE =2,
|
||||
CV_SHAPE_CUSTOM =100 //!< custom structuring element
|
||||
};
|
||||
|
||||
/** Morphological operations */
|
||||
enum
|
||||
{
|
||||
CV_MOP_ERODE =0,
|
||||
CV_MOP_DILATE =1,
|
||||
CV_MOP_OPEN =2,
|
||||
CV_MOP_CLOSE =3,
|
||||
CV_MOP_GRADIENT =4,
|
||||
CV_MOP_TOPHAT =5,
|
||||
CV_MOP_BLACKHAT =6
|
||||
};
|
||||
|
||||
/** Spatial and central moments */
|
||||
typedef struct CvMoments
|
||||
{
|
||||
double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /**< spatial moments */
|
||||
double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /**< central moments */
|
||||
double inv_sqrt_m00; /**< m00 != 0 ? 1/sqrt(m00) : 0 */
|
||||
|
||||
#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
|
||||
CvMoments(){}
|
||||
CvMoments(const cv::Moments& m)
|
||||
{
|
||||
m00 = m.m00; m10 = m.m10; m01 = m.m01;
|
||||
m20 = m.m20; m11 = m.m11; m02 = m.m02;
|
||||
m30 = m.m30; m21 = m.m21; m12 = m.m12; m03 = m.m03;
|
||||
mu20 = m.mu20; mu11 = m.mu11; mu02 = m.mu02;
|
||||
mu30 = m.mu30; mu21 = m.mu21; mu12 = m.mu12; mu03 = m.mu03;
|
||||
double am00 = std::abs(m.m00);
|
||||
inv_sqrt_m00 = am00 > DBL_EPSILON ? 1./std::sqrt(am00) : 0;
|
||||
}
|
||||
operator cv::Moments() const
|
||||
{
|
||||
return cv::Moments(m00, m10, m01, m20, m11, m02, m30, m21, m12, m03);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
CvMoments;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
CV_INLINE CvMoments cvMoments()
|
||||
{
|
||||
#if !defined(CV__ENABLE_C_API_CTORS)
|
||||
CvMoments self = CV_STRUCT_INITIALIZER; return self;
|
||||
#else
|
||||
return CvMoments();
|
||||
#endif
|
||||
}
|
||||
|
||||
CV_INLINE CvMoments cvMoments(const cv::Moments& m)
|
||||
{
|
||||
#if !defined(CV__ENABLE_C_API_CTORS)
|
||||
double am00 = std::abs(m.m00);
|
||||
CvMoments self = {
|
||||
m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03,
|
||||
m.mu20, m.mu11, m.mu02, m.mu30, m.mu21, m.mu12, m.mu03,
|
||||
am00 > DBL_EPSILON ? 1./std::sqrt(am00) : 0
|
||||
};
|
||||
return self;
|
||||
#else
|
||||
return CvMoments(m);
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/** Hu invariants */
|
||||
typedef struct CvHuMoments
|
||||
{
|
||||
double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /**< Hu invariants */
|
||||
}
|
||||
CvHuMoments;
|
||||
|
||||
/** Template matching methods */
|
||||
enum
|
||||
{
|
||||
CV_TM_SQDIFF =0,
|
||||
CV_TM_SQDIFF_NORMED =1,
|
||||
CV_TM_CCORR =2,
|
||||
CV_TM_CCORR_NORMED =3,
|
||||
CV_TM_CCOEFF =4,
|
||||
CV_TM_CCOEFF_NORMED =5
|
||||
};
|
||||
|
||||
typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param );
|
||||
|
||||
/** Contour retrieval modes */
|
||||
enum
|
||||
{
|
||||
CV_RETR_EXTERNAL=0,
|
||||
CV_RETR_LIST=1,
|
||||
CV_RETR_CCOMP=2,
|
||||
CV_RETR_TREE=3,
|
||||
CV_RETR_FLOODFILL=4
|
||||
};
|
||||
|
||||
/** Contour approximation methods */
|
||||
enum
|
||||
{
|
||||
CV_CHAIN_CODE=0,
|
||||
CV_CHAIN_APPROX_NONE=1,
|
||||
CV_CHAIN_APPROX_SIMPLE=2,
|
||||
CV_CHAIN_APPROX_TC89_L1=3,
|
||||
CV_CHAIN_APPROX_TC89_KCOS=4,
|
||||
CV_LINK_RUNS=5
|
||||
};
|
||||
|
||||
/*
|
||||
Internal structure that is used for sequential retrieving contours from the image.
|
||||
It supports both hierarchical and plane variants of Suzuki algorithm.
|
||||
*/
|
||||
typedef struct _CvContourScanner* CvContourScanner;
|
||||
|
||||
/** Freeman chain reader state */
|
||||
typedef struct CvChainPtReader
|
||||
{
|
||||
CV_SEQ_READER_FIELDS()
|
||||
char code;
|
||||
CvPoint pt;
|
||||
schar deltas[8][2];
|
||||
}
|
||||
CvChainPtReader;
|
||||
|
||||
/** initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
|
||||
#define CV_INIT_3X3_DELTAS( deltas, step, nch ) \
|
||||
((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \
|
||||
(deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \
|
||||
(deltas)[4] = -(nch), (deltas)[5] = (step) - (nch), \
|
||||
(deltas)[6] = (step), (deltas)[7] = (step) + (nch))
|
||||
|
||||
|
||||
/** Contour approximation algorithms */
|
||||
enum
|
||||
{
|
||||
CV_POLY_APPROX_DP = 0
|
||||
};
|
||||
|
||||
/** Shape matching methods */
|
||||
enum
|
||||
{
|
||||
CV_CONTOURS_MATCH_I1 =1, //!< \f[I_1(A,B) = \sum _{i=1...7} \left | \frac{1}{m^A_i} - \frac{1}{m^B_i} \right |\f]
|
||||
CV_CONTOURS_MATCH_I2 =2, //!< \f[I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |\f]
|
||||
CV_CONTOURS_MATCH_I3 =3 //!< \f[I_3(A,B) = \max _{i=1...7} \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f]
|
||||
};
|
||||
|
||||
/** Shape orientation */
|
||||
enum
|
||||
{
|
||||
CV_CLOCKWISE =1,
|
||||
CV_COUNTER_CLOCKWISE =2
|
||||
};
|
||||
|
||||
|
||||
/** Convexity defect */
|
||||
typedef struct CvConvexityDefect
|
||||
{
|
||||
CvPoint* start; /**< point of the contour where the defect begins */
|
||||
CvPoint* end; /**< point of the contour where the defect ends */
|
||||
CvPoint* depth_point; /**< the farthest from the convex hull point within the defect */
|
||||
float depth; /**< distance between the farthest point and the convex hull */
|
||||
} CvConvexityDefect;
|
||||
|
||||
|
||||
/** Histogram comparison methods */
|
||||
enum
|
||||
{
|
||||
CV_COMP_CORREL =0,
|
||||
CV_COMP_CHISQR =1,
|
||||
CV_COMP_INTERSECT =2,
|
||||
CV_COMP_BHATTACHARYYA =3,
|
||||
CV_COMP_HELLINGER =CV_COMP_BHATTACHARYYA,
|
||||
CV_COMP_CHISQR_ALT =4,
|
||||
CV_COMP_KL_DIV =5
|
||||
};
|
||||
|
||||
/** Mask size for distance transform */
|
||||
enum
|
||||
{
|
||||
CV_DIST_MASK_3 =3,
|
||||
CV_DIST_MASK_5 =5,
|
||||
CV_DIST_MASK_PRECISE =0
|
||||
};
|
||||
|
||||
/** Content of output label array: connected components or pixels */
|
||||
enum
|
||||
{
|
||||
CV_DIST_LABEL_CCOMP = 0,
|
||||
CV_DIST_LABEL_PIXEL = 1
|
||||
};
|
||||
|
||||
/** Distance types for Distance Transform and M-estimators */
|
||||
enum
|
||||
{
|
||||
CV_DIST_USER =-1, /**< User defined distance */
|
||||
CV_DIST_L1 =1, /**< distance = |x1-x2| + |y1-y2| */
|
||||
CV_DIST_L2 =2, /**< the simple euclidean distance */
|
||||
CV_DIST_C =3, /**< distance = max(|x1-x2|,|y1-y2|) */
|
||||
CV_DIST_L12 =4, /**< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */
|
||||
CV_DIST_FAIR =5, /**< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */
|
||||
CV_DIST_WELSCH =6, /**< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */
|
||||
CV_DIST_HUBER =7 /**< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
|
||||
};
|
||||
|
||||
|
||||
/** Threshold types */
|
||||
enum
|
||||
{
|
||||
CV_THRESH_BINARY =0, /**< value = value > threshold ? max_value : 0 */
|
||||
CV_THRESH_BINARY_INV =1, /**< value = value > threshold ? 0 : max_value */
|
||||
CV_THRESH_TRUNC =2, /**< value = value > threshold ? threshold : value */
|
||||
CV_THRESH_TOZERO =3, /**< value = value > threshold ? value : 0 */
|
||||
CV_THRESH_TOZERO_INV =4, /**< value = value > threshold ? 0 : value */
|
||||
CV_THRESH_MASK =7,
|
||||
CV_THRESH_OTSU =8, /**< use Otsu algorithm to choose the optimal threshold value;
|
||||
combine the flag with one of the above CV_THRESH_* values */
|
||||
CV_THRESH_TRIANGLE =16 /**< use Triangle algorithm to choose the optimal threshold value;
|
||||
combine the flag with one of the above CV_THRESH_* values, but not
|
||||
with CV_THRESH_OTSU */
|
||||
};
|
||||
|
||||
/** Adaptive threshold methods */
|
||||
enum
|
||||
{
|
||||
CV_ADAPTIVE_THRESH_MEAN_C =0,
|
||||
CV_ADAPTIVE_THRESH_GAUSSIAN_C =1
|
||||
};
|
||||
|
||||
/** FloodFill flags */
|
||||
enum
|
||||
{
|
||||
CV_FLOODFILL_FIXED_RANGE =(1 << 16),
|
||||
CV_FLOODFILL_MASK_ONLY =(1 << 17)
|
||||
};
|
||||
|
||||
|
||||
/** Canny edge detector flags */
|
||||
enum
|
||||
{
|
||||
CV_CANNY_L2_GRADIENT =(1 << 31)
|
||||
};
|
||||
|
||||
/** Variants of a Hough transform */
|
||||
enum
|
||||
{
|
||||
CV_HOUGH_STANDARD =0,
|
||||
CV_HOUGH_PROBABILISTIC =1,
|
||||
CV_HOUGH_MULTI_SCALE =2,
|
||||
CV_HOUGH_GRADIENT =3
|
||||
};
|
||||
|
||||
|
||||
/* Fast search data structures */
|
||||
struct CvFeatureTree;
|
||||
struct CvLSH;
|
||||
struct CvLSHOperations;
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
131
3rdparty/opencv-4.5.4/modules/imgproc/misc/java/gen_dict.json
vendored
Normal file
@ -0,0 +1,131 @@
|
||||
{
|
||||
"const_ignore_list": [
|
||||
"CV_TM_.+",
|
||||
"CV_COLORCVT_MAX",
|
||||
"CV_.*Bayer.*",
|
||||
"CV_YUV420(i|sp|p)2.+",
|
||||
"CV_L?(BGRA?|RGBA?|GRAY|XYZ|YCrCb|Luv|Lab|HLS|YUV|HSV)\\d*2L?(BGRA?|RGBA?|GRAY|XYZ|YCrCb|Luv|Lab|HLS|YUV|HSV).*",
|
||||
"CV_FLOODFILL_.+",
|
||||
"CV_ADAPTIVE_THRESH_.+"
|
||||
],
|
||||
"const_private_list" : [
|
||||
"CV_MOP_.+",
|
||||
"CV_INTER_.+",
|
||||
"CV_THRESH_.+",
|
||||
"CV_INPAINT_.+",
|
||||
"CV_RETR_.+",
|
||||
"CV_CHAIN_APPROX_.+"
|
||||
],
|
||||
"missing_consts" : {
|
||||
"Imgproc" : {
|
||||
"private" : [
|
||||
["IPL_BORDER_CONSTANT", 0 ],
|
||||
["IPL_BORDER_REPLICATE", 1 ],
|
||||
["IPL_BORDER_REFLECT", 2 ],
|
||||
["IPL_BORDER_WRAP", 3 ],
|
||||
["IPL_BORDER_REFLECT_101", 4 ],
|
||||
["IPL_BORDER_TRANSPARENT", 5 ]
|
||||
]
|
||||
}
|
||||
},
|
||||
"ManualFuncs" : {
|
||||
"Imgproc" : {
|
||||
"getTextSize" : {
|
||||
"j_code" : [
|
||||
"\n",
|
||||
"// C++: Size getTextSize(const String& text, int fontFace, double fontScale, int thickness, int* baseLine);",
|
||||
"//javadoc:getTextSize(text, fontFace, fontScale, thickness, baseLine)",
|
||||
"public static Size getTextSize(String text, int fontFace, double fontScale, int thickness, int[] baseLine) {",
|
||||
" if(baseLine != null && baseLine.length != 1)",
|
||||
" throw new java.lang.IllegalArgumentException(\"'baseLine' must be 'int[1]' or 'null'.\");",
|
||||
" Size retVal = new Size(n_getTextSize(text, fontFace, fontScale, thickness, baseLine));",
|
||||
" return retVal;",
|
||||
"}",
|
||||
"\n"
|
||||
],
|
||||
"jn_code" : [
|
||||
"private static native double[] n_getTextSize(String text, int fontFace, double fontScale, int thickness, int[] baseLine);\n"
|
||||
],
|
||||
"cpp_code" : [
|
||||
"\n",
|
||||
" // C++: Size getTextSize(const String& text, int fontFace, double fontScale, int thickness, int* baseLine);",
|
||||
" JNIEXPORT jdoubleArray JNICALL Java_org_opencv_imgproc_Imgproc_n_1getTextSize (JNIEnv*, jclass, jstring, jint, jdouble, jint, jintArray);",
|
||||
"\n",
|
||||
" JNIEXPORT jdoubleArray JNICALL Java_org_opencv_imgproc_Imgproc_n_1getTextSize",
|
||||
" (JNIEnv* env, jclass, jstring text, jint fontFace, jdouble fontScale, jint thickness, jintArray baseLine)",
|
||||
" {",
|
||||
" try {",
|
||||
" LOGD(\"Core::n_1getTextSize()\");",
|
||||
" jdoubleArray result;",
|
||||
" result = env->NewDoubleArray(2);",
|
||||
" if (result == NULL) {",
|
||||
" return NULL; /* out of memory error thrown */",
|
||||
" }",
|
||||
"\n",
|
||||
" const char* utf_text = env->GetStringUTFChars(text, 0);",
|
||||
" String n_text( utf_text ? utf_text : \"\" );",
|
||||
" env->ReleaseStringUTFChars(text, utf_text);",
|
||||
"\n",
|
||||
" int _baseLine;",
|
||||
" int* pbaseLine = 0;",
|
||||
"\n",
|
||||
" if (baseLine != NULL)",
|
||||
" pbaseLine = &_baseLine;",
|
||||
"\n",
|
||||
" cv::Size rsize = cv::getTextSize(n_text, (int)fontFace, (double)fontScale, (int)thickness, pbaseLine);",
|
||||
"\n",
|
||||
" jdouble fill[2];",
|
||||
" fill[0]=rsize.width;",
|
||||
" fill[1]=rsize.height;",
|
||||
"\n",
|
||||
" env->SetDoubleArrayRegion(result, 0, 2, fill);",
|
||||
"\n",
|
||||
" if (baseLine != NULL) {",
|
||||
" jint jbaseLine = (jint)(*pbaseLine);",
|
||||
" env->SetIntArrayRegion(baseLine, 0, 1, &jbaseLine);",
|
||||
" }",
|
||||
"\n",
|
||||
" return result;",
|
||||
"\n",
|
||||
" } catch(const cv::Exception& e) {",
|
||||
" LOGD(\"Imgproc::n_1getTextSize() caught cv::Exception: %s\", e.what());",
|
||||
" jclass je = env->FindClass(\"org/opencv/core/CvException\");",
|
||||
" if(!je) je = env->FindClass(\"java/lang/Exception\");",
|
||||
" env->ThrowNew(je, e.what());",
|
||||
" return NULL;",
|
||||
" } catch (...) {",
|
||||
" LOGD(\"Imgproc::n_1getTextSize() caught unknown exception (...)\");",
|
||||
" jclass je = env->FindClass(\"java/lang/Exception\");",
|
||||
" env->ThrowNew(je, \"Unknown exception in JNI code {core::getTextSize()}\");",
|
||||
" return NULL;",
|
||||
" }",
|
||||
" }"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"func_arg_fix" : {
|
||||
"goodFeaturesToTrack" : { "corners" : {"ctype" : "vector_Point"} },
|
||||
"minEnclosingCircle" : { "points" : {"ctype" : "vector_Point2f"} },
|
||||
"fitEllipse" : { "points" : {"ctype" : "vector_Point2f"} },
|
||||
"fillPoly" : { "pts" : {"ctype" : "vector_vector_Point"} },
|
||||
"polylines" : { "pts" : {"ctype" : "vector_vector_Point"} },
|
||||
"fillConvexPoly" : { "points" : {"ctype" : "vector_Point"} },
|
||||
"approxPolyDP" : { "curve" : {"ctype" : "vector_Point2f"},
|
||||
"approxCurve" : {"ctype" : "vector_Point2f"} },
|
||||
"arcLength" : { "curve" : {"ctype" : "vector_Point2f"} },
|
||||
"pointPolygonTest" : { "contour" : {"ctype" : "vector_Point2f"} },
|
||||
"minAreaRect" : { "points" : {"ctype" : "vector_Point2f"} },
|
||||
"getAffineTransform" : { "src" : {"ctype" : "vector_Point2f"},
|
||||
"dst" : {"ctype" : "vector_Point2f"} },
|
||||
"drawContours" : {"contours" : {"ctype" : "vector_vector_Point"} },
|
||||
"findContours" : {"contours" : {"ctype" : "vector_vector_Point"} },
|
||||
"convexityDefects" : { "contour" : {"ctype" : "vector_Point"},
|
||||
"convexhull" : {"ctype" : "vector_int"},
|
||||
"convexityDefects" : {"ctype" : "vector_Vec4i"} },
|
||||
"isContourConvex" : { "contour" : {"ctype" : "vector_Point"} },
|
||||
"convexHull" : { "points" : {"ctype" : "vector_Point"},
|
||||
"hull" : {"ctype" : "vector_int"},
|
||||
"returnPoints" : {"ctype" : ""} }
|
||||
}
|
||||
}
|
||||
242
3rdparty/opencv-4.5.4/modules/imgproc/misc/java/src/java/imgproc+Moments.java
vendored
Normal file
@ -0,0 +1,242 @@
|
||||
package org.opencv.imgproc;
|
||||
|
||||
//javadoc:Moments
|
||||
public class Moments {
|
||||
|
||||
public double m00;
|
||||
public double m10;
|
||||
public double m01;
|
||||
public double m20;
|
||||
public double m11;
|
||||
public double m02;
|
||||
public double m30;
|
||||
public double m21;
|
||||
public double m12;
|
||||
public double m03;
|
||||
|
||||
public double mu20;
|
||||
public double mu11;
|
||||
public double mu02;
|
||||
public double mu30;
|
||||
public double mu21;
|
||||
public double mu12;
|
||||
public double mu03;
|
||||
|
||||
public double nu20;
|
||||
public double nu11;
|
||||
public double nu02;
|
||||
public double nu30;
|
||||
public double nu21;
|
||||
public double nu12;
|
||||
public double nu03;
|
||||
|
||||
public Moments(
|
||||
double m00,
|
||||
double m10,
|
||||
double m01,
|
||||
double m20,
|
||||
double m11,
|
||||
double m02,
|
||||
double m30,
|
||||
double m21,
|
||||
double m12,
|
||||
double m03)
|
||||
{
|
||||
this.m00 = m00;
|
||||
this.m10 = m10;
|
||||
this.m01 = m01;
|
||||
this.m20 = m20;
|
||||
this.m11 = m11;
|
||||
this.m02 = m02;
|
||||
this.m30 = m30;
|
||||
this.m21 = m21;
|
||||
this.m12 = m12;
|
||||
this.m03 = m03;
|
||||
this.completeState();
|
||||
}
|
||||
|
||||
public Moments() {
|
||||
this(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Moments(double[] vals) {
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
m00 = vals.length > 0 ? vals[0] : 0;
|
||||
m10 = vals.length > 1 ? vals[1] : 0;
|
||||
m01 = vals.length > 2 ? vals[2] : 0;
|
||||
m20 = vals.length > 3 ? vals[3] : 0;
|
||||
m11 = vals.length > 4 ? vals[4] : 0;
|
||||
m02 = vals.length > 5 ? vals[5] : 0;
|
||||
m30 = vals.length > 6 ? vals[6] : 0;
|
||||
m21 = vals.length > 7 ? vals[7] : 0;
|
||||
m12 = vals.length > 8 ? vals[8] : 0;
|
||||
m03 = vals.length > 9 ? vals[9] : 0;
|
||||
this.completeState();
|
||||
} else {
|
||||
m00 = 0;
|
||||
m10 = 0;
|
||||
m01 = 0;
|
||||
m20 = 0;
|
||||
m11 = 0;
|
||||
m02 = 0;
|
||||
m30 = 0;
|
||||
m21 = 0;
|
||||
m12 = 0;
|
||||
m03 = 0;
|
||||
mu20 = 0;
|
||||
mu11 = 0;
|
||||
mu02 = 0;
|
||||
mu30 = 0;
|
||||
mu21 = 0;
|
||||
mu12 = 0;
|
||||
mu03 = 0;
|
||||
nu20 = 0;
|
||||
nu11 = 0;
|
||||
nu02 = 0;
|
||||
nu30 = 0;
|
||||
nu21 = 0;
|
||||
nu12 = 0;
|
||||
nu03 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Moments [ " +
|
||||
"\n" +
|
||||
"m00=" + m00 + ", " +
|
||||
"\n" +
|
||||
"m10=" + m10 + ", " +
|
||||
"m01=" + m01 + ", " +
|
||||
"\n" +
|
||||
"m20=" + m20 + ", " +
|
||||
"m11=" + m11 + ", " +
|
||||
"m02=" + m02 + ", " +
|
||||
"\n" +
|
||||
"m30=" + m30 + ", " +
|
||||
"m21=" + m21 + ", " +
|
||||
"m12=" + m12 + ", " +
|
||||
"m03=" + m03 + ", " +
|
||||
"\n" +
|
||||
"mu20=" + mu20 + ", " +
|
||||
"mu11=" + mu11 + ", " +
|
||||
"mu02=" + mu02 + ", " +
|
||||
"\n" +
|
||||
"mu30=" + mu30 + ", " +
|
||||
"mu21=" + mu21 + ", " +
|
||||
"mu12=" + mu12 + ", " +
|
||||
"mu03=" + mu03 + ", " +
|
||||
"\n" +
|
||||
"nu20=" + nu20 + ", " +
|
||||
"nu11=" + nu11 + ", " +
|
||||
"nu02=" + nu02 + ", " +
|
||||
"\n" +
|
||||
"nu30=" + nu30 + ", " +
|
||||
"nu21=" + nu21 + ", " +
|
||||
"nu12=" + nu12 + ", " +
|
||||
"nu03=" + nu03 + ", " +
|
||||
"\n]";
|
||||
}
|
||||
|
||||
protected void completeState()
|
||||
{
|
||||
double cx = 0, cy = 0;
|
||||
double mu20, mu11, mu02;
|
||||
double inv_m00 = 0.0;
|
||||
|
||||
if( Math.abs(this.m00) > 0.00000001 )
|
||||
{
|
||||
inv_m00 = 1. / this.m00;
|
||||
cx = this.m10 * inv_m00;
|
||||
cy = this.m01 * inv_m00;
|
||||
}
|
||||
|
||||
// mu20 = m20 - m10*cx
|
||||
mu20 = this.m20 - this.m10 * cx;
|
||||
// mu11 = m11 - m10*cy
|
||||
mu11 = this.m11 - this.m10 * cy;
|
||||
// mu02 = m02 - m01*cy
|
||||
mu02 = this.m02 - this.m01 * cy;
|
||||
|
||||
this.mu20 = mu20;
|
||||
this.mu11 = mu11;
|
||||
this.mu02 = mu02;
|
||||
|
||||
// mu30 = m30 - cx*(3*mu20 + cx*m10)
|
||||
this.mu30 = this.m30 - cx * (3 * mu20 + cx * this.m10);
|
||||
mu11 += mu11;
|
||||
// mu21 = m21 - cx*(2*mu11 + cx*m01) - cy*mu20
|
||||
this.mu21 = this.m21 - cx * (mu11 + cx * this.m01) - cy * mu20;
|
||||
// mu12 = m12 - cy*(2*mu11 + cy*m10) - cx*mu02
|
||||
this.mu12 = this.m12 - cy * (mu11 + cy * this.m10) - cx * mu02;
|
||||
// mu03 = m03 - cy*(3*mu02 + cy*m01)
|
||||
this.mu03 = this.m03 - cy * (3 * mu02 + cy * this.m01);
|
||||
|
||||
|
||||
double inv_sqrt_m00 = Math.sqrt(Math.abs(inv_m00));
|
||||
double s2 = inv_m00*inv_m00, s3 = s2*inv_sqrt_m00;
|
||||
|
||||
this.nu20 = this.mu20*s2;
|
||||
this.nu11 = this.mu11*s2;
|
||||
this.nu02 = this.mu02*s2;
|
||||
this.nu30 = this.mu30*s3;
|
||||
this.nu21 = this.mu21*s3;
|
||||
this.nu12 = this.mu12*s3;
|
||||
this.nu03 = this.mu03*s3;
|
||||
|
||||
}
|
||||
|
||||
public double get_m00() { return this.m00; }
|
||||
public double get_m10() { return this.m10; }
|
||||
public double get_m01() { return this.m01; }
|
||||
public double get_m20() { return this.m20; }
|
||||
public double get_m11() { return this.m11; }
|
||||
public double get_m02() { return this.m02; }
|
||||
public double get_m30() { return this.m30; }
|
||||
public double get_m21() { return this.m21; }
|
||||
public double get_m12() { return this.m12; }
|
||||
public double get_m03() { return this.m03; }
|
||||
public double get_mu20() { return this.mu20; }
|
||||
public double get_mu11() { return this.mu11; }
|
||||
public double get_mu02() { return this.mu02; }
|
||||
public double get_mu30() { return this.mu30; }
|
||||
public double get_mu21() { return this.mu21; }
|
||||
public double get_mu12() { return this.mu12; }
|
||||
public double get_mu03() { return this.mu03; }
|
||||
public double get_nu20() { return this.nu20; }
|
||||
public double get_nu11() { return this.nu11; }
|
||||
public double get_nu02() { return this.nu02; }
|
||||
public double get_nu30() { return this.nu30; }
|
||||
public double get_nu21() { return this.nu21; }
|
||||
public double get_nu12() { return this.nu12; }
|
||||
public double get_nu03() { return this.nu03; }
|
||||
|
||||
public void set_m00(double m00) { this.m00 = m00; }
|
||||
public void set_m10(double m10) { this.m10 = m10; }
|
||||
public void set_m01(double m01) { this.m01 = m01; }
|
||||
public void set_m20(double m20) { this.m20 = m20; }
|
||||
public void set_m11(double m11) { this.m11 = m11; }
|
||||
public void set_m02(double m02) { this.m02 = m02; }
|
||||
public void set_m30(double m30) { this.m30 = m30; }
|
||||
public void set_m21(double m21) { this.m21 = m21; }
|
||||
public void set_m12(double m12) { this.m12 = m12; }
|
||||
public void set_m03(double m03) { this.m03 = m03; }
|
||||
public void set_mu20(double mu20) { this.mu20 = mu20; }
|
||||
public void set_mu11(double mu11) { this.mu11 = mu11; }
|
||||
public void set_mu02(double mu02) { this.mu02 = mu02; }
|
||||
public void set_mu30(double mu30) { this.mu30 = mu30; }
|
||||
public void set_mu21(double mu21) { this.mu21 = mu21; }
|
||||
public void set_mu12(double mu12) { this.mu12 = mu12; }
|
||||
public void set_mu03(double mu03) { this.mu03 = mu03; }
|
||||
public void set_nu20(double nu20) { this.nu20 = nu20; }
|
||||
public void set_nu11(double nu11) { this.nu11 = nu11; }
|
||||
public void set_nu02(double nu02) { this.nu02 = nu02; }
|
||||
public void set_nu30(double nu30) { this.nu30 = nu30; }
|
||||
public void set_nu21(double nu21) { this.nu21 = nu21; }
|
||||
public void set_nu12(double nu12) { this.nu12 = nu12; }
|
||||
public void set_nu03(double nu03) { this.nu03 = nu03; }
|
||||
}
|
||||
2075
3rdparty/opencv-4.5.4/modules/imgproc/misc/java/test/ImgprocTest.java
vendored
Normal file
51
3rdparty/opencv-4.5.4/modules/imgproc/misc/java/test/MomentsTest.java
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
package org.opencv.test.imgproc;
|
||||
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Scalar;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
import org.opencv.imgproc.Moments;
|
||||
|
||||
public class MomentsTest extends OpenCVTestCase {
|
||||
|
||||
Mat data;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
data = new Mat(3,3, CvType.CV_8UC1, new Scalar(1));
|
||||
data.row(1).setTo(new Scalar(5));
|
||||
}
|
||||
|
||||
public void testAll() {
|
||||
Moments res = Imgproc.moments(data);
|
||||
assertEquals(res.m00, 21.0, EPS);
|
||||
assertEquals(res.m10, 21.0, EPS);
|
||||
assertEquals(res.m01, 21.0, EPS);
|
||||
assertEquals(res.m20, 35.0, EPS);
|
||||
assertEquals(res.m11, 21.0, EPS);
|
||||
assertEquals(res.m02, 27.0, EPS);
|
||||
assertEquals(res.m30, 63.0, EPS);
|
||||
assertEquals(res.m21, 35.0, EPS);
|
||||
assertEquals(res.m12, 27.0, EPS);
|
||||
assertEquals(res.m03, 39.0, EPS);
|
||||
assertEquals(res.mu20, 14.0, EPS);
|
||||
assertEquals(res.mu11, 0.0, EPS);
|
||||
assertEquals(res.mu02, 6.0, EPS);
|
||||
assertEquals(res.mu30, 0.0, EPS);
|
||||
assertEquals(res.mu21, 0.0, EPS);
|
||||
assertEquals(res.mu12, 0.0, EPS);
|
||||
assertEquals(res.mu03, 0.0, EPS);
|
||||
assertEquals(res.nu20, 0.031746031746031744, EPS);
|
||||
assertEquals(res.nu11, 0.0, EPS);
|
||||
assertEquals(res.nu02, 0.013605442176870746, EPS);
|
||||
assertEquals(res.nu30, 0.0, EPS);
|
||||
assertEquals(res.nu21, 0.0, EPS);
|
||||
assertEquals(res.nu12, 0.0, EPS);
|
||||
assertEquals(res.nu03, 0.0, EPS);
|
||||
}
|
||||
|
||||
}
|
||||
117
3rdparty/opencv-4.5.4/modules/imgproc/misc/java/test/Subdiv2DTest.java
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
package org.opencv.test.imgproc;
|
||||
|
||||
import org.opencv.core.MatOfFloat6;
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Rect;
|
||||
import org.opencv.imgproc.Subdiv2D;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class Subdiv2DTest extends OpenCVTestCase {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void testEdgeDstInt() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testEdgeDstIntPoint() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testEdgeOrgInt() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testEdgeOrgIntPoint() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testFindNearestPoint() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testFindNearestPointPoint() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testGetEdge() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testGetEdgeList() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testGetTriangleList() {
|
||||
Subdiv2D s2d = new Subdiv2D( new Rect(0, 0, 50, 50) );
|
||||
s2d.insert( new Point(10, 10) );
|
||||
s2d.insert( new Point(20, 10) );
|
||||
s2d.insert( new Point(20, 20) );
|
||||
s2d.insert( new Point(10, 20) );
|
||||
MatOfFloat6 triangles = new MatOfFloat6();
|
||||
s2d.getTriangleList(triangles);
|
||||
assertEquals(2, triangles.rows());
|
||||
/*
|
||||
int cnt = triangles.rows();
|
||||
float buff[] = new float[cnt*6];
|
||||
triangles.get(0, 0, buff);
|
||||
for(int i=0; i<cnt; i++)
|
||||
Log.d("*****", "["+i+"]: " + // (a.x, a.y) -> (b.x, b.y) -> (c.x, c.y)
|
||||
"("+buff[6*i+0]+","+buff[6*i+1]+")" + "->" +
|
||||
"("+buff[6*i+2]+","+buff[6*i+3]+")" + "->" +
|
||||
"("+buff[6*i+4]+","+buff[6*i+5]+")"
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
||||
public void testGetVertexInt() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testGetVertexIntIntArray() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testGetVoronoiFacetList() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testInitDelaunay() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testInsertListOfPoint() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testInsertPoint() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testLocate() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testNextEdge() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testRotateEdge() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testSubdiv2D() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testSubdiv2DRect() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testSymEdge() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
}
|
||||
68
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/common/Moments.h
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// Moments.h
|
||||
//
|
||||
// Created by Giles Payne on 2019/10/06.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv2/core.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
CV_EXPORTS @interface Moments : NSObject
|
||||
|
||||
@property double m00;
|
||||
@property double m10;
|
||||
@property double m01;
|
||||
@property double m20;
|
||||
@property double m11;
|
||||
@property double m02;
|
||||
@property double m30;
|
||||
@property double m21;
|
||||
@property double m12;
|
||||
@property double m03;
|
||||
|
||||
@property double mu20;
|
||||
@property double mu11;
|
||||
@property double mu02;
|
||||
@property double mu30;
|
||||
@property double mu21;
|
||||
@property double mu12;
|
||||
@property double mu03;
|
||||
|
||||
@property double nu20;
|
||||
@property double nu11;
|
||||
@property double nu02;
|
||||
@property double nu30;
|
||||
@property double nu21;
|
||||
@property double nu12;
|
||||
@property double nu03;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@property(readonly) cv::Moments& nativeRef;
|
||||
#endif
|
||||
|
||||
-(instancetype)initWithM00:(double)m00 m10:(double)m10 m01:(double)m01 m20:(double)m20 m11:(double)m11 m02:(double)m02 m30:(double)m30 m21:(double)m21 m12:(double)m12 m03:(double)m03;
|
||||
|
||||
-(instancetype)init;
|
||||
|
||||
-(instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
|
||||
|
||||
#ifdef __cplusplus
|
||||
+(instancetype)fromNative:(cv::Moments&)moments;
|
||||
#endif
|
||||
|
||||
-(void)set:(NSArray<NSNumber*>*)vals;
|
||||
-(void)completeState;
|
||||
-(NSString *)description;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
304
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/common/Moments.mm
vendored
Normal file
@ -0,0 +1,304 @@
|
||||
//
|
||||
// Moments.mm
|
||||
//
|
||||
// Created by Giles Payne on 2019/10/09.
|
||||
//
|
||||
|
||||
#import "Moments.h"
|
||||
|
||||
@implementation Moments {
|
||||
cv::Moments native;
|
||||
}
|
||||
|
||||
-(cv::Moments&)nativeRef {
|
||||
return native;
|
||||
}
|
||||
|
||||
- (double)m00 {
|
||||
return native.m00;
|
||||
}
|
||||
|
||||
- (void)setM00:(double)val {
|
||||
native.m00 = val;
|
||||
}
|
||||
|
||||
- (double)m10 {
|
||||
return native.m10;
|
||||
}
|
||||
|
||||
- (void)setM10:(double)val {
|
||||
native.m10 = val;
|
||||
}
|
||||
|
||||
- (double)m01 {
|
||||
return native.m01;
|
||||
}
|
||||
|
||||
- (void)setM01:(double)val {
|
||||
native.m01 = val;
|
||||
}
|
||||
|
||||
- (double)m20 {
|
||||
return native.m20;
|
||||
}
|
||||
|
||||
- (void)setM20:(double)val {
|
||||
native.m20 = val;
|
||||
}
|
||||
|
||||
- (double)m11 {
|
||||
return native.m11;
|
||||
}
|
||||
|
||||
- (void)setM11:(double)val {
|
||||
native.m11 = val;
|
||||
}
|
||||
|
||||
- (double)m02 {
|
||||
return native.m02;
|
||||
}
|
||||
|
||||
- (void)setM02:(double)val {
|
||||
native.m02 = val;
|
||||
}
|
||||
|
||||
- (double)m30 {
|
||||
return native.m30;
|
||||
}
|
||||
|
||||
- (void)setM30:(double)val {
|
||||
native.m30 = val;
|
||||
}
|
||||
|
||||
- (double)m21 {
|
||||
return native.m21;
|
||||
}
|
||||
|
||||
- (void)setM21:(double)val {
|
||||
native.m21 = val;
|
||||
}
|
||||
|
||||
- (double)m12 {
|
||||
return native.m12;
|
||||
}
|
||||
|
||||
- (void)setM12:(double)val {
|
||||
native.m12 = val;
|
||||
}
|
||||
|
||||
- (double)m03 {
|
||||
return native.m03;
|
||||
}
|
||||
|
||||
- (void)setM03:(double)val {
|
||||
native.m03 = val;
|
||||
}
|
||||
|
||||
- (double)mu20 {
|
||||
return native.mu20;
|
||||
}
|
||||
|
||||
- (void)setMu20:(double)val {
|
||||
native.mu20 = val;
|
||||
}
|
||||
|
||||
- (double)mu11 {
|
||||
return native.mu11;
|
||||
}
|
||||
|
||||
- (void)setMu11:(double)val {
|
||||
native.mu11 = val;
|
||||
}
|
||||
|
||||
- (double)mu02 {
|
||||
return native.mu02;
|
||||
}
|
||||
|
||||
- (void)setMu02:(double)val {
|
||||
native.mu02 = val;
|
||||
}
|
||||
|
||||
- (double)mu30 {
|
||||
return native.mu30;
|
||||
}
|
||||
|
||||
- (void)setMu30:(double)val {
|
||||
native.mu30 = val;
|
||||
}
|
||||
|
||||
- (double)mu21 {
|
||||
return native.mu21;
|
||||
}
|
||||
|
||||
- (void)setMu21:(double)val {
|
||||
native.mu21 = val;
|
||||
}
|
||||
- (double)mu12 {
|
||||
return native.mu12;
|
||||
}
|
||||
|
||||
- (void)setMu12:(double)val {
|
||||
native.mu12 = val;
|
||||
}
|
||||
|
||||
- (double)mu03 {
|
||||
return native.mu03;
|
||||
}
|
||||
|
||||
- (void)setMu03:(double)val {
|
||||
native.mu03 = val;
|
||||
}
|
||||
|
||||
- (double)nu20 {
|
||||
return native.nu20;
|
||||
}
|
||||
|
||||
- (void)setNu20:(double)val {
|
||||
native.nu20 = val;
|
||||
}
|
||||
|
||||
- (double)nu11 {
|
||||
return native.nu11;
|
||||
}
|
||||
|
||||
- (void)setNu11:(double)val {
|
||||
native.nu11 = val;
|
||||
}
|
||||
|
||||
- (double)nu02 {
|
||||
return native.nu02;
|
||||
}
|
||||
|
||||
- (void)setNu02:(double)val {
|
||||
native.nu02 = val;
|
||||
}
|
||||
|
||||
- (double)nu30 {
|
||||
return native.nu30;
|
||||
}
|
||||
|
||||
- (void)setNu30:(double)val {
|
||||
native.nu30 = val;
|
||||
}
|
||||
|
||||
- (double)nu21 {
|
||||
return native.nu21;
|
||||
}
|
||||
|
||||
- (void)setNu21:(double)val {
|
||||
native.nu21 = val;
|
||||
}
|
||||
|
||||
- (double)nu12 {
|
||||
return native.nu12;
|
||||
}
|
||||
|
||||
- (void)setNu12:(double)val {
|
||||
native.nu12 = val;
|
||||
}
|
||||
|
||||
- (double)nu03 {
|
||||
return native.nu03;
|
||||
}
|
||||
|
||||
- (void)setNu03:(double)val {
|
||||
native.nu03 = val;
|
||||
}
|
||||
|
||||
-(instancetype)initWithM00:(double)m00 m10:(double)m10 m01:(double)m01 m20:(double)m20 m11:(double)m11 m02:(double)m02 m30:(double)m30 m21:(double)m21 m12:(double)m12 m03:(double)m03 {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.m00 = m00;
|
||||
self.m10 = m10;
|
||||
self.m01 = m01;
|
||||
self.m20 = m20;
|
||||
self.m11 = m11;
|
||||
self.m02 = m02;
|
||||
self.m30 = m30;
|
||||
self.m21 = m21;
|
||||
self.m12 = m12;
|
||||
self.m03 = m03;
|
||||
[self completeState];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(instancetype)init {
|
||||
return [self initWithM00:0 m10:0 m01:0 m20:0 m11:0 m02:0 m30:0 m21:0 m12:0 m03:0];
|
||||
}
|
||||
|
||||
-(instancetype)initWithVals:(NSArray<NSNumber*>*)vals {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self set:vals];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+(instancetype)fromNative:(cv::Moments&)moments {
|
||||
return [[Moments alloc] initWithM00:moments.m00 m10:moments.m10 m01:moments.m01 m20:moments.m20 m11:moments.m11 m02:moments.m02 m30:moments.m30 m21:moments.m21 m12:moments.m12 m03:moments.m03];
|
||||
}
|
||||
|
||||
-(void)set:(NSArray<NSNumber*>*)vals {
|
||||
self.m00 = (vals != nil && vals.count > 0) ? vals[0].doubleValue : 0;
|
||||
self.m10 = (vals != nil && vals.count > 1) ? vals[1].doubleValue : 0;
|
||||
self.m01 = (vals != nil && vals.count > 2) ? vals[2].doubleValue : 0;
|
||||
self.m20 = (vals != nil && vals.count > 3) ? vals[3].doubleValue : 0;
|
||||
self.m11 = (vals != nil && vals.count > 4) ? vals[4].doubleValue : 0;
|
||||
self.m02 = (vals != nil && vals.count > 5) ? vals[5].doubleValue : 0;
|
||||
self.m30 = (vals != nil && vals.count > 6) ? vals[6].doubleValue : 0;
|
||||
self.m21 = (vals != nil && vals.count > 7) ? vals[7].doubleValue : 0;
|
||||
self.m12 = (vals != nil && vals.count > 8) ? vals[8].doubleValue : 0;
|
||||
self.m03 = (vals != nil && vals.count > 9) ? vals[9].doubleValue : 0;
|
||||
[self completeState];
|
||||
}
|
||||
|
||||
-(void)completeState {
|
||||
double cx = 0, cy = 0;
|
||||
double mu20, mu11, mu02;
|
||||
double inv_m00 = 0.0;
|
||||
|
||||
if (abs(self.m00) > 0.00000001) {
|
||||
inv_m00 = 1. / self.m00;
|
||||
cx = self.m10 * inv_m00;
|
||||
cy = self.m01 * inv_m00;
|
||||
}
|
||||
|
||||
// mu20 = m20 - m10*cx
|
||||
mu20 = self.m20 - self.m10 * cx;
|
||||
// mu11 = m11 - m10*cy
|
||||
mu11 = self.m11 - self.m10 * cy;
|
||||
// mu02 = m02 - m01*cy
|
||||
mu02 = self.m02 - self.m01 * cy;
|
||||
|
||||
self.mu20 = mu20;
|
||||
self.mu11 = mu11;
|
||||
self.mu02 = mu02;
|
||||
|
||||
// mu30 = m30 - cx*(3*mu20 + cx*m10)
|
||||
self.mu30 = self.m30 - cx * (3 * mu20 + cx * self.m10);
|
||||
mu11 += mu11;
|
||||
// mu21 = m21 - cx*(2*mu11 + cx*m01) - cy*mu20
|
||||
self.mu21 = self.m21 - cx * (mu11 + cx * self.m01) - cy * mu20;
|
||||
// mu12 = m12 - cy*(2*mu11 + cy*m10) - cx*mu02
|
||||
self.mu12 = self.m12 - cy * (mu11 + cy * self.m10) - cx * mu02;
|
||||
// mu03 = m03 - cy*(3*mu02 + cy*m01)
|
||||
self.mu03 = self.m03 - cy * (3 * mu02 + cy * self.m01);
|
||||
|
||||
|
||||
double inv_sqrt_m00 = sqrt(abs(inv_m00));
|
||||
double s2 = inv_m00*inv_m00, s3 = s2*inv_sqrt_m00;
|
||||
|
||||
self.nu20 = self.mu20*s2;
|
||||
self.nu11 = self.mu11*s2;
|
||||
self.nu02 = self.mu02*s2;
|
||||
self.nu30 = self.mu30*s3;
|
||||
self.nu21 = self.mu21*s3;
|
||||
self.nu12 = self.mu12*s3;
|
||||
self.nu03 = self.mu03*s3;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"Moments [ \nm00=%lf, \nm10=%lf, m01=%lf, \nm20=%lf, m11=%lf, m02=%lf, \nm30=%lf, m21=%lf, m12=%lf, m03=%lf, \nmu20=%lf, mu11=%lf, mu02=%lf, \nmu30=%lf, mu21=%lf, mu12=%lf, mu03=%lf, \nnu20=%lf, nu11=%lf, nu02=%lf, \nnu30=%lf, nu21=%lf, nu12=%lf, nu03=%lf, \n]", self.m00, self.m10, self.m01, self.m20, self.m11, self.m02, self.m30, self.m21, self.m12, self.m03, self.mu20, self.mu11, self.mu02, self.mu30, self.mu21, self.mu12, self.mu03, self.nu20, self.nu11, self.nu02, self.nu30, self.nu21, self.nu12, self.nu03];
|
||||
}
|
||||
|
||||
@end
|
||||
132
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/gen_dict.json
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
{
|
||||
"AdditionalImports" : {
|
||||
"Imgproc" : [ "\"imgproc/bindings.hpp\"" ]
|
||||
},
|
||||
"enum_ignore_list" : [
|
||||
"MorphShapes_c",
|
||||
"SmoothMethod_c"
|
||||
],
|
||||
"module_imports": ["Size2i"],
|
||||
"const_ignore_list": [
|
||||
"CV_TM_.+",
|
||||
"CV_COLORCVT_MAX",
|
||||
"CV_.*Bayer.*",
|
||||
"CV_YUV420(i|sp|p)2.+",
|
||||
"CV_L?(BGRA?|RGBA?|GRAY|XYZ|YCrCb|Luv|Lab|HLS|YUV|HSV)\\d*2L?(BGRA?|RGBA?|GRAY|XYZ|YCrCb|Luv|Lab|HLS|YUV|HSV).*",
|
||||
"CV_FLOODFILL_.+",
|
||||
"CV_ADAPTIVE_THRESH_.+",
|
||||
"CV_DIST_.+",
|
||||
"CV_HOUGH_.+",
|
||||
"CV_CONTOURS_MATCH_.+",
|
||||
"CV_COMP_.+"
|
||||
],
|
||||
"const_private_list" : [
|
||||
"CV_MOP_.+",
|
||||
"CV_INTER_.+",
|
||||
"CV_THRESH_.+",
|
||||
"CV_INPAINT_.+",
|
||||
"CV_RETR_.+",
|
||||
"CV_CHAIN_APPROX_.+"
|
||||
],
|
||||
"missing_consts" : {
|
||||
"Imgproc" : {
|
||||
"private" : [
|
||||
["IPL_BORDER_CONSTANT", 0 ],
|
||||
["IPL_BORDER_REPLICATE", 1 ],
|
||||
["IPL_BORDER_REFLECT", 2 ],
|
||||
["IPL_BORDER_WRAP", 3 ],
|
||||
["IPL_BORDER_REFLECT_101", 4 ],
|
||||
["IPL_BORDER_TRANSPARENT", 5 ]
|
||||
]
|
||||
}
|
||||
},
|
||||
"func_arg_fix" : {
|
||||
"Imgproc" : {
|
||||
"goodFeaturesToTrack" : { "corners" : {"ctype" : "vector_Point"} },
|
||||
"minEnclosingCircle" : { "points" : {"ctype" : "vector_Point2f"} },
|
||||
"fitEllipse" : { "points" : {"ctype" : "vector_Point2f"} },
|
||||
"fillPoly" : { "pts" : {"ctype" : "vector_vector_Point"},
|
||||
"lineType" : {"ctype" : "LineTypes"}},
|
||||
"polylines" : { "pts" : {"ctype" : "vector_vector_Point"},
|
||||
"lineType" : {"ctype" : "LineTypes"} },
|
||||
"fillConvexPoly" : { "points" : {"ctype" : "vector_Point"},
|
||||
"lineType" : {"ctype" : "LineTypes"} },
|
||||
"approxPolyDP" : { "curve" : {"ctype" : "vector_Point2f"},
|
||||
"approxCurve" : {"ctype" : "vector_Point2f"} },
|
||||
"arcLength" : { "curve" : {"ctype" : "vector_Point2f"} },
|
||||
"pointPolygonTest" : { "contour" : {"ctype" : "vector_Point2f"} },
|
||||
"minAreaRect" : { "points" : {"ctype" : "vector_Point2f"} },
|
||||
"getAffineTransform" : { "src" : {"ctype" : "vector_Point2f"},
|
||||
"dst" : {"ctype" : "vector_Point2f"} },
|
||||
"drawContours" : { "contours" : {"ctype" : "vector_vector_Point"},
|
||||
"lineType" : {"ctype" : "LineTypes"} },
|
||||
"findContours" : { "contours" : {"ctype" : "vector_vector_Point"},
|
||||
"mode" : {"ctype" : "RetrievalModes"},
|
||||
"method" : {"ctype" : "ContourApproximationModes"} },
|
||||
"convexityDefects" : { "contour" : {"ctype" : "vector_Point"},
|
||||
"convexhull" : {"ctype" : "vector_int"},
|
||||
"convexityDefects" : {"ctype" : "vector_Vec4i"} },
|
||||
"isContourConvex" : { "contour" : {"ctype" : "vector_Point"} },
|
||||
"convexHull" : { "points" : {"ctype" : "vector_Point"},
|
||||
"hull" : {"ctype" : "vector_int"},
|
||||
"returnPoints" : {"ctype" : ""} },
|
||||
"getStructuringElement" : { "shape" : {"ctype" : "MorphShapes"} },
|
||||
"EMD" : {"lowerBound" : {"defval" : "cv::Ptr<float>()"},
|
||||
"distType" : {"ctype" : "DistanceTypes"}},
|
||||
"createLineSegmentDetector" : { "_refine" : {"ctype" : "LineSegmentDetectorModes"}},
|
||||
"compareHist" : { "method" : {"ctype" : "HistCompMethods"}},
|
||||
"matchShapes" : { "method" : {"ctype" : "ShapeMatchModes"}},
|
||||
"threshold" : { "type" : {"ctype" : "ThresholdTypes"}},
|
||||
"connectedComponentsWithStatsWithAlgorithm" : { "ccltype" : {"ctype" : "ConnectedComponentsAlgorithmsTypes"}},
|
||||
"GaussianBlur" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"HoughCircles" : { "method" : {"ctype" : "HoughModes"}},
|
||||
"Laplacian" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"Scharr" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"Sobel" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"adaptiveThreshold" : { "adaptiveMethod" : {"ctype" : "AdaptiveThresholdTypes"},
|
||||
"thresholdType" : {"ctype" : "ThresholdTypes"}},
|
||||
"applyColorMap" : { "colormap" : {"ctype" : "ColormapTypes"}},
|
||||
"arrowedLine" : { "line_type" : {"ctype" : "LineTypes"}},
|
||||
"bilateralFilter" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"blur" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"boxFilter" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"circle" : { "lineType" : {"ctype" : "LineTypes"}},
|
||||
"cornerEigenValsAndVecs" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"cornerHarris" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"cornerMinEigenVal" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"cvtColor" : { "code" : {"ctype" : "ColorConversionCodes"}},
|
||||
"dilate" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"distanceTransformWithLabels" : { "labelType" : {"ctype" : "DistanceTransformLabelTypes"},
|
||||
"distanceType" : {"ctype" : "DistanceTypes"},
|
||||
"maskSize" : {"ctype" : "DistanceTransformMasks"}},
|
||||
"distanceTransform" : { "distanceType" : {"ctype" : "DistanceTypes"},
|
||||
"maskSize" : {"ctype" : "DistanceTransformMasks"}},
|
||||
"drawMarker" : { "markerType" : {"ctype" : "MarkerTypes"},
|
||||
"line_type" : {"ctype" : "LineTypes"}},
|
||||
"ellipse" : { "lineType" : {"ctype" : "LineTypes"}},
|
||||
"erode" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"filter2D" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"fitLine" : { "distType" : {"ctype" : "DistanceTypes"}},
|
||||
"line" : { "lineType" : {"ctype" : "LineTypes"}},
|
||||
"matchTemplate" : { "method" : {"ctype" : "TemplateMatchModes"}},
|
||||
"morphologyEx" : { "op" : {"ctype" : "MorphTypes"},
|
||||
"borderType" : {"ctype" : "BorderTypes"}},
|
||||
"preCornerDetect" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"putText" : { "fontFace" : {"ctype" : "HersheyFonts"},
|
||||
"lineType" : {"ctype" : "LineTypes"}},
|
||||
"pyrDown" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"pyrUp" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"rectangle" : { "lineType" : {"ctype" : "LineTypes"}},
|
||||
"remap" : { "borderMode": {"ctype" : "BorderTypes"}},
|
||||
"sepFilter2D" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"spatialGradient" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"sqrBoxFilter" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"warpAffine" : { "borderMode": {"ctype" : "BorderTypes"}},
|
||||
"warpPerspective" : { "borderMode": {"ctype" : "BorderTypes"}},
|
||||
"getTextSize" : { "fontFace": {"ctype" : "HersheyFonts"}}
|
||||
},
|
||||
"Subdiv2D" : {
|
||||
"(void)insert:(NSArray<Point2f*>*)ptvec" : { "insert" : {"name" : "insertVector"} }
|
||||
}
|
||||
}
|
||||
}
|
||||
1744
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/test/ImgprocTest.swift
vendored
Normal file
42
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/test/MomentsTest.swift
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// MomentsTest.swift
|
||||
//
|
||||
// Created by Giles Payne on 2020/02/10.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import OpenCV
|
||||
|
||||
class MomentsTest: XCTestCase {
|
||||
|
||||
func testAll() {
|
||||
let data = Mat(rows: 3,cols: 3, type: CvType.CV_8UC1, scalar: Scalar(1))
|
||||
data.row(1).setTo(scalar: Scalar(5))
|
||||
let res = Imgproc.moments(array: data)
|
||||
XCTAssertEqual(res.m00, 21.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m10, 21.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m01, 21.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m20, 35.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m11, 21.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m02, 27.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m30, 63.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m21, 35.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m12, 27.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m03, 39.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu20, 14.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu11, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu02, 6.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu30, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu21, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu12, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu03, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu20, 0.031746031746031744, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu11, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu02, 0.013605442176870746, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu30, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu21, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu12, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu03, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
}
|
||||
|
||||
}
|
||||
23
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/test/Subdiv2DTest.swift
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// Subdiv2DTest.swift
|
||||
//
|
||||
// Created by Giles Payne on 2020/02/10.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import OpenCV
|
||||
|
||||
class Subdiv2DTest: OpenCVTestCase {
|
||||
|
||||
func testGetTriangleList() {
|
||||
let s2d = Subdiv2D(rect: Rect(x: 0, y: 0, width: 50, height: 50))
|
||||
s2d.insert(pt: Point2f(x: 10, y: 10))
|
||||
s2d.insert(pt: Point2f(x: 20, y: 10))
|
||||
s2d.insert(pt: Point2f(x: 20, y: 20))
|
||||
s2d.insert(pt: Point2f(x: 10, y: 20))
|
||||
var triangles = [Float6]()
|
||||
s2d.getTriangleList(triangleList: &triangles)
|
||||
XCTAssertEqual(2, triangles.count)
|
||||
}
|
||||
|
||||
}
|
||||
137
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_3vs4.cpp
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// 3 channels Vs 4 ////////////////////////
|
||||
|
||||
enum
|
||||
{
|
||||
Pure = 0, Split, Convert
|
||||
};
|
||||
|
||||
CV_ENUM(Modes, Pure, Split, Convert)
|
||||
|
||||
typedef tuple <Size, MatType, Modes> _3vs4Params;
|
||||
typedef TestBaseWithParam<_3vs4Params> _3vs4_Fixture;
|
||||
|
||||
OCL_PERF_TEST_P(_3vs4_Fixture, Resize,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC3, CV_32FC3), Modes::all()))
|
||||
{
|
||||
_3vs4Params params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), depth = CV_MAT_DEPTH(type);
|
||||
const int mode = get<2>(params);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
if (mode == Pure)
|
||||
{
|
||||
OCL_TEST_CYCLE() resize(src, dst, Size(), 0.5, 0.5, INTER_LINEAR_EXACT);
|
||||
}
|
||||
else if (mode == Split)
|
||||
{
|
||||
std::vector<UMat> srcs(3), dsts(3);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
dsts[i] = UMat(srcSize, depth);
|
||||
srcs[i] = UMat(srcSize, depth);
|
||||
}
|
||||
|
||||
OCL_TEST_CYCLE()
|
||||
{
|
||||
split(src, srcs);
|
||||
|
||||
for (size_t i = 0; i < srcs.size(); ++i)
|
||||
resize(srcs[i], dsts[i], Size(), 0.5, 0.5, INTER_LINEAR_EXACT);
|
||||
|
||||
merge(dsts, dst);
|
||||
}
|
||||
}
|
||||
else if (mode == Convert)
|
||||
{
|
||||
int type4 = CV_MAKE_TYPE(depth, 4);
|
||||
UMat src4(srcSize, type4), dst4(srcSize, type4);
|
||||
|
||||
OCL_TEST_CYCLE()
|
||||
{
|
||||
cvtColor(src, src4, COLOR_RGB2RGBA);
|
||||
resize(src4, dst4, Size(), 0.5, 0.5, INTER_LINEAR_EXACT);
|
||||
cvtColor(dst4, dst, COLOR_RGBA2RGB);
|
||||
}
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
OCL_PERF_TEST_P(_3vs4_Fixture, Subtract,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC3, CV_32FC3), Modes::all()))
|
||||
{
|
||||
_3vs4Params params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), depth = CV_MAT_DEPTH(type);
|
||||
const int mode = get<2>(params);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
Scalar s(14);
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
if (mode == Pure)
|
||||
{
|
||||
OCL_TEST_CYCLE() subtract(src, s, dst);
|
||||
}
|
||||
else if (mode == Split)
|
||||
{
|
||||
std::vector<UMat> srcs(3), dsts(3);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
dsts[i] = UMat(srcSize, depth);
|
||||
srcs[i] = UMat(srcSize, depth);
|
||||
}
|
||||
|
||||
OCL_TEST_CYCLE()
|
||||
{
|
||||
split(src, srcs);
|
||||
|
||||
for (size_t i = 0; i < srcs.size(); ++i)
|
||||
subtract(srcs[i], s, dsts[i]);
|
||||
|
||||
merge(dsts, dst);
|
||||
}
|
||||
}
|
||||
else if (mode == Convert)
|
||||
{
|
||||
int type4 = CV_MAKE_TYPE(depth, 4);
|
||||
UMat src4(srcSize, type4), dst4(srcSize, type4);
|
||||
|
||||
OCL_TEST_CYCLE()
|
||||
{
|
||||
cvtColor(src, src4, COLOR_RGB2RGBA);
|
||||
subtract(src4, s, dst4);
|
||||
cvtColor(dst4, dst, COLOR_RGBA2RGB);
|
||||
}
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
140
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_accumulate.cpp
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// @Authors
|
||||
// Nathan, liujun@multicorewareinc.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors as is and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
/////////////////////////////////// Accumulate ///////////////////////////////////
|
||||
|
||||
typedef Size_MatType AccumulateFixture;
|
||||
|
||||
OCL_PERF_TEST_P(AccumulateFixture, Accumulate,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
|
||||
{
|
||||
Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int srcType = get<1>(params), cn = CV_MAT_CN(srcType), dstType = CV_32FC(cn);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, dstType);
|
||||
|
||||
UMat src(srcSize, srcType), dst(srcSize, dstType);
|
||||
declare.in(src, dst, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::accumulate(src, dst);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
/////////////////////////////////// AccumulateSquare ///////////////////////////////////
|
||||
|
||||
typedef Size_MatType AccumulateSquareFixture;
|
||||
|
||||
OCL_PERF_TEST_P(AccumulateSquareFixture, AccumulateSquare,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
|
||||
{
|
||||
Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int srcType = get<1>(params), cn = CV_MAT_CN(srcType), dstType = CV_32FC(cn);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, dstType);
|
||||
|
||||
UMat src(srcSize, srcType), dst(srcSize, dstType);
|
||||
declare.in(src, dst, WARMUP_RNG);
|
||||
|
||||
OCL_TEST_CYCLE() cv::accumulateSquare(src, dst);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
/////////////////////////////////// AccumulateProduct ///////////////////////////////////
|
||||
|
||||
typedef Size_MatType AccumulateProductFixture;
|
||||
|
||||
OCL_PERF_TEST_P(AccumulateProductFixture, AccumulateProduct,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
|
||||
{
|
||||
Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int srcType = get<1>(params), cn = CV_MAT_CN(srcType), dstType = CV_32FC(cn);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, dstType);
|
||||
|
||||
UMat src1(srcSize, srcType), src2(srcSize, srcType), dst(srcSize, dstType);
|
||||
declare.in(src1, src2, dst, WARMUP_RNG);
|
||||
|
||||
OCL_TEST_CYCLE() cv::accumulateProduct(src1, src2, dst);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
/////////////////////////////////// AccumulateWeighted ///////////////////////////////////
|
||||
|
||||
typedef Size_MatType AccumulateWeightedFixture;
|
||||
|
||||
OCL_PERF_TEST_P(AccumulateWeightedFixture, AccumulateWeighted,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
|
||||
{
|
||||
Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int srcType = get<1>(params), cn = CV_MAT_CN(srcType), dstType = CV_32FC(cn);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, dstType);
|
||||
|
||||
UMat src(srcSize, srcType), dst(srcSize, dstType);
|
||||
declare.in(src, dst, WARMUP_RNG);
|
||||
|
||||
OCL_TEST_CYCLE() cv::accumulateWeighted(src, dst, 2.0);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif
|
||||
82
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_blend.cpp
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// @Authors
|
||||
// Fangfang Bai, fangfang@multicorewareinc.com
|
||||
// Jin Ma, jin@multicorewareinc.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors as is and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// BlendLinear ////////////////////////
|
||||
|
||||
typedef Size_MatType BlendLinearFixture;
|
||||
|
||||
OCL_PERF_TEST_P(BlendLinearFixture, BlendLinear, ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
|
||||
{
|
||||
Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int srcType = get<1>(params);
|
||||
const double eps = CV_MAT_DEPTH(srcType) <= CV_32S ? 1.0 : 0.2;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, srcType);
|
||||
|
||||
UMat src1(srcSize, srcType), src2(srcSize, srcType), dst(srcSize, srcType);
|
||||
UMat weights1(srcSize, CV_32FC1), weights2(srcSize, CV_32FC1);
|
||||
|
||||
declare.in(src1, src2, WARMUP_RNG).in(weights1, weights2, WARMUP_READ).out(dst);
|
||||
randu(weights1, 0, 1);
|
||||
randu(weights2, 0, 1);
|
||||
|
||||
OCL_TEST_CYCLE() cv::blendLinear(src1, src2, weights1, weights2, dst);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
113
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_color.cpp
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// @Authors
|
||||
// Fangfang Bai, fangfang@multicorewareinc.com
|
||||
// Jin Ma, jin@multicorewareinc.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors as is and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// cvtColor////////////////////////
|
||||
|
||||
CV_ENUM(ConversionTypes, COLOR_RGB2GRAY, COLOR_RGB2BGR, COLOR_RGB2YUV, COLOR_YUV2RGB, COLOR_RGB2YCrCb,
|
||||
COLOR_YCrCb2RGB, COLOR_RGB2XYZ, COLOR_XYZ2RGB, COLOR_RGB2HSV, COLOR_HSV2RGB, COLOR_RGB2HLS,
|
||||
COLOR_HLS2RGB, COLOR_BGR5652BGR, COLOR_BGR2BGR565, COLOR_RGBA2mRGBA, COLOR_mRGBA2RGBA,
|
||||
COLOR_RGB2Lab, COLOR_Lab2BGR, COLOR_RGB2Luv, COLOR_Luv2LBGR, COLOR_YUV2RGB_NV12, COLOR_YUV2RGB_IYUV,
|
||||
COLOR_YUV2GRAY_420, COLOR_RGB2YUV_IYUV, COLOR_YUV2RGB_YUY2, COLOR_YUV2GRAY_YUY2)
|
||||
|
||||
typedef tuple<Size, tuple<ConversionTypes, int, int> > CvtColorParams;
|
||||
typedef TestBaseWithParam<CvtColorParams> CvtColorFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CvtColorFixture, CvtColor, testing::Combine(
|
||||
OCL_TEST_SIZES,
|
||||
testing::Values(
|
||||
make_tuple(ConversionTypes(COLOR_RGB2GRAY), 3, 1),
|
||||
make_tuple(ConversionTypes(COLOR_RGB2BGR), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_RGB2YUV), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_YUV2RGB), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_RGB2YCrCb), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_YCrCb2RGB), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_RGB2XYZ), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_XYZ2RGB), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_RGB2HSV), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_HSV2RGB), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_RGB2HLS), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_HLS2RGB), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_BGR5652BGR), 2, 3),
|
||||
make_tuple(ConversionTypes(COLOR_BGR2BGR565), 3, 2),
|
||||
make_tuple(ConversionTypes(COLOR_RGBA2mRGBA), 4, 4),
|
||||
make_tuple(ConversionTypes(COLOR_mRGBA2RGBA), 4, 4),
|
||||
make_tuple(ConversionTypes(COLOR_RGB2Lab), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_Lab2BGR), 3, 4),
|
||||
make_tuple(ConversionTypes(COLOR_RGB2Luv), 3, 3),
|
||||
make_tuple(ConversionTypes(COLOR_Luv2LBGR), 3, 4),
|
||||
make_tuple(ConversionTypes(COLOR_YUV2RGB_NV12), 1, 3),
|
||||
make_tuple(ConversionTypes(COLOR_YUV2RGB_IYUV), 1, 3),
|
||||
make_tuple(ConversionTypes(COLOR_YUV2GRAY_420), 1, 1),
|
||||
make_tuple(ConversionTypes(COLOR_RGB2YUV_IYUV), 3, 1),
|
||||
make_tuple(ConversionTypes(COLOR_YUV2RGB_YUY2), 2, 3),
|
||||
make_tuple(ConversionTypes(COLOR_YUV2GRAY_YUY2), 2, 1)
|
||||
)))
|
||||
{
|
||||
CvtColorParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const tuple<int, int, int> conversionParams = get<1>(params);
|
||||
const int code = get<0>(conversionParams), scn = get<1>(conversionParams),
|
||||
dcn = get<2>(conversionParams);
|
||||
|
||||
UMat src(srcSize, CV_8UC(scn)), dst(srcSize, CV_8UC(scn));
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::cvtColor(src, dst, code, dcn);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
415
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_filters.cpp
vendored
Normal file
@ -0,0 +1,415 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// @Authors
|
||||
// Fangfang Bai, fangfang@multicorewareinc.com
|
||||
// Jin Ma, jin@multicorewareinc.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors as is and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
typedef tuple<Size, MatType, int> FilterParams;
|
||||
typedef TestBaseWithParam<FilterParams> FilterFixture;
|
||||
|
||||
///////////// Blur ////////////////////////
|
||||
|
||||
typedef FilterFixture BlurFixture;
|
||||
|
||||
OCL_PERF_TEST_P(BlurFixture, Blur,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5)))
|
||||
{
|
||||
const FilterParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), ksize = get<2>(params), bordertype = BORDER_CONSTANT;
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-5;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::blur(src, dst, Size(ksize, ksize), Point(-1, -1), bordertype);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// SqrBoxFilter ////////////////////////
|
||||
|
||||
typedef tuple<Size, MatType, Size> SqrBoxFilterParams;
|
||||
typedef TestBaseWithParam<SqrBoxFilterParams> SqrBoxFilterFixture;
|
||||
|
||||
OCL_PERF_TEST_P(SqrBoxFilterFixture, SqrBoxFilter,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4),
|
||||
OCL_PERF_ENUM(Size(3, 3), Size(20, 3), Size(3, 20), Size(20, 20))))
|
||||
{
|
||||
const SqrBoxFilterParams params = GetParam();
|
||||
const Size srcSize = get<0>(params), ksize = get<2>(params);
|
||||
const int type = get<1>(params), depth = CV_MAT_DEPTH(type),
|
||||
ddepth = depth == CV_8U ? CV_32S : CV_32F;
|
||||
const double eps = ddepth == CV_32S ? 0 : 5e-5;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, CV_MAKE_TYPE(ddepth, CV_MAT_CN(type)));
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::sqrBoxFilter(src, dst, ddepth, ksize, Point(-1, -1), false);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// Laplacian////////////////////////
|
||||
|
||||
typedef FilterFixture LaplacianFixture;
|
||||
|
||||
OCL_PERF_TEST_P(LaplacianFixture, Laplacian,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5)))
|
||||
{
|
||||
const FilterParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), ksize = get<2>(params);
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 2e-5;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::Laplacian(src, dst, -1, ksize, 1);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// Erode ////////////////////
|
||||
|
||||
typedef FilterFixture ErodeFixture;
|
||||
|
||||
OCL_PERF_TEST_P(ErodeFixture, Erode,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5)))
|
||||
{
|
||||
const FilterParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), ksize = get<2>(params);
|
||||
const Mat ker = getStructuringElement(MORPH_RECT, Size(ksize, ksize));
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst).in(ker);
|
||||
|
||||
OCL_TEST_CYCLE() cv::erode(src, dst, ker);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
///////////// Dilate ////////////////////
|
||||
|
||||
typedef FilterFixture DilateFixture;
|
||||
|
||||
OCL_PERF_TEST_P(DilateFixture, Dilate,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5)))
|
||||
{
|
||||
const FilterParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), ksize = get<2>(params);
|
||||
const Mat ker = getStructuringElement(MORPH_RECT, Size(ksize, ksize));
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst).in(ker);
|
||||
|
||||
OCL_TEST_CYCLE() cv::dilate(src, dst, ker);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
///////////// MorphologyEx ////////////////////////
|
||||
|
||||
CV_ENUM(MorphOp, MORPH_OPEN, MORPH_CLOSE, MORPH_GRADIENT, MORPH_TOPHAT, MORPH_BLACKHAT)
|
||||
|
||||
typedef tuple<Size, MatType, MorphOp, int> MorphologyExParams;
|
||||
typedef TestBaseWithParam<MorphologyExParams> MorphologyExFixture;
|
||||
|
||||
OCL_PERF_TEST_P(MorphologyExFixture, MorphologyEx,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, MorphOp::all(), OCL_PERF_ENUM(3, 5)))
|
||||
{
|
||||
const MorphologyExParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), op = get<2>(params), ksize = get<3>(params);
|
||||
const Mat ker = getStructuringElement(MORPH_RECT, Size(ksize, ksize));
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst).in(ker);
|
||||
|
||||
OCL_TEST_CYCLE() cv::morphologyEx(src, dst, op, ker);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
///////////// Sobel ////////////////////////
|
||||
|
||||
typedef Size_MatType SobelFixture;
|
||||
|
||||
OCL_PERF_TEST_P(SobelFixture, Sobel,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), dx = 1, dy = 1;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type, sizeof(float) * 2);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::Sobel(src, dst, -1, dx, dy);
|
||||
|
||||
SANITY_CHECK(dst, 1e-6);
|
||||
}
|
||||
|
||||
///////////// Scharr ////////////////////////
|
||||
|
||||
typedef Size_MatType ScharrFixture;
|
||||
|
||||
OCL_PERF_TEST_P(ScharrFixture, Scharr,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), dx = 1, dy = 0;
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-5;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type, sizeof(float) * 2);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::Scharr(src, dst, -1, dx, dy);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// GaussianBlur ////////////////////////
|
||||
|
||||
typedef FilterFixture OCL_GaussianBlurFixture;
|
||||
|
||||
PERF_TEST_P_(OCL_GaussianBlurFixture, GaussianBlur)
|
||||
{
|
||||
const FilterParams& params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), ksize = get<2>(params);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::GaussianBlur(src, dst, Size(ksize, ksize), 1, 1, cv::BORDER_CONSTANT);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(/*nothing*/, OCL_GaussianBlurFixture,
|
||||
::testing::Combine(
|
||||
OCL_TEST_SIZES,
|
||||
OCL_TEST_TYPES,
|
||||
OCL_PERF_ENUM(3, 5, 7)
|
||||
)
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SIFT, OCL_GaussianBlurFixture,
|
||||
::testing::Combine(
|
||||
::testing::Values(sz1080p),
|
||||
::testing::Values(CV_32FC1),
|
||||
OCL_PERF_ENUM(11, 13, 17, 21, 27)
|
||||
)
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DISABLED_FULL, OCL_GaussianBlurFixture,
|
||||
::testing::Combine(
|
||||
::testing::Values(sz1080p),
|
||||
::testing::Values(
|
||||
CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4,
|
||||
CV_8SC1, CV_8SC2, CV_8SC3, CV_8SC4,
|
||||
CV_16UC1, CV_16UC2, CV_16UC3, CV_16UC4,
|
||||
CV_16SC1, CV_16SC2, CV_16SC3, CV_16SC4,
|
||||
CV_32SC1, CV_32SC2, CV_32SC3, CV_32SC4,
|
||||
CV_32FC1, CV_32FC2, CV_32FC3, CV_32FC4,
|
||||
CV_64FC1, CV_64FC2, CV_64FC3, CV_64FC4
|
||||
),
|
||||
OCL_PERF_ENUM(3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
///////////// Filter2D ////////////////////////
|
||||
|
||||
typedef FilterFixture Filter2DFixture;
|
||||
|
||||
OCL_PERF_TEST_P(Filter2DFixture, Filter2D,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, OCL_PERF_ENUM(3, 5)))
|
||||
{
|
||||
const FilterParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), ksize = get<2>(params);
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-5;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
Mat kernel(ksize, ksize, CV_32SC1);
|
||||
declare.in(src, WARMUP_RNG).in(kernel).out(dst);
|
||||
randu(kernel, -3.0, 3.0);
|
||||
|
||||
OCL_TEST_CYCLE() cv::filter2D(src, dst, -1, kernel);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// SepFilter2D /////////////
|
||||
|
||||
typedef FilterFixture OCL_SepFilter2D;
|
||||
|
||||
PERF_TEST_P_(OCL_SepFilter2D, SepFilter2D)
|
||||
{
|
||||
const FilterParams& params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), ksize = get<2>(params);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
Mat kernelX(1, ksize, CV_32FC1);
|
||||
randu(kernelX, -3.0, 3.0);
|
||||
Mat kernelY(1, ksize, CV_32FC1);
|
||||
randu(kernelY, -3.0, 3.0);
|
||||
|
||||
OCL_TEST_CYCLE() cv::sepFilter2D(src, dst, -1, kernelX, kernelY, cv::Point(-1, -1), 1.0f, cv::BORDER_CONSTANT);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P_(OCL_SepFilter2D, SepFilter2D_BitExact)
|
||||
{
|
||||
const FilterParams& params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), ksize = get<2>(params);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
Mat kernelX(1, ksize, CV_32SC1);
|
||||
randu(kernelX, -16.0, 16.0);
|
||||
kernelX.convertTo(kernelX, CV_32FC1, 1/16.0f, 0);
|
||||
Mat kernelY(1, ksize, CV_32SC1);
|
||||
randu(kernelY, -16.0, 16.0);
|
||||
kernelY.convertTo(kernelY, CV_32FC1, 1/16.0f, 0);
|
||||
|
||||
OCL_TEST_CYCLE() cv::sepFilter2D(src, dst, -1, kernelX, kernelY, cv::Point(-1, -1), 1.0f, cv::BORDER_CONSTANT);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(/*nothing*/, OCL_SepFilter2D,
|
||||
::testing::Combine(
|
||||
::testing::Values(sz1080p),
|
||||
OCL_TEST_TYPES,
|
||||
OCL_PERF_ENUM(3, 5, 7, 9, 11)
|
||||
)
|
||||
);
|
||||
|
||||
///////////// Bilateral ////////////////////////
|
||||
|
||||
typedef TestBaseWithParam<Size> BilateralFixture;
|
||||
|
||||
OCL_PERF_TEST_P(BilateralFixture, Bilateral, OCL_TEST_SIZES)
|
||||
{
|
||||
const Size srcSize = GetParam();
|
||||
const int d = 7;
|
||||
const double sigmacolor = 50.0, sigmaspace = 50.0;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1);
|
||||
|
||||
UMat src(srcSize, CV_8UC1), dst(srcSize, CV_8UC1);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::bilateralFilter(src, dst, d, sigmacolor, sigmaspace);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
///////////// MedianBlur ////////////////////////
|
||||
|
||||
typedef tuple<Size, int> MedianBlurParams;
|
||||
typedef TestBaseWithParam<MedianBlurParams> MedianBlurFixture;
|
||||
|
||||
OCL_PERF_TEST_P(MedianBlurFixture, Bilateral, ::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(3, 5)))
|
||||
{
|
||||
MedianBlurParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int ksize = get<1>(params);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1);
|
||||
|
||||
UMat src(srcSize, CV_8UC1), dst(srcSize, CV_8UC1);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::medianBlur(src, dst, ksize);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
116
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_gftt.cpp
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
//////////////////////////// GoodFeaturesToTrack //////////////////////////
|
||||
|
||||
typedef tuple<String, double, bool> GoodFeaturesToTrackParams;
|
||||
typedef TestBaseWithParam<GoodFeaturesToTrackParams> GoodFeaturesToTrackFixture;
|
||||
|
||||
OCL_PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrack,
|
||||
::testing::Combine(OCL_PERF_ENUM(String("gpu/opticalflow/rubberwhale1.png")),
|
||||
OCL_PERF_ENUM(0.0, 3.0), Bool()))
|
||||
{
|
||||
GoodFeaturesToTrackParams params = GetParam();
|
||||
const String fileName = get<0>(params);
|
||||
const double minDistance = get<1>(params), qualityLevel = 0.01;
|
||||
const bool harrisDetector = get<2>(params);
|
||||
const int maxCorners = 1000;
|
||||
|
||||
Mat img = imread(getDataPath(fileName), cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img.empty()) << "could not load " << fileName;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(img.size(), img.type());
|
||||
|
||||
UMat src(img.size(), img.type()), dst(1, maxCorners, CV_32FC2);
|
||||
img.copyTo(src);
|
||||
|
||||
declare.in(src, WARMUP_READ).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::goodFeaturesToTrack(src, dst, maxCorners, qualityLevel,
|
||||
minDistance, noArray(), 3, 3, harrisDetector, 0.04);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
OCL_PERF_TEST_P(GoodFeaturesToTrackFixture, GoodFeaturesToTrackWithQuality,
|
||||
::testing::Combine(OCL_PERF_ENUM(String("gpu/opticalflow/rubberwhale1.png")),
|
||||
OCL_PERF_ENUM(3.0), Bool()))
|
||||
{
|
||||
GoodFeaturesToTrackParams params = GetParam();
|
||||
const String fileName = get<0>(params);
|
||||
const double minDistance = get<1>(params), qualityLevel = 0.01;
|
||||
const bool harrisDetector = get<2>(params);
|
||||
const int maxCorners = 1000;
|
||||
|
||||
Mat img = imread(getDataPath(fileName), cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img.empty()) << "could not load " << fileName;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(img.size(), img.type());
|
||||
|
||||
UMat src(img.size(), img.type()), dst(1, maxCorners, CV_32FC2);
|
||||
img.copyTo(src);
|
||||
|
||||
std::vector<float> cornersQuality;
|
||||
|
||||
declare.in(src, WARMUP_READ).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::goodFeaturesToTrack(src, dst, maxCorners, qualityLevel, minDistance,
|
||||
noArray(), cornersQuality, 3, 3, harrisDetector, 0.04);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
SANITY_CHECK(cornersQuality, 1e-6);
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif
|
||||
91
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_houghlines.cpp
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
// Copyright (C) 2014, Itseez, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// HoughLines //////////////////////
|
||||
|
||||
struct Vec2fComparator
|
||||
{
|
||||
bool operator()(const Vec2f& a, const Vec2f b) const
|
||||
{
|
||||
if(a[0] != b[0]) return a[0] < b[0];
|
||||
else return a[1] < b[1];
|
||||
}
|
||||
};
|
||||
|
||||
typedef tuple<Size, double, double> ImageSize_RhoStep_ThetaStep_t;
|
||||
typedef TestBaseWithParam<ImageSize_RhoStep_ThetaStep_t> HoughLinesFixture;
|
||||
|
||||
OCL_PERF_TEST_P(HoughLinesFixture, HoughLines, Combine(OCL_TEST_SIZES,
|
||||
Values( 0.1, 1 ),
|
||||
Values( CV_PI / 180.0, 0.1 )))
|
||||
{
|
||||
const Size srcSize = get<0>(GetParam());
|
||||
double rhoStep = get<1>(GetParam());
|
||||
double thetaStep = get<2>(GetParam());
|
||||
int threshold = 250;
|
||||
|
||||
UMat usrc(srcSize, CV_8UC1), lines(1, 1, CV_32FC2);
|
||||
Mat src(srcSize, CV_8UC1);
|
||||
src.setTo(Scalar::all(0));
|
||||
line(src, Point(0, 100), Point(src.cols, 100), Scalar::all(255), 1);
|
||||
line(src, Point(0, 200), Point(src.cols, 200), Scalar::all(255), 1);
|
||||
line(src, Point(0, 400), Point(src.cols, 400), Scalar::all(255), 1);
|
||||
line(src, Point(100, 0), Point(100, src.rows), Scalar::all(255), 1);
|
||||
line(src, Point(200, 0), Point(200, src.rows), Scalar::all(255), 1);
|
||||
line(src, Point(400, 0), Point(400, src.rows), Scalar::all(255), 1);
|
||||
src.copyTo(usrc);
|
||||
|
||||
declare.in(usrc).out(lines);
|
||||
|
||||
OCL_TEST_CYCLE() cv::HoughLines(usrc, lines, rhoStep, thetaStep, threshold);
|
||||
|
||||
Mat result;
|
||||
lines.copyTo(result);
|
||||
std::sort(result.begin<Vec2f>(), result.end<Vec2f>(), Vec2fComparator());
|
||||
|
||||
SANITY_CHECK(result, 1e-6);
|
||||
}
|
||||
|
||||
///////////// HoughLinesP /////////////////////
|
||||
|
||||
typedef tuple<string, double, double> Image_RhoStep_ThetaStep_t;
|
||||
typedef TestBaseWithParam<Image_RhoStep_ThetaStep_t> HoughLinesPFixture;
|
||||
|
||||
OCL_PERF_TEST_P(HoughLinesPFixture, HoughLinesP, Combine(Values("cv/shared/pic5.png", "stitching/a1.png"),
|
||||
Values( 0.1, 1 ),
|
||||
Values( CV_PI / 180.0, 0.1 )))
|
||||
{
|
||||
string filename = get<0>(GetParam());
|
||||
double rhoStep = get<1>(GetParam());
|
||||
double thetaStep = get<2>(GetParam());
|
||||
int threshold = 100;
|
||||
double minLineLength = 50, maxGap = 5;
|
||||
|
||||
Mat image = imread(getDataPath(filename), IMREAD_GRAYSCALE);
|
||||
Canny(image, image, 50, 200, 3);
|
||||
UMat usrc, lines(1, 1, CV_32SC4);
|
||||
image.copyTo(usrc);
|
||||
|
||||
declare.in(usrc).out(lines);
|
||||
|
||||
OCL_TEST_CYCLE() cv::HoughLinesP(usrc, lines, rhoStep, thetaStep, threshold, minLineLength, maxGap);
|
||||
|
||||
EXPECT_NE((int) lines.total(), 0);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
336
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_imgproc.cpp
vendored
Normal file
@ -0,0 +1,336 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// @Authors
|
||||
// Fangfang Bai, fangfang@multicorewareinc.com
|
||||
// Jin Ma, jin@multicorewareinc.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors as is and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// equalizeHist ////////////////////////
|
||||
|
||||
typedef TestBaseWithParam<Size> EqualizeHistFixture;
|
||||
|
||||
OCL_PERF_TEST_P(EqualizeHistFixture, EqualizeHist, OCL_TEST_SIZES)
|
||||
{
|
||||
const Size srcSize = GetParam();
|
||||
const double eps = 1;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1);
|
||||
|
||||
UMat src(srcSize, CV_8UC1), dst(srcSize, CV_8UC1);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::equalizeHist(src, dst);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// calcHist ////////////////////////
|
||||
|
||||
typedef TestBaseWithParam<Size> CalcHistFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CalcHistFixture, CalcHist, OCL_TEST_SIZES)
|
||||
{
|
||||
const Size srcSize = GetParam();
|
||||
|
||||
const std::vector<int> channels(1, 0);
|
||||
std::vector<float> ranges(2);
|
||||
std::vector<int> histSize(1, 256);
|
||||
ranges[0] = 0;
|
||||
ranges[1] = 256;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1);
|
||||
|
||||
UMat src(srcSize, CV_8UC1), hist(256, 1, CV_32FC1);
|
||||
declare.in(src, WARMUP_RNG).out(hist);
|
||||
|
||||
OCL_TEST_CYCLE() cv::calcHist(std::vector<UMat>(1, src), channels, noArray(), hist, histSize, ranges, false);
|
||||
|
||||
SANITY_CHECK(hist);
|
||||
}
|
||||
|
||||
///////////// calcHist ////////////////////////
|
||||
|
||||
typedef TestBaseWithParam<Size> CalcBackProjFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CalcBackProjFixture, CalcBackProj, OCL_TEST_SIZES)
|
||||
{
|
||||
const Size srcSize = GetParam();
|
||||
|
||||
const std::vector<int> channels(1, 0);
|
||||
std::vector<float> ranges(2);
|
||||
std::vector<int> histSize(1, 256);
|
||||
ranges[0] = 0;
|
||||
ranges[1] = 256;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1);
|
||||
|
||||
UMat src(srcSize, CV_8UC1), hist(256, 1, CV_32FC1), dst(srcSize, CV_8UC1);
|
||||
declare.in(src, WARMUP_RNG).out(hist);
|
||||
|
||||
cv::calcHist(std::vector<UMat>(1, src), channels, noArray(), hist, histSize, ranges, false);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
OCL_TEST_CYCLE() cv::calcBackProject(std::vector<UMat>(1,src), channels, hist, dst, ranges, 1);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
|
||||
/////////// CopyMakeBorder //////////////////////
|
||||
|
||||
CV_ENUM(Border, BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT, BORDER_WRAP, BORDER_REFLECT_101)
|
||||
|
||||
typedef tuple<Size, MatType, Border> CopyMakeBorderParamType;
|
||||
typedef TestBaseWithParam<CopyMakeBorderParamType> CopyMakeBorderFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CopyMakeBorderFixture, CopyMakeBorder,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134, Border::all()))
|
||||
{
|
||||
const CopyMakeBorderParamType params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), borderType = get<2>(params);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst;
|
||||
const Size dstSize = srcSize + Size(12, 12);
|
||||
dst.create(dstSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::copyMakeBorder(src, dst, 7, 5, 5, 7, borderType, cv::Scalar(1.0));
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
///////////// CornerMinEigenVal ////////////////////////
|
||||
|
||||
typedef Size_MatType CornerMinEigenValFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CornerMinEigenValFixture, CornerMinEigenVal,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), borderType = BORDER_REFLECT;
|
||||
const int blockSize = 7, apertureSize = 1 + 2 * 3;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, CV_32FC1);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::cornerMinEigenVal(src, dst, blockSize, apertureSize, borderType);
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
bool strictCheck = !ocl::useOpenCL() || ocl::Device::getDefault().isIntel();
|
||||
#else
|
||||
bool strictCheck = true;
|
||||
#endif
|
||||
|
||||
// using native_* OpenCL functions on non-intel devices may lose accuracy
|
||||
if (strictCheck)
|
||||
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
|
||||
else
|
||||
SANITY_CHECK(dst, 0.1, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
///////////// CornerHarris ////////////////////////
|
||||
|
||||
typedef Size_MatType CornerHarrisFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CornerHarrisFixture, CornerHarris,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), borderType = BORDER_REFLECT;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, CV_32FC1);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::cornerHarris(src, dst, 5, 7, 0.1, borderType);
|
||||
|
||||
SANITY_CHECK(dst, 5e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
///////////// PreCornerDetect ////////////////////////
|
||||
|
||||
typedef Size_MatType PreCornerDetectFixture;
|
||||
|
||||
OCL_PERF_TEST_P(PreCornerDetectFixture, PreCornerDetect,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_8UC1, CV_32FC1)))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), borderType = BORDER_REFLECT;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, CV_32FC1);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::preCornerDetect(src, dst, 3, borderType);
|
||||
|
||||
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
///////////// Integral ////////////////////////
|
||||
|
||||
typedef tuple<Size, MatDepth> IntegralParams;
|
||||
typedef TestBaseWithParam<IntegralParams> IntegralFixture;
|
||||
|
||||
OCL_PERF_TEST_P(IntegralFixture, Integral1, ::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32S, CV_32F)))
|
||||
{
|
||||
const IntegralParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int ddepth = get<1>(params);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, ddepth);
|
||||
|
||||
UMat src(srcSize, CV_8UC1), dst(srcSize + Size(1, 1), ddepth);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::integral(src, dst, ddepth);
|
||||
|
||||
SANITY_CHECK(dst, 2e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
OCL_PERF_TEST_P(IntegralFixture, Integral2, ::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(CV_32S, CV_32F)))
|
||||
{
|
||||
const IntegralParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int ddepth = get<1>(params);
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, ddepth);
|
||||
|
||||
UMat src(srcSize, CV_8UC1), sum(srcSize + Size(1, 1), ddepth), sqsum(srcSize + Size(1, 1), CV_32F);
|
||||
declare.in(src, WARMUP_RNG).out(sum, sqsum);
|
||||
|
||||
OCL_TEST_CYCLE() cv::integral(src, sum, sqsum, ddepth, CV_32F);
|
||||
|
||||
SANITY_CHECK(sum, 2e-4, ERROR_RELATIVE);
|
||||
SANITY_CHECK(sqsum, 5e-5, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
///////////// Threshold ////////////////////////
|
||||
|
||||
CV_ENUM(ThreshType, THRESH_BINARY, THRESH_BINARY_INV, THRESH_TRUNC, THRESH_TOZERO_INV)
|
||||
|
||||
typedef tuple<Size, MatType, ThreshType> ThreshParams;
|
||||
typedef TestBaseWithParam<ThreshParams> ThreshFixture;
|
||||
|
||||
OCL_PERF_TEST_P(ThreshFixture, Threshold,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES, ThreshType::all()))
|
||||
{
|
||||
const ThreshParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int srcType = get<1>(params);
|
||||
const int threshType = get<2>(params);
|
||||
const double maxValue = 220.0, threshold = 50;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, srcType);
|
||||
|
||||
UMat src(srcSize, srcType), dst(srcSize, srcType);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::threshold(src, dst, threshold, maxValue, threshType);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
///////////// CLAHE ////////////////////////
|
||||
|
||||
typedef TestBaseWithParam<Size> CLAHEFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CLAHEFixture, CLAHE, OCL_TEST_SIZES)
|
||||
{
|
||||
const Size srcSize = GetParam();
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, CV_8UC1);
|
||||
|
||||
UMat src(srcSize, CV_8UC1), dst(srcSize, CV_8UC1);
|
||||
const double clipLimit = 40.0;
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE(clipLimit);
|
||||
OCL_TEST_CYCLE() clahe->apply(src, dst);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
///////////// Canny ////////////////////////
|
||||
|
||||
typedef tuple<Size, int, bool> CannyParams;
|
||||
typedef TestBaseWithParam<CannyParams> CannyFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CannyFixture, Canny, ::testing::Combine(OCL_TEST_SIZES, OCL_PERF_ENUM(3, 5), Bool()))
|
||||
{
|
||||
const CannyParams& params = GetParam();
|
||||
cv::Size imgSize = get<0>(params);
|
||||
int apertureSize = get<1>(params);
|
||||
bool L2Grad = get<2>(params);
|
||||
|
||||
Mat _img = imread(getDataPath("gpu/stereobm/aloe-L.png"), cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_TRUE(!_img.empty()) << "can't open aloe-L.png";
|
||||
|
||||
UMat img;
|
||||
cv::resize(_img, img, imgSize, 0, 0, INTER_LINEAR_EXACT);
|
||||
UMat edges(img.size(), CV_8UC1);
|
||||
|
||||
declare.in(img).out(edges);
|
||||
|
||||
PERF_SAMPLE_BEGIN();
|
||||
cv::Canny(img, edges, 50.0, 100.0, apertureSize, L2Grad);
|
||||
PERF_SAMPLE_END();
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
237
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_imgwarp.cpp
vendored
Normal file
@ -0,0 +1,237 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// @Authors
|
||||
// Fangfang Bai, fangfang@multicorewareinc.com
|
||||
// Jin Ma, jin@multicorewareinc.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors as is and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// WarpAffine ////////////////////////
|
||||
|
||||
CV_ENUM(InterType, INTER_NEAREST, INTER_LINEAR, INTER_CUBIC)
|
||||
|
||||
typedef tuple<Size, MatType, InterType> WarpAffineParams;
|
||||
typedef TestBaseWithParam<WarpAffineParams> WarpAffineFixture;
|
||||
|
||||
OCL_PERF_TEST_P(WarpAffineFixture, WarpAffine,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134, InterType::all()))
|
||||
{
|
||||
static const double coeffs[2][3] =
|
||||
{
|
||||
{ cos(CV_PI / 6), -sin(CV_PI / 6), 100.0 },
|
||||
{ sin(CV_PI / 6), cos(CV_PI / 6) , -100.0 }
|
||||
};
|
||||
Mat M(2, 3, CV_64F, (void *)coeffs);
|
||||
|
||||
const WarpAffineParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), interpolation = get<2>(params);
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : interpolation == INTER_CUBIC ? 2e-3 : 1e-4;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::warpAffine(src, dst, M, srcSize, interpolation);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// WarpPerspective ////////////////////////
|
||||
|
||||
typedef WarpAffineParams WarpPerspectiveParams;
|
||||
typedef TestBaseWithParam<WarpPerspectiveParams> WarpPerspectiveFixture;
|
||||
|
||||
OCL_PERF_TEST_P(WarpPerspectiveFixture, WarpPerspective,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134,
|
||||
OCL_PERF_ENUM(InterType(INTER_NEAREST), InterType(INTER_LINEAR))))
|
||||
{
|
||||
static const double coeffs[3][3] =
|
||||
{
|
||||
{cos(CV_PI / 6), -sin(CV_PI / 6), 100.0},
|
||||
{sin(CV_PI / 6), cos(CV_PI / 6), -100.0},
|
||||
{0.0, 0.0, 1.0}
|
||||
};
|
||||
Mat M(3, 3, CV_64F, (void *)coeffs);
|
||||
|
||||
const WarpPerspectiveParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), interpolation = get<2>(params);
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-4;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::warpPerspective(src, dst, M, srcSize, interpolation);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// Resize ////////////////////////
|
||||
|
||||
typedef tuple<Size, MatType, InterType, double> ResizeParams;
|
||||
typedef TestBaseWithParam<ResizeParams> ResizeFixture;
|
||||
|
||||
OCL_PERF_TEST_P(ResizeFixture, Resize,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134,
|
||||
OCL_PERF_ENUM(InterType(INTER_NEAREST), InterType(INTER_LINEAR)),
|
||||
::testing::Values(0.5, 2.0)))
|
||||
{
|
||||
const ResizeParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), interType = get<2>(params);
|
||||
double scale = get<3>(params);
|
||||
const Size dstSize(cvRound(srcSize.width * scale), cvRound(srcSize.height * scale));
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-4;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
checkDeviceMaxMemoryAllocSize(dstSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(dstSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::resize(src, dst, Size(), scale, scale, interType);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
typedef tuple<Size, MatType, double> ResizeAreaParams;
|
||||
typedef TestBaseWithParam<ResizeAreaParams> ResizeAreaFixture;
|
||||
|
||||
OCL_PERF_TEST_P(ResizeAreaFixture, Resize,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134, ::testing::Values(0.3, 0.5, 0.6)))
|
||||
{
|
||||
const ResizeAreaParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params);
|
||||
double scale = get<2>(params);
|
||||
const Size dstSize(cvRound(srcSize.width * scale), cvRound(srcSize.height * scale));
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-4;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
checkDeviceMaxMemoryAllocSize(dstSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(dstSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::resize(src, dst, Size(), scale, scale, cv::INTER_AREA);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
typedef ResizeAreaParams ResizeLinearExactParams;
|
||||
typedef TestBaseWithParam<ResizeLinearExactParams> ResizeLinearExactFixture;
|
||||
|
||||
OCL_PERF_TEST_P(ResizeLinearExactFixture, Resize,
|
||||
::testing::Combine(OCL_TEST_SIZES, ::testing::Values(CV_8UC1, CV_8UC3, CV_8UC4), ::testing::Values(0.5, 2.0)))
|
||||
{
|
||||
const ResizeAreaParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params);
|
||||
double scale = get<2>(params);
|
||||
const Size dstSize(cvRound(srcSize.width * scale), cvRound(srcSize.height * scale));
|
||||
const double eps = 1e-4;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
checkDeviceMaxMemoryAllocSize(dstSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(dstSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::resize(src, dst, Size(), scale, scale, cv::INTER_LINEAR_EXACT);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// Remap ////////////////////////
|
||||
|
||||
typedef tuple<Size, MatType, InterType> RemapParams;
|
||||
typedef TestBaseWithParam<RemapParams> RemapFixture;
|
||||
|
||||
OCL_PERF_TEST_P(RemapFixture, Remap,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134,
|
||||
OCL_PERF_ENUM(InterType(INTER_NEAREST), InterType(INTER_LINEAR))))
|
||||
{
|
||||
const RemapParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), interpolation = get<2>(params), borderMode = BORDER_CONSTANT;
|
||||
//const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-4;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(srcSize, type);
|
||||
UMat xmap(srcSize, CV_32FC1), ymap(srcSize, CV_32FC1);
|
||||
|
||||
{
|
||||
Mat _xmap = xmap.getMat(ACCESS_WRITE), _ymap = ymap.getMat(ACCESS_WRITE);
|
||||
for (int i = 0; i < srcSize.height; ++i)
|
||||
{
|
||||
float * const xmap_row = _xmap.ptr<float>(i);
|
||||
float * const ymap_row = _ymap.ptr<float>(i);
|
||||
|
||||
for (int j = 0; j < srcSize.width; ++j)
|
||||
{
|
||||
xmap_row[j] = (j - srcSize.width * 0.5f) * 0.75f + srcSize.width * 0.5f;
|
||||
ymap_row[j] = (i - srcSize.height * 0.5f) * 0.75f + srcSize.height * 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
declare.in(src, WARMUP_RNG).in(xmap, ymap, WARMUP_READ).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::remap(src, dst, xmap, ymap, interpolation, borderMode);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
88
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_matchTemplate.cpp
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
CV_ENUM(MethodType, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED)
|
||||
|
||||
typedef tuple<Size, Size, MethodType, MatType> ImgSize_TmplSize_Method_MatType_t;
|
||||
typedef TestBaseWithParam<ImgSize_TmplSize_Method_MatType_t> ImgSize_TmplSize_Method_MatType;
|
||||
|
||||
OCL_PERF_TEST_P(ImgSize_TmplSize_Method_MatType, MatchTemplate,
|
||||
::testing::Combine(
|
||||
testing::Values(cv::Size(640, 480), cv::Size(1280, 1024)),
|
||||
testing::Values(cv::Size(11, 11), cv::Size(16, 16), cv::Size(41, 41)),
|
||||
MethodType::all(),
|
||||
testing::Values(CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3)
|
||||
)
|
||||
)
|
||||
{
|
||||
const ImgSize_TmplSize_Method_MatType_t params = GetParam();
|
||||
const Size imgSz = get<0>(params), tmplSz = get<1>(params);
|
||||
const int method = get<2>(params);
|
||||
int type = get<3>(GetParam());
|
||||
|
||||
UMat img(imgSz, type), tmpl(tmplSz, type);
|
||||
UMat result(imgSz - tmplSz + Size(1, 1), CV_32F);
|
||||
|
||||
declare.in(img, tmpl, WARMUP_RNG).out(result);
|
||||
|
||||
OCL_TEST_CYCLE() matchTemplate(img, tmpl, result, method);
|
||||
|
||||
bool isNormed =
|
||||
method == TM_CCORR_NORMED ||
|
||||
method == TM_SQDIFF_NORMED ||
|
||||
method == TM_CCOEFF_NORMED;
|
||||
double eps = isNormed ? 3e-2
|
||||
: 255 * 255 * tmpl.total() * 1e-4;
|
||||
|
||||
SANITY_CHECK(result, eps, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
/////////// matchTemplate (performance tests from 2.4) ////////////////////////
|
||||
|
||||
typedef Size_MatType CV_TM_CCORRFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CV_TM_CCORRFixture, matchTemplate,
|
||||
::testing::Combine(::testing::Values(Size(1000, 1000), Size(2000, 2000)),
|
||||
OCL_PERF_ENUM(CV_32FC1, CV_32FC4)))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params), templSize(5, 5);
|
||||
const int type = get<1>(params);
|
||||
|
||||
UMat src(srcSize, type), templ(templSize, type);
|
||||
const Size dstSize(src.cols - templ.cols + 1, src.rows - templ.rows + 1);
|
||||
UMat dst(dstSize, CV_32F);
|
||||
|
||||
declare.in(src, templ, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::matchTemplate(src, templ, dst, CV_TM_CCORR);
|
||||
|
||||
SANITY_CHECK(dst, 1e-4);
|
||||
}
|
||||
|
||||
typedef TestBaseWithParam<Size> CV_TM_CCORR_NORMEDFixture;
|
||||
|
||||
OCL_PERF_TEST_P(CV_TM_CCORR_NORMEDFixture, matchTemplate,
|
||||
::testing::Values(Size(1000, 1000), Size(2000, 2000), Size(4000, 4000)))
|
||||
{
|
||||
const Size srcSize = GetParam(), templSize(5, 5);
|
||||
|
||||
UMat src(srcSize, CV_8UC1), templ(templSize, CV_8UC1);
|
||||
const Size dstSize(src.cols - templ.cols + 1, src.rows - templ.rows + 1);
|
||||
UMat dst(dstSize, CV_8UC1);
|
||||
|
||||
declare.in(src, templ, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::matchTemplate(src, templ, dst, CV_TM_CCORR_NORMED);
|
||||
|
||||
SANITY_CHECK(dst, 3e-2);
|
||||
}
|
||||
|
||||
} } // namespace
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
78
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_moments.cpp
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// @Authors
|
||||
// Fangfang Bai, fangfang@multicorewareinc.com
|
||||
// Jin Ma, jin@multicorewareinc.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other Materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors as is and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// Moments ////////////////////////
|
||||
|
||||
typedef tuple<Size, bool> MomentsParams;
|
||||
typedef TestBaseWithParam<MomentsParams> MomentsFixture;
|
||||
|
||||
OCL_PERF_TEST_P(MomentsFixture, Moments,
|
||||
::testing::Combine(OCL_TEST_SIZES, ::testing::Bool()))
|
||||
{
|
||||
const MomentsParams params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const bool binaryImage = get<1>(params);
|
||||
|
||||
cv::Moments m;
|
||||
UMat src(srcSize, CV_8UC1);
|
||||
declare.in(src, WARMUP_RNG);
|
||||
|
||||
OCL_TEST_CYCLE() m = cv::moments(src, binaryImage);
|
||||
|
||||
SANITY_CHECK_MOMENTS(m, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
134
3rdparty/opencv-4.5.4/modules/imgproc/perf/opencl/perf_pyramid.cpp
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// @Authors
|
||||
// Fangfang Bai, fangfang@multicorewareinc.com
|
||||
// Jin Ma, jin@multicorewareinc.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors as is and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
///////////// PyrDown //////////////////////
|
||||
|
||||
typedef Size_MatType PyrDownFixture;
|
||||
|
||||
OCL_PERF_TEST_P(PyrDownFixture, PyrDown,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params);
|
||||
const Size dstSize((srcSize.height + 1) >> 1, (srcSize.width + 1) >> 1);
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-5;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
checkDeviceMaxMemoryAllocSize(dstSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(dstSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::pyrDown(src, dst);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// PyrUp ////////////////////////
|
||||
|
||||
typedef Size_MatType PyrUpFixture;
|
||||
|
||||
OCL_PERF_TEST_P(PyrUpFixture, PyrUp,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params);
|
||||
const Size dstSize(srcSize.height << 1, srcSize.width << 1);
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-5;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
checkDeviceMaxMemoryAllocSize(dstSize, type);
|
||||
|
||||
UMat src(srcSize, type), dst(dstSize, type);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
OCL_TEST_CYCLE() cv::pyrUp(src, dst);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
///////////// buildPyramid ////////////////////////
|
||||
|
||||
typedef Size_MatType BuildPyramidFixture;
|
||||
|
||||
OCL_PERF_TEST_P(BuildPyramidFixture, BuildPyramid,
|
||||
::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES_134))
|
||||
{
|
||||
const Size_MatType_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const int type = get<1>(params), maxLevel = 5;
|
||||
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-5;
|
||||
|
||||
checkDeviceMaxMemoryAllocSize(srcSize, type);
|
||||
|
||||
std::vector<UMat> dst(maxLevel);
|
||||
UMat src(srcSize, type);
|
||||
declare.in(src, WARMUP_RNG);
|
||||
|
||||
OCL_TEST_CYCLE() cv::buildPyramid(src, dst, maxLevel);
|
||||
|
||||
UMat dst0 = dst[0], dst1 = dst[1], dst2 = dst[2], dst3 = dst[3], dst4 = dst[4];
|
||||
|
||||
SANITY_CHECK(dst0, eps);
|
||||
SANITY_CHECK(dst1, eps);
|
||||
SANITY_CHECK(dst2, eps);
|
||||
SANITY_CHECK(dst3, eps);
|
||||
SANITY_CHECK(dst4, eps);
|
||||
}
|
||||
|
||||
} } // namespace opencv_test::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
106
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_accumulate.cpp
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
typedef Size_MatType Accumulate;
|
||||
|
||||
#define MAT_TYPES_ACCUMLATE CV_8UC1, CV_16UC1, CV_32FC1
|
||||
#define MAT_TYPES_ACCUMLATE_C MAT_TYPES_ACCUMLATE, CV_8UC3, CV_16UC3, CV_32FC3
|
||||
#define MAT_TYPES_ACCUMLATE_D MAT_TYPES_ACCUMLATE, CV_64FC1
|
||||
#define MAT_TYPES_ACCUMLATE_D_C MAT_TYPES_ACCUMLATE_C, CV_64FC1, CV_64FC1
|
||||
|
||||
#define PERF_ACCUMULATE_INIT(_FLTC) \
|
||||
const Size srcSize = get<0>(GetParam()); \
|
||||
const int srcType = get<1>(GetParam()); \
|
||||
const int dstType = _FLTC(CV_MAT_CN(srcType)); \
|
||||
Mat src1(srcSize, srcType), dst(srcSize, dstType); \
|
||||
declare.in(src1, dst, WARMUP_RNG).out(dst);
|
||||
|
||||
#define PERF_ACCUMULATE_MASK_INIT(_FLTC) \
|
||||
PERF_ACCUMULATE_INIT(_FLTC) \
|
||||
Mat mask(srcSize, CV_8UC1); \
|
||||
declare.in(mask, WARMUP_RNG);
|
||||
|
||||
#define PERF_TEST_P_ACCUMULATE(_NAME, _TYPES, _INIT, _FUN) \
|
||||
PERF_TEST_P(Accumulate, _NAME, \
|
||||
testing::Combine( \
|
||||
testing::Values(sz1080p, sz720p, szVGA, szQVGA, szODD), \
|
||||
testing::Values(_TYPES) \
|
||||
) \
|
||||
) \
|
||||
{ \
|
||||
_INIT \
|
||||
TEST_CYCLE() _FUN; \
|
||||
SANITY_CHECK_NOTHING(); \
|
||||
}
|
||||
|
||||
/////////////////////////////////// Accumulate ///////////////////////////////////
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(Accumulate, MAT_TYPES_ACCUMLATE,
|
||||
PERF_ACCUMULATE_INIT(CV_32FC), accumulate(src1, dst))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(AccumulateMask, MAT_TYPES_ACCUMLATE_C,
|
||||
PERF_ACCUMULATE_MASK_INIT(CV_32FC), accumulate(src1, dst, mask))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(AccumulateDouble, MAT_TYPES_ACCUMLATE_D,
|
||||
PERF_ACCUMULATE_INIT(CV_64FC), accumulate(src1, dst))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(AccumulateDoubleMask, MAT_TYPES_ACCUMLATE_D_C,
|
||||
PERF_ACCUMULATE_MASK_INIT(CV_64FC), accumulate(src1, dst, mask))
|
||||
|
||||
///////////////////////////// AccumulateSquare ///////////////////////////////////
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(Square, MAT_TYPES_ACCUMLATE,
|
||||
PERF_ACCUMULATE_INIT(CV_32FC), accumulateSquare(src1, dst))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(SquareMask, MAT_TYPES_ACCUMLATE_C,
|
||||
PERF_ACCUMULATE_MASK_INIT(CV_32FC), accumulateSquare(src1, dst, mask))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(SquareDouble, MAT_TYPES_ACCUMLATE_D,
|
||||
PERF_ACCUMULATE_INIT(CV_64FC), accumulateSquare(src1, dst))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(SquareDoubleMask, MAT_TYPES_ACCUMLATE_D_C,
|
||||
PERF_ACCUMULATE_MASK_INIT(CV_64FC), accumulateSquare(src1, dst, mask))
|
||||
|
||||
///////////////////////////// AccumulateProduct ///////////////////////////////////
|
||||
|
||||
#define PERF_ACCUMULATE_INIT_2(_FLTC) \
|
||||
PERF_ACCUMULATE_INIT(_FLTC) \
|
||||
Mat src2(srcSize, srcType); \
|
||||
declare.in(src2);
|
||||
|
||||
#define PERF_ACCUMULATE_MASK_INIT_2(_FLTC) \
|
||||
PERF_ACCUMULATE_MASK_INIT(_FLTC) \
|
||||
Mat src2(srcSize, srcType); \
|
||||
declare.in(src2);
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(Product, MAT_TYPES_ACCUMLATE,
|
||||
PERF_ACCUMULATE_INIT_2(CV_32FC), accumulateProduct(src1, src2, dst))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(ProductMask, MAT_TYPES_ACCUMLATE_C,
|
||||
PERF_ACCUMULATE_MASK_INIT_2(CV_32FC), accumulateProduct(src1, src2, dst, mask))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(ProductDouble, MAT_TYPES_ACCUMLATE_D,
|
||||
PERF_ACCUMULATE_INIT_2(CV_64FC), accumulateProduct(src1, src2, dst))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(ProductDoubleMask, MAT_TYPES_ACCUMLATE_D_C,
|
||||
PERF_ACCUMULATE_MASK_INIT_2(CV_64FC), accumulateProduct(src1, src2, dst, mask))
|
||||
|
||||
///////////////////////////// AccumulateWeighted ///////////////////////////////////
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(Weighted, MAT_TYPES_ACCUMLATE,
|
||||
PERF_ACCUMULATE_INIT(CV_32FC), accumulateWeighted(src1, dst, 0.123))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(WeightedMask, MAT_TYPES_ACCUMLATE_C,
|
||||
PERF_ACCUMULATE_MASK_INIT(CV_32FC), accumulateWeighted(src1, dst, 0.123, mask))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(WeightedDouble, MAT_TYPES_ACCUMLATE_D,
|
||||
PERF_ACCUMULATE_INIT(CV_64FC), accumulateWeighted(src1, dst, 0.123456))
|
||||
|
||||
PERF_TEST_P_ACCUMULATE(WeightedDoubleMask, MAT_TYPES_ACCUMLATE_D_C,
|
||||
PERF_ACCUMULATE_MASK_INIT(CV_64FC), accumulateWeighted(src1, dst, 0.123456, mask))
|
||||
|
||||
} // namespace
|
||||
38
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_bilateral.cpp
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
CV_ENUM(Mat_Type, CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3)
|
||||
|
||||
typedef TestBaseWithParam< tuple<Size, int, Mat_Type> > TestBilateralFilter;
|
||||
|
||||
PERF_TEST_P( TestBilateralFilter, BilateralFilter,
|
||||
Combine(
|
||||
Values( szVGA, sz1080p ), // image size
|
||||
Values( 3, 5 ), // d
|
||||
Mat_Type::all() // image type
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz;
|
||||
int d, type;
|
||||
const double sigmaColor = 1., sigmaSpace = 1.;
|
||||
|
||||
sz = get<0>(GetParam());
|
||||
d = get<1>(GetParam());
|
||||
type = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, type);
|
||||
Mat dst(sz, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst).time(20);
|
||||
|
||||
TEST_CYCLE() bilateralFilter(src, dst, d, sigmaColor, sigmaSpace, BORDER_DEFAULT);
|
||||
|
||||
SANITY_CHECK(dst, .01, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
256
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_blur.cpp
vendored
Normal file
@ -0,0 +1,256 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
typedef tuple<Size, MatType, int> Size_MatType_kSize_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_kSize_t> Size_MatType_kSize;
|
||||
|
||||
PERF_TEST_P(Size_MatType_kSize, medianBlur,
|
||||
testing::Combine(
|
||||
testing::Values(szODD, szQVGA, szVGA, sz720p),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
testing::Values(3, 5)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
int ksize = get<2>(GetParam());
|
||||
|
||||
Mat src(size, type);
|
||||
Mat dst(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
if (CV_MAT_DEPTH(type) > CV_16S || CV_MAT_CN(type) > 1)
|
||||
declare.time(15);
|
||||
|
||||
TEST_CYCLE() medianBlur(src, dst, ksize);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
CV_ENUM(BorderType3x3, BORDER_REPLICATE, BORDER_CONSTANT)
|
||||
CV_ENUM(BorderType, BORDER_REPLICATE, BORDER_CONSTANT, BORDER_REFLECT, BORDER_REFLECT101)
|
||||
|
||||
typedef tuple<Size, MatType, BorderType3x3> Size_MatType_BorderType3x3_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_BorderType3x3_t> Size_MatType_BorderType3x3;
|
||||
|
||||
typedef tuple<Size, MatType, BorderType> Size_MatType_BorderType_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_BorderType_t> Size_MatType_BorderType;
|
||||
|
||||
typedef tuple<Size, int, BorderType3x3> Size_ksize_BorderType_t;
|
||||
typedef perf::TestBaseWithParam<Size_ksize_BorderType_t> Size_ksize_BorderType;
|
||||
|
||||
PERF_TEST_P(Size_MatType_BorderType3x3, gaussianBlur3x3,
|
||||
testing::Combine(
|
||||
testing::Values(szODD, szQVGA, szVGA, sz720p),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
BorderType3x3::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
BorderType3x3 btype = get<2>(GetParam());
|
||||
|
||||
Mat src(size, type);
|
||||
Mat dst(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() GaussianBlur(src, dst, Size(3,3), 0, 0, btype);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType_BorderType3x3, blur3x3,
|
||||
testing::Combine(
|
||||
testing::Values(szODD, szQVGA, szVGA, sz720p),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
BorderType3x3::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
BorderType3x3 btype = get<2>(GetParam());
|
||||
|
||||
Mat src(size, type);
|
||||
Mat dst(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() blur(src, dst, Size(3,3), Point(-1,-1), btype);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType_BorderType, blur16x16,
|
||||
testing::Combine(
|
||||
testing::Values(szVGA, sz720p),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
BorderType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
BorderType btype = get<2>(GetParam());
|
||||
double eps = 1e-3;
|
||||
|
||||
eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : eps;
|
||||
|
||||
Mat src(size, type);
|
||||
Mat dst(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() blur(src, dst, Size(16,16), Point(-1,-1), btype);
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType_BorderType3x3, box3x3,
|
||||
testing::Combine(
|
||||
testing::Values(szODD, szQVGA, szVGA, sz720p),
|
||||
testing::Values(CV_8UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_32FC3),
|
||||
BorderType3x3::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
BorderType3x3 btype = get<2>(GetParam());
|
||||
|
||||
Mat src(size, type);
|
||||
Mat dst(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() boxFilter(src, dst, -1, Size(3,3), Point(-1,-1), false, btype);
|
||||
|
||||
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_ksize_BorderType, box_CV8U_CV16U,
|
||||
testing::Combine(
|
||||
testing::Values(szODD, szQVGA, szVGA, sz720p),
|
||||
testing::Values(3, 5, 15),
|
||||
BorderType3x3::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
int ksize = get<1>(GetParam());
|
||||
BorderType3x3 btype = get<2>(GetParam());
|
||||
|
||||
Mat src(size, CV_8UC1);
|
||||
Mat dst(size, CV_16UC1);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() boxFilter(src, dst, CV_16UC1, Size(ksize, ksize), Point(-1,-1), false, btype);
|
||||
|
||||
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType_BorderType3x3, box3x3_inplace,
|
||||
testing::Combine(
|
||||
testing::Values(szODD, szQVGA, szVGA, sz720p),
|
||||
testing::Values(CV_8UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_32FC3),
|
||||
BorderType3x3::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
BorderType3x3 btype = get<2>(GetParam());
|
||||
|
||||
Mat src(size, type);
|
||||
Mat dst(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
while(next())
|
||||
{
|
||||
src.copyTo(dst);
|
||||
startTimer();
|
||||
boxFilter(dst, dst, -1, Size(3,3), Point(-1,-1), false, btype);
|
||||
stopTimer();
|
||||
}
|
||||
|
||||
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType_BorderType, gaussianBlur5x5,
|
||||
testing::Combine(
|
||||
testing::Values(szODD, szQVGA, szVGA, sz720p),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1),
|
||||
BorderType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
BorderType btype = get<2>(GetParam());
|
||||
|
||||
Mat src(size, type);
|
||||
Mat dst(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() GaussianBlur(src, dst, Size(5,5), 0, 0, btype);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType_BorderType, blur5x5,
|
||||
testing::Combine(
|
||||
testing::Values(szVGA, sz720p),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1, CV_32FC3),
|
||||
BorderType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
BorderType btype = get<2>(GetParam());
|
||||
|
||||
Mat src(size, type);
|
||||
Mat dst(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() blur(src, dst, Size(5,5), Point(-1,-1), btype);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
///////////// BlendLinear ////////////////////////
|
||||
PERF_TEST_P(Size_MatType, BlendLinear,
|
||||
testing::Combine(
|
||||
testing::Values(szVGA, sz720p, sz1080p, sz2160p),
|
||||
testing::Values(CV_8UC1, CV_32FC1, CV_8UC3, CV_32FC3, CV_8UC4, CV_32FC4)
|
||||
)
|
||||
)
|
||||
{
|
||||
const Size srcSize = get<0>(GetParam());
|
||||
const int srcType = get<1>(GetParam());
|
||||
|
||||
Mat src1(srcSize, srcType), src2(srcSize, srcType), dst(srcSize, srcType);
|
||||
Mat weights1(srcSize, CV_32FC1), weights2(srcSize, CV_32FC1);
|
||||
|
||||
declare.in(src1, src2, WARMUP_RNG).in(weights1, weights2, WARMUP_READ).out(dst);
|
||||
randu(weights1, 0, 1);
|
||||
randu(weights2, 0, 1);
|
||||
|
||||
TEST_CYCLE() blendLinear(src1, src2, weights1, weights2, dst);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
40
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_canny.cpp
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
typedef tuple<string, int, bool, tuple<double, double> > Img_Aperture_L2_thresholds_t;
|
||||
typedef perf::TestBaseWithParam<Img_Aperture_L2_thresholds_t> Img_Aperture_L2_thresholds;
|
||||
|
||||
PERF_TEST_P(Img_Aperture_L2_thresholds, canny,
|
||||
testing::Combine(
|
||||
testing::Values( "cv/shared/lena.png", "stitching/b1.png", "cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png" ),
|
||||
testing::Values( 3, 5 ),
|
||||
testing::Bool(),
|
||||
testing::Values( make_tuple(50.0, 100.0), make_tuple(0.0, 50.0), make_tuple(100.0, 120.0) )
|
||||
)
|
||||
)
|
||||
{
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
int aperture = get<1>(GetParam());
|
||||
bool useL2 = get<2>(GetParam());
|
||||
double thresh_low = get<0>(get<3>(GetParam()));
|
||||
double thresh_high = get<1>(get<3>(GetParam()));
|
||||
|
||||
Mat img = imread(filename, IMREAD_GRAYSCALE);
|
||||
if (img.empty())
|
||||
FAIL() << "Unable to load source image " << filename;
|
||||
Mat edges(img.size(), img.type());
|
||||
|
||||
declare.in(img).out(edges);
|
||||
|
||||
PERF_SAMPLE_BEGIN();
|
||||
Canny(img, edges, thresh_low, thresh_high, aperture, useL2);
|
||||
PERF_SAMPLE_END();
|
||||
|
||||
SANITY_CHECK(edges);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
109
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_contours.cpp
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
CV_ENUM(RetrMode, RETR_EXTERNAL, RETR_LIST, RETR_CCOMP, RETR_TREE)
|
||||
CV_ENUM(ApproxMode, CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE, CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS)
|
||||
|
||||
typedef TestBaseWithParam< tuple<Size, RetrMode, ApproxMode, int> > TestFindContours;
|
||||
|
||||
PERF_TEST_P(TestFindContours, findContours,
|
||||
Combine(
|
||||
Values( szVGA, sz1080p ), // image size
|
||||
RetrMode::all(), // retrieval mode
|
||||
ApproxMode::all(), // approximation method
|
||||
Values( 32, 128 ) // blob count
|
||||
)
|
||||
)
|
||||
{
|
||||
Size img_size = get<0>(GetParam());
|
||||
int retr_mode = get<1>(GetParam());
|
||||
int approx_method = get<2>(GetParam());
|
||||
int blob_count = get<3>(GetParam());
|
||||
|
||||
RNG rng;
|
||||
Mat img = Mat::zeros(img_size, CV_8UC1);
|
||||
for(int i = 0; i < blob_count; i++ )
|
||||
{
|
||||
Point center;
|
||||
center.x = (unsigned)rng % (img.cols-2);
|
||||
center.y = (unsigned)rng % (img.rows-2);
|
||||
Size axes;
|
||||
axes.width = ((unsigned)rng % 49 + 2)/2;
|
||||
axes.height = ((unsigned)rng % 49 + 2)/2;
|
||||
double angle = (unsigned)rng % 180;
|
||||
int brightness = (unsigned)rng % 2;
|
||||
|
||||
// keep the border clear
|
||||
ellipse( img(Rect(1,1,img.cols-2,img.rows-2)), Point(center), Size(axes), angle, 0., 360., Scalar(brightness), -1);
|
||||
}
|
||||
vector< vector<Point> > contours;
|
||||
|
||||
TEST_CYCLE() findContours( img, contours, retr_mode, approx_method );
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
typedef TestBaseWithParam< tuple<Size, ApproxMode, int> > TestFindContoursFF;
|
||||
|
||||
PERF_TEST_P(TestFindContoursFF, findContours,
|
||||
Combine(
|
||||
Values(szVGA, sz1080p), // image size
|
||||
ApproxMode::all(), // approximation method
|
||||
Values(32, 128) // blob count
|
||||
)
|
||||
)
|
||||
{
|
||||
Size img_size = get<0>(GetParam());
|
||||
int approx_method = get<1>(GetParam());
|
||||
int blob_count = get<2>(GetParam());
|
||||
|
||||
RNG rng;
|
||||
Mat img = Mat::zeros(img_size, CV_32SC1);
|
||||
for (int i = 0; i < blob_count; i++)
|
||||
{
|
||||
Point center;
|
||||
center.x = (unsigned)rng % (img.cols - 2);
|
||||
center.y = (unsigned)rng % (img.rows - 2);
|
||||
Size axes;
|
||||
axes.width = ((unsigned)rng % 49 + 2) / 2;
|
||||
axes.height = ((unsigned)rng % 49 + 2) / 2;
|
||||
double angle = (unsigned)rng % 180;
|
||||
int brightness = (unsigned)rng % 2;
|
||||
|
||||
// keep the border clear
|
||||
ellipse(img(Rect(1, 1, img.cols - 2, img.rows - 2)), Point(center), Size(axes), angle, 0., 360., Scalar(brightness), -1);
|
||||
}
|
||||
vector< vector<Point> > contours;
|
||||
|
||||
TEST_CYCLE() findContours(img, contours, RETR_FLOODFILL, approx_method);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
typedef TestBaseWithParam< tuple<MatDepth, int> > TestBoundingRect;
|
||||
|
||||
PERF_TEST_P(TestBoundingRect, BoundingRect,
|
||||
Combine(
|
||||
testing::Values(CV_32S, CV_32F), // points type
|
||||
Values(400, 511, 1000, 10000, 100000) // points count
|
||||
)
|
||||
)
|
||||
|
||||
{
|
||||
int ptType = get<0>(GetParam());
|
||||
int n = get<1>(GetParam());
|
||||
|
||||
Mat pts(n, 2, ptType);
|
||||
declare.in(pts, WARMUP_RNG);
|
||||
|
||||
cv::Rect rect;
|
||||
TEST_CYCLE() rect = boundingRect(pts);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} } // namespace
|
||||
93
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_corners.cpp
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
CV_ENUM(BorderType, BORDER_REPLICATE, BORDER_CONSTANT, BORDER_REFLECT, BORDER_REFLECT_101)
|
||||
|
||||
typedef tuple<string, int, int, double, BorderType> Img_BlockSize_ApertureSize_k_BorderType_t;
|
||||
typedef perf::TestBaseWithParam<Img_BlockSize_ApertureSize_k_BorderType_t> Img_BlockSize_ApertureSize_k_BorderType;
|
||||
|
||||
PERF_TEST_P(Img_BlockSize_ApertureSize_k_BorderType, cornerHarris,
|
||||
testing::Combine(
|
||||
testing::Values( "stitching/a1.png", "cv/shared/pic5.png"),
|
||||
testing::Values( 3, 5 ),
|
||||
testing::Values( 3, 5 ),
|
||||
testing::Values( 0.04, 0.1 ),
|
||||
BorderType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
int blockSize = get<1>(GetParam());
|
||||
int apertureSize = get<2>(GetParam());
|
||||
double k = get<3>(GetParam());
|
||||
BorderType borderType = get<4>(GetParam());
|
||||
|
||||
Mat src = imread(filename, IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(src.empty()) << "Unable to load source image: " << filename;
|
||||
|
||||
Mat dst;
|
||||
|
||||
TEST_CYCLE() cornerHarris(src, dst, blockSize, apertureSize, k, borderType);
|
||||
|
||||
SANITY_CHECK(dst, 2e-5, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
typedef tuple<string, int, int, BorderType> Img_BlockSize_ApertureSize_BorderType_t;
|
||||
typedef perf::TestBaseWithParam<Img_BlockSize_ApertureSize_BorderType_t> Img_BlockSize_ApertureSize_BorderType;
|
||||
|
||||
PERF_TEST_P(Img_BlockSize_ApertureSize_BorderType, cornerEigenValsAndVecs,
|
||||
testing::Combine(
|
||||
testing::Values( "stitching/a1.png", "cv/shared/pic5.png"),
|
||||
testing::Values( 3, 5 ),
|
||||
testing::Values( 3, 5 ),
|
||||
BorderType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
int blockSize = get<1>(GetParam());
|
||||
int apertureSize = get<2>(GetParam());
|
||||
BorderType borderType = get<3>(GetParam());
|
||||
|
||||
Mat src = imread(filename, IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(src.empty()) << "Unable to load source image: " << filename;
|
||||
|
||||
Mat dst;
|
||||
|
||||
TEST_CYCLE() cornerEigenValsAndVecs(src, dst, blockSize, apertureSize, borderType);
|
||||
|
||||
Mat l1;
|
||||
extractChannel(dst, l1, 0);
|
||||
|
||||
SANITY_CHECK(l1, 2e-5, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Img_BlockSize_ApertureSize_BorderType, cornerMinEigenVal,
|
||||
testing::Combine(
|
||||
testing::Values( "stitching/a1.png", "cv/shared/pic5.png"),
|
||||
testing::Values( 3, 5 ),
|
||||
testing::Values( 3, 5 ),
|
||||
BorderType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
int blockSize = get<1>(GetParam());
|
||||
int apertureSize = get<2>(GetParam());
|
||||
BorderType borderType = get<3>(GetParam());
|
||||
|
||||
Mat src = imread(filename, IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(src.empty()) << "Unable to load source image: " << filename;
|
||||
|
||||
Mat dst;
|
||||
|
||||
TEST_CYCLE() cornerMinEigenVal(src, dst, blockSize, apertureSize, borderType);
|
||||
|
||||
SANITY_CHECK(dst, 2e-5, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
499
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_cvt_color.cpp
vendored
Normal file
@ -0,0 +1,499 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
//extra color conversions supported implicitly
|
||||
enum
|
||||
{
|
||||
CX_BGRA2HLS = COLOR_COLORCVT_MAX + COLOR_BGR2HLS,
|
||||
CX_BGRA2HLS_FULL = COLOR_COLORCVT_MAX + COLOR_BGR2HLS_FULL,
|
||||
CX_BGRA2HSV = COLOR_COLORCVT_MAX + COLOR_BGR2HSV,
|
||||
CX_BGRA2HSV_FULL = COLOR_COLORCVT_MAX + COLOR_BGR2HSV_FULL,
|
||||
CX_BGRA2Lab = COLOR_COLORCVT_MAX + COLOR_BGR2Lab,
|
||||
CX_BGRA2Luv = COLOR_COLORCVT_MAX + COLOR_BGR2Luv,
|
||||
CX_BGRA2XYZ = COLOR_COLORCVT_MAX + COLOR_BGR2XYZ,
|
||||
CX_BGRA2YCrCb = COLOR_COLORCVT_MAX + COLOR_BGR2YCrCb,
|
||||
CX_BGRA2YUV = COLOR_COLORCVT_MAX + COLOR_BGR2YUV,
|
||||
CX_HLS2BGRA = COLOR_COLORCVT_MAX + COLOR_HLS2BGR,
|
||||
CX_HLS2BGRA_FULL = COLOR_COLORCVT_MAX + COLOR_HLS2BGR_FULL,
|
||||
CX_HLS2RGBA = COLOR_COLORCVT_MAX + COLOR_HLS2RGB,
|
||||
CX_HLS2RGBA_FULL = COLOR_COLORCVT_MAX + COLOR_HLS2RGB_FULL,
|
||||
CX_HSV2BGRA = COLOR_COLORCVT_MAX + COLOR_HSV2BGR,
|
||||
CX_HSV2BGRA_FULL = COLOR_COLORCVT_MAX + COLOR_HSV2BGR_FULL,
|
||||
CX_HSV2RGBA = COLOR_COLORCVT_MAX + COLOR_HSV2RGB,
|
||||
CX_HSV2RGBA_FULL = COLOR_COLORCVT_MAX + COLOR_HSV2RGB_FULL,
|
||||
CX_Lab2BGRA = COLOR_COLORCVT_MAX + COLOR_Lab2BGR,
|
||||
CX_Lab2LBGRA = COLOR_COLORCVT_MAX + COLOR_Lab2LBGR,
|
||||
CX_Lab2LRGBA = COLOR_COLORCVT_MAX + COLOR_Lab2LRGB,
|
||||
CX_Lab2RGBA = COLOR_COLORCVT_MAX + COLOR_Lab2RGB,
|
||||
CX_LBGRA2Lab = COLOR_COLORCVT_MAX + COLOR_LBGR2Lab,
|
||||
CX_LBGRA2Luv = COLOR_COLORCVT_MAX + COLOR_LBGR2Luv,
|
||||
CX_LRGBA2Lab = COLOR_COLORCVT_MAX + COLOR_LRGB2Lab,
|
||||
CX_LRGBA2Luv = COLOR_COLORCVT_MAX + COLOR_LRGB2Luv,
|
||||
CX_Luv2BGRA = COLOR_COLORCVT_MAX + COLOR_Luv2BGR,
|
||||
CX_Luv2LBGRA = COLOR_COLORCVT_MAX + COLOR_Luv2LBGR,
|
||||
CX_Luv2LRGBA = COLOR_COLORCVT_MAX + COLOR_Luv2LRGB,
|
||||
CX_Luv2RGBA = COLOR_COLORCVT_MAX + COLOR_Luv2RGB,
|
||||
CX_RGBA2HLS = COLOR_COLORCVT_MAX + COLOR_RGB2HLS,
|
||||
CX_RGBA2HLS_FULL = COLOR_COLORCVT_MAX + COLOR_RGB2HLS_FULL,
|
||||
CX_RGBA2HSV = COLOR_COLORCVT_MAX + COLOR_RGB2HSV,
|
||||
CX_RGBA2HSV_FULL = COLOR_COLORCVT_MAX + COLOR_RGB2HSV_FULL,
|
||||
CX_RGBA2Lab = COLOR_COLORCVT_MAX + COLOR_RGB2Lab,
|
||||
CX_RGBA2Luv = COLOR_COLORCVT_MAX + COLOR_RGB2Luv,
|
||||
CX_RGBA2XYZ = COLOR_COLORCVT_MAX + COLOR_RGB2XYZ,
|
||||
CX_RGBA2YCrCb = COLOR_COLORCVT_MAX + COLOR_RGB2YCrCb,
|
||||
CX_RGBA2YUV = COLOR_COLORCVT_MAX + COLOR_RGB2YUV,
|
||||
CX_XYZ2BGRA = COLOR_COLORCVT_MAX + COLOR_XYZ2BGR,
|
||||
CX_XYZ2RGBA = COLOR_COLORCVT_MAX + COLOR_XYZ2RGB,
|
||||
CX_YCrCb2BGRA = COLOR_COLORCVT_MAX + COLOR_YCrCb2BGR,
|
||||
CX_YCrCb2RGBA = COLOR_COLORCVT_MAX + COLOR_YCrCb2RGB,
|
||||
CX_YUV2BGRA = COLOR_COLORCVT_MAX + COLOR_YUV2BGR,
|
||||
CX_YUV2RGBA = COLOR_COLORCVT_MAX + COLOR_YUV2RGB
|
||||
};
|
||||
|
||||
CV_ENUM(CvtMode,
|
||||
COLOR_BGR2BGR555, COLOR_BGR2BGR565, COLOR_BGR2BGRA, COLOR_BGR2GRAY,
|
||||
COLOR_BGR2HLS, COLOR_BGR2HLS_FULL, COLOR_BGR2HSV, COLOR_BGR2HSV_FULL,
|
||||
COLOR_BGR2Lab, COLOR_BGR2Luv, COLOR_BGR2RGB, COLOR_BGR2RGBA, COLOR_BGR2XYZ,
|
||||
COLOR_BGR2YCrCb, COLOR_BGR2YUV, COLOR_BGR5552BGR, COLOR_BGR5552BGRA,
|
||||
|
||||
COLOR_BGR5552GRAY, COLOR_BGR5552RGB, COLOR_BGR5552RGBA, COLOR_BGR5652BGR,
|
||||
COLOR_BGR5652BGRA, COLOR_BGR5652GRAY, COLOR_BGR5652RGB, COLOR_BGR5652RGBA,
|
||||
|
||||
COLOR_BGRA2BGR, COLOR_BGRA2BGR555, COLOR_BGRA2BGR565, COLOR_BGRA2GRAY, COLOR_BGRA2RGBA,
|
||||
CX_BGRA2HLS, CX_BGRA2HLS_FULL, CX_BGRA2HSV, CX_BGRA2HSV_FULL,
|
||||
CX_BGRA2Lab, CX_BGRA2Luv, CX_BGRA2XYZ,
|
||||
CX_BGRA2YCrCb, CX_BGRA2YUV,
|
||||
|
||||
COLOR_GRAY2BGR, COLOR_GRAY2BGR555, COLOR_GRAY2BGR565, COLOR_GRAY2BGRA,
|
||||
|
||||
COLOR_HLS2BGR, COLOR_HLS2BGR_FULL, COLOR_HLS2RGB, COLOR_HLS2RGB_FULL,
|
||||
CX_HLS2BGRA, CX_HLS2BGRA_FULL, CX_HLS2RGBA, CX_HLS2RGBA_FULL,
|
||||
|
||||
COLOR_HSV2BGR, COLOR_HSV2BGR_FULL, COLOR_HSV2RGB, COLOR_HSV2RGB_FULL,
|
||||
CX_HSV2BGRA, CX_HSV2BGRA_FULL, CX_HSV2RGBA, CX_HSV2RGBA_FULL,
|
||||
|
||||
COLOR_Lab2BGR, COLOR_Lab2LBGR, COLOR_Lab2LRGB, COLOR_Lab2RGB,
|
||||
CX_Lab2BGRA, CX_Lab2LBGRA, CX_Lab2LRGBA, CX_Lab2RGBA,
|
||||
|
||||
COLOR_LBGR2Lab, COLOR_LBGR2Luv, COLOR_LRGB2Lab, COLOR_LRGB2Luv,
|
||||
CX_LBGRA2Lab, CX_LBGRA2Luv, CX_LRGBA2Lab, CX_LRGBA2Luv,
|
||||
|
||||
COLOR_Luv2BGR, COLOR_Luv2LBGR, COLOR_Luv2LRGB, COLOR_Luv2RGB,
|
||||
CX_Luv2BGRA, CX_Luv2LBGRA, CX_Luv2LRGBA, CX_Luv2RGBA,
|
||||
|
||||
COLOR_RGB2BGR555, COLOR_RGB2BGR565, COLOR_RGB2GRAY,
|
||||
COLOR_RGB2HLS, COLOR_RGB2HLS_FULL, COLOR_RGB2HSV, COLOR_RGB2HSV_FULL,
|
||||
COLOR_RGB2Lab, COLOR_RGB2Luv, COLOR_RGB2XYZ, COLOR_RGB2YCrCb, COLOR_RGB2YUV,
|
||||
|
||||
COLOR_RGBA2BGR, COLOR_RGBA2BGR555, COLOR_RGBA2BGR565, COLOR_RGBA2GRAY,
|
||||
CX_RGBA2HLS, CX_RGBA2HLS_FULL, CX_RGBA2HSV, CX_RGBA2HSV_FULL,
|
||||
CX_RGBA2Lab, CX_RGBA2Luv, CX_RGBA2XYZ,
|
||||
CX_RGBA2YCrCb, CX_RGBA2YUV,
|
||||
|
||||
COLOR_XYZ2BGR, COLOR_XYZ2RGB, CX_XYZ2BGRA, CX_XYZ2RGBA,
|
||||
|
||||
COLOR_YCrCb2BGR, COLOR_YCrCb2RGB, CX_YCrCb2BGRA, CX_YCrCb2RGBA,
|
||||
COLOR_YUV2BGR, COLOR_YUV2RGB, CX_YUV2BGRA, CX_YUV2RGBA
|
||||
)
|
||||
|
||||
CV_ENUM(CvtMode16U,
|
||||
COLOR_BGR2BGRA, COLOR_BGR2GRAY,
|
||||
COLOR_BGR2RGB, COLOR_BGR2RGBA, COLOR_BGR2XYZ,
|
||||
COLOR_BGR2YCrCb, COLOR_BGR2YUV,
|
||||
|
||||
COLOR_BGRA2BGR, COLOR_BGRA2GRAY, COLOR_BGRA2RGBA,
|
||||
CX_BGRA2XYZ,
|
||||
CX_BGRA2YCrCb, CX_BGRA2YUV,
|
||||
|
||||
COLOR_GRAY2BGR, COLOR_GRAY2BGRA,
|
||||
|
||||
COLOR_RGB2GRAY,
|
||||
COLOR_RGB2XYZ, COLOR_RGB2YCrCb, COLOR_RGB2YUV,
|
||||
|
||||
COLOR_RGBA2BGR, COLOR_RGBA2GRAY,
|
||||
CX_RGBA2XYZ,
|
||||
CX_RGBA2YCrCb, CX_RGBA2YUV,
|
||||
|
||||
COLOR_XYZ2BGR, COLOR_XYZ2RGB, CX_XYZ2BGRA, CX_XYZ2RGBA,
|
||||
|
||||
COLOR_YCrCb2BGR, COLOR_YCrCb2RGB, CX_YCrCb2BGRA, CX_YCrCb2RGBA,
|
||||
COLOR_YUV2BGR, COLOR_YUV2RGB, CX_YUV2BGRA, CX_YUV2RGBA
|
||||
)
|
||||
|
||||
CV_ENUM(CvtMode32F,
|
||||
COLOR_BGR2BGRA, COLOR_BGR2GRAY,
|
||||
COLOR_BGR2HLS, COLOR_BGR2HLS_FULL, COLOR_BGR2HSV, COLOR_BGR2HSV_FULL,
|
||||
COLOR_BGR2Lab, COLOR_BGR2Luv, COLOR_BGR2RGB, COLOR_BGR2RGBA, COLOR_BGR2XYZ,
|
||||
COLOR_BGR2YCrCb, COLOR_BGR2YUV,
|
||||
|
||||
COLOR_BGRA2BGR, COLOR_BGRA2GRAY, COLOR_BGRA2RGBA,
|
||||
CX_BGRA2HLS, CX_BGRA2HLS_FULL, CX_BGRA2HSV, CX_BGRA2HSV_FULL,
|
||||
CX_BGRA2Lab, CX_BGRA2Luv, CX_BGRA2XYZ,
|
||||
CX_BGRA2YCrCb, CX_BGRA2YUV,
|
||||
|
||||
COLOR_GRAY2BGR, COLOR_GRAY2BGRA,
|
||||
|
||||
COLOR_HLS2BGR, COLOR_HLS2BGR_FULL, COLOR_HLS2RGB, COLOR_HLS2RGB_FULL,
|
||||
CX_HLS2BGRA, CX_HLS2BGRA_FULL, CX_HLS2RGBA, CX_HLS2RGBA_FULL,
|
||||
|
||||
COLOR_HSV2BGR, COLOR_HSV2BGR_FULL, COLOR_HSV2RGB, COLOR_HSV2RGB_FULL,
|
||||
CX_HSV2BGRA, CX_HSV2BGRA_FULL, CX_HSV2RGBA, CX_HSV2RGBA_FULL,
|
||||
|
||||
COLOR_Lab2BGR, COLOR_Lab2LBGR, COLOR_Lab2LRGB, COLOR_Lab2RGB,
|
||||
CX_Lab2BGRA, CX_Lab2LBGRA, CX_Lab2LRGBA, CX_Lab2RGBA,
|
||||
|
||||
COLOR_LBGR2Lab, COLOR_LBGR2Luv, COLOR_LRGB2Lab, COLOR_LRGB2Luv,
|
||||
CX_LBGRA2Lab, CX_LBGRA2Luv, CX_LRGBA2Lab, CX_LRGBA2Luv,
|
||||
|
||||
COLOR_Luv2BGR, COLOR_Luv2LBGR, COLOR_Luv2LRGB, COLOR_Luv2RGB,
|
||||
CX_Luv2BGRA, CX_Luv2LBGRA, CX_Luv2LRGBA, CX_Luv2RGBA,
|
||||
|
||||
COLOR_RGB2GRAY,
|
||||
COLOR_RGB2HLS, COLOR_RGB2HLS_FULL, COLOR_RGB2HSV, COLOR_RGB2HSV_FULL,
|
||||
COLOR_RGB2Lab, COLOR_RGB2Luv, COLOR_RGB2XYZ, COLOR_RGB2YCrCb, COLOR_RGB2YUV,
|
||||
|
||||
COLOR_RGBA2BGR, COLOR_RGBA2GRAY,
|
||||
CX_RGBA2HLS, CX_RGBA2HLS_FULL, CX_RGBA2HSV, CX_RGBA2HSV_FULL,
|
||||
CX_RGBA2Lab, CX_RGBA2Luv, CX_RGBA2XYZ,
|
||||
CX_RGBA2YCrCb, CX_RGBA2YUV,
|
||||
|
||||
COLOR_XYZ2BGR, COLOR_XYZ2RGB, CX_XYZ2BGRA, CX_XYZ2RGBA,
|
||||
|
||||
COLOR_YCrCb2BGR, COLOR_YCrCb2RGB, CX_YCrCb2BGRA, CX_YCrCb2RGBA,
|
||||
COLOR_YUV2BGR, COLOR_YUV2RGB, CX_YUV2BGRA, CX_YUV2RGBA
|
||||
)
|
||||
|
||||
CV_ENUM(CvtModeBayer,
|
||||
COLOR_BayerBG2BGR, COLOR_BayerBG2BGRA, COLOR_BayerBG2BGR_VNG, COLOR_BayerBG2GRAY,
|
||||
COLOR_BayerGB2BGR, COLOR_BayerGB2BGRA, COLOR_BayerGB2BGR_VNG, COLOR_BayerGB2GRAY,
|
||||
COLOR_BayerGR2BGR, COLOR_BayerGR2BGRA, COLOR_BayerGR2BGR_VNG, COLOR_BayerGR2GRAY,
|
||||
COLOR_BayerRG2BGR, COLOR_BayerRG2BGRA, COLOR_BayerRG2BGR_VNG, COLOR_BayerRG2GRAY
|
||||
)
|
||||
|
||||
|
||||
CV_ENUM(CvtMode2, COLOR_YUV2BGR_NV12, COLOR_YUV2BGRA_NV12, COLOR_YUV2RGB_NV12, COLOR_YUV2RGBA_NV12, COLOR_YUV2BGR_NV21, COLOR_YUV2BGRA_NV21, COLOR_YUV2RGB_NV21, COLOR_YUV2RGBA_NV21,
|
||||
COLOR_YUV2BGR_YV12, COLOR_YUV2BGRA_YV12, COLOR_YUV2RGB_YV12, COLOR_YUV2RGBA_YV12, COLOR_YUV2BGR_IYUV, COLOR_YUV2BGRA_IYUV, COLOR_YUV2RGB_IYUV, COLOR_YUV2RGBA_IYUV,
|
||||
COLOR_YUV2GRAY_420, COLOR_YUV2RGB_UYVY, COLOR_YUV2BGR_UYVY, COLOR_YUV2RGBA_UYVY, COLOR_YUV2BGRA_UYVY, COLOR_YUV2RGB_YUY2, COLOR_YUV2BGR_YUY2, COLOR_YUV2RGB_YVYU,
|
||||
COLOR_YUV2BGR_YVYU, COLOR_YUV2RGBA_YUY2, COLOR_YUV2BGRA_YUY2, COLOR_YUV2RGBA_YVYU, COLOR_YUV2BGRA_YVYU)
|
||||
|
||||
CV_ENUM(CvtMode3, COLOR_RGB2YUV_IYUV, COLOR_BGR2YUV_IYUV, COLOR_RGBA2YUV_IYUV, COLOR_BGRA2YUV_IYUV,
|
||||
COLOR_RGB2YUV_YV12, COLOR_BGR2YUV_YV12, COLOR_RGBA2YUV_YV12, COLOR_BGRA2YUV_YV12)
|
||||
|
||||
struct ChPair
|
||||
{
|
||||
ChPair(int _scn, int _dcn): scn(_scn), dcn(_dcn) {}
|
||||
int scn, dcn;
|
||||
};
|
||||
|
||||
static ChPair getConversionInfo(int cvtMode)
|
||||
{
|
||||
switch(cvtMode)
|
||||
{
|
||||
case COLOR_BayerBG2GRAY: case COLOR_BayerGB2GRAY:
|
||||
case COLOR_BayerGR2GRAY: case COLOR_BayerRG2GRAY:
|
||||
case COLOR_YUV2GRAY_420:
|
||||
return ChPair(1,1);
|
||||
case COLOR_GRAY2BGR555: case COLOR_GRAY2BGR565:
|
||||
return ChPair(1,2);
|
||||
case COLOR_BayerBG2BGR: case COLOR_BayerBG2BGR_VNG:
|
||||
case COLOR_BayerGB2BGR: case COLOR_BayerGB2BGR_VNG:
|
||||
case COLOR_BayerGR2BGR: case COLOR_BayerGR2BGR_VNG:
|
||||
case COLOR_BayerRG2BGR: case COLOR_BayerRG2BGR_VNG:
|
||||
case COLOR_GRAY2BGR:
|
||||
case COLOR_YUV2BGR_NV12: case COLOR_YUV2RGB_NV12:
|
||||
case COLOR_YUV2BGR_NV21: case COLOR_YUV2RGB_NV21:
|
||||
case COLOR_YUV2BGR_YV12: case COLOR_YUV2RGB_YV12:
|
||||
case COLOR_YUV2BGR_IYUV: case COLOR_YUV2RGB_IYUV:
|
||||
return ChPair(1,3);
|
||||
case COLOR_GRAY2BGRA:
|
||||
case COLOR_YUV2BGRA_NV12: case COLOR_YUV2RGBA_NV12:
|
||||
case COLOR_YUV2BGRA_NV21: case COLOR_YUV2RGBA_NV21:
|
||||
case COLOR_YUV2BGRA_YV12: case COLOR_YUV2RGBA_YV12:
|
||||
case COLOR_YUV2BGRA_IYUV: case COLOR_YUV2RGBA_IYUV:
|
||||
case COLOR_BayerBG2BGRA: case COLOR_BayerGB2BGRA:
|
||||
case COLOR_BayerGR2BGRA: case COLOR_BayerRG2BGRA:
|
||||
return ChPair(1,4);
|
||||
case COLOR_BGR5552GRAY: case COLOR_BGR5652GRAY:
|
||||
return ChPair(2,1);
|
||||
case COLOR_BGR5552BGR: case COLOR_BGR5552RGB:
|
||||
case COLOR_BGR5652BGR: case COLOR_BGR5652RGB:
|
||||
case COLOR_YUV2RGB_UYVY: case COLOR_YUV2BGR_UYVY:
|
||||
case COLOR_YUV2RGB_YUY2: case COLOR_YUV2BGR_YUY2:
|
||||
case COLOR_YUV2RGB_YVYU: case COLOR_YUV2BGR_YVYU:
|
||||
return ChPair(2,3);
|
||||
case COLOR_BGR5552BGRA: case COLOR_BGR5552RGBA:
|
||||
case COLOR_BGR5652BGRA: case COLOR_BGR5652RGBA:
|
||||
case COLOR_YUV2RGBA_UYVY: case COLOR_YUV2BGRA_UYVY:
|
||||
case COLOR_YUV2RGBA_YUY2: case COLOR_YUV2BGRA_YUY2:
|
||||
case COLOR_YUV2RGBA_YVYU: case COLOR_YUV2BGRA_YVYU:
|
||||
return ChPair(2,4);
|
||||
case COLOR_BGR2GRAY: case COLOR_RGB2GRAY:
|
||||
case COLOR_RGB2YUV_IYUV: case COLOR_RGB2YUV_YV12:
|
||||
case COLOR_BGR2YUV_IYUV: case COLOR_BGR2YUV_YV12:
|
||||
return ChPair(3,1);
|
||||
case COLOR_BGR2BGR555: case COLOR_BGR2BGR565:
|
||||
case COLOR_RGB2BGR555: case COLOR_RGB2BGR565:
|
||||
return ChPair(3,2);
|
||||
case COLOR_BGR2HLS: case COLOR_BGR2HLS_FULL:
|
||||
case COLOR_BGR2HSV: case COLOR_BGR2HSV_FULL:
|
||||
case COLOR_BGR2Lab: case COLOR_BGR2Luv:
|
||||
case COLOR_BGR2RGB: case COLOR_BGR2XYZ:
|
||||
case COLOR_BGR2YCrCb: case COLOR_BGR2YUV:
|
||||
case COLOR_HLS2BGR: case COLOR_HLS2BGR_FULL:
|
||||
case COLOR_HLS2RGB: case COLOR_HLS2RGB_FULL:
|
||||
case COLOR_HSV2BGR: case COLOR_HSV2BGR_FULL:
|
||||
case COLOR_HSV2RGB: case COLOR_HSV2RGB_FULL:
|
||||
case COLOR_Lab2BGR: case COLOR_Lab2LBGR:
|
||||
case COLOR_Lab2LRGB: case COLOR_Lab2RGB:
|
||||
case COLOR_LBGR2Lab: case COLOR_LBGR2Luv:
|
||||
case COLOR_LRGB2Lab: case COLOR_LRGB2Luv:
|
||||
case COLOR_Luv2BGR: case COLOR_Luv2LBGR:
|
||||
case COLOR_Luv2LRGB: case COLOR_Luv2RGB:
|
||||
case COLOR_RGB2HLS: case COLOR_RGB2HLS_FULL:
|
||||
case COLOR_RGB2HSV: case COLOR_RGB2HSV_FULL:
|
||||
case COLOR_RGB2Lab: case COLOR_RGB2Luv:
|
||||
case COLOR_RGB2XYZ: case COLOR_RGB2YCrCb:
|
||||
case COLOR_RGB2YUV: case COLOR_XYZ2BGR:
|
||||
case COLOR_XYZ2RGB: case COLOR_YCrCb2BGR:
|
||||
case COLOR_YCrCb2RGB: case COLOR_YUV2BGR:
|
||||
case COLOR_YUV2RGB:
|
||||
return ChPair(3,3);
|
||||
case COLOR_BGR2BGRA: case COLOR_BGR2RGBA:
|
||||
case CX_HLS2BGRA: case CX_HLS2BGRA_FULL:
|
||||
case CX_HLS2RGBA: case CX_HLS2RGBA_FULL:
|
||||
case CX_HSV2BGRA: case CX_HSV2BGRA_FULL:
|
||||
case CX_HSV2RGBA: case CX_HSV2RGBA_FULL:
|
||||
case CX_Lab2BGRA: case CX_Lab2LBGRA:
|
||||
case CX_Lab2LRGBA: case CX_Lab2RGBA:
|
||||
case CX_Luv2BGRA: case CX_Luv2LBGRA:
|
||||
case CX_Luv2LRGBA: case CX_Luv2RGBA:
|
||||
case CX_XYZ2BGRA: case CX_XYZ2RGBA:
|
||||
case CX_YCrCb2BGRA: case CX_YCrCb2RGBA:
|
||||
case CX_YUV2BGRA: case CX_YUV2RGBA:
|
||||
return ChPair(3,4);
|
||||
case COLOR_BGRA2GRAY: case COLOR_RGBA2GRAY:
|
||||
case COLOR_RGBA2YUV_IYUV: case COLOR_RGBA2YUV_YV12:
|
||||
case COLOR_BGRA2YUV_IYUV: case COLOR_BGRA2YUV_YV12:
|
||||
return ChPair(4,1);
|
||||
case COLOR_BGRA2BGR555: case COLOR_BGRA2BGR565:
|
||||
case COLOR_RGBA2BGR555: case COLOR_RGBA2BGR565:
|
||||
return ChPair(4,2);
|
||||
case COLOR_BGRA2BGR: case CX_BGRA2HLS:
|
||||
case CX_BGRA2HLS_FULL: case CX_BGRA2HSV:
|
||||
case CX_BGRA2HSV_FULL: case CX_BGRA2Lab:
|
||||
case CX_BGRA2Luv: case CX_BGRA2XYZ:
|
||||
case CX_BGRA2YCrCb: case CX_BGRA2YUV:
|
||||
case CX_LBGRA2Lab: case CX_LBGRA2Luv:
|
||||
case CX_LRGBA2Lab: case CX_LRGBA2Luv:
|
||||
case COLOR_RGBA2BGR: case CX_RGBA2HLS:
|
||||
case CX_RGBA2HLS_FULL: case CX_RGBA2HSV:
|
||||
case CX_RGBA2HSV_FULL: case CX_RGBA2Lab:
|
||||
case CX_RGBA2Luv: case CX_RGBA2XYZ:
|
||||
case CX_RGBA2YCrCb: case CX_RGBA2YUV:
|
||||
return ChPair(4,3);
|
||||
case COLOR_BGRA2RGBA:
|
||||
return ChPair(4,4);
|
||||
default:
|
||||
ADD_FAILURE() << "Unknown conversion type";
|
||||
break;
|
||||
};
|
||||
return ChPair(0,0);
|
||||
}
|
||||
|
||||
typedef tuple<Size, CvtMode> Size_CvtMode_t;
|
||||
typedef perf::TestBaseWithParam<Size_CvtMode_t> Size_CvtMode;
|
||||
|
||||
PERF_TEST_P(Size_CvtMode, cvtColor8u,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szVGA, ::perf::sz1080p),
|
||||
CvtMode::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int _mode = get<1>(GetParam()), mode = _mode;
|
||||
ChPair ch = getConversionInfo(mode);
|
||||
mode %= COLOR_COLORCVT_MAX;
|
||||
|
||||
Mat src(sz, CV_8UC(ch.scn));
|
||||
Mat dst(sz, CV_8UC(ch.dcn));
|
||||
|
||||
declare.time(100);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
int runs = sz.width <= 320 ? 100 : 5;
|
||||
TEST_CYCLE_MULTIRUN(runs) cvtColor(src, dst, mode, ch.dcn);
|
||||
|
||||
#if defined(__APPLE__) && defined(HAVE_IPP)
|
||||
SANITY_CHECK(dst, _mode == CX_BGRA2HLS_FULL ? 2 : 1);
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1900 /* MSVC 14 */
|
||||
if (_mode == CX_Luv2BGRA)
|
||||
SANITY_CHECK_NOTHING();
|
||||
else
|
||||
SANITY_CHECK(dst, 1);
|
||||
#else
|
||||
SANITY_CHECK(dst, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
typedef tuple<Size, CvtMode16U> Size_CvtMode16U_t;
|
||||
typedef perf::TestBaseWithParam<Size_CvtMode16U_t> Size_CvtMode16U;
|
||||
|
||||
PERF_TEST_P(Size_CvtMode16U, DISABLED_cvtColor_16u,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szVGA, ::perf::sz1080p),
|
||||
CvtMode16U::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int _mode = get<1>(GetParam()), mode = _mode;
|
||||
ChPair ch = getConversionInfo(mode);
|
||||
mode %= COLOR_COLORCVT_MAX;
|
||||
Mat src(sz, CV_16UC(ch.scn));
|
||||
Mat dst(sz, CV_16UC(ch.scn));
|
||||
|
||||
declare.time(100);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
int runs = sz.width <= 320 ? 100 : 5;
|
||||
TEST_CYCLE_MULTIRUN(runs) cvtColor(src, dst, mode, ch.dcn);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
|
||||
typedef tuple<Size, CvtMode32F> Size_CvtMode32F_t;
|
||||
typedef perf::TestBaseWithParam<Size_CvtMode32F_t> Size_CvtMode32F;
|
||||
|
||||
PERF_TEST_P(Size_CvtMode32F, DISABLED_cvtColor_32f,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szVGA, ::perf::sz1080p),
|
||||
CvtMode32F::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int _mode = get<1>(GetParam()), mode = _mode;
|
||||
ChPair ch = getConversionInfo(mode);
|
||||
mode %= COLOR_COLORCVT_MAX;
|
||||
Mat src(sz, CV_32FC(ch.scn));
|
||||
Mat dst(sz, CV_32FC(ch.scn));
|
||||
|
||||
declare.time(100);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
int runs = sz.width <= 320 ? 100 : 5;
|
||||
TEST_CYCLE_MULTIRUN(runs) cvtColor(src, dst, mode, ch.dcn);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
typedef tuple<Size, CvtModeBayer> Size_CvtMode_Bayer_t;
|
||||
typedef perf::TestBaseWithParam<Size_CvtMode_Bayer_t> Size_CvtMode_Bayer;
|
||||
|
||||
PERF_TEST_P(Size_CvtMode_Bayer, cvtColorBayer8u,
|
||||
testing::Combine(
|
||||
testing::Values(::perf::szODD, ::perf::szVGA),
|
||||
CvtModeBayer::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int mode = get<1>(GetParam());
|
||||
ChPair ch = getConversionInfo(mode);
|
||||
mode %= COLOR_COLORCVT_MAX;
|
||||
|
||||
Mat src(sz, CV_8UC(ch.scn));
|
||||
Mat dst(sz, CV_8UC(ch.dcn));
|
||||
|
||||
declare.time(100);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() cvtColor(src, dst, mode, ch.dcn);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
typedef tuple<Size, CvtMode2> Size_CvtMode2_t;
|
||||
typedef perf::TestBaseWithParam<Size_CvtMode2_t> Size_CvtMode2;
|
||||
|
||||
PERF_TEST_P(Size_CvtMode2, cvtColorYUV420,
|
||||
testing::Combine(
|
||||
testing::Values(szVGA, sz1080p, Size(130, 60)),
|
||||
CvtMode2::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int mode = get<1>(GetParam());
|
||||
ChPair ch = getConversionInfo(mode);
|
||||
|
||||
Mat src(sz.height + sz.height / 2, sz.width, CV_8UC(ch.scn));
|
||||
Mat dst(sz, CV_8UC(ch.dcn));
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
int runs = (sz.width <= 640) ? 8 : 1;
|
||||
TEST_CYCLE_MULTIRUN(runs) cvtColor(src, dst, mode, ch.dcn);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
typedef tuple<Size, CvtMode3> Size_CvtMode3_t;
|
||||
typedef perf::TestBaseWithParam<Size_CvtMode3_t> Size_CvtMode3;
|
||||
|
||||
PERF_TEST_P(Size_CvtMode3, cvtColorRGB2YUV420p,
|
||||
testing::Combine(
|
||||
testing::Values(szVGA, sz720p, sz1080p, Size(130, 60)),
|
||||
CvtMode3::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int mode = get<1>(GetParam());
|
||||
ChPair ch = getConversionInfo(mode);
|
||||
|
||||
Mat src(sz, CV_8UC(ch.scn));
|
||||
Mat dst(sz.height + sz.height / 2, sz.width, CV_8UC(ch.dcn));
|
||||
|
||||
declare.time(100);
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
int runs = (sz.width <= 640) ? 10 : 1;
|
||||
TEST_CYCLE_MULTIRUN(runs) cvtColor(src, dst, mode, ch.dcn);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
CV_ENUM(EdgeAwareBayerMode, COLOR_BayerBG2BGR_EA, COLOR_BayerGB2BGR_EA, COLOR_BayerRG2BGR_EA, COLOR_BayerGR2BGR_EA)
|
||||
|
||||
typedef tuple<Size, EdgeAwareBayerMode> EdgeAwareParams;
|
||||
typedef perf::TestBaseWithParam<EdgeAwareParams> EdgeAwareDemosaicingTest;
|
||||
|
||||
PERF_TEST_P(EdgeAwareDemosaicingTest, demosaicingEA,
|
||||
testing::Combine(
|
||||
testing::Values(szVGA, sz720p, sz1080p, Size(130, 60)),
|
||||
EdgeAwareBayerMode::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int mode = get<1>(GetParam());
|
||||
|
||||
Mat src(sz, CV_8UC1);
|
||||
Mat dst(sz, CV_8UC3);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() cvtColor(src, dst, mode, 3);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
79
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_distanceTransform.cpp
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
CV_ENUM(DistanceType, DIST_L1, DIST_L2 , DIST_C)
|
||||
CV_ENUM(MaskSize, DIST_MASK_3, DIST_MASK_5, DIST_MASK_PRECISE)
|
||||
CV_ENUM(DstType, CV_8U, CV_32F)
|
||||
CV_ENUM(LabelType, DIST_LABEL_CCOMP, DIST_LABEL_PIXEL)
|
||||
|
||||
typedef tuple<Size, DistanceType, MaskSize, DstType> SrcSize_DistType_MaskSize_DstType;
|
||||
typedef tuple<Size, DistanceType, MaskSize, LabelType> SrcSize_DistType_MaskSize_LabelType;
|
||||
typedef perf::TestBaseWithParam<SrcSize_DistType_MaskSize_DstType> DistanceTransform_Test;
|
||||
typedef perf::TestBaseWithParam<SrcSize_DistType_MaskSize_LabelType> DistanceTransform_NeedLabels_Test;
|
||||
|
||||
PERF_TEST_P(DistanceTransform_Test, distanceTransform,
|
||||
testing::Combine(
|
||||
testing::Values(cv::Size(640, 480), cv::Size(800, 600), cv::Size(1024, 768), cv::Size(1280, 1024)),
|
||||
DistanceType::all(),
|
||||
MaskSize::all(),
|
||||
DstType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size srcSize = get<0>(GetParam());
|
||||
int distanceType = get<1>(GetParam());
|
||||
int maskSize = get<2>(GetParam());
|
||||
int dstType = get<3>(GetParam());
|
||||
|
||||
Mat src(srcSize, CV_8U);
|
||||
Mat dst(srcSize, dstType);
|
||||
|
||||
declare
|
||||
.in(src, WARMUP_RNG)
|
||||
.out(dst, WARMUP_RNG)
|
||||
.time(30);
|
||||
|
||||
TEST_CYCLE() distanceTransform( src, dst, distanceType, maskSize, dstType);
|
||||
|
||||
double eps = 2e-4;
|
||||
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DistanceTransform_NeedLabels_Test, distanceTransform_NeedLabels,
|
||||
testing::Combine(
|
||||
testing::Values(cv::Size(640, 480), cv::Size(800, 600), cv::Size(1024, 768), cv::Size(1280, 1024)),
|
||||
DistanceType::all(),
|
||||
MaskSize::all(),
|
||||
LabelType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size srcSize = get<0>(GetParam());
|
||||
int distanceType = get<1>(GetParam());
|
||||
int maskSize = get<2>(GetParam());
|
||||
int labelType = get<3>(GetParam());
|
||||
|
||||
Mat src(srcSize, CV_8U);
|
||||
Mat label(srcSize, CV_32S);
|
||||
Mat dst(srcSize, CV_32F);
|
||||
|
||||
declare
|
||||
.in(src, WARMUP_RNG)
|
||||
.out(label, WARMUP_RNG)
|
||||
.out(dst, WARMUP_RNG)
|
||||
.time(30);
|
||||
|
||||
TEST_CYCLE() distanceTransform( src, dst, label, distanceType, maskSize, labelType);
|
||||
|
||||
double eps = 2e-4;
|
||||
|
||||
SANITY_CHECK(label, eps);
|
||||
SANITY_CHECK(dst, eps);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
100
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_filter2d.cpp
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
CV_ENUM(BorderMode, BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT_101)
|
||||
|
||||
typedef TestBaseWithParam< tuple<Size, int, BorderMode> > TestFilter2d;
|
||||
typedef TestBaseWithParam< tuple<string, int> > Image_KernelSize;
|
||||
|
||||
PERF_TEST_P( TestFilter2d, Filter2d,
|
||||
Combine(
|
||||
Values( Size(320, 240), sz1080p ),
|
||||
Values( 3, 5 ),
|
||||
BorderMode::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz;
|
||||
int borderMode, kSize;
|
||||
sz = get<0>(GetParam());
|
||||
kSize = get<1>(GetParam());
|
||||
borderMode = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, CV_8UC4);
|
||||
Mat dst(sz, CV_8UC4);
|
||||
|
||||
Mat kernel(kSize, kSize, CV_32FC1);
|
||||
randu(kernel, -3, 10);
|
||||
double s = fabs( sum(kernel)[0] );
|
||||
if(s > 1e-3) kernel /= s;
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst).time(20);
|
||||
|
||||
TEST_CYCLE() cv::filter2D(src, dst, CV_8UC4, kernel, Point(1, 1), 0., borderMode);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
PERF_TEST_P(TestFilter2d, DISABLED_Filter2d_ovx,
|
||||
Combine(
|
||||
Values(Size(320, 240), sz1080p),
|
||||
Values(3, 5),
|
||||
Values(BORDER_CONSTANT, BORDER_REPLICATE)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz;
|
||||
int borderMode, kSize;
|
||||
sz = get<0>(GetParam());
|
||||
kSize = get<1>(GetParam());
|
||||
borderMode = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, CV_8UC1);
|
||||
Mat dst(sz, CV_16SC1);
|
||||
|
||||
Mat kernel(kSize, kSize, CV_16SC1);
|
||||
randu(kernel, -3, 10);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst).time(20);
|
||||
|
||||
TEST_CYCLE() cv::filter2D(src, dst, CV_16SC1, kernel, Point(kSize / 2, kSize / 2), 0., borderMode);
|
||||
|
||||
SANITY_CHECK(dst, 1);
|
||||
}
|
||||
|
||||
PERF_TEST_P( Image_KernelSize, GaborFilter2d,
|
||||
Combine(
|
||||
Values("stitching/a1.png", "cv/shared/pic5.png"),
|
||||
Values(16, 32, 64) )
|
||||
)
|
||||
{
|
||||
string fileName = getDataPath(get<0>(GetParam()));
|
||||
Mat sourceImage = imread(fileName, IMREAD_GRAYSCALE);
|
||||
if( sourceImage.empty() )
|
||||
{
|
||||
FAIL() << "Unable to load source image" << fileName;
|
||||
}
|
||||
|
||||
int kernelSize = get<1>(GetParam());
|
||||
double sigma = 4;
|
||||
double lambda = 11;
|
||||
double theta = 47;
|
||||
double gamma = 0.5;
|
||||
Mat gaborKernel = getGaborKernel(Size(kernelSize, kernelSize), sigma, theta, lambda, gamma);
|
||||
Mat filteredImage;
|
||||
|
||||
declare.in(sourceImage);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::filter2D(sourceImage, filteredImage, CV_32F, gaborKernel);
|
||||
}
|
||||
|
||||
SANITY_CHECK(filteredImage, 1e-6, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
70
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_floodfill.cpp
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
// Copyright (C) 2014, Itseez, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
typedef tuple<string, Point, int, int, int, int> Size_Source_Fl_t;
|
||||
typedef perf::TestBaseWithParam<Size_Source_Fl_t> Size_Source_Fl;
|
||||
|
||||
PERF_TEST_P(Size_Source_Fl, floodFill1, Combine(
|
||||
testing::Values("cv/shared/fruits.png", "cv/optflow/RubberWhale1.png"), //images
|
||||
testing::Values(Point(120, 82), Point(200, 140)), //seed points
|
||||
testing::Values(4,8), //connectivity
|
||||
testing::Values((int)IMREAD_COLOR, (int)IMREAD_GRAYSCALE), //color image, or not
|
||||
testing::Values(0, 1, 2), //use fixed(1), gradient (2) or simple(0) mode
|
||||
testing::Values((int)CV_8U, (int)CV_32F, (int)CV_32S) //image depth
|
||||
))
|
||||
{
|
||||
//test given image(s)
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
Point pseed;
|
||||
pseed = get<1>(GetParam());
|
||||
|
||||
int connectivity = get<2>(GetParam());
|
||||
int colorType = get<3>(GetParam());
|
||||
int modeType = get<4>(GetParam());
|
||||
int imdepth = get<5>(GetParam());
|
||||
|
||||
Mat image0 = imread(filename, colorType);
|
||||
|
||||
Scalar newval, loVal, upVal;
|
||||
if (modeType == 0)
|
||||
{
|
||||
loVal = Scalar(0, 0, 0);
|
||||
upVal = Scalar(0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
loVal = Scalar(4, 4, 4);
|
||||
upVal = Scalar(20, 20, 20);
|
||||
}
|
||||
int newMaskVal = 255; //base mask for floodfill type
|
||||
int flags = connectivity + (newMaskVal << 8) + (modeType == 1 ? FLOODFILL_FIXED_RANGE : 0);
|
||||
|
||||
int b = 152;//(unsigned)theRNG() & 255;
|
||||
int g = 136;//(unsigned)theRNG() & 255;
|
||||
int r = 53;//(unsigned)theRNG() & 255;
|
||||
newval = (colorType == IMREAD_COLOR) ? Scalar(b, g, r) : Scalar(r*0.299 + g*0.587 + b*0.114);
|
||||
|
||||
Rect outputRect = Rect();
|
||||
Mat source = Mat();
|
||||
|
||||
for (; next(); )
|
||||
{
|
||||
image0.convertTo(source, imdepth);
|
||||
startTimer();
|
||||
cv::floodFill(source, pseed, newval, &outputRect, loVal, upVal, flags);
|
||||
stopTimer();
|
||||
}
|
||||
EXPECT_EQ(image0.cols, source.cols);
|
||||
EXPECT_EQ(image0.rows, source.rows);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
77
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_goodFeaturesToTrack.cpp
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
typedef tuple<string, int, double, int, int, bool> Image_MaxCorners_QualityLevel_MinDistance_BlockSize_gradientSize_UseHarris_t;
|
||||
typedef perf::TestBaseWithParam<Image_MaxCorners_QualityLevel_MinDistance_BlockSize_gradientSize_UseHarris_t> Image_MaxCorners_QualityLevel_MinDistance_BlockSize_gradientSize_UseHarris;
|
||||
|
||||
PERF_TEST_P(Image_MaxCorners_QualityLevel_MinDistance_BlockSize_gradientSize_UseHarris, goodFeaturesToTrack,
|
||||
testing::Combine(
|
||||
testing::Values( "stitching/a1.png", "cv/shared/pic5.png"),
|
||||
testing::Values( 100, 500 ),
|
||||
testing::Values( 0.1, 0.01 ),
|
||||
testing::Values( 3, 5 ),
|
||||
testing::Values( 3, 5 ),
|
||||
testing::Bool()
|
||||
)
|
||||
)
|
||||
{
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
int maxCorners = get<1>(GetParam());
|
||||
double qualityLevel = get<2>(GetParam());
|
||||
int blockSize = get<3>(GetParam());
|
||||
int gradientSize = get<4>(GetParam());
|
||||
bool useHarrisDetector = get<5>(GetParam());
|
||||
|
||||
Mat image = imread(filename, IMREAD_GRAYSCALE);
|
||||
if (image.empty())
|
||||
FAIL() << "Unable to load source image" << filename;
|
||||
|
||||
std::vector<Point2f> corners;
|
||||
|
||||
double minDistance = 1;
|
||||
TEST_CYCLE() goodFeaturesToTrack(image, corners, maxCorners, qualityLevel, minDistance, noArray(), blockSize, gradientSize, useHarrisDetector);
|
||||
|
||||
if (corners.size() > 50)
|
||||
corners.erase(corners.begin() + 50, corners.end());
|
||||
|
||||
SANITY_CHECK(corners);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Image_MaxCorners_QualityLevel_MinDistance_BlockSize_gradientSize_UseHarris, goodFeaturesToTrackWithQuality,
|
||||
testing::Combine(
|
||||
testing::Values( "stitching/a1.png", "cv/shared/pic5.png"),
|
||||
testing::Values( 50 ),
|
||||
testing::Values( 0.01 ),
|
||||
testing::Values( 3 ),
|
||||
testing::Values( 3 ),
|
||||
testing::Bool()
|
||||
)
|
||||
)
|
||||
{
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
int maxCorners = get<1>(GetParam());
|
||||
double qualityLevel = get<2>(GetParam());
|
||||
int blockSize = get<3>(GetParam());
|
||||
int gradientSize = get<4>(GetParam());
|
||||
bool useHarrisDetector = get<5>(GetParam());
|
||||
double minDistance = 1;
|
||||
|
||||
Mat image = imread(filename, IMREAD_GRAYSCALE);
|
||||
if (image.empty())
|
||||
FAIL() << "Unable to load source image" << filename;
|
||||
|
||||
std::vector<Point2f> corners;
|
||||
std::vector<float> cornersQuality;
|
||||
|
||||
TEST_CYCLE() goodFeaturesToTrack(image, corners, maxCorners, qualityLevel, minDistance, noArray(),
|
||||
cornersQuality, blockSize, gradientSize, useHarrisDetector);
|
||||
|
||||
SANITY_CHECK(corners);
|
||||
SANITY_CHECK(cornersQuality, 1e-6);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
168
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_histogram.cpp
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
typedef tuple<Size, MatType> Size_Source_t;
|
||||
typedef TestBaseWithParam<Size_Source_t> Size_Source;
|
||||
typedef TestBaseWithParam<Size> TestMatSize;
|
||||
|
||||
static const float rangeHight = 256.0f;
|
||||
static const float rangeLow = 0.0f;
|
||||
|
||||
PERF_TEST_P(Size_Source, calcHist1d,
|
||||
testing::Combine(testing::Values(sz3MP, sz5MP),
|
||||
testing::Values(CV_8U, CV_16U, CV_32F) )
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
MatType type = get<1>(GetParam());
|
||||
Mat source(size.height, size.width, type);
|
||||
Mat hist;
|
||||
int channels [] = {0};
|
||||
int histSize [] = {256};
|
||||
int dims = 1;
|
||||
int numberOfImages = 1;
|
||||
|
||||
const float range[] = {rangeLow, rangeHight};
|
||||
const float* ranges[] = {range};
|
||||
|
||||
randu(source, rangeLow, rangeHight);
|
||||
|
||||
declare.in(source);
|
||||
|
||||
TEST_CYCLE_MULTIRUN(3)
|
||||
{
|
||||
calcHist(&source, numberOfImages, channels, Mat(), hist, dims, histSize, ranges);
|
||||
}
|
||||
|
||||
SANITY_CHECK(hist);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_Source, calcHist2d,
|
||||
testing::Combine(testing::Values(sz3MP, sz5MP),
|
||||
testing::Values(CV_8UC2, CV_16UC2, CV_32FC2) )
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
MatType type = get<1>(GetParam());
|
||||
Mat source(size.height, size.width, type);
|
||||
Mat hist;
|
||||
int channels [] = {0, 1};
|
||||
int histSize [] = {256, 256};
|
||||
int dims = 2;
|
||||
int numberOfImages = 1;
|
||||
|
||||
const float r[] = {rangeLow, rangeHight};
|
||||
const float* ranges[] = {r, r};
|
||||
|
||||
randu(source, rangeLow, rangeHight);
|
||||
|
||||
declare.in(source);
|
||||
TEST_CYCLE()
|
||||
{
|
||||
calcHist(&source, numberOfImages, channels, Mat(), hist, dims, histSize, ranges);
|
||||
}
|
||||
|
||||
SANITY_CHECK(hist);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_Source, calcHist3d,
|
||||
testing::Combine(testing::Values(sz3MP, sz5MP),
|
||||
testing::Values(CV_8UC3, CV_16UC3, CV_32FC3) )
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
MatType type = get<1>(GetParam());
|
||||
Mat hist;
|
||||
int channels [] = {0, 1, 2};
|
||||
int histSize [] = {32, 32, 32};
|
||||
int dims = 3;
|
||||
int numberOfImages = 1;
|
||||
Mat source(size.height, size.width, type);
|
||||
|
||||
const float r[] = {rangeLow, rangeHight};
|
||||
const float* ranges[] = {r, r, r};
|
||||
|
||||
randu(source, rangeLow, rangeHight);
|
||||
|
||||
declare.in(source);
|
||||
TEST_CYCLE()
|
||||
{
|
||||
calcHist(&source, numberOfImages, channels, Mat(), hist, dims, histSize, ranges);
|
||||
}
|
||||
|
||||
SANITY_CHECK(hist);
|
||||
}
|
||||
|
||||
#define MatSize TestMatSize
|
||||
PERF_TEST_P(MatSize, equalizeHist,
|
||||
testing::Values(TYPICAL_MAT_SIZES)
|
||||
)
|
||||
{
|
||||
Size size = GetParam();
|
||||
Mat source(size.height, size.width, CV_8U);
|
||||
Mat destination;
|
||||
declare.in(source, WARMUP_RNG);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
equalizeHist(source, destination);
|
||||
}
|
||||
|
||||
SANITY_CHECK(destination);
|
||||
}
|
||||
#undef MatSize
|
||||
|
||||
typedef TestBaseWithParam< tuple<int, int> > Dim_Cmpmethod;
|
||||
PERF_TEST_P(Dim_Cmpmethod, compareHist,
|
||||
testing::Combine(testing::Values(1, 3),
|
||||
testing::Values(HISTCMP_CORREL, HISTCMP_CHISQR, HISTCMP_INTERSECT, HISTCMP_BHATTACHARYYA, HISTCMP_CHISQR_ALT, HISTCMP_KL_DIV))
|
||||
)
|
||||
{
|
||||
int dims = get<0>(GetParam());
|
||||
int method = get<1>(GetParam());
|
||||
int histSize[] = { 2048, 128, 64 };
|
||||
|
||||
Mat hist1(dims, histSize, CV_32FC1);
|
||||
Mat hist2(dims, histSize, CV_32FC1);
|
||||
randu(hist1, 0, 256);
|
||||
randu(hist2, 0, 256);
|
||||
|
||||
declare.in(hist1.reshape(1, 256), hist2.reshape(1, 256));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
compareHist(hist1, hist2, method);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
typedef tuple<Size, double, MatType> Sz_ClipLimit_t;
|
||||
typedef TestBaseWithParam<Sz_ClipLimit_t> Sz_ClipLimit;
|
||||
|
||||
PERF_TEST_P(Sz_ClipLimit, CLAHE,
|
||||
testing::Combine(testing::Values(::perf::szVGA, ::perf::sz720p, ::perf::sz1080p),
|
||||
testing::Values(0.0, 40.0),
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_16UC1)))
|
||||
)
|
||||
{
|
||||
const Size size = get<0>(GetParam());
|
||||
const double clipLimit = get<1>(GetParam());
|
||||
const int type = get<2>(GetParam());
|
||||
|
||||
Mat src(size, type);
|
||||
declare.in(src, WARMUP_RNG);
|
||||
|
||||
Ptr<CLAHE> clahe = createCLAHE(clipLimit);
|
||||
Mat dst;
|
||||
|
||||
TEST_CYCLE() clahe->apply(src, dst);
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
85
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_houghcircles.cpp
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
#include "opencv2/imgproc/types_c.h"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
PERF_TEST(PerfHoughCircles, Basic)
|
||||
{
|
||||
string filename = getDataPath("cv/imgproc/stuff.jpg");
|
||||
const double dp = 1.0;
|
||||
double minDist = 20;
|
||||
double edgeThreshold = 20;
|
||||
double accumThreshold = 30;
|
||||
int minRadius = 20;
|
||||
int maxRadius = 200;
|
||||
|
||||
Mat img = imread(filename, IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img.empty()) << "Unable to load source image " << filename;
|
||||
|
||||
GaussianBlur(img, img, Size(9, 9), 2, 2);
|
||||
|
||||
vector<Vec3f> circles;
|
||||
declare.in(img);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
HoughCircles(img, circles, CV_HOUGH_GRADIENT, dp, minDist, edgeThreshold, accumThreshold, minRadius, maxRadius);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST(PerfHoughCircles2, ManySmallCircles)
|
||||
{
|
||||
string filename = getDataPath("cv/imgproc/beads.jpg");
|
||||
const double dp = 1.0;
|
||||
double minDist = 10;
|
||||
double edgeThreshold = 90;
|
||||
double accumThreshold = 11;
|
||||
int minRadius = 7;
|
||||
int maxRadius = 18;
|
||||
|
||||
Mat img = imread(filename, IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img.empty()) << "Unable to load source image " << filename;
|
||||
|
||||
vector<Vec3f> circles;
|
||||
declare.in(img);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
HoughCircles(img, circles, CV_HOUGH_GRADIENT, dp, minDist, edgeThreshold, accumThreshold, minRadius, maxRadius);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST(PerfHoughCircles4f, Basic)
|
||||
{
|
||||
string filename = getDataPath("cv/imgproc/stuff.jpg");
|
||||
const double dp = 1.0;
|
||||
double minDist = 20;
|
||||
double edgeThreshold = 20;
|
||||
double accumThreshold = 30;
|
||||
int minRadius = 20;
|
||||
int maxRadius = 200;
|
||||
|
||||
Mat img = imread(filename, IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img.empty()) << "Unable to load source image " << filename;
|
||||
|
||||
GaussianBlur(img, img, Size(9, 9), 2, 2);
|
||||
|
||||
vector<Vec4f> circles;
|
||||
declare.in(img);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
HoughCircles(img, circles, CV_HOUGH_GRADIENT, dp, minDist, edgeThreshold, accumThreshold, minRadius, maxRadius);
|
||||
}
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
115
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_houghlines.cpp
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
typedef tuple<string, double, double, double> Image_RhoStep_ThetaStep_Threshold_t;
|
||||
typedef perf::TestBaseWithParam<Image_RhoStep_ThetaStep_Threshold_t> Image_RhoStep_ThetaStep_Threshold;
|
||||
|
||||
PERF_TEST_P(Image_RhoStep_ThetaStep_Threshold, HoughLines,
|
||||
testing::Combine(
|
||||
testing::Values( "cv/shared/pic5.png", "stitching/a1.png" ),
|
||||
testing::Values( 1, 10 ),
|
||||
testing::Values( 0.01, 0.1 ),
|
||||
testing::Values( 0.5, 1.1 )
|
||||
)
|
||||
)
|
||||
{
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
double rhoStep = get<1>(GetParam());
|
||||
double thetaStep = get<2>(GetParam());
|
||||
double threshold_ratio = get<3>(GetParam());
|
||||
|
||||
Mat image = imread(filename, IMREAD_GRAYSCALE);
|
||||
if (image.empty())
|
||||
FAIL() << "Unable to load source image" << filename;
|
||||
|
||||
Canny(image, image, 32, 128);
|
||||
|
||||
// add some synthetic lines:
|
||||
line(image, Point(0, 0), Point(image.cols, image.rows), Scalar::all(255), 3);
|
||||
line(image, Point(image.cols, 0), Point(image.cols/2, image.rows), Scalar::all(255), 3);
|
||||
|
||||
vector<Vec2f> lines;
|
||||
declare.time(60);
|
||||
|
||||
int hough_threshold = (int)(std::min(image.cols, image.rows) * threshold_ratio);
|
||||
|
||||
TEST_CYCLE() HoughLines(image, lines, rhoStep, thetaStep, hough_threshold);
|
||||
|
||||
printf("%dx%d: %d lines\n", image.cols, image.rows, (int)lines.size());
|
||||
|
||||
if (threshold_ratio < 1.0)
|
||||
{
|
||||
EXPECT_GE(lines.size(), 2u);
|
||||
}
|
||||
|
||||
EXPECT_LT(lines.size(), 3000u);
|
||||
|
||||
#if 0
|
||||
cv::cvtColor(image,image,cv::COLOR_GRAY2BGR);
|
||||
for( size_t i = 0; i < lines.size(); i++ )
|
||||
{
|
||||
float rho = lines[i][0], theta = lines[i][1];
|
||||
Point pt1, pt2;
|
||||
double a = cos(theta), b = sin(theta);
|
||||
double x0 = a*rho, y0 = b*rho;
|
||||
pt1.x = cvRound(x0 + 1000*(-b));
|
||||
pt1.y = cvRound(y0 + 1000*(a));
|
||||
pt2.x = cvRound(x0 - 1000*(-b));
|
||||
pt2.y = cvRound(y0 - 1000*(a));
|
||||
line(image, pt1, pt2, Scalar(0,0,255), 1, cv::LINE_AA);
|
||||
}
|
||||
cv::imshow("result", image);
|
||||
cv::waitKey();
|
||||
#endif
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P(Image_RhoStep_ThetaStep_Threshold, HoughLines3f,
|
||||
testing::Combine(
|
||||
testing::Values( "cv/shared/pic5.png", "stitching/a1.png" ),
|
||||
testing::Values( 1, 10 ),
|
||||
testing::Values( 0.01, 0.1 ),
|
||||
testing::Values( 0.5, 1.1 )
|
||||
)
|
||||
)
|
||||
{
|
||||
string filename = getDataPath(get<0>(GetParam()));
|
||||
double rhoStep = get<1>(GetParam());
|
||||
double thetaStep = get<2>(GetParam());
|
||||
double threshold_ratio = get<3>(GetParam());
|
||||
|
||||
Mat image = imread(filename, IMREAD_GRAYSCALE);
|
||||
if (image.empty())
|
||||
FAIL() << "Unable to load source image" << filename;
|
||||
|
||||
Canny(image, image, 32, 128);
|
||||
|
||||
// add some synthetic lines:
|
||||
line(image, Point(0, 0), Point(image.cols, image.rows), Scalar::all(255), 3);
|
||||
line(image, Point(image.cols, 0), Point(image.cols/2, image.rows), Scalar::all(255), 3);
|
||||
|
||||
vector<Vec3f> lines;
|
||||
declare.time(60);
|
||||
|
||||
int hough_threshold = (int)(std::min(image.cols, image.rows) * threshold_ratio);
|
||||
|
||||
TEST_CYCLE() HoughLines(image, lines, rhoStep, thetaStep, hough_threshold);
|
||||
|
||||
printf("%dx%d: %d lines\n", image.cols, image.rows, (int)lines.size());
|
||||
|
||||
if (threshold_ratio < 1.0)
|
||||
{
|
||||
EXPECT_GE(lines.size(), 2u);
|
||||
}
|
||||
|
||||
EXPECT_LT(lines.size(), 3000u);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
139
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_integral.cpp
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
enum PerfSqMatDepth{
|
||||
DEPTH_32S_32S = 0,
|
||||
DEPTH_32S_32F,
|
||||
DEPTH_32S_64F,
|
||||
DEPTH_32F_32F,
|
||||
DEPTH_32F_64F,
|
||||
DEPTH_64F_64F};
|
||||
|
||||
CV_ENUM(IntegralOutputDepths, DEPTH_32S_32S, DEPTH_32S_32F, DEPTH_32S_64F, DEPTH_32F_32F, DEPTH_32F_64F, DEPTH_64F_64F);
|
||||
|
||||
static int extraOutputDepths[6][2] = {{CV_32S, CV_32S}, {CV_32S, CV_32F}, {CV_32S, CV_64F}, {CV_32F, CV_32F}, {CV_32F, CV_64F}, {CV_64F, CV_64F}};
|
||||
|
||||
typedef tuple<Size, MatType, MatDepth> Size_MatType_OutMatDepth_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_OutMatDepth_t> Size_MatType_OutMatDepth;
|
||||
|
||||
typedef tuple<Size, MatType, IntegralOutputDepths> Size_MatType_OutMatDepthArray_t;
|
||||
typedef perf::TestBaseWithParam<Size_MatType_OutMatDepthArray_t> Size_MatType_OutMatDepthArray;
|
||||
|
||||
PERF_TEST_P(Size_MatType_OutMatDepth, integral,
|
||||
testing::Combine(
|
||||
testing::Values(TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4),
|
||||
testing::Values(CV_32S, CV_32F, CV_64F)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int matType = get<1>(GetParam());
|
||||
int sdepth = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, matType);
|
||||
Mat sum(sz, sdepth);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(sum);
|
||||
if (sdepth == CV_32F)
|
||||
src *= (1 << 23) / (double)(sz.area() * 256); // FP32 calculations are not accurate (mantissa is 23-bit)
|
||||
|
||||
TEST_CYCLE() integral(src, sum, sdepth);
|
||||
|
||||
Mat src_roi; src(Rect(src.cols - 4, src.rows - 4, 4, 4)).convertTo(src_roi, sdepth);
|
||||
Mat restored_src_roi =
|
||||
sum(Rect(sum.cols - 4, sum.rows - 4, 4, 4)) + sum(Rect(sum.cols - 5, sum.rows - 5, 4, 4)) -
|
||||
sum(Rect(sum.cols - 4, sum.rows - 5, 4, 4)) - sum(Rect(sum.cols - 5, sum.rows - 4, 4, 4));
|
||||
EXPECT_EQ(0, cvtest::norm(restored_src_roi, src_roi, NORM_INF))
|
||||
<< src_roi << endl << restored_src_roi << endl
|
||||
<< sum(Rect(sum.cols - 4, sum.rows - 4, 4, 4));
|
||||
|
||||
if (sdepth == CV_32F)
|
||||
SANITY_CHECK_NOTHING();
|
||||
else
|
||||
SANITY_CHECK(sum, 1e-6);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType_OutMatDepth, integral_sqsum,
|
||||
testing::Combine(
|
||||
testing::Values(TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4),
|
||||
testing::Values(CV_32S, CV_32F, CV_64F)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int matType = get<1>(GetParam());
|
||||
int sdepth = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, matType);
|
||||
Mat sum(sz, sdepth);
|
||||
Mat sqsum(sz, sdepth);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(sum, sqsum);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE() integral(src, sum, sqsum, sdepth);
|
||||
|
||||
SANITY_CHECK(sum, 1e-6);
|
||||
SANITY_CHECK(sqsum, 1e-6);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType_OutMatDepthArray, DISABLED_integral_sqsum_full,
|
||||
testing::Combine(
|
||||
testing::Values(TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4),
|
||||
testing::Values(DEPTH_32S_32S, DEPTH_32S_32F, DEPTH_32S_64F, DEPTH_32F_32F, DEPTH_32F_64F, DEPTH_64F_64F)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int matType = get<1>(GetParam());
|
||||
int *outputDepths = (int *)extraOutputDepths[get<2>(GetParam())];
|
||||
int sdepth = outputDepths[0];
|
||||
int sqdepth = outputDepths[1];
|
||||
|
||||
Mat src(sz, matType);
|
||||
Mat sum(sz, sdepth);
|
||||
Mat sqsum(sz, sqdepth);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(sum, sqsum);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE() integral(src, sum, sqsum, sdepth, sqdepth);
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum_tilted,
|
||||
testing::Combine(
|
||||
testing::Values(TYPICAL_MAT_SIZES),
|
||||
testing::Values( CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4 ),
|
||||
testing::Values( CV_32S, CV_32F, CV_64F )
|
||||
)
|
||||
)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int matType = get<1>(GetParam());
|
||||
int sdepth = get<2>(GetParam());
|
||||
|
||||
Mat src(sz, matType);
|
||||
Mat sum(sz, sdepth);
|
||||
Mat sqsum(sz, sdepth);
|
||||
Mat tilted(sz, sdepth);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(sum, sqsum, tilted);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE() integral(src, sum, sqsum, tilted, sdepth);
|
||||
|
||||
SANITY_CHECK(sum, 1e-6);
|
||||
SANITY_CHECK(sqsum, 1e-6);
|
||||
SANITY_CHECK(tilted, 1e-6, tilted.depth() > CV_32S ? ERROR_RELATIVE : ERROR_ABSOLUTE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
10
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_main.cpp
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
#if defined(HAVE_HPX)
|
||||
#include <hpx/hpx_main.hpp>
|
||||
#endif
|
||||
|
||||
CV_PERF_TEST_MAIN(imgproc)
|
||||
84
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_matchTemplate.cpp
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
CV_ENUM(MethodType, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED)
|
||||
|
||||
typedef tuple<Size, Size, MethodType> ImgSize_TmplSize_Method_t;
|
||||
typedef perf::TestBaseWithParam<ImgSize_TmplSize_Method_t> ImgSize_TmplSize_Method;
|
||||
|
||||
PERF_TEST_P(ImgSize_TmplSize_Method, matchTemplateSmall,
|
||||
testing::Combine(
|
||||
testing::Values(szSmall128, cv::Size(320, 240),
|
||||
cv::Size(640, 480), cv::Size(800, 600),
|
||||
cv::Size(1024, 768), cv::Size(1280, 1024)),
|
||||
testing::Values(cv::Size(12, 12), cv::Size(28, 9),
|
||||
cv::Size(8, 30), cv::Size(16, 16)),
|
||||
MethodType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size imgSz = get<0>(GetParam());
|
||||
Size tmplSz = get<1>(GetParam());
|
||||
int method = get<2>(GetParam());
|
||||
|
||||
Mat img(imgSz, CV_8UC1);
|
||||
Mat tmpl(tmplSz, CV_8UC1);
|
||||
Mat result(imgSz - tmplSz + Size(1,1), CV_32F);
|
||||
|
||||
declare
|
||||
.in(img, WARMUP_RNG)
|
||||
.in(tmpl, WARMUP_RNG)
|
||||
.out(result)
|
||||
.time(30);
|
||||
|
||||
TEST_CYCLE() matchTemplate(img, tmpl, result, method);
|
||||
|
||||
bool isNormed =
|
||||
method == TM_CCORR_NORMED ||
|
||||
method == TM_SQDIFF_NORMED ||
|
||||
method == TM_CCOEFF_NORMED;
|
||||
double eps = isNormed ? 1e-5
|
||||
: 255 * 255 * tmpl.total() * 1e-6;
|
||||
|
||||
SANITY_CHECK(result, eps);
|
||||
}
|
||||
|
||||
PERF_TEST_P(ImgSize_TmplSize_Method, matchTemplateBig,
|
||||
testing::Combine(
|
||||
testing::Values(cv::Size(1280, 1024)),
|
||||
testing::Values(cv::Size(1260, 1000), cv::Size(1261, 1013)),
|
||||
MethodType::all()
|
||||
)
|
||||
)
|
||||
{
|
||||
Size imgSz = get<0>(GetParam());
|
||||
Size tmplSz = get<1>(GetParam());
|
||||
int method = get<2>(GetParam());
|
||||
|
||||
Mat img(imgSz, CV_8UC1);
|
||||
Mat tmpl(tmplSz, CV_8UC1);
|
||||
Mat result(imgSz - tmplSz + Size(1,1), CV_32F);
|
||||
|
||||
declare
|
||||
.in(img, WARMUP_RNG)
|
||||
.in(tmpl, WARMUP_RNG)
|
||||
.out(result)
|
||||
.time(30);
|
||||
|
||||
TEST_CYCLE() matchTemplate(img, tmpl, result, method);
|
||||
|
||||
bool isNormed =
|
||||
method == TM_CCORR_NORMED ||
|
||||
method == TM_SQDIFF_NORMED ||
|
||||
method == TM_CCOEFF_NORMED;
|
||||
double eps = isNormed ? 1e-6
|
||||
: 255.0 * 255.0 * (double)tmpl.total() * 1e-6;
|
||||
|
||||
SANITY_CHECK(result, eps);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
41
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_moments.cpp
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
// Copyright (C) 2014, Itseez, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
typedef tuple<Size, MatDepth, bool> MomentsParams_t;
|
||||
typedef perf::TestBaseWithParam<MomentsParams_t> MomentsFixture_val;
|
||||
|
||||
PERF_TEST_P(MomentsFixture_val, Moments1,
|
||||
::testing::Combine(
|
||||
testing::Values(TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_16U, CV_16S, CV_32F, CV_64F),
|
||||
testing::Bool()))
|
||||
{
|
||||
const MomentsParams_t params = GetParam();
|
||||
const Size srcSize = get<0>(params);
|
||||
const MatDepth srcDepth = get<1>(params);
|
||||
const bool binaryImage = get<2>(params);
|
||||
|
||||
cv::Moments m;
|
||||
Mat src(srcSize, srcDepth);
|
||||
declare.in(src, WARMUP_RNG);
|
||||
|
||||
TEST_CYCLE() m = cv::moments(src, binaryImage);
|
||||
|
||||
int len = (int)sizeof(cv::Moments) / sizeof(double);
|
||||
cv::Mat mat(1, len, CV_64F, (void*)&m);
|
||||
//adding 1 to moments to avoid accidental tests fail on values close to 0
|
||||
mat += 1;
|
||||
|
||||
|
||||
SANITY_CHECK_MOMENTS(m, 2e-4, ERROR_RELATIVE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
42
3rdparty/opencv-4.5.4/modules/imgproc/perf/perf_morph.cpp
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
#define TYPICAL_MAT_TYPES_MORPH CV_8UC1, CV_8UC4
|
||||
#define TYPICAL_MATS_MORPH testing::Combine(SZ_ALL_GA, testing::Values(TYPICAL_MAT_TYPES_MORPH))
|
||||
|
||||
PERF_TEST_P(Size_MatType, erode, TYPICAL_MATS_MORPH)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
|
||||
Mat src(sz, type);
|
||||
Mat dst(sz, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
int runs = (sz.width <= 320) ? 15 : 1;
|
||||
TEST_CYCLE_MULTIRUN(runs) erode(src, dst, noArray());
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
PERF_TEST_P(Size_MatType, dilate, TYPICAL_MATS_MORPH)
|
||||
{
|
||||
Size sz = get<0>(GetParam());
|
||||
int type = get<1>(GetParam());
|
||||
|
||||
Mat src(sz, type);
|
||||
Mat dst(sz, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
|
||||
TEST_CYCLE() dilate(src, dst, noArray());
|
||||
|
||||
SANITY_CHECK(dst);
|
||||
}
|
||||
|
||||
} // namespace
|
||||