Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Sep 4, 2018
2 parents e0bfe44 + 351ee2e commit d74b98c
Show file tree
Hide file tree
Showing 117 changed files with 7,654 additions and 4,454 deletions.
45 changes: 0 additions & 45 deletions cmake/OpenCVFindIPPAsync.cmake

This file was deleted.

11 changes: 0 additions & 11 deletions cmake/OpenCVFindLibsPerf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@ if(WITH_IPP)
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 ---
if(WITH_CUDA)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCUDA.cmake")
Expand Down
3 changes: 0 additions & 3 deletions cmake/templates/cvconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@
#cmakedefine HAVE_IPP_ICV
#cmakedefine HAVE_IPP_IW

/* Intel IPP Async */
#cmakedefine HAVE_IPP_A

/* JPEG-2000 codec */
#cmakedefine HAVE_JASPER

Expand Down
1 change: 0 additions & 1 deletion doc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = __cplusplus=1 \
HAVE_IPP_A=1 \
CVAPI(x)=x \
CV_DOXYGEN= \
CV_EXPORTS= \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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
----
Expand Down

This file was deleted.

Binary file not shown.
Binary file removed doc/tutorials/core/images/How_To_Use_IPPA.jpg
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Interoperability with OpenCV 1 {#tutorial_interoperability_with_OpenCV_1}
==============================

@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
----
Expand Down
9 changes: 0 additions & 9 deletions doc/tutorials/core/table_of_content_core.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,6 @@ understanding how to manipulate the images on a pixel level.
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_

*Compatibility:* \>= OpenCV 2.4.3
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Motion Deblur Filter {#tutorial_motion_deblur_filter}
==========================

Goal
----

In this tutorial you will learn:

- what the PSF of a motion blur image is
- how to restore a motion blur image

Theory
------

For the degradation image model theory and the Wiener filter theory you can refer to the tutorial @ref tutorial_out_of_focus_deblur_filter "Out-of-focus Deblur Filter".
On this page only a linear motion blur distortion is considered. The motion blur image on this page is a real world image. The blur was caused by a moving subject.

### What is the PSF of a motion blur image?

The point spread function (PSF) of a linear motion blur distortion is a line segment. Such a PSF is specified by two parameters: \f$LEN\f$ is the length of the blur and \f$THETA\f$ is the angle of motion.

![Point spread function of a linear motion blur distortion](images/motion_psf.png)

### How to restore a blurred image?

On this page the Wiener filter is used as the restoration filter, for details you can refer to the tutorial @ref tutorial_out_of_focus_deblur_filter "Out-of-focus Deblur Filter".
In order to synthesize the Wiener filter for a motion blur case, it needs to specify the signal-to-noise ratio (\f$SNR\f$), \f$LEN\f$ and \f$THETA\f$ of the PSF.

Source code
-----------

You can find source code in the `samples/cpp/tutorial_code/ImgProc/motion_deblur_filter/motion_deblur_filter.cpp` of the OpenCV source code library.

@include cpp/tutorial_code/ImgProc/motion_deblur_filter/motion_deblur_filter.cpp

Explanation
-----------

A motion blur image recovering algorithm consists of PSF generation, Wiener filter generation and filtering a blurred image in a frequency domain:
@snippet samples/cpp/tutorial_code/ImgProc/motion_deblur_filter/motion_deblur_filter.cpp main

A function calcPSF() forms a PSF according to input parameters \f$LEN\f$ and \f$THETA\f$ (in degrees):
@snippet samples/cpp/tutorial_code/ImgProc/motion_deblur_filter/motion_deblur_filter.cpp calcPSF

A function edgetaper() tapers the input image’s edges in order to reduce the ringing effect in a restored image:
@snippet samples/cpp/tutorial_code/ImgProc/motion_deblur_filter/motion_deblur_filter.cpp edgetaper

The functions calcWnrFilter(), fftshift() and filter2DFreq() realize an image filtration by a specified PSF in the frequency domain. The functions are copied from the tutorial
@ref tutorial_out_of_focus_deblur_filter "Out-of-focus Deblur Filter".

Result
------

Below you can see the real world image with motion blur distortion. The license plate is not readable on both cars. The red markers show the car’s license plate location.
![Motion blur image. The license plates are not readable](images/motion_original.jpg)


Below you can see the restoration result for the black car license plate. The result has been computed with \f$LEN\f$ = 125, \f$THETA\f$ = 0, \f$SNR\f$ = 700.
![The restored image of the black car license plate](images/black_car.jpg)

Below you can see the restoration result for the white car license plate. The result has been computed with \f$LEN\f$ = 78, \f$THETA\f$ = 15, \f$SNR\f$ = 300.
![The restored image of the white car license plate](images/white_car.jpg)

The values of \f$SNR\f$, \f$LEN\f$ and \f$THETA\f$ were selected manually to give the best possible visual result. The \f$THETA\f$ parameter coincides with the car’s moving direction, and the
\f$LEN\f$ parameter depends on the car’s moving speed.
The result is not perfect, but at least it gives us a hint of the image’s content. With some effort, the car license plate is now readable.

@note The parameters \f$LEN\f$ and \f$THETA\f$ are the most important. You should adjust \f$LEN\f$ and \f$THETA\f$ first, then \f$SNR\f$.

You can also find a quick video demonstration of a license plate recovering method
[YouTube](https://youtu.be/xSrE0hdhb4o).
@youtube{xSrE0hdhb4o}
Loading

0 comments on commit d74b98c

Please sign in to comment.