vendor: OpenCV 5.0.0 snapshot at 40738fb16ceddb5fb3fea747585f7ce6abb0605b

This commit is contained in:
Gitea Mirror Bot
2026-08-22 00:10:33 +08:00
commit f7f077da11
6933 changed files with 2335208 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
set(the_description "Image Processing")
ocv_add_dispatched_file(accum SSE4_1 AVX AVX2)
ocv_add_dispatched_file(bilateral_filter SSE2 AVX2 AVX512_SKX AVX512_ICL)
ocv_add_dispatched_file(box_filter SSE2 SSE4_1 AVX2 AVX512_SKX)
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 AVX512_SKX AVX512_ICL)
ocv_add_dispatched_file(morph SSE2 SSE4_1 AVX2)
ocv_add_dispatched_file(smooth SSE2 SSE4_1 AVX2 AVX512_ICL)
ocv_add_dispatched_file(sumpixels SSE2 AVX2 AVX512_SKX)
ocv_add_dispatched_file(warp_kernels SSE2 SSE4_1 AVX2 NEON NEON_FP16 RVV LASX)
ocv_add_dispatched_file(undistort SSE2 AVX2)
ocv_define_module(imgproc opencv_core opencv_geometry WRAP java objc python js)
ocv_module_include_directories(opencv_imgproc ${ZLIB_INCLUDE_DIRS})
if(HAVE_IPP)
# OPENCV_IPP_ENABLE_ALL is defined in modules/core/CMakeList.txt
OCV_OPTION(OPENCV_IPP_GAUSSIAN_BLUR "Enable IPP optimizations for GaussianBlur (+8Mb in binary size)" OPENCV_IPP_ENABLE_ALL)
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()
endif()
set(UNIFONT_MD5 "fb79cf5b4f4c89414f1233f14c2eb273")
set(UNIFONT_NAME "WenQuanYiMicroHei.ttf.gz")
set(UNIFONT_COMMIT "cc7d85179d69a704bee209aa37ce8a657f2f8b34")
set(UNIFONT_URL "https://raw.githubusercontent.com/vpisarev/opencv_3rdparty/${UNIFONT_COMMIT}/")
unset(HAVE_UNIFONT)
unset(HAVE_UNIFONT CACHE)
if (WITH_UNIFONT)
ocv_download(FILENAME ${UNIFONT_NAME}
HASH ${UNIFONT_MD5}
URL
"${OPENCV_UNIFONT_URL}"
"${UNIFONT_URL}"
DESTINATION_DIR "${CMAKE_CURRENT_BINARY_DIR}"
ID UNIFONT
STATUS res
RELATIVE_URL)
if (res)
message(STATUS "Unicode font has been downloaded successfully.")
set(HAVE_UNIFONT ON CACHE INTERNAL "")
else()
message(STATUS "Unicode font download failed. Turning it off.")
set(HAVE_UNIFONT OFF CACHE INTERNAL "")
endif()
else()
set(HAVE_UNIFONT OFF CACHE INTERNAL "")
endif()
ocv_blob2hdr("${CMAKE_CURRENT_SOURCE_DIR}/fonts/Rubik.ttf.gz" "${CMAKE_CURRENT_BINARY_DIR}/builtin_font_sans.h" OcvBuiltinFontSans)
ocv_blob2hdr("${CMAKE_CURRENT_SOURCE_DIR}/fonts/Rubik-Italic.ttf.gz" "${CMAKE_CURRENT_BINARY_DIR}/builtin_font_italic.h" OcvBuiltinFontItalic)
if (HAVE_UNIFONT)
ocv_blob2hdr("${CMAKE_CURRENT_BINARY_DIR}/${UNIFONT_NAME}" "${CMAKE_CURRENT_BINARY_DIR}/builtin_font_uni.h" OcvBuiltinFontUni)
endif()
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
ocv_target_link_libraries(${the_module} LINK_PRIVATE ${ZLIB_LIBRARIES})
ocv_install_3rdparty_licenses(fonts fonts/Rubik_OFL.txt)
+206
View File
@@ -0,0 +1,206 @@
Color conversions {#imgproc_color_conversions}
=================
See cv::cvtColor and cv::ColorConversionCodes
@todo document other conversion modes
@anchor color_convert_rgb_gray
RGB <-> 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 <-> 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 <-> 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_yuv_42x
RGB <-> YUV with subsampling
------------------------------
Only 8-bit values are supported.
The coefficients correspond to BT.601 standard with resulting values Y [16, 235], U and V [16, 240] centered at 128.
Two subsampling schemes are supported: 4:2:0 (Fourcc codes NV12, NV21, YV12, I420 and synonimic)
and 4:2:2 (Fourcc codes UYVY, YUY2, YVYU and synonimic).
In both subsampling schemes Y values are written for each pixel so that Y plane is in fact a scaled and biased gray version
of a source image.
In 4:2:0 scheme U and V values are averaged over 2x2 squares, i.e. only 1 U and 1 V value is saved per each 4 pixels.
U and V values are saved interleaved into a separate plane (NV12, NV21) or into two separate semi-planes (YV12, I420).
In 4:2:2 scheme U and V values are averaged horizontally over each pair of pixels, i.e. only 1 U and 1 V value is saved
per each 2 pixels. U and V values are saved interleaved with Y values for both pixels according to its Fourcc code.
Note that different conversions are perfomed with different precision for speed or compatibility purposes. For example,
RGB to YUV 4:2:2 is converted using 14-bit fixed-point arithmetics while other conversions use 20 bits.
\f[R \leftarrow 1.164 \cdot (Y - 16) + 1.596 \cdot (V - 128)\f]
\f[G \leftarrow 1.164 \cdot (Y - 16) - 0.813 \cdot (V - 128) - 0.391 \cdot (U - 128)\f]
\f[B \leftarrow 1.164 \cdot (Y - 16) + 2.018 \cdot (U - 128)\f]
\f[Y \leftarrow (R \cdot 0.299 + G \cdot 0.587 + B \cdot 0.114) \cdot \frac{236 - 16}{256} + 16 \f]
\f[U \leftarrow -0.148 \cdot R_{avg} - 0.291 \cdot G_{avg} + 0.439 \cdot B_{avg} + 128 \f]
\f[V \leftarrow 0.439 \cdot R_{avg} - 0.368 \cdot G_{avg} - 0.071 \cdot B_{avg} + 128 \f]
@see cv::COLOR_YUV2RGB_NV12, cv::COLOR_YUV2RGBA_YUY2, cv::COLOR_BGR2YUV_YV12 and similar ones
@anchor color_convert_rgb_hsv
RGB <-> 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 \leftarrow 65535 V, S \leftarrow 65535 S, H \leftarrow 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 <-> 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 \leftarrow 65535 \cdot V, S \leftarrow 65535 \cdot S, H \leftarrow 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 <-> 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 <-> 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 -> 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:
![Bayer patterns (BGGR, GBRG, GRBG, RGGB)](pics/Bayer_patterns.png)
The output RGB components of a pixel are interpolated from 1, 2, or 4 neighbors of the pixel
having the same color.
@note See the following for information about correspondences between OpenCV Bayer pattern naming and classical Bayer pattern naming.
![Bayer pattern](pics/bayer.png)
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_BayerRGGB2BGR, cv::COLOR_BayerGRBG2BGR, cv::COLOR_BayerBGGR2BGR, cv::COLOR_BayerGBRG2BGR, cv::COLOR_BayerRGGB2RGB, cv::COLOR_BayerGRBG2RGB, cv::COLOR_BayerBGGR2RGB, cv::COLOR_BayerGBRG2RGB
cv::COLOR_BayerBG2BGR, cv::COLOR_BayerGB2BGR, cv::COLOR_BayerRG2BGR, cv::COLOR_BayerGR2BGR, cv::COLOR_BayerBG2RGB, cv::COLOR_BayerGB2RGB, cv::COLOR_BayerRG2RGB, cv::COLOR_BayerGR2RGB
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 325 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.
Binary file not shown.
+93
View File
@@ -0,0 +1,93 @@
Copyright 2015 The Rubik Project Authors (https://github.com/googlefonts/rubik),
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,54 @@
// 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,
bool use_edgeval = false
)
{
std::vector<Vec3f> lines_acc;
HoughLines(image, lines_acc, rho, theta, threshold, srn, stn, min_theta, max_theta, use_edgeval);
Mat(lines_acc).copyTo(lines);
}
/** @brief Finds circles in a grayscale image using the Hough transform and get accumulator.
*
* @note This function is for bindings use only. Use original function in C++ code
*
* @sa HoughCircles
*/
CV_WRAP static inline
void HoughCirclesWithAccumulator(
InputArray image, OutputArray circles,
int method, double dp, double minDist,
double param1 = 100, double param2 = 100,
int minRadius = 0, int maxRadius = 0
)
{
std::vector<Vec4f> circles_acc;
HoughCircles(image, circles_acc, method, dp, minDist, param1, param2, minRadius, maxRadius);
Mat(1, static_cast<int>(circles_acc.size()), CV_32FC4, &circles_acc.front()).copyTo(circles);
}
} // namespace
#endif // OPENCV_IMGPROC_BINDINGS_HPP
@@ -0,0 +1,269 @@
#ifndef CV_IMGPROC_HAL_HPP
#define CV_IMGPROC_HAL_HPP
#include "opencv2/core/cvdef.h"
#include "opencv2/core/cvstd.hpp"
#include "opencv2/core/utility.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 warpAffineBlocklineNN(int *adelta, int *bdelta, short* xy, int X0, int Y0, int bw);
CV_EXPORTS void warpAffineBlockline(int *adelta, int *bdelta, short* xy, short* alpha, int X0, int Y0, int bw);
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 warpPerspectiveBlocklineNN(const double *M, short* xy, double X0, double Y0, double W0, int bw);
CV_EXPORTS void warpPerspectiveBlockline(const double *M, short* xy, short* alpha, double X0, double Y0, double W0, int bw);
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,
AlgorithmHint hint = ALGO_HINT_DEFAULT);
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,
AlgorithmHint hint = ALGO_HINT_DEFAULT);
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,
AlgorithmHint hint = ALGO_HINT_DEFAULT);
//! 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,
AlgorithmHint hint = ALGO_HINT_DEFAULT);
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,
AlgorithmHint hint = ALGO_HINT_DEFAULT);
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,
AlgorithmHint hint = ALGO_HINT_DEFAULT);
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,
AlgorithmHint hint = ALGO_HINT_DEFAULT);
//! 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,
AlgorithmHint hint = ALGO_HINT_DEFAULT);
CV_EXPORTS void cvtOnePlaneBGRtoYUV(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, int ycn,
AlgorithmHint hint = ALGO_HINT_DEFAULT);
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
@@ -0,0 +1,52 @@
#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
#define CV_HAL_INTER_LINEAR_EXACT 5
#define CV_HAL_INTER_NEAREST_EXACT 6
#define CV_HAL_INTER_MAX 7
#define CV_HAL_WARP_FILL_OUTLIERS 8
#define CV_HAL_WARP_INVERSE_MAP 16
#define CV_HAL_WARP_RELATIVE_MAP 32
//! @}
//! @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
@@ -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"
+111
View File
@@ -0,0 +1,111 @@
{
"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" : {
"drawContours" : {"contours" : {"ctype" : "vector_vector_Point"} },
"findContours" : {"contours" : {"ctype" : "vector_vector_Point"} }
}
}
@@ -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; }
}
File diff suppressed because it is too large Load Diff
+85
View File
@@ -0,0 +1,85 @@
{
"whitelist":
{
"": [
"adaptiveThreshold",
"applyColorMap",
"arcLength",
"arrowedLine",
"bilateralFilter",
"blendLinear",
"blur",
"boxFilter",
"calcBackProject",
"calcHist",
"Canny",
"circle",
"clipLine",
"compareHist",
"connectedComponents",
"connectedComponentsWithStats",
"contourArea",
"convertMaps",
"cornerHarris",
"cornerMinEigenVal",
"createCLAHE",
"createHanningWindow",
"createLineSegmentDetector",
"cvtColor",
"demosaicing",
"dilate",
"distanceTransform",
"distanceTransformWithLabels",
"drawContours",
"drawMarker",
"drawFrameAxes",
"ellipse",
"ellipse2Poly",
"equalizeHist",
"erode",
"fillConvexPoly",
"fillPoly",
"filter2D",
"findContours",
"findContoursLinkRuns",
"floodFill",
"fisheye_initUndistortRectifyMap",
"GaussianBlur",
"getFontScaleFromHeight",
"getRectSubPix",
"getStructuringElement",
"grabCut",
"HoughCircles",
"HoughLines",
"HoughLinesP",
"integral",
"integral2",
"Laplacian",
"line",
"matchTemplate",
"medianBlur",
"morphologyEx",
"polylines",
"preCornerDetect",
"putText",
"pyrDown",
"pyrUp",
"rectangle",
"remap",
"resize",
"Scharr",
"sepFilter2D",
"Sobel",
"spatialGradient",
"sqrBoxFilter",
"stackBlur",
"threshold",
"warpAffine",
"warpPerspective",
"warpPolar",
"watershed"
],
"CLAHE": ["apply", "collectGarbage", "getClipLimit", "getTilesGridSize", "setClipLimit", "setTilesGridSize"],
"FontFace": ["set", "getName", "setInstance", "getInstance", "getBuiltinFontData"]
}
}
@@ -0,0 +1,38 @@
//
// FontFace.h
//
// Created by VP in 2020
//
#pragma once
#ifdef __cplusplus
#import "opencv.hpp"
#else
#define CV_EXPORTS
#endif
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
CV_EXPORTS @interface FontFace : NSObject
@property(readonly) NSString* name;
#ifdef __cplusplus
@property(readonly) cv::FontFace& nativeRef;
#endif
-(instancetype)initWith:(const NSString*)name;
-(instancetype)init;
#ifdef __cplusplus
+(instancetype)fromNative:(cv::FontFace&)fface;
#endif
-(NSString *)description;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,43 @@
//
// FontFace.mm
//
// Created by VP in 2020.
//
#import "FontFace.h"
@implementation FontFace {
cv::FontFace native;
}
-(cv::FontFace&)nativeRef {
return native;
}
- (NSString*)name {
return [NSString stringWithUTF8String:native.getName().c_str()];
}
-(instancetype)init {
return [super init];
}
-(instancetype)initWith:(NSString*)name {
self = [super init];
if (self) {
self.nativeRef.set(std::string(name.UTF8String));
}
return self;
}
+(instancetype)fromNative:(cv::FontFace&)fface {
FontFace* ff = [[FontFace alloc] init];
ff.nativeRef = fface;
return ff;
}
- (NSString *)description {
return [NSString stringWithFormat:@"FontFace [name=%s]", self.nativeRef.getName().c_str()];
}
@end
@@ -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
View 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
+120
View File
@@ -0,0 +1,120 @@
{
"class_ignore_list": [
"FontFace"
],
"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" : {
"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"} },
"drawContours" : { "contours" : {"ctype" : "vector_vector_Point"},
"lineType" : {"ctype" : "LineTypes"} },
"findContours" : { "contours" : {"ctype" : "vector_vector_Point"},
"mode" : {"ctype" : "RetrievalModes"},
"method" : {"ctype" : "ContourApproximationModes"} },
"getStructuringElement" : { "shape" : {"ctype" : "MorphShapes"} },
"EMD" : {"lowerBound" : {"defval" : "cv::Ptr<float>()"},
"distType" : {"ctype" : "DistanceTypes"}},
"createLineSegmentDetector" : { "_refine" : {"ctype" : "LineSegmentDetectorModes"}},
"compareHist" : { "method" : {"ctype" : "HistCompMethods"}},
"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"}},
"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"}}
}
},
"type_dict": {
"FontFace": {
"objc_type": "FontFace*",
"to_cpp": "%(n)s.nativeRef",
"from_cpp": "[FontFace fromNative:%(n)s]"
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,48 @@
#!/usr/bin/env python
from __future__ import print_function
import numpy as np
import cv2 as cv
try:
from PIL import Image
except ImportError:
Image = None
from tests_common import NewOpenCVTests
class Imgproc_Tests(NewOpenCVTests):
def test_python_986(self):
cntls = []
img = np.zeros((100,100,3), dtype=np.uint8)
color = (0,0,0)
cnts = np.array(cntls, dtype=np.int32).reshape((1, -1, 2))
try:
cv.fillPoly(img, cnts, color)
assert False
except:
assert True
def test_filter2d(self):
img = self.get_sample('samples/data/lena.jpg', 1)
eps = 0.001
# compare 2 ways of computing 3x3 blur using the same function
kernel = np.array([[1, 1, 1], [1, 1, 1], [1, 1, 1]], dtype='float32')
img_blur0 = cv.filter2D(img, cv.CV_32F, kernel*(1./9))
img_blur1 = cv.filter2Dp(img, kernel, ddepth=cv.CV_32F, scale=1./9)
self.assertLess(cv.norm(img_blur0 - img_blur1, cv.NORM_INF), eps)
def test_resize_pillow(self):
if Image is None:
self.skipTest("Pillow is not available")
r = np.random.randint(0, 255, size=(128, 147, 3), dtype="uint8")
target_size=[(128,128), (129,129), (160,160)]
for ts in target_size:
pil_result = np.array(Image.fromarray(r).resize(ts, Image.NEAREST))
ocv_result = cv.resize(r, dsize=ts, interpolation=cv.INTER_NEAREST_EXACT)
status = np.all(pil_result == ocv_result)
print(ts, status)
self.assertTrue(status, "resize result differs from Pillow for target size %s" % (ts,))
+137
View 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
@@ -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
@@ -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
+114
View File
@@ -0,0 +1,114 @@
/*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_RGB2YUV_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_RGB2YUV_YUY2), 3, 2),
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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,252 @@
/*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);
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);
if (interpolation == INTER_CUBIC)
{
SANITY_CHECK_NOTHING();
}
else
{
// Ticket: https://github.com/opencv/opencv/issues/26235
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 2 : interpolation == INTER_CUBIC ? 2e-3 : 3e-2;
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);
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);
if (interpolation == INTER_CUBIC)
{
SANITY_CHECK_NOTHING();
}
else
{
const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-4;
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
@@ -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
@@ -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
@@ -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
+112
View File
@@ -0,0 +1,112 @@
// 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(AccumulateMask32FC4, CV_32FC4,
PERF_ACCUMULATE_MASK_INIT(CV_32FC), accumulate(src1, dst, mask))
PERF_TEST_P_ACCUMULATE(AccumulateMask8UC4To32FC4, CV_8UC4,
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
+40
View 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 {
CV_ENUM(Mat_Type, CV_8UC1, CV_8UC3, CV_32FC1, CV_32FC3)
typedef TestBaseWithParam< tuple<Size, int, Mat_Type, double> > TestBilateralFilter;
PERF_TEST_P( TestBilateralFilter, BilateralFilter,
Combine(
Values( szVGA, sz1080p ), // image size
Values( 3, 5 ), // d
Mat_Type::all(), // image type
Values(1., 5.)
)
)
{
Size sz;
int d, type;
double sigmaColor, sigmaSpace;
sz = get<0>(GetParam());
d = get<1>(GetParam());
type = get<2>(GetParam());
sigmaColor = sigmaSpace = get<3>(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
+314
View File
@@ -0,0 +1,314 @@
// 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;
typedef tuple<Size, MatType, BorderType, int> Size_MatType_BorderType_ksize_t;
typedef perf::TestBaseWithParam<Size_MatType_BorderType_ksize_t> Size_MatType_BorderType_ksize;
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 = 1.25e-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_BorderType_ksize, box,
testing::Combine(
testing::Values(szODD, szQVGA, szVGA, sz720p),
testing::Values(CV_8UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_32FC3),
BorderType::all(),
testing::Values(3, 5)
)
)
{
auto p = GetParam();
Size size = get<0>(p);
int type = get<1>(p);
BorderType btype = get<2>(p);
int ksize = get<3>(p);
Mat src(size, type);
Mat dst(size, type);
declare.in(src, WARMUP_RNG).out(dst);
TEST_CYCLE() boxFilter(src, dst, -1, Size(ksize, ksize), 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_BorderType_ksize, box_inplace,
testing::Combine(
testing::Values(szODD, szQVGA, szVGA, sz720p),
testing::Values(CV_8UC1, CV_16SC1, CV_32SC1, CV_32FC1, CV_32FC3),
BorderType::all(),
testing::Values(3, 5)
)
)
{
auto p = GetParam();
Size size = get<0>(p);
int type = get<1>(p);
BorderType btype = get<2>(p);
int ksize = get<3>(p);
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(ksize, ksize), 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();
}
///////////// Stackblur ////////////////////////
PERF_TEST_P(Size_MatType, stackblur3x3,
testing::Combine(
testing::Values(sz720p, sz1080p, sz2160p),
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1)
)
)
{
Size size = get<0>(GetParam());
int type = get<1>(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() stackBlur(src, dst, Size(3,3));
SANITY_CHECK_NOTHING();
}
PERF_TEST_P(Size_MatType, stackblur101x101,
testing::Combine(
testing::Values(sz720p, sz1080p, sz2160p),
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_16SC1, CV_32FC1)
)
)
{
Size size = get<0>(GetParam());
int type = get<1>(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() stackBlur(src, dst, Size(101,101));
SANITY_CHECK_NOTHING();
}
} // namespace
+40
View 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
+161
View File
@@ -0,0 +1,161 @@
// 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();
}
// ============================================================
// findTRUContours performance tests
// ============================================================
typedef TestBaseWithParam< tuple<Size, int, int> > TestFindTRUContours;
PERF_TEST_P(TestFindTRUContours, findTRUContours,
Combine(
Values(sz1080p, sz2160p), // image size
Values(128, 512, 2048), // circle count
Values(1, 0) // nthreads: 1=single-thread baseline, 0=all available
)
)
{
Size img_size = get<0>(GetParam());
int num_circles = get<1>(GetParam());
int nthreads = get<2>(GetParam());
RNG rng(12345);
Mat img = Mat::zeros(img_size, CV_8UC1);
for (int i = 0; i < num_circles; ++i)
{
Point center(rng.uniform(50, img_size.width - 50),
rng.uniform(50, img_size.height - 50));
int radius = rng.uniform(10, 200);
circle(img, center, radius, Scalar::all(255), FILLED);
}
Mat binary;
adaptiveThreshold(img, binary, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, 11, 0);
vector<vector<Point>> contours;
int prev_nthreads=cv::getNumThreads();
cv::setNumThreads(nthreads);
TEST_CYCLE() findContours(binary, contours, RETR_LIST, CHAIN_APPROX_NONE);
cv::setNumThreads(prev_nthreads);
SANITY_CHECK_NOTHING();
}
// Baseline: same image, findContours(RETR_LIST, CHAIN_APPROX_NONE) for direct comparison
typedef TestBaseWithParam< tuple<Size, int> > TestFindContoursBaseline;
PERF_TEST_P(TestFindContoursBaseline, findContours_baseline_for_TRUCO,
Combine(
Values(sz1080p, sz2160p),
Values(128, 512, 2048)
)
)
{
Size img_size = get<0>(GetParam());
int num_circles = get<1>(GetParam());
RNG rng(12345);
Mat img = Mat::zeros(img_size, CV_8UC1);
for (int i = 0; i < num_circles; ++i)
{
Point center(rng.uniform(50, img_size.width - 50),
rng.uniform(50, img_size.height - 50));
int radius = rng.uniform(10, 200);
circle(img, center, radius, Scalar::all(255), FILLED);
}
Mat binary;
adaptiveThreshold(img, binary, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, 11, 0);
vector<vector<Point>> contours;
vector<Vec4i> hierarchy;
TEST_CYCLE() findContours(binary, contours, hierarchy, RETR_LIST, CHAIN_APPROX_NONE);
SANITY_CHECK_NOTHING();
}
} } // namespace
+93
View 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
+509
View File
@@ -0,0 +1,509 @@
// 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,
COLOR_RGB2YUV_UYVY, COLOR_BGR2YUV_UYVY, COLOR_RGBA2YUV_UYVY, COLOR_BGRA2YUV_UYVY, COLOR_RGB2YUV_YUY2, COLOR_BGR2YUV_YUY2, COLOR_RGB2YUV_YVYU,
COLOR_BGR2YUV_YVYU, COLOR_RGBA2YUV_YUY2, COLOR_BGRA2YUV_YUY2, COLOR_RGBA2YUV_YVYU, COLOR_BGRA2YUV_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_RGB2YUV_UYVY: case COLOR_BGR2YUV_UYVY:
case COLOR_RGB2YUV_YUY2: case COLOR_BGR2YUV_YUY2:
case COLOR_RGB2YUV_YVYU: case COLOR_BGR2YUV_YVYU:
return ChPair(3,2);
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_RGBA2YUV_UYVY: case COLOR_BGRA2YUV_UYVY:
case COLOR_RGBA2YUV_YUY2: case COLOR_BGRA2YUV_YUY2:
case COLOR_RGBA2YUV_YVYU: case COLOR_BGRA2YUV_YVYU:
return ChPair(4,2);
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
@@ -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
+142
View File
@@ -0,0 +1,142 @@
// 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);
}
// Performance test for the tiled parallel FilterEngine path (images >= 1MP).
// Exercises filter2D and sepFilter2D separately across common types and border modes.
typedef TestBaseWithParam< tuple<Size, int, BorderMode, bool> > ImgProc_ParallelFilter_Perf;
PERF_TEST_P( ImgProc_ParallelFilter_Perf, filter2D_parallel,
Combine(
Values( Size(1280, 1024), sz1080p ),
Values( CV_8UC1, CV_8UC3, CV_32FC1 ),
Values( BORDER_DEFAULT, BORDER_CONSTANT ),
Values( false, true ) // false = filter2D, true = sepFilter2D
)
)
{
const Size sz = get<0>(GetParam());
const int type = get<1>(GetParam());
const int borderMode = get<2>(GetParam());
const bool isSep = get<3>(GetParam());
Mat src(sz, type);
Mat dst(sz, type);
declare.in(src, WARMUP_RNG).out(dst);
if (isSep)
{
Mat kx = (Mat_<float>(1, 3) << 0.25f, 0.5f, 0.25f);
Mat ky = (Mat_<float>(3, 1) << 0.25f, 0.5f, 0.25f);
TEST_CYCLE() cv::sepFilter2D(src, dst, -1, kx, ky,
Point(-1, -1), 0, borderMode);
}
else
{
Mat kernel = (Mat_<float>(3, 3) <<
1/16.f, 2/16.f, 1/16.f,
2/16.f, 4/16.f, 2/16.f,
1/16.f, 2/16.f, 1/16.f);
TEST_CYCLE() cv::filter2D(src, dst, -1, kernel,
Point(-1, -1), 0, borderMode);
}
SANITY_CHECK_NOTHING();
}
} // namespace
+70
View 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
+168
View 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
@@ -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 {
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
View 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
+162
View File
@@ -0,0 +1,162 @@
// 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, std::tuple<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);
}
static std::vector<std::tuple<MatType, IntegralOutputDepths>> GetFullSqsumDepthPairs() {
static int extraDepths[12][2] = {
{CV_8U, DEPTH_32S_64F},
{CV_8U, DEPTH_32S_32F},
{CV_8U, DEPTH_32S_32S},
{CV_8U, DEPTH_32F_64F},
{CV_8U, DEPTH_32F_32F},
{CV_8U, DEPTH_64F_64F},
{CV_16U, DEPTH_64F_64F},
{CV_16S, DEPTH_64F_64F},
{CV_32F, DEPTH_32F_64F},
{CV_32F, DEPTH_32F_32F},
{CV_32F, DEPTH_64F_64F},
{CV_64F, DEPTH_64F_64F}
};
std::vector<std::tuple<MatType, IntegralOutputDepths>> valid_pairs;
for (size_t i = 0; i < 12; i++) {
for (int cn = 1; cn <= 4; cn++) {
valid_pairs.emplace_back(CV_MAKETYPE(extraDepths[i][0], cn), extraDepths[i][1]);
}
}
return valid_pairs;
}
PERF_TEST_P(Size_MatType_OutMatDepthArray, DISABLED_integral_sqsum_full,
testing::Combine(
testing::Values(TYPICAL_MAT_SIZES),
testing::ValuesIn(GetFullSqsumDepthPairs())
)
)
{
Size sz = get<0>(GetParam());
auto depths = get<1>(GetParam());
int matType = get<0>(depths);
int sdepth = extraOutputDepths[get<1>(depths)][0];
int sqdepth = extraOutputDepths[get<1>(depths)][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
+40
View 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 {
CV_ENUM(BorderMode, BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT_101)
CV_ENUM(TargetDepth, CV_8U, CV_16S)
typedef tuple<Size, int, TargetDepth, BorderMode> LaplacianParams;
typedef perf::TestBaseWithParam<LaplacianParams> Perf_Laplacian;
PERF_TEST_P(Perf_Laplacian, Laplacian,
testing::Combine(
testing::Values(szVGA, sz720p, sz1080p),
testing::Values(1, 3, 5), // ksize: 1, 3, 5
TargetDepth::all(), // CV_8U and CV_16S
BorderMode::all()
))
{
Size sz = get<0>(GetParam());
int ksize = get<1>(GetParam());
int ddepth = get<2>(GetParam());
int borderMode = get<3>(GetParam());
Mat src(sz, CV_8UC1);
Mat dst(sz, ddepth == CV_16S ? CV_16SC1 : CV_8UC1);
declare.in(src, WARMUP_RNG).out(dst);
TEST_CYCLE()
{
cv::Laplacian(src, dst, ddepth, ksize, 1.0, 0.0, borderMode);
}
SANITY_CHECK(dst);
}
} // namespace opencv_test
+10
View 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)
@@ -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
+42
View 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
+22
View File
@@ -0,0 +1,22 @@
// 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 TestBaseWithParam<Size > CreateHanningWindowFixture;
PERF_TEST_P( CreateHanningWindowFixture, CreateHanningWindow, Values(szVGA, sz1080p))
{
const Size size = GetParam();
Mat dst(size, CV_32FC1);
declare.in(dst, WARMUP_RNG).out(dst);
TEST_CYCLE() cv::createHanningWindow(dst, size, CV_32FC1);
SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE);
}
} // namespace
+15
View File
@@ -0,0 +1,15 @@
// 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_PERF_PRECOMP_HPP__
#define __OPENCV_PERF_PRECOMP_HPP__
#include "opencv2/ts.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/geometry.hpp"
namespace opencv_test {
using namespace perf;
} // namespace
#endif

Some files were not shown because too many files have changed in this diff Show More