Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
32a02544
Commit
32a02544
authored
Aug 30, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12189 from alalek:ippa_cleanup_3.4
parents
fc1dee68
e86287d8
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
3 additions
and
568 deletions
+3
-568
OpenCVFindIPPAsync.cmake
cmake/OpenCVFindIPPAsync.cmake
+0
-46
OpenCVFindLibsPerf.cmake
cmake/OpenCVFindLibsPerf.cmake
+0
-11
cvconfig.h.in
cmake/templates/cvconfig.h.in
+0
-3
Doxyfile.in
doc/Doxyfile.in
+0
-1
how_to_use_OpenCV_parallel_for_.markdown
...CV_parallel_for_/how_to_use_OpenCV_parallel_for_.markdown
+1
-1
how_to_use_ippa_conversion.markdown
...o_use_ippa_conversion/how_to_use_ippa_conversion.markdown
+0
-146
How_To_Use_IPPA_Result.jpg
..._to_use_ippa_conversion/images/How_To_Use_IPPA_Result.jpg
+0
-0
How_To_Use_IPPA.jpg
doc/tutorials/core/images/How_To_Use_IPPA.jpg
+0
-0
interoperability_with_OpenCV_1.markdown
...ity_with_OpenCV_1/interoperability_with_OpenCV_1.markdown
+1
-1
table_of_content_core.markdown
doc/tutorials/core/table_of_content_core.markdown
+0
-9
windows_install.markdown
...als/introduction/windows_install/windows_install.markdown
+0
-6
ippasync.hpp
modules/core/include/opencv2/core/ippasync.hpp
+1
-1
test_ippasync.cpp
modules/core/test/test_ippasync.cpp
+0
-172
CMakeLists.txt
samples/cpp/CMakeLists.txt
+0
-3
ippasync_sample.cpp
samples/cpp/tutorial_code/core/ippasync/ippasync_sample.cpp
+0
-168
No files found.
cmake/OpenCVFindIPPAsync.cmake
deleted
100644 → 0
View file @
fc1dee68
# Main variables:
# IPP_A_LIBRARIES and IPP_A_INCLUDE to use IPP Async
# HAVE_IPP_A for conditional compilation OpenCV with/without IPP Async
# IPP_ASYNC_ROOT - root of IPP Async installation
if
(
X86_64
)
find_path
(
IPP_A_INCLUDE_DIR
NAMES ipp_async_defs.h
PATHS $ENV{IPP_ASYNC_ROOT}
PATH_SUFFIXES include
DOC
"Path to Intel IPP Async interface headers"
)
find_file
(
IPP_A_LIBRARIES
NAMES ipp_async_preview.lib
PATHS $ENV{IPP_ASYNC_ROOT}
PATH_SUFFIXES lib/intel64
DOC
"Path to Intel IPP Async interface libraries"
)
else
()
find_path
(
IPP_A_INCLUDE_DIR
NAMES ipp_async_defs.h
PATHS $ENV{IPP_ASYNC_ROOT}
PATH_SUFFIXES include
DOC
"Path to Intel IPP Async interface headers"
)
find_file
(
IPP_A_LIBRARIES
NAMES ipp_async_preview.lib
PATHS $ENV{IPP_ASYNC_ROOT}
PATH_SUFFIXES lib/ia32
DOC
"Path to Intel IPP Async interface libraries"
)
endif
()
if
(
IPP_A_INCLUDE_DIR AND IPP_A_LIBRARIES
)
set
(
HAVE_IPP_A TRUE
)
else
()
set
(
HAVE_IPP_A FALSE
)
message
(
WARNING
"Intel IPP Async library directory (set by IPP_A_LIBRARIES_DIR variable) is not found or does not have Intel IPP Async libraries."
)
endif
()
mark_as_advanced
(
FORCE IPP_A_LIBRARIES IPP_A_INCLUDE_DIR
)
\ No newline at end of file
cmake/OpenCVFindLibsPerf.cmake
View file @
32a02544
...
@@ -28,17 +28,6 @@ if(WITH_IPP)
...
@@ -28,17 +28,6 @@ if(WITH_IPP)
endif
()
endif
()
endif
()
endif
()
# --- IPP Async ---
if
(
WITH_IPP_A
)
include
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/OpenCVFindIPPAsync.cmake"
)
if
(
IPP_A_INCLUDE_DIR AND IPP_A_LIBRARIES
)
ocv_include_directories
(
${
IPP_A_INCLUDE_DIR
}
)
link_directories
(
${
IPP_A_LIBRARIES
}
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
IPP_A_LIBRARIES
}
)
endif
()
endif
(
WITH_IPP_A
)
# --- CUDA ---
# --- CUDA ---
if
(
WITH_CUDA
)
if
(
WITH_CUDA
)
include
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/OpenCVDetectCUDA.cmake"
)
include
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/OpenCVDetectCUDA.cmake"
)
...
...
cmake/templates/cvconfig.h.in
View file @
32a02544
...
@@ -106,9 +106,6 @@
...
@@ -106,9 +106,6 @@
#cmakedefine HAVE_IPP_ICV
#cmakedefine HAVE_IPP_ICV
#cmakedefine HAVE_IPP_IW
#cmakedefine HAVE_IPP_IW
/* Intel IPP Async */
#cmakedefine HAVE_IPP_A
/* JPEG-2000 codec */
/* JPEG-2000 codec */
#cmakedefine HAVE_JASPER
#cmakedefine HAVE_JASPER
...
...
doc/Doxyfile.in
View file @
32a02544
...
@@ -227,7 +227,6 @@ SEARCH_INCLUDES = YES
...
@@ -227,7 +227,6 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
INCLUDE_FILE_PATTERNS =
PREDEFINED = __cplusplus=1 \
PREDEFINED = __cplusplus=1 \
HAVE_IPP_A=1 \
CVAPI(x)=x \
CVAPI(x)=x \
CV_DOXYGEN= \
CV_DOXYGEN= \
CV_EXPORTS= \
CV_EXPORTS= \
...
...
doc/tutorials/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.markdown
View file @
32a02544
How to use the OpenCV parallel_for_ to parallelize your code {#tutorial_how_to_use_OpenCV_parallel_for_}
How to use the OpenCV parallel_for_ to parallelize your code {#tutorial_how_to_use_OpenCV_parallel_for_}
==================================================================
==================================================================
@prev_tutorial{tutorial_
how_to_use_ippa_conversion
}
@prev_tutorial{tutorial_
interoperability_with_OpenCV_1
}
Goal
Goal
----
----
...
...
doc/tutorials/core/how_to_use_ippa_conversion/how_to_use_ippa_conversion.markdown
deleted
100644 → 0
View file @
fc1dee68
Intel® IPP Asynchronous C/C++ library in OpenCV {#tutorial_how_to_use_ippa_conversion}
===============================================
@prev_tutorial{tutorial_interoperability_with_OpenCV_1}
@next_tutorial{tutorial_how_to_use_OpenCV_parallel_for_}
Goal
----
The tutorial demonstrates the
[
Intel® IPP Asynchronous
C/C++](http://software.intel.com/en-us/intel-ipp-preview) library usage with OpenCV. The code
example below illustrates implementation of the Sobel operation, accelerated with Intel® IPP
Asynchronous C/C++ functions. In this code example, @ref cv::hpp::getMat and @ref cv::hpp::getHpp
functions are used for data conversion between
[
hppiMatrix
](
http://software.intel.com/en-us/node/501660
)
and Mat matrices.
Code
----
You may also find the source code in the
`samples/cpp/tutorial_code/core/ippasync/ippasync_sample.cpp`
file of the OpenCV source library or
download it from
[
here
](
https://github.com/opencv/opencv/tree/3.4/samples/cpp/tutorial_code/core/ippasync/ippasync_sample.cpp
)
.
@include cpp/tutorial_code/core/ippasync/ippasync_sample.cpp
Explanation
-----------
-# Create parameters for OpenCV:
@code{.cpp}
VideoCapture cap;
Mat image, gray, result;
@endcode
and IPP Async:
@code{.cpp}
hppiMatrix
* src,*
dst;
hppAccel accel = 0;
hppAccelType accelType;
hppStatus sts;
hppiVirtualMatrix
*
virtMatrix;
@endcode
-# Load input image or video. How to open and read video stream you can see in the
@ref tutorial_video_input_psnr_ssim tutorial.
@code{.cpp}
if( useCamera )
{
printf("used camera
\n
");
cap.open(0);
}
else
{
printf("used image %s
\n
", file.c_str());
cap.open(file.c_str());
}
if( !cap.isOpened() )
{
printf("can not open camera or video file\n");
return -1;
}
@endcode
-# Create accelerator instance using
[
hppCreateInstance
](
http://software.intel.com/en-us/node/501686
)
:
@code{.cpp}
accelType = sAccel == "cpu" ? HPP_ACCEL_TYPE_CPU:
sAccel == "gpu" ? HPP_ACCEL_TYPE_GPU:
HPP_ACCEL_TYPE_ANY;
//Create accelerator instance
sts = hppCreateInstance(accelType, 0, &accel);
CHECK_STATUS(sts, "hppCreateInstance");
@endcode
-# Create an array of virtual matrices using
[
hppiCreateVirtualMatrices
](
http://software.intel.com/en-us/node/501700
)
function.
@code{.cpp}
virtMatrix = hppiCreateVirtualMatrices(accel, 1);
@endcode
-# Prepare a matrix for input and output data:
@code{.cpp}
cap >> image;
if(image.empty())
break;
cvtColor( image, gray, COLOR_BGR2GRAY );
result.create( image.rows, image.cols, CV_8U);
@endcode
-# Convert Mat to
[
hppiMatrix
](
http://software.intel.com/en-us/node/501660
)
using @ref cv::hpp::getHpp
and call
[
hppiSobel
](
http://software.intel.com/en-us/node/474701
)
function.
@code{.cpp}
//convert Mat to hppiMatrix
src = getHpp(gray, accel);
dst = getHpp(result, accel);
sts = hppiSobel(accel,src, HPP_MASK_SIZE_3X3,HPP_NORM_L1,virtMatrix[0]);
CHECK_STATUS(sts,"hppiSobel");
sts = hppiConvert(accel, virtMatrix[0], 0, HPP_RND_MODE_NEAR, dst, HPP_DATA_TYPE_8U);
CHECK_STATUS(sts,"hppiConvert");
// Wait for tasks to complete
sts = hppWait(accel, HPP_TIME_OUT_INFINITE);
CHECK_STATUS(sts, "hppWait");
@endcode
We use [hppiConvert](http://software.intel.com/en-us/node/501746) because
[hppiSobel](http://software.intel.com/en-us/node/474701) returns destination matrix with
HPP_DATA_TYPE_16S data type for source matrix with HPP_DATA_TYPE_8U type. You should check
hppStatus after each call IPP Async function.
-# Create windows and show the images, the usual way.
@code{.cpp}
imshow("image", image);
imshow("rez", result);
waitKey(15);
@endcode
-# Delete hpp matrices.
@code{.cpp}
sts = hppiFreeMatrix(src);
CHECK_DEL_STATUS(sts,"hppiFreeMatrix");
sts = hppiFreeMatrix(dst);
CHECK_DEL_STATUS(sts,"hppiFreeMatrix");
@endcode
-# Delete virtual matrices and accelerator instance.
@code{.cpp}
if (virtMatrix)
{
sts = hppiDeleteVirtualMatrices(accel, virtMatrix);
CHECK_DEL_STATUS(sts,"hppiDeleteVirtualMatrices");
}
if (accel)
{
sts = hppDeleteInstance(accel);
CHECK_DEL_STATUS(sts, "hppDeleteInstance");
}
@endcode
Result
------
After compiling the code above we can execute it giving an image or video path and accelerator type
as an argument. For this tutorial we use baboon.png image as input. The result is below.
![](
images/How_To_Use_IPPA_Result.jpg
)
doc/tutorials/core/how_to_use_ippa_conversion/images/How_To_Use_IPPA_Result.jpg
deleted
100644 → 0
View file @
fc1dee68
61.4 KB
doc/tutorials/core/images/How_To_Use_IPPA.jpg
deleted
100644 → 0
View file @
fc1dee68
6.83 KB
doc/tutorials/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.markdown
View file @
32a02544
...
@@ -2,7 +2,7 @@ Interoperability with OpenCV 1 {#tutorial_interoperability_with_OpenCV_1}
...
@@ -2,7 +2,7 @@ Interoperability with OpenCV 1 {#tutorial_interoperability_with_OpenCV_1}
==============================
==============================
@prev_tutorial{tutorial_file_input_output_with_xml_yml}
@prev_tutorial{tutorial_file_input_output_with_xml_yml}
@next_tutorial{tutorial_how_to_use_
ippa_conversion
}
@next_tutorial{tutorial_how_to_use_
OpenCV_parallel_for_
}
Goal
Goal
----
----
...
...
doc/tutorials/core/table_of_content_core.markdown
View file @
32a02544
...
@@ -93,15 +93,6 @@ understanding how to manipulate the images on a pixel level.
...
@@ -93,15 +93,6 @@ understanding how to manipulate the images on a pixel level.
Look here to shed light on all this questions.
Look here to shed light on all this questions.
-
@subpage tutorial_how_to_use_ippa_conversion
*Compatibility:* \> OpenCV 2.0
*Author:* Elena Gvozdeva
You will see how to use the IPP Async with OpenCV.
-
@subpage tutorial_how_to_use_OpenCV_parallel_for_
-
@subpage tutorial_how_to_use_OpenCV_parallel_for_
*Compatibility:* \>= OpenCV 2.4.3
*Compatibility:* \>= OpenCV 2.4.3
...
...
doc/tutorials/introduction/windows_install/windows_install.markdown
View file @
32a02544
...
@@ -142,8 +142,6 @@ of them, you need to download and install them on your system.
...
@@ -142,8 +142,6 @@ of them, you need to download and install them on your system.
-
[
Intel Integrated Performance Primitives (*IPP*)
](
http://software.intel.com/en-us/articles/intel-ipp/
)
may be used to improve the performance
-
[
Intel Integrated Performance Primitives (*IPP*)
](
http://software.intel.com/en-us/articles/intel-ipp/
)
may be used to improve the performance
of color conversion, Haar training and DFT functions of the OpenCV library. Watch out, since
of color conversion, Haar training and DFT functions of the OpenCV library. Watch out, since
this is not a free service.
this is not a free service.
-
[
Intel IPP Asynchronous C/C++
](
http://software.intel.com/en-us/intel-ipp-preview
)
is currently focused delivering Intel Graphics
support for advanced image processing and computer vision functions.
-
OpenCV offers a somewhat fancier and more useful graphical user interface, than the default one
-
OpenCV offers a somewhat fancier and more useful graphical user interface, than the default one
by using the
[
Qt framework
](
http://qt.nokia.com/downloads
)
. For a quick overview of what this has to offer, look into the
by using the
[
Qt framework
](
http://qt.nokia.com/downloads
)
. For a quick overview of what this has to offer, look into the
documentations
*highgui*
module, under the
*Qt New Functions*
section. Version 4.6 or later of
documentations
*highgui*
module, under the
*Qt New Functions*
section. Version 4.6 or later of
...
@@ -204,10 +202,6 @@ libraries). If you do not need the support for some of these, you can just freel
...
@@ -204,10 +202,6 @@ libraries). If you do not need the support for some of these, you can just freel
![](images/IntelTBB.png)
![](images/IntelTBB.png)
-# For the [Intel IPP Asynchronous C/C++](http://software.intel.com/en-us/intel-ipp-preview) download the source files and set environment
variable **IPP_ASYNC_ROOT**. It should point to
`<your Program Files(x86) directory>/Intel/IPP Preview */ipp directory`. Here \* denotes the
particular preview name.
-# In case of the [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page#Download) library it is again a case of download and extract to the
-# In case of the [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page#Download) library it is again a case of download and extract to the
`D:/OpenCV/dep` directory.
`D:/OpenCV/dep` directory.
-# Same as above with [OpenEXR](http://www.openexr.com/downloads.html).
-# Same as above with [OpenEXR](http://www.openexr.com/downloads.html).
...
...
modules/core/include/opencv2/core/ippasync.hpp
View file @
32a02544
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
#ifndef OPENCV_CORE_IPPASYNC_HPP
#ifndef OPENCV_CORE_IPPASYNC_HPP
#define OPENCV_CORE_IPPASYNC_HPP
#define OPENCV_CORE_IPPASYNC_HPP
#ifdef HAVE_IPP_A
#ifdef HAVE_IPP_A
// this file will be removed in OpenCV 4.0
#include "opencv2/core.hpp"
#include "opencv2/core.hpp"
#include <ipp_async_op.h>
#include <ipp_async_op.h>
...
...
modules/core/test/test_ippasync.cpp
deleted
100644 → 0
View file @
fc1dee68
// 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 "test_precomp.hpp"
#include "opencv2/ts/ocl_test.hpp"
#ifdef HAVE_IPP_A
#include "opencv2/core/ippasync.hpp"
using
namespace
cv
;
using
namespace
std
;
using
namespace
opencv_test
;
namespace
opencv_test
{
namespace
ocl
{
PARAM_TEST_CASE
(
IPPAsync
,
MatDepth
,
Channels
,
hppAccelType
)
{
int
type
;
int
cn
;
int
depth
;
hppAccelType
accelType
;
Mat
matrix
,
result
;
hppiMatrix
*
hppMat
;
hppAccel
accel
;
hppiVirtualMatrix
*
virtMatrix
;
hppStatus
sts
;
virtual
void
SetUp
()
{
type
=
CV_MAKE_TYPE
(
GET_PARAM
(
0
),
GET_PARAM
(
1
));
depth
=
GET_PARAM
(
0
);
cn
=
GET_PARAM
(
1
);
accelType
=
GET_PARAM
(
2
);
}
void
generateTestData
()
{
Size
matrix_Size
=
randomSize
(
2
,
100
);
const
double
upValue
=
100
;
matrix
=
randomMat
(
matrix_Size
,
type
,
-
upValue
,
upValue
);
}
void
Near
(
double
threshold
=
0.0
)
{
EXPECT_MAT_NEAR
(
matrix
,
result
,
threshold
);
}
};
TEST_P
(
IPPAsync
,
accuracy
)
{
sts
=
hppCreateInstance
(
accelType
,
0
,
&
accel
);
if
(
sts
!=
HPP_STATUS_NO_ERROR
)
printf
(
"hppStatus = %d
\n
"
,
sts
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
virtMatrix
=
hppiCreateVirtualMatrices
(
accel
,
2
);
for
(
int
j
=
0
;
j
<
test_loop_times
;
j
++
)
{
generateTestData
();
hppMat
=
hpp
::
getHpp
(
matrix
,
accel
);
hppScalar
a
=
3
;
sts
=
hppiAddC
(
accel
,
hppMat
,
a
,
0
,
virtMatrix
[
0
]);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
sts
=
hppiSubC
(
accel
,
virtMatrix
[
0
],
a
,
0
,
virtMatrix
[
1
]);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
sts
=
hppWait
(
accel
,
HPP_TIME_OUT_INFINITE
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
result
=
hpp
::
getMat
(
virtMatrix
[
1
],
accel
,
cn
);
Near
(
5.0e-6
);
sts
=
hppiFreeMatrix
(
hppMat
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
}
sts
=
hppiDeleteVirtualMatrices
(
accel
,
virtMatrix
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
sts
=
hppDeleteInstance
(
accel
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
}
PARAM_TEST_CASE
(
IPPAsyncShared
,
Channels
,
hppAccelType
)
{
int
cn
;
int
type
;
hppAccelType
accelType
;
Mat
matrix
,
result
;
hppiMatrix
*
hppMat
;
hppAccel
accel
;
hppiVirtualMatrix
*
virtMatrix
;
hppStatus
sts
;
virtual
void
SetUp
()
{
cn
=
GET_PARAM
(
0
);
accelType
=
GET_PARAM
(
1
);
type
=
CV_MAKE_TYPE
(
CV_8U
,
GET_PARAM
(
0
));
}
void
generateTestData
()
{
Size
matrix_Size
=
randomSize
(
2
,
100
);
hpp32u
pitch
,
size
;
const
int
upValue
=
100
;
sts
=
hppQueryMatrixAllocParams
(
accel
,
(
hpp32u
)(
matrix_Size
.
width
*
cn
),
(
hpp32u
)
matrix_Size
.
height
,
HPP_DATA_TYPE_8U
,
&
pitch
,
&
size
);
matrix
=
randomMat
(
matrix_Size
,
type
,
0
,
upValue
);
}
void
Near
(
double
threshold
=
0.0
)
{
EXPECT_MAT_NEAR
(
matrix
,
result
,
threshold
);
}
};
TEST_P
(
IPPAsyncShared
,
accuracy
)
{
sts
=
hppCreateInstance
(
accelType
,
0
,
&
accel
);
if
(
sts
!=
HPP_STATUS_NO_ERROR
)
printf
(
"hppStatus = %d
\n
"
,
sts
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
virtMatrix
=
hppiCreateVirtualMatrices
(
accel
,
2
);
for
(
int
j
=
0
;
j
<
test_loop_times
;
j
++
)
{
generateTestData
();
hppMat
=
hpp
::
getHpp
(
matrix
,
accel
);
hppScalar
a
=
3
;
sts
=
hppiAddC
(
accel
,
hppMat
,
a
,
0
,
virtMatrix
[
0
]);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
sts
=
hppiSubC
(
accel
,
virtMatrix
[
0
],
a
,
0
,
virtMatrix
[
1
]);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
sts
=
hppWait
(
accel
,
HPP_TIME_OUT_INFINITE
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
result
=
hpp
::
getMat
(
virtMatrix
[
1
],
accel
,
cn
);
Near
(
0
);
sts
=
hppiFreeMatrix
(
hppMat
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
}
sts
=
hppiDeleteVirtualMatrices
(
accel
,
virtMatrix
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
sts
=
hppDeleteInstance
(
accel
);
CV_Assert
(
sts
==
HPP_STATUS_NO_ERROR
);
}
INSTANTIATE_TEST_CASE_P
(
IppATest
,
IPPAsyncShared
,
Combine
(
Values
(
1
,
2
,
3
,
4
),
Values
(
HPP_ACCEL_TYPE_CPU
,
HPP_ACCEL_TYPE_GPU
)));
INSTANTIATE_TEST_CASE_P
(
IppATest
,
IPPAsync
,
Combine
(
Values
(
CV_8U
,
CV_16U
,
CV_16S
,
CV_32F
),
Values
(
1
,
2
,
3
,
4
),
Values
(
HPP_ACCEL_TYPE_CPU
,
HPP_ACCEL_TYPE_GPU
)));
}
}
#endif
\ No newline at end of file
samples/cpp/CMakeLists.txt
View file @
32a02544
...
@@ -36,9 +36,6 @@ endif()
...
@@ -36,9 +36,6 @@ endif()
if
(
NOT BUILD_opencv_viz OR NOT VTK_USE_FILE
)
if
(
NOT BUILD_opencv_viz OR NOT VTK_USE_FILE
)
ocv_list_filterout
(
cpp_samples
"/viz/"
)
ocv_list_filterout
(
cpp_samples
"/viz/"
)
endif
()
endif
()
if
(
NOT HAVE_IPP_A
)
ocv_list_filterout
(
cpp_samples
"/ippasync/"
)
endif
()
ocv_list_filterout
(
cpp_samples
"real_time_pose_estimation/"
)
ocv_list_filterout
(
cpp_samples
"real_time_pose_estimation/"
)
foreach
(
sample_filename
${
cpp_samples
}
)
foreach
(
sample_filename
${
cpp_samples
}
)
if
(
sample_filename MATCHES
"/viz/"
)
if
(
sample_filename MATCHES
"/viz/"
)
...
...
samples/cpp/tutorial_code/core/ippasync/ippasync_sample.cpp
deleted
100644 → 0
View file @
fc1dee68
#include <stdio.h>
#include "opencv2/core/utility.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "cvconfig.h"
using
namespace
std
;
using
namespace
cv
;
#ifdef HAVE_IPP_A
#include "opencv2/core/ippasync.hpp"
#define CHECK_STATUS(STATUS, NAME)\
if(STATUS!=HPP_STATUS_NO_ERROR){ printf("%s error %d\n", NAME, STATUS);\
if (virtMatrix) {hppStatus delSts = hppiDeleteVirtualMatrices(accel, virtMatrix); CHECK_DEL_STATUS(delSts,"hppiDeleteVirtualMatrices");}\
if (accel) {hppStatus delSts = hppDeleteInstance(accel); CHECK_DEL_STATUS(delSts, "hppDeleteInstance");}\
return -1;}
#define CHECK_DEL_STATUS(STATUS, NAME)\
if(STATUS!=HPP_STATUS_NO_ERROR){ printf("%s error %d\n", NAME, STATUS); return -1;}
#endif
static
void
help
()
{
printf
(
"
\n
This program shows how to use the conversion for IPP Async.
\n
"
"This example uses the Sobel filter.
\n
"
"You can use cv::Sobel or hppiSobel.
\n
"
"Usage:
\n
"
"./ipp_async_sobel [--camera]=<use camera,if this key is present>,
\n
"
" [--file_name]=<path to movie or image file>
\n
"
" [--accel]=<accelerator type: auto (default), cpu, gpu>
\n\n
"
);
}
const
char
*
keys
=
{
"{c camera | | use camera or not}"
"{fn file_name|../data/baboon.jpg | image file }"
"{a accel |auto | accelerator type: auto (default), cpu, gpu}"
};
//this is a sample for hppiSobel functions
int
main
(
int
argc
,
const
char
**
argv
)
{
help
();
VideoCapture
cap
;
CommandLineParser
parser
(
argc
,
argv
,
keys
);
Mat
image
,
gray
,
result
;
#ifdef HAVE_IPP_A
hppiMatrix
*
src
,
*
dst
;
hppAccel
accel
=
0
;
hppAccelType
accelType
;
hppStatus
sts
;
hppiVirtualMatrix
*
virtMatrix
;
bool
useCamera
=
parser
.
has
(
"camera"
);
string
file
=
parser
.
get
<
string
>
(
"file_name"
);
string
sAccel
=
parser
.
get
<
string
>
(
"accel"
);
parser
.
printMessage
();
if
(
useCamera
)
{
printf
(
"used camera
\n
"
);
cap
.
open
(
0
);
}
else
{
printf
(
"used image %s
\n
"
,
file
.
c_str
());
cap
.
open
(
file
.
c_str
());
}
if
(
!
cap
.
isOpened
()
)
{
printf
(
"can not open camera or video file
\n
"
);
return
-
1
;
}
accelType
=
sAccel
==
"cpu"
?
HPP_ACCEL_TYPE_CPU
:
sAccel
==
"gpu"
?
HPP_ACCEL_TYPE_GPU
:
HPP_ACCEL_TYPE_ANY
;
//Create accelerator instance
sts
=
hppCreateInstance
(
accelType
,
0
,
&
accel
);
CHECK_STATUS
(
sts
,
"hppCreateInstance"
);
accelType
=
hppQueryAccelType
(
accel
);
sAccel
=
accelType
==
HPP_ACCEL_TYPE_CPU
?
"cpu"
:
accelType
==
HPP_ACCEL_TYPE_GPU
?
"gpu"
:
accelType
==
HPP_ACCEL_TYPE_GPU_VIA_DX9
?
"gpu dx9"
:
"?"
;
printf
(
"accelType %s
\n
"
,
sAccel
.
c_str
());
virtMatrix
=
hppiCreateVirtualMatrices
(
accel
,
1
);
for
(;;)
{
cap
>>
image
;
if
(
image
.
empty
())
break
;
cvtColor
(
image
,
gray
,
COLOR_BGR2GRAY
);
result
.
create
(
image
.
rows
,
image
.
cols
,
CV_8U
);
double
execTime
=
(
double
)
getTickCount
();
//convert Mat to hppiMatrix
src
=
hpp
::
getHpp
(
gray
,
accel
);
dst
=
hpp
::
getHpp
(
result
,
accel
);
sts
=
hppiSobel
(
accel
,
src
,
HPP_MASK_SIZE_3X3
,
HPP_NORM_L1
,
virtMatrix
[
0
]);
CHECK_STATUS
(
sts
,
"hppiSobel"
);
sts
=
hppiConvert
(
accel
,
virtMatrix
[
0
],
0
,
HPP_RND_MODE_NEAR
,
dst
,
HPP_DATA_TYPE_8U
);
CHECK_STATUS
(
sts
,
"hppiConvert"
);
// Wait for tasks to complete
sts
=
hppWait
(
accel
,
HPP_TIME_OUT_INFINITE
);
CHECK_STATUS
(
sts
,
"hppWait"
);
execTime
=
((
double
)
getTickCount
()
-
execTime
)
*
1000.
/
getTickFrequency
();
printf
(
"Time : %0.3fms
\n
"
,
execTime
);
imshow
(
"image"
,
image
);
imshow
(
"rez"
,
result
);
waitKey
(
15
);
sts
=
hppiFreeMatrix
(
src
);
CHECK_DEL_STATUS
(
sts
,
"hppiFreeMatrix"
);
sts
=
hppiFreeMatrix
(
dst
);
CHECK_DEL_STATUS
(
sts
,
"hppiFreeMatrix"
);
}
if
(
!
useCamera
)
waitKey
(
0
);
if
(
virtMatrix
)
{
sts
=
hppiDeleteVirtualMatrices
(
accel
,
virtMatrix
);
CHECK_DEL_STATUS
(
sts
,
"hppiDeleteVirtualMatrices"
);
}
if
(
accel
)
{
sts
=
hppDeleteInstance
(
accel
);
CHECK_DEL_STATUS
(
sts
,
"hppDeleteInstance"
);
}
printf
(
"SUCCESS
\n
"
);
#else
printf
(
"IPP Async not supported
\n
"
);
#endif
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment