Absolute path to tests in opencv_run_app_tests.sh fixed.
(cherry picked from commit 530702c5f2350c58f0e9078b5fde8185af6a3c77)
Implicit testdata directory permissions setup added.
(cherry picked from commit b86088b89c43ba1b7db2d8435f222489722e62c9)
Revert "disable gpu Subtract_Array test:"

This reverts commit e91bf95d5832e87aa70240c50f0bf7fcc587e8c8.
(cherry picked from commit da44a2fac1c0be45d2a987c165298a9629757723)
Revert "disable gpu CvtColor.*2HSV tests:"

This reverts commit 952027a8536215a5e4308c79a59308c6b3426354.
(cherry picked from commit b6ba1f226c3da6ba726416f92550410145e89c10)
fix epsilons for several gpu tests
(cherry picked from commit 3e4bb371c8a364315dec18df14674d9164b7523d)
Revert "disable CUDA generalized Hough Transform"

This reverts commit 33d42b740c6fe938b63a0b25c9ad51741aba48c3.
(cherry picked from commit 5d099df57864d083881f026ffe32637afac6ba2e)
Revert "disable gpu Canny and HoughCircles perf tests:"

This reverts commit dbce90692acd84fbf46bde4da4b1726049f42857.
(cherry picked from commit bfc27271e2543bb0807f6dc000f770993a740581)
fixed several bugs in CUDA Canny implementation:

* out of border access in edgesHysteresisLocalKernel
* incorrect usage of atomicAdd(cherry picked from commit 5dbdadb769e97f47b64655b5b3144787c57e2740)
Fixed MinGW build by declaring the minimal required Windows version.

Also deleted miscellaneous remaining multimon cruft.
Deleted #include <winuser.h>, because <windows.h> includes it
already.

This should have a nice side effect of preventing us from
accidentally using any Windows API that's too new.
(cherry picked from commit 795c108f2bf2880a81a8d0db1ddc2da71c91864e)
fixed bug #3341
(cherry picked from commit 09d25e11c65fa20f9ddba1d25ee4f3344ba4e655)
fixing bug #3345
(cherry picked from commit b036fc756a65c8be5b9b0e4d77d94b6f8099fc20)
fixing bug #3345. don't use BORDER_ISOLATED alone. it should be combined with some border type
(cherry picked from commit 2272a5876972f74684c43f2069c3046bd2888d01)
fixed bug #3319
(cherry picked from commit 4f9c081dc313f8fdfee3f0a4572779ae13e27e40)
Fix typo of SparseMat_<_Tp>::SparseMat_(const SparseMat& m)

Fix compilation erros when compiling this constructor.
First argument type of "convertTo" should be instance, not a pointer of instance.

First pull request was created for master branch.
But it should be marged for 2.4.
https://github.com/Itseez/opencv/pull/2113
(cherry picked from commit 2ae20c74a2661d5975529211f4c95206e8558243)
Fix algorithm setter argument validation for uchar(cherry picked from commit e21c6e19db0183e40d12b6634aec2d1923496336)
Fixed a valgrind 'Conditional jump or move depends on uninitialised value(s)' on cv::kmeans(...). The original code used points(sampleCount, 1, CV_32FC2), which confused generateCentersPP into thinking it is a 1 dimensional center, instead of 2. As a result it would set only the x variable and leave y unitialised.
(cherry picked from commit 601b7d1dd3a3ec9e8af5df461d43632d98ed3a7a)
Corrected package name in tutorial

See also #2101(cherry picked from commit ae795e5797ba3b85812d56edc7fe497d05cc2d77)
Fix: freeing previous elements has to be done before loading new parameters to avoid trying to delete unexisting objects if arrays size was modified
(cherry picked from commit 3f458c6eb114bd46ce7f08b8ca471822ea16d26e)
Fixed bug #3489: The code assumed that two global variables would be constructed in a particular order, but global variable initialization order is compiler-dependent.
(cherry picked from commit 6bf599b1bca8a58c7a656ddc169f7be0fc3094c6)
fix GpuMat::copyTo method with mask:

fill destination matrix with zeros if it was reallocated(cherry picked from commit dda999545c9dd1cca56081a4b2d56755210b840a)