Merge remote-tracking branch 'upstream/master' into bow_desc

Conflicts:
	modules/features2d/src/bagofwords.cpp
Remove duplicate functions.
Fix warnings as errors.
Fix useless space...
Fix name of parameter to have proper documentation.
mouse_and_match.py missing import cv2
Suppress a space!
Fix name of one parameter to fit the documentation.
Fix compilation issue related to previous commit.
Merge pull request #1860 from alalek:ocl_fix_undef_warn
Merge pull request #1850 from ilya-lavrenov:pthread_mutex
Merge pull request #1864 from berak:mouse_and_match
Merge pull request #1839 from pmiecielica:memory_leaks
Merge pull request #1837 from asmorkalov:android_opencl
Merge pull request #1822 from SpecLad:msvc12
Added fixes mentioned in bugreport 3306
- Added author provided fixes
- Added code example
- Added documentation fixes
Merge pull request #1842 from StevenPuttemans:bugfix_3315
Applied feature #3375 and fix of pull 1842 to avoid merging problems later
fixed ocl_arithm_op; fix for 3-channel images is needed
bugfix in deallocate