1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

Compare commits

...

456 Commits

Author SHA1 Message Date
Alexander Alekhin 62eece0d7e core(logger): complete initialization of logger structures
- for using of logging functions from global destructors

original commit: 99bc35a883
2020-06-22 10:49:59 +00:00
Liubov Batanina 8e92c704fb Disabling dafault NMS in yolo layer
original commit: 85c0c8c7ed
2020-06-22 10:49:34 +00:00
Liubov Batanina 1c15b43b90 Changed StridedSlice to VariadicSplit in Region layer
original commit: d93b6be3cc
2020-06-17 11:49:26 +03:00
Alexander Alekhin 7deba5add7 OpenCV version '-openvino' 2020-06-09 14:13:26 +03:00
Alexander Alekhin 2813aa7eb9 dnn: use OpenVINO 2020.4 defines 2020-06-09 14:13:21 +03:00
Alexander Alekhin 25f3a11a16 Merge pull request #17509 from mshabunin:fix-kw-issues 2020-06-09 11:11:39 +00:00
Alexander Alekhin b1706bc7e5 Merge pull request #17507 from alalek:update_ffmpeg_4.4 2020-06-09 09:31:16 +00:00
Maksim Shabunin 579d74d35b QRDetectMulti: refactored checkPoints method 2020-06-09 11:10:47 +03:00
Maksim Shabunin 7ce518106b dnn/NGraph: added nullptr checks 2020-06-09 11:10:36 +03:00
Alexander Alekhin fd498501d6 ffmpeg/4.4: update FFmpeg wrapper
- FFmpeg 4.2.3
2020-06-09 10:41:08 +03:00
Alexander Alekhin 51bfe74ce1 Merge pull request #17506 from alalek:update_version_4.4.0-pre 2020-06-09 07:39:10 +00:00
Alexander Alekhin 5f3012fc9a pre: OpenCV 4.4.0 (version++) 2020-06-09 02:27:13 +00:00
Alexander Alekhin 0f3c82e73b Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-06-08 19:50:55 +00:00
Alexander Alekhin 458f1d5ebe Merge pull request #17501 from alalek:update_version_3.4.11-pre 2020-06-08 19:35:34 +00:00
Alexander Alekhin a43e3bebe6 pre: OpenCV 3.4.11 (version++) 2020-06-08 18:46:27 +00:00
Alexander Alekhin f62fe956d1 Merge pull request #17498 from alalek:update_tbb 2020-06-08 18:38:57 +00:00
Giles Payne 02385472b6 Merge pull request #17165 from komakai:objc-binding
Objc binding

* Initial work on Objective-C wrapper

* Objective-C generator script; update manually generated wrappers

* Add Mat tests

* Core Tests

* Imgproc wrapper generation and tests

* Fixes for Imgcodecs wrapper

* Miscellaneous fixes. Swift build support

* Objective-C wrapper build/install

* Add Swift wrappers for videoio/objdetect/feature2d

* Framework build;iOS support

* Fix toArray functions;Use enum types whenever possible

* Use enum types where possible;prepare test build

* Update test

* Add test runner scripts for iOS and macOS

* Add test scripts and samples

* Build fixes

* Fix build (cmake 3.17.x compatibility)

* Fix warnings

* Fix enum name conflicting handling

* Add support for document generation with Jazzy

* Swift/Native fast accessor functions

* Add Objective-C wrapper for calib3d, dnn, ml, photo and video modules

* Remove IntOut/FloatOut/DoubleOut classes

* Fix iOS default test platform value

* Fix samples

* Revert default framework name to opencv2

* Add converter util functions

* Fix failing test

* Fix whitespace

* Add handling for deprecated methods;fix warnings;define __OPENCV_BUILD

* Suppress cmake warnings

* Reduce severity of "jazzy not found" log message

* Fix incorrect #include of compatibility header in ios.h

* Use explicit returns in subscript/get implementation

* Reduce minimum required cmake version to 3.15 for Objective-C/Swift binding
2020-06-08 18:32:53 +00:00
Alexander Alekhin f30b5995b6 Merge pull request #17497 from alalek:fix_ffmpeg_wrapper_build 2020-06-08 18:07:08 +00:00
Alexander Alekhin 852b0226e0 3rdparty: update TBB 2020.1 => 2020.2
https://github.com/oneapi-src/oneTBB/releases/tag/v2020.2
2020-06-08 11:04:33 +00:00
Alexander Alekhin 89a6937c00 videoio: fix plugins build 2020-06-08 09:17:13 +00:00
Alexander Alekhin 08a3eef62a Merge pull request #17485 from sitic:stitching 2020-06-06 19:37:11 +00:00
Alexander Alekhin 434014b05e Merge pull request #17471 from asmorkalov:as/video_capability_check 2020-06-05 19:54:41 +00:00
Maksim Shabunin 29ff1129fb Merge pull request #17431 from mshabunin:support-vtk9
* Added VTK 9 support
2020-06-05 17:55:53 +00:00
Jan Lebert 5906b49bd1 Fix '--help' of stitching_detailed.py sample
Fixes the help for `--features`, previously listed all possible values as default value.

Also adds the default value to the help for two other arguments
2020-06-05 19:37:02 +02:00
Alexander Alekhin b03ed532cf Merge pull request #17474 from komakai:ndk-side-by-side 2020-06-05 10:37:48 +00:00
Alexander Alekhin 7d30e19b3e Merge pull request #17350 from AsyaPronina:gapi_ocv_stateful_kernel
Enable stateful kernels in G-API OCV Backend
2020-06-05 00:51:22 +03:00
AsyaPronina b083c20eb2 Enable stateful kernels in G-API OCV Backend 2020-06-04 22:14:42 +03:00
Alexander Alekhin 7722a2b8a8 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-06-04 17:58:34 +00:00
Alexander Alekhin ef3844a177 Merge pull request #17466 from alalek:build_opencv_winpack_dldt_2020.3.0 2020-06-04 17:32:09 +00:00
Alexander Alekhin 476aa443c6 Merge pull request #17432 from tomoaki0705:automaticCC 2020-06-04 17:10:04 +00:00
Fernando Martin cb0f74ab9f Merge pull request #17473 from f3rm4rf3r:fixingFourCCDocBrokenLink
* - Fixing broken URL to mp4ra website

* - Fixing broken URL to mp4ra website (in C videoio API)
2020-06-04 17:07:54 +00:00
Giles Payne 977e5afbac Add handling for Android "NDK (Side by side)" 2020-06-04 21:13:11 +09:00
Alexander Alekhin 08d1c54364 Merge pull request #17469 from l-bat:fix_virtual_try_on 2020-06-04 10:32:30 +00:00
Alexander Alekhin dbbfa003d3 Merge pull request #17455 from mshabunin:check-count-non-zero 2020-06-04 08:47:43 +00:00
Alexander Smorkalov a17d1843fb Skip some GAPI tests if VideoCapture is not capable to playback video. 2020-06-04 09:59:09 +03:00
Liubov Batanina 5ffc5bca7c Fixed virtual try on sample 2020-06-04 09:41:24 +03:00
Alexander Alekhin 11ac2e1475 build: winpack_dldt with dldt 2020.3.0
https://github.com/openvinotoolkit/openvino/releases/tag/2020.3.0
2020-06-04 01:21:16 +00:00
Maksim Shabunin 59608907b8 Added countNonZero test for big arrays and disable IPP for some cases 2020-06-03 18:58:41 +03:00
Alexander Alekhin e454c4891e Merge pull request #17369 from themightyoarfish:doc-essential-matrix-different-cameras 2020-06-03 12:55:55 +00:00
Alexander Alekhin 3ed243abde Merge pull request #17430 from alalek:issue_17257 2020-06-02 12:42:04 +00:00
Alexander Alekhin d60524ecfa Merge pull request #17447 from alalek:dnn_ie_extract_layers 2020-06-02 12:40:06 +00:00
Rasmus Diederichsen 345e071b24 Add instructions for how to use findEssentialMat() when camera matrices are different 2020-06-02 12:19:49 +03:00
Alexander Alekhin be1a121d0d dnn(ie): fix layers extraction 2020-06-01 21:57:39 +00:00
Tomoaki Teshima 156406b56c select the architecture based on nvcc result
* cache the result
  * DRY
  * brush up based on review
2020-06-02 05:07:53 +09:00
Alexander Alekhin f68654a204 Merge pull request #17438 from alalek:fix_eigen_builds 2020-06-01 18:02:07 +00:00
Vadim Pisarevsky 8abb312c20 Merge pull request #17417 from vpisarev:fix_fitellipse
* improved fitEllipse and fitEllipseDirect accuracy in singular or close-to-singular cases (see issue #9923)

* scale points using double precision

* added normalization to fitEllipseAMS as well; fixed Java test case by raising the tolerance (it's unclear what is the correct result in this case).

* improved point perturbation a bit. make the code a little bit more clear

* trying to fix Java fitEllipseTest by slightly raising the tolerance threshold

* synchronized C++ version of Java's fitEllipse test

* removed trailing whitespaces
2020-06-01 18:01:20 +00:00
Alexander Alekhin adcb943f61 Merge pull request #17424 from berak:dnn_sample_human_parsing 2020-06-01 17:58:13 +00:00
Vadim Pisarevsky 5489735258 Merge pull request #17436 from vpisarev:fix_python_io
* fixed #17044
1. fixed Python part of the tutorial about using OpenCV XML-YAML-JSON I/O functionality from C++ and Python.
2. added startWriteStruct() and endWriteStruct() methods to FileStorage
3. modifed FileStorage::write() methods to make them work well inside sequences, not only mappings.

* try to fix the doc builder

* added Python regression test for FileStorage I/O API ([TODO] iterating through long sequences can be very slow)

* fixed yaml testing
2020-06-01 11:33:09 +00:00
Alexander Alekhin 8de176988d Merge pull request #17439 from alalek:fix_dnn_test_required_file 2020-05-31 19:51:56 +00:00
Alexander Alekhin 79c5d07abe dnn(test): file 'dnn/efficientdet-d0.pb' is optional 2020-05-31 16:18:37 +00:00
Alexander Alekhin 74020a084b core: fix builds with eigen helper header 2020-05-31 15:41:42 +00:00
berak 09acd478f1 dnn: add a human parsing cpp sample 2020-05-31 09:50:20 +02:00
Alexander Alekhin e6c9e2fa50 Merge pull request #17420 from nosajthenitram:fix_cascadedetect_convert_bug_for_old_cascade 2020-05-30 17:34:20 +00:00
Meng Wang ab2c59b80e Merge pull request #17403 from wangmengHB:master
Fix Test Case: in latest version, window.cv is a promise instance that makes most test case failed.

* Fix Browser Test Case: In latest version, window.cv is a promise instance

In latest version of opencv.js, window.cv is promise instance.
So that most of the test cases is run failed.
This commit is to fix browser test case.

* Add comment for backward compatible

Add comments for backward compatible
2020-05-30 17:33:17 +00:00
Jason Martin a5209c4882 Fixed cascadedetect convert from old cascade to new 2020-05-30 11:45:24 -05:00
Alexander Alekhin f1dd5e49c5 videoio(ffmpeg): fix handling of AVERROR_EOF
decoder should be properly flushed after that
2020-05-29 19:52:26 +00:00
Alexander Alekhin c6b60e219d Merge pull request #17428 from asmorkalov:as/java_smart_constructors 2020-05-29 18:38:34 +00:00
Alexander Alekhin 740f6628ec Merge pull request #17419 from YourButterfly:fix_divide_zero_in_darknet_3_4 2020-05-29 17:32:48 +00:00
Alexander Smorkalov 821fac187c Generate constructor with smart pointer, if it's expected. 2020-05-29 16:40:19 +03:00
Alexander Alekhin 73fdf75328 Merge pull request #17338 from hunter-college-ossd-spr-2020:contours-toc 2020-05-29 10:40:43 +00:00
YourButterfly f7daa9e4f5 chk divide 0 2020-05-29 09:54:46 +08:00
Alexander Alekhin c3e8a82c9c Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-05-28 23:53:54 +00:00
Liubov Batanina d3aaf2d3a3 Merge pull request #17371 from l-bat:nms_model
* Fix NMS bug in DetectionModel

* Fixed comments

* Refactoring
2020-05-28 22:54:19 +00:00
Alexander Alekhin e58e545584 Merge pull request #17392 from alalek:dnn_test_yolov4 2020-05-28 22:52:21 +00:00
Alexander Alekhin 319db07b6b Merge pull request #17384 from dkurt:efficientdet 2020-05-28 22:48:52 +00:00
Alexander Alekhin 407cc5f1b6 Merge pull request #17416 from vpisarev:fix_fillpoly 2020-05-28 21:37:15 +00:00
Vadim Pisarevsky 80037dc6de fixed fillPoly, the overloaded variant with InputArrayOfArrays parameter (single or multiple polygons) 2020-05-28 21:36:28 +03:00
Dmitry Kurtaev d9bada9867 dnn: EfficientDet 2020-05-28 17:23:42 +03:00
Alexander Alekhin 6b89154afd dnn(test): add YOLOv4 tests 2020-05-28 13:27:40 +00:00
Alexander Alekhin 1f2d4e4839 Merge pull request #17410 from asmorkalov:as/formulae_command_typo 2020-05-28 11:45:19 +00:00
Alexander Smorkalov 4a9904fe62 Command name typo fix for formulas in documentation. 2020-05-28 13:59:31 +03:00
Alexander Alekhin 4b5fdc6bb2 Merge pull request #17406 from mshabunin:fix-msmf-audio-handling 2020-05-27 19:20:39 +00:00
Maksim Shabunin 2d11edd103 videoio/MSMF: fixed audio stream handling 2020-05-27 17:57:18 +03:00
Alexander Alekhin 515a06cedf Merge pull request #17359 from YashasSamaga:cuda4dnn-fix-default-stream-wrappers 2020-05-27 11:28:09 +00:00
Ningxin Hu fef6192bca Merge pull request #17394 from huningxin:fix_segmentation_py
* Fix window title of python segmentation example

* Fix float text position of python segmentation examples
2020-05-27 11:20:07 +03:00
Alexander Alekhin 7d9e1be588 Merge pull request #17388 from alalek:dnn_update_network_dump 2020-05-27 07:55:32 +00:00
Liubov Batanina ba3cf47600 Merge pull request #17386 from l-bat:tf_clamp_subgraph
* Added ClipByValue subgraph

* Return const nodes
2020-05-26 19:01:47 +00:00
Alexander Alekhin 9e09828cc3 Merge pull request #17390 from l-bat:fix_ngraph_multiply 2020-05-26 16:33:12 +00:00
Liubov Batanina b236f10792 Switch ngraph::op::v1::Multiply to v0 2020-05-26 16:59:50 +03:00
Alexander Alekhin f0bef94a03 dnn: update network dump code, include ngraph serialization 2020-05-26 12:49:22 +00:00
Alexander Alekhin 9f177b2bcd Merge pull request #17377 from jtojnar:patch-1 2020-05-26 09:52:13 +00:00
Jan Tojnar 765f333a1d pkg-config: Drop broken include path
The legacy `includedir` was removed in 4.0 (https://github.com/opencv/opencv/pull/12477) but it was not removed from the `.pc` file.

This causes issues when trying to link against OpenCV using pkg-config in CMake.
2020-05-25 22:33:34 +02:00
Egor Pugin 1bec7ca540 Merge pull request #17352 from egorpugin:patch-2
* Fix integer overflow in parseOption().

Previous code does not work for values like 100000MB.

* Fix warning during 32-bit build on inactive code path.

* fix build without C++11
2020-05-25 20:25:18 +00:00
Alexander Alekhin 29bbbaa0a7 Merge pull request #17376 from alalek:dnn_fix_build 2020-05-25 19:59:58 +00:00
shijiayuan 4e97c69792 Merge pull request #17275 from shijiayuan:fixbug
* fix bug for CHECK issue

* remove chack for bpp

* add test for tif file

* add test for tiff file

* change the test name

* use proper bpp value, use clear test names
2020-05-25 18:49:37 +00:00
Alexander Alekhin 88d8a48b09 Merge pull request #17374 from alalek:dnn_fix_build 2020-05-25 18:46:15 +00:00
Alexander Alekhin 73aa5f567b dnn: *_DENORMALS_ZERO_MODE is defined for SSE3 2020-05-25 17:55:36 +00:00
Liubov Batanina d5e8792f55 Merge pull request #17332 from l-bat:fix_nms
Fixed NMSBoxes bug

* Added NMS for each class

* Updated cpp sample

* Fixed errors

* Refactoring

* Added NMS for IE
2020-05-25 12:34:11 +00:00
Alexander Alekhin 6202556fc0 Merge pull request #17367 from anton-potapov:ap/fluid_fix_uninit_members 2020-05-25 11:00:13 +00:00
Anton Potapov be9f3826d7 GAPI: fix uninitialized variables in Fluid 2020-05-25 11:59:28 +03:00
Michal W. Tarnowski 7f453ade73 Merge pull request #17361 from mwtarnowski:fix-documentation-gapi-imgproc-blur
* fix documentation for cv::gapi::blur

* remove dst parameter and move ksize parameter to its correct position
2020-05-24 22:48:44 +00:00
Michal W. Tarnowski 5393185add Merge pull request #17360 from mwtarnowski:fix-documentation-imgproc-blur
* fix documentation for cv::blur

* correct the position of ksize parameter
2020-05-24 22:46:41 +00:00
YashasSamaga b3a261c7ce set stream at the site of creation 2020-05-24 19:01:17 +05:30
Josh Bradley 9fef09fe89 Merge pull request #17320 from jgbradley1:add-eigen-tensor-conversions
* add eigen tensor conversion functions

* add eigen tensor conversion tests

* add support for column major order

* update eigen tensor tests

* fix coding style and add conditional compilation

* fix conditional compilation checks

* remove whitespace

* rearrange functions for easier reading

* reformat function documentation and add tensormap unit test

* cleanup documentation of unit test

* remove condition duplication

* check Eigen major version, not minor version

* restrict to Eigen v3.3.0+

* add documentation note and add type checking to cv2eigen_tensormap()
2020-05-23 18:25:01 +00:00
Alexander Alekhin 6b0fff72d9 Merge pull request #17349 from YashasSamaga:cuda4dnn-general-fixes 2020-05-23 18:18:55 +00:00
Alexander Alekhin 21e28adb87 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-05-22 19:50:14 +00:00
Alexander Alekhin a9b030591b Merge pull request #17295 from dkurt:dnn_fusion_ftz 2020-05-22 18:49:43 +00:00
YashasSamaga 57ca10636c do not create redundant handles 2020-05-22 19:52:20 +05:30
Alexander Alekhin d4a9c731ff Merge pull request #17345 from alalek:build_fix_mac_warnings 2020-05-22 10:50:41 +00:00
Alexander Alekhin 17d15df6cd Merge pull request #17343 from hunter-college-ossd-spr-2020:mac-install 2020-05-22 08:12:10 +00:00
Alexander Alekhin 98611adeb9 build: fix warnings about TARGET_OS_MACCATALYST 2020-05-21 20:41:47 +00:00
Alexander Alekhin 01a8c9ca8d Merge pull request #17331 from allnes:update_quirc 2020-05-21 20:15:55 +00:00
Boubacar 0940c56a3f add note on cmake brew install 2020-05-21 10:34:17 -04:00
Alexander Alekhin d650b5cc5a Merge pull request #17339 from hunter-college-ossd-spr-2020:pylint-note 2020-05-21 13:53:29 +00:00
Alexander Alekhin e96a58f091 Merge pull request #17191 from anton-potapov:gapi_variant_converting_ctor_assign_op_reworked 2020-05-21 12:59:31 +00:00
Boubacar b624da27bd add pylint install note 2020-05-21 07:55:11 -04:00
Boubacar 5b443199ca group contour articles together 2020-05-21 07:16:54 -04:00
Alexander Alekhin cb82388a84 Merge pull request #17325 from hunter-college-ossd-spr-2020:nav-links 2020-05-20 18:14:27 +00:00
Nesterov Alexander 735c31bb4a Resolve type conflict 2020-05-20 18:05:27 +03:00
Nesterov Alexander b7253e3280 Update version quirc 2020-05-20 17:55:14 +03:00
Anton Potapov e02318d384 GAPI: utils - variant converting ctor and assignment op. reworked
- reworked variant::operator(T&&) and varaint::variant(T&&) to be more
concise and signature accurate with C++17 specification
- restricted cv::detail::OpaqueRef::OpaqueRef(T&&) to not substitute
copy/move ctors
- moved common additions to C++11 version of std <type_traits> to
separte header
2020-05-20 14:34:55 +03:00
Daniel Mallia 94d187e269 Add next and previous navigation links to all tutorials 2020-05-19 18:59:28 -04:00
Liubov Batanina d991c22090 Merge pull request #16575 from l-bat:flownet2
Support FlowNet2 model

* Support DataAugmentation layer

* Fix warnings

* Fix comments

* Support Correlation layer

* TEST

* Support Correlation layer

* Supported Accum and FlowWarp layers

* Supported ChannelNorm layer

* Supported Resample with inputs.size() > 1

* Fixed comments

* Refactoring

* Added tests

* Add resample test

* Added asserts in resize layer

* Updated DataAugmentation layer

* Update convolution layer

* Refactoring

* Fix data augmentation layer

* Fix caffe importer

* Fix resize

* Switch to Mat ptr

* Remove useless resize type

* Used ResizeLayer in Accum

* Split ChannelNormLayer

* Delete duplicate assert

* Add sample

* Fix sample

* Added colormap
2020-05-19 12:29:50 +00:00
Alexander Alekhin 9039284d96 Merge pull request #17317 from Yosshi999:prevent-build-failure-without-flann 2020-05-19 08:30:54 +00:00
Alexander Alekhin 593af7287b Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-05-18 17:50:16 +00:00
Alexander Alekhin 322960f795 Merge pull request #17297 from dkurt:dnn_yolov3_ocl 2020-05-18 17:47:16 +00:00
Dmitry Kurtaev b5035ce991 Increase test threshold for YOLOv3 on OCL FP16 2020-05-18 19:06:15 +03:00
dmallia17 07c56f149f Merge pull request #17313 from hunter-college-ossd-spr-2020:revise-knn-tutorials
* Revise and expand kNN Python tutorials

* Correct NPTEL link
2020-05-18 15:53:17 +00:00
Yosshi999 c0f435349a ignore tests dependent on flann when flann module is absent 2020-05-18 15:30:32 +00:00
Alexander Alekhin 0e1c7eda39 Merge pull request #17092 from alalek:imgproc_ipp_parallel_gaussuanBlur 2020-05-18 11:51:59 +00:00
Alexander Alekhin 2b2bcc9b38 Merge pull request #17304 from chrisballinger:maccatalyst 2020-05-17 20:33:05 +00:00
Alexander Alekhin a3b109eca0 imgproc: enable GaussianBlur IPP parallel processing 2020-05-17 11:40:34 +00:00
Alexander Alekhin a1b09a3734 imgproc(perf): add GaussianBlur cases for SIFT 2020-05-17 10:15:31 +00:00
Chris Ballinger d81ac52ce2 Remove linking against AssetsLibrary framework 2020-05-16 12:47:50 -07:00
Chris Ballinger 220df8252d Add target conditionals for Mac Catalyst 2020-05-16 12:47:50 -07:00
Alexander Alekhin de720ac34a Merge pull request #17294 from alalek:issue_17247 2020-05-16 18:49:22 +00:00
Dmitry Kurtaev 68d59a2913 Flush to zero Convolution denormal weights 2020-05-15 23:44:34 +03:00
Alexander Alekhin 5ecf5f106a Merge pull request #17296 from mshabunin:fix-vulkan-build 2020-05-15 16:51:29 +00:00
Alexander Alekhin 753e417dec Merge pull request #17299 from tweenietomatoes:patch-1 2020-05-15 15:48:46 +00:00
tweenietomatoes 7d1094b7e1 Important single character fix 2020-05-15 14:41:55 +03:00
jumostedu 5b095dfcb6 Merge pull request #15214 from jumostedu:matchtemplmask
* imgproc: templmatch: Add support for mask for all methods

Add support for masked template matching. Fix/scrub old implementation
for masked matching, as it did partly not even really do a meaningful
masking, and only supported limited template matching methods.

Add documentation including formulas for masked matching.

* imgproc: test: Add tests for masked template matching

Test accuracy by comparing to naive implementation for one point.
Test compatibility/correctness by comparing results without mask and
with all ones mask.
All tests are done for all methods, all supported depths, and for 1 and
3 channels.

* imgproc: test: templmatch: Add test for crossCorr

Add a test for the crossCorr function in templmatch.cpp. crossCorr() had
to be added to exported functions to be testable.

This test can maybe help to identify the problem with template matching
on MacOSX.

* fix: Fixed wrong evaluations of the MatExpr on Clang

* fix: removed crossCorr from public interface.

If it should be exported, it should be done as separate PR.

Co-authored-by: Vadim Levin <vadim.levin@xperience.ai>
2020-05-14 22:46:25 +00:00
Maksim Shabunin 7c41b54e3d Fixed build with latest Vulkan headers 2020-05-14 23:20:28 +03:00
Alexander Alekhin 58426c80a3 samples: fix OpenCL events leaks 2020-05-14 17:15:09 +00:00
Ganesh Kathiresan cddd7f10d5 Merge pull request #17224 from ganesh-k13:bugfix/calib3d/17201
* Fixed indexing in prefilter

* Initialised prefilter

* Initialised prefilter with value initialisation

* Added TC to trigger different Mem Allocs in BufferBM

* Optimize cases with only needed conditions
2020-05-14 16:30:01 +00:00
Alexander Alekhin ea3c2307dc Merge pull request #17248 from nroduit:java-addall 2020-05-14 12:17:51 +00:00
Alexander Alekhin 65b3209441 Merge pull request #17055 from vnikoofard:patch-1 2020-05-14 12:17:26 +00:00
Nicolas Roduit 400a781ebf Prefer addall instead of iteration for performance 2020-05-14 11:42:24 +03:00
Alexander Alekhin c8689d9d0a Merge pull request #17288 from dkurt:dnn_tf_resize_down 2020-05-14 07:08:41 +00:00
Alexander Alekhin ea0d1424d8 Merge pull request #17287 from tomoaki0705:fixAkazeTestFailureMali 2020-05-14 06:59:28 +00:00
Alexander Alekhin 365f44b094 Merge pull request #17285 from sauhaardac:patch-1 2020-05-14 06:58:42 +00:00
Alexander Alekhin bcf96d637e Merge pull request #17284 from dkurt:dnn_bn_fusion 2020-05-14 06:57:36 +00:00
Alexander Alekhin 6ced54a892 Merge pull request #17281 from l-bat:ssd_placeholder_shape 2020-05-14 06:55:52 +00:00
Alexander Alekhin 486de65067 Merge pull request #17268 from anton-potapov:deownification_fix 2020-05-14 06:55:08 +00:00
Liubov Batanina c5a2d28367 Determine SSD input shape 2020-05-14 08:16:45 +03:00
Dmitry Kurtaev b4a6aa335d TensorFlow bilinear resize downscale 2020-05-13 23:59:20 +03:00
Tomoaki Teshima 35245cb76e fix test failure on Mali T760 and Mali T628 2020-05-14 05:44:14 +09:00
Sauhaarda Chowdhuri fa349b7a4e Fix #17279 Documentation Error
Update documentation to solve #17279. Simple documentation bug.
2020-05-13 13:14:05 -07:00
Dmitry Kurtaev df305e83fa Fix BatchNorm reinitialization after fusion 2020-05-13 22:15:36 +03:00
Alexander Alekhin b2464e3379 Merge pull request #17270 from l-bat:ngraph_missed_data 2020-05-13 08:27:04 +00:00
Alexander Alekhin 06bff34a6b Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-05-12 19:24:28 +00:00
Alexander Alekhin 6856cc7253 Merge pull request #17228 from mshabunin:mfx-surface-pool-34 2020-05-12 19:00:49 +00:00
Alexander Alekhin 508bd3f55d Merge pull request #17260 from jsxyhelu:add_deepgreen_colormap 2020-05-12 18:58:54 +00:00
Alexander Alekhin 8b51e2df8b Merge pull request #17211 from alalek:sift_dispatch 2020-05-12 18:53:35 +00:00
Alexander Alekhin bd1b252de9 Merge pull request #17196 from alalek:core_matexpr_fix_warning 2020-05-12 18:50:58 +00:00
Alexander Alekhin 77ddfa2fc9 Merge pull request #17215 from spmallick:master 2020-05-12 16:52:27 +00:00
Maksim Shabunin f30931848e CAP_MFX: surface pool with timeout, more parameters 2020-05-12 18:43:04 +03:00
Liubov Batanina b27ae9c63b Switch v1::Multiply to v0::Multiply 2020-05-12 16:05:03 +03:00
Liubov Batanina 79f8b7fd73 Merge pull request #17233 from l-bat:onnx_bn
* Added ONNX BatchNorm subgraph

* Move removing constant inputs to addConstantNodesForInitializers

* Added initializers to ONNXGraphWrapper
2020-05-12 15:33:57 +03:00
jsxyhelu 48e9e651a4 add DeepGreen colormap 2020-05-12 15:24:32 +03:00
Anton Potapov 7386d8523b G-API: "deownification" corrections
- moved "standalone" aliases of cv types to "opencv_includes.hpp" to
keep responsibility principle aplied
- introduced correct aliasing for "descr_of(Mat)" function for
standalone case
 - added missing include in `gapi/own/mat.hpp`
2020-05-12 14:28:32 +03:00
Alexander Alekhin 1bf353b876 Merge pull request #17230 from asmorkalov:as/issue_17171 2020-05-12 10:53:23 +00:00
Alexander Alekhin 23e336ee53 Merge pull request #17244 from hunter-college-ossd-spr-2020:toc-updates 2020-05-12 07:35:14 +00:00
Alexander Alekhin ac54bb193c Merge pull request #17256 from R-penguins:jstutfix 2020-05-12 07:34:00 +00:00
Alexander Alekhin 713577b257 Merge pull request #17258 from YashasSamaga:cuda4dnn-hotfix-slice-pr17231-pr17222 2020-05-11 19:25:50 +00:00
Alexander Alekhin 583f4b9633 Merge pull request #17253 from YashasSamaga:cuda4dnn-region-yolov4 2020-05-11 19:23:55 +00:00
YashasSamaga 45a6386e45 port pr17222 changes to CUDA backend 2020-05-11 11:01:01 +05:30
Rui Hou e9058ea8f5 Easier access to opencv.js in tutorial 2020-05-10 11:20:27 -04:00
YashasSamaga 3c35b563d7 add scale_x_y parameter to region 2020-05-10 16:53:28 +05:30
Alexander Alekhin fd06139c20 Merge pull request #17235 from R-penguins:patch-1 2020-05-10 08:16:34 +00:00
R-penguins b43da8aa5d Update Image Watch Tutorial
Updated the Windows Visual Studio Image Watch tutorial to include download links to the latest versions of Visual Studio Image Watch for newer Visual Studio versions.
2020-05-09 23:24:47 -04:00
Alexander Alekhin 066259b656 Merge pull request #17118 from l-bat/concat_3d
Added NDHWC Concat support for TensorFlow

* Supported TF concat 3d

* Skip myriad

* Fix test
2020-05-09 22:24:06 +03:00
Yashas Samaga B L d981d04c76 Merge pull request #17200 from YashasSamaga:cuda4dnn-general-opt1
cuda4dnn: optimizations for swish, mish, sigmoid, region, resize based ops, transpose, identity-conv fusion

* bunch of optimizations

* more accurate implementation for mish
2020-05-09 17:20:30 +00:00
Alexander Alekhin 666be238d8 Merge pull request #17229 from smirnov-alexey:as/fix_fluid_resize 2020-05-08 18:59:41 +00:00
Alexander Alekhin 64f5471b2a Merge pull request #17208 from hn-88:3.4 2020-05-08 18:31:11 +00:00
Daniel Mallia 4e789635c9 Update tutorials tables of content for several modules 2020-05-08 14:22:30 -04:00
Alexander Smorkalov 7c17695be4 Added Java and C++ regression test for estimateNewCameraMatrixForUndistortRectify. 2020-05-08 13:04:25 +03:00
Smirnov Alexey 3e3d4ad797 Fix fluid resize operating with zero output size 2020-05-07 12:24:57 +03:00
Alexander Alekhin 73bbabcd04 Merge pull request #17223 from hunter-college-ossd-spr-2020:imgproc-toc 2020-05-07 08:44:02 +00:00
Alexander Alekhin 93d79d2e5d Merge pull request #17219 from hunter-college-ossd-spr-2020:mathjax-link 2020-05-07 08:43:16 +00:00
Alexander Alekhin 1889d72889 Merge pull request #17218 from hunter-college-ossd-spr-2020:numpy-links-17212 2020-05-07 08:42:50 +00:00
Satya Mallick 6e5437a582 Adding Official OpenCV Courses link to README.md 2020-05-06 16:32:08 -07:00
Alexander Alekhin 09799402f9 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-05-06 19:53:51 +00:00
Alexander Alekhin 5813d2439c Merge pull request #17222 from dkurt:dnn_flexible_slice 2020-05-06 19:46:34 +00:00
Alexander Alekhin 4f1ba5e69e Merge pull request #16941 from rngtna:examples_dnn_text_decoder 2020-05-06 22:45:05 +03:00
Daniel Mallia c934d9c3cc Update imgproc tutorials table of content Languages fields 2020-05-06 13:07:24 -04:00
Aleksandr Pertovskiy 00b19d6fba Add text recognition example 2020-05-06 15:26:17 +03:00
Dmitry Kurtaev 8b13b85c5e dnn: Slice with variable input shapes 2020-05-05 13:35:17 +03:00
Daniel Mallia 64b0757758 Update Supported formula commands - MathJax link 2020-05-04 23:50:22 -04:00
Daniel Mallia 1622e7cc90 Update NumPy links 2020-05-04 23:20:52 -04:00
Alexander Alekhin 1f9713195b features2d(sift): enable runtime dispatching 2020-05-03 11:59:27 +00:00
hn-88 ea04f9d12e to make OpenCV compile on mingw32
added #define NO_DSHOW_STRSAFE
2020-05-03 11:19:04 +05:30
Alexander Alekhin 74e4cfd1da core(MatExpr): fix warning in case of e.s == (0, 0, 0, 0) 2020-05-01 07:29:57 +00:00
Alexander Alekhin 27ee6501eb Merge pull request #17188 from asmorkalov:as/fisheye_test 2020-04-30 13:55:31 +00:00
Liubov Batanina a5696da9ec Merge pull request #17185 from l-bat:yolo_v4
* Support Yolov4

* Skip Mish on OpenVINO 2020.2

* Revert Mish

* Refactoring
2020-04-30 16:53:44 +03:00
Alexander Alekhin 0b439bcd08 Merge pull request #17190 from alalek:dnn_test_win32_skip_list 2020-04-29 20:53:54 +00:00
Alexander Alekhin b805115c1a dnn(test): update skip tests on Win32 configuration 2020-04-29 20:02:13 +00:00
Alexander Smorkalov c41fb45da3 Restored test disabled during 3.0-alpha preparation. 2020-04-29 17:08:51 +03:00
QIU Xiaochen cdfa58dde0 Merge pull request #17180 from PetWorm:3.4
* fix Scharr nomination
2020-04-29 09:55:59 +00:00
Alexander Alekhin c722625f28 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-28 16:53:19 +00:00
Alexander Alekhin 6630eac813 Merge pull request #17173 from tomoaki0705:fixOclHogDetect 2020-04-28 16:36:14 +00:00
Tomoaki Teshima 63f5f93063 fix test failure on ODROID-N2 2020-04-28 21:46:31 +09:00
Alexander Alekhin 1d30a524fa Merge pull request #17145 from asmorkalov:as/riscv 2020-04-28 10:41:41 +00:00
Vadim Levin 7f90f04df2 Merge pull request #16766 from VadimLevin:dev/vlevin/video_writer_params_constructor
* feature: Extend VideoWriter to accept vector of parameters

 - Add additional constructor and `open` method for `VideoWriter`
   those accept a vector of parameters
 - Move actual implementation of the `VideoWriter::open` to general method
   which accepts vector of parameters
 - Propagate parsed parameters map up to actual video backend construction

* fix: Change VideoWriter constructor description to suppress doc warning

* refactor: Rollback newlines changes

* feature: Changed VideoWriter parameters workflow

* feature: Log unused parameters in VideoWriter open

* doc: Fix VideoWriter `isColor` parameter description

* fix: int to bool VC++ conversion warning

* doc: Remove information about `isColor` flag usage.
2020-04-28 08:38:39 +00:00
Alexander Alekhin 5da4bb7e88 Merge pull request #16983 from dkurt:dnn_tf_prelu 2020-04-28 08:37:46 +00:00
Alexander Alekhin dc1b1f2cd7 Merge pull request #16914 from jackson0223:patch-1 2020-04-28 08:36:51 +00:00
Dmitry Kurtaev 25ec4ce6f1 PReLU from Tensorflow 2020-04-28 00:01:21 +03:00
jackson0223 d30bc0a4c0 Restore face detection train.prototxt from #9516 2020-04-27 23:07:33 +03:00
Alexander Alekhin c05ac8729e features2d: keep history of simd.cpp 2020-04-27 18:19:14 +00:00
Alexander Alekhin 9926a93a78 features2d: copy sift.dispatch.cpp 2020-04-27 18:18:16 +00:00
Alexander Alekhin 7093752cb5 features2d: copy sift.simd.hpp 2020-04-27 18:17:15 +00:00
Alexander Alekhin 0daf055fe6 Merge pull request #17159 from pauljurczak:patch-3 2020-04-27 12:43:32 +00:00
Alexander Alekhin 3f38edfd61 Merge pull request #17161 from alalek:cmake_protobuf_fix 2020-04-27 12:24:37 +00:00
Alexander Alekhin ee201f4df5 Merge pull request #17157 from alalek:issue_17138 2020-04-27 12:23:44 +00:00
Alexander Smorkalov 7228d2a824 Added initial version of cmake toolchain for RISC-V architecture. 2020-04-27 12:42:38 +03:00
Alexander Alekhin 9181ecfc7b cmake: fix protobuf handling 2020-04-27 02:11:19 +00:00
Liubov Batanina 4bf94cb5d1 Fix test 2020-04-26 20:42:11 +03:00
Paul Jurczak 599a3026d1 Added to Camera constructor parameter description 2020-04-26 00:17:39 -06:00
Alexander Alekhin 288fa70ed9 dnn(protobuf): backport AllowUnknownField(), SetRecursionLimit()
- limit recursion in SkipField*() calls
2020-04-25 20:45:43 +00:00
Alexander Alekhin 152e6476d9 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-24 19:02:39 +00:00
Alexander Alekhin 8d05dab32c Merge pull request #17119 from alalek:move_sift 2020-04-24 18:15:15 +00:00
Alexander Alekhin 3c14a8c507 Merge pull request #17149 from alalek:core_simd_suppress_coverity 2020-04-24 17:46:54 +00:00
Alexander Alekhin 15b948d109 Merge pull request #17144 from YashasSamaga:cuda4dnn-fix-i17116 2020-04-24 17:40:57 +00:00
Alexander Alekhin ab3b1e9922 Merge pull request #17108 from HowardsPlayPen:patch-1 2020-04-24 17:25:31 +00:00
Alexander Alekhin cd7db168e0 core(SIMD): suppress coverity UNINIT_CTOR on SIMD vectors 2020-04-24 16:36:35 +00:00
HowardsPlayPen cbcdbde29d Update videocapture_basic.cpp
I believe you are using the wrong version of open() on line 28 - adding deviceID + appId together. It's better to use the new version of .open() taking two integers as parameter.
2020-04-24 11:42:45 +03:00
YashasSamaga aff2c7c43c handle redundant slice in SliceOp 2020-04-24 12:54:17 +05:30
Alexander Alekhin 2df978b8e7 Merge pull request #17134 from alalek:dnn_ie_avoid_conversion_to_legacy 2020-04-23 22:39:45 +00:00
Alexander Alekhin 10808ccbb4 Merge pull request #17129 from alalek:dnn_myriad_tests 2020-04-23 19:41:15 +00:00
Alexander Alekhin f756923271 dnn(ie): avoid conversion to legacy CNNNetworkImpl 2020-04-23 19:11:33 +00:00
Maxim Pashchenkov 51a42c0647 Merge pull request #17088 from mpashchenkov:mp/ocv-gapi-kernel-laplacian
G-API: Laplacian and bilateralFilter standard kernels

* Added Laplacian kernel and tests

* Added: Laplacian kernel, Bilateral kernel (CPU, GPU); Performance and accuracy tests for this kernels

* Changed tolerance for GPU test

* boner

* Some changes with alignment; Tests's parameters are the same as for OCV

* Cut tests

* Compressed tests

* Minor changes (rsrt bb)

* Returned types
2020-04-23 17:47:55 +00:00
Alexander Alekhin 189fc43765 Merge pull request #17082 from OrestChura:oc/buildPyramid 2020-04-23 12:07:27 +00:00
Alexander Alekhin a327418767 features2d(sift): move SIFT tests / headers / build fixes 2020-04-23 08:45:22 +00:00
Alexander Alekhin a1641f938e Merge pull request #17133 from alalek:build_fix_gapi_ie 2020-04-22 23:06:14 +00:00
Alexander Alekhin 351fb8c058 gapi: fix build, update IE handling, add OPENCV_GAPI_INF_ENGINE 2020-04-22 21:47:45 +00:00
Alexander Alekhin 83c4378d5d dnn(test): skip failed NGRAPH/MYRIAD tests 2020-04-22 15:00:23 +00:00
Alexander Alekhin 561421f748 Merge pull request #17122 from mshabunin:videoio-win-dbg-plugins 2020-04-22 11:42:33 +00:00
Maksim Shabunin 9415560250 videoio: load debug versions of plug-ins in debug builds 2020-04-22 13:35:06 +03:00
Alexander Alekhin e74075c689 Merge pull request #16887 from ashishkrshrivastava:fasterrcnn 2020-04-22 09:47:45 +00:00
Alexander Alekhin 511d0fe198 Merge pull request #17120 from ganesh-k13:bugfix/documentation/16987 2020-04-22 09:08:02 +00:00
Liubov Batanina 1c1762d3f6 Skip myriad 2020-04-22 09:52:20 +03:00
ashishiva3@gmail.com e0ac0cfbe2 add fused batchNorm Upsample 2020-04-22 08:24:17 +05:30
Alexander Alekhin bfcc136dc7 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-21 21:32:51 +00:00
Alexander Alekhin 775d031366 Merge pull request #17123 from ganesh-k13:bugfix/documentation/3.4/16987 2020-04-21 21:03:36 +00:00
Alexander Alekhin 1a17f402a4 Merge pull request #17030 from ashishkrshrivastava:onnximporter 2020-04-21 21:02:41 +00:00
Polina Smolnikova 40973bea31 Merge pull request #16961 from rayonnant14:objdetect_different_return_value_issue
QRDetectMulti : different return value bug fix

* QRDetectMulti : bug fix

* added tests

* changed test image due to large size of previous test image
2020-04-21 20:44:50 +00:00
Maxim Pashchenkov 94e36d8c8d Merge pull request #16995 from mpashchenkov:mp/ocv-gapi-standalone-mat
G-API: Mat's "deownification"

* deowned Mat

* boner

* Removed canDescribe test for own::Mat

* Removed STANDALONE flag for apply() and operator()

* Removed: desc_tests for own::Mat, descr_of for own::Mat.

* Returned: tests, cv::gapi::own::descr_of; fixed alignment; Removed own::Mat's headers

* Removed unused header own/mat.hpp from gbackend.hpp
2020-04-21 20:22:01 +00:00
Ganesh Kathiresan 4ee6852a1e Formula Fixes for master branch
Foumula fix 6

Foumula fix 7
2020-04-21 19:31:52 +05:30
Ganesh Kathiresan 0be2c7018b Formula Fixes for 3.4 branch
Foumula fix 1

Foumula fix 2

Foumula fix 3

Foumula fix 4

Foumula fix 5

Foumula fix 8
2020-04-21 19:23:23 +05:30
Liubov Batanina aa08900ac8 Supported TF concat 3d 2020-04-21 15:15:22 +03:00
OrestChura 05d5c284f6 gapi: buildOpticalFlowPyramid() interface, CPUkernel and CPUtests implementation
- kernel added to a cv::gapi::video namespace
     - tests to check a kernels (based on cv::video tests for cv::buildOpticalFlowPyramid())
     - tests for a combined G-API-pipeline (buildOpticalFlowPyramid() -> calcOpticalFlowPyrLK())
     - tests for internal purposes added
     - custom function for comparison in tests implemented
2020-04-21 14:36:42 +03:00
AshihsKrShrivastava d37180a2c4 modification for upsample node fused from unfused Resize subgraph 2020-04-21 15:03:00 +05:30
Liubov Batanina 8badf7f354 Merge pull request #17112 from l-bat:ie_region
* Support nGraph Region

* Support region since OpenVINO 2020.2

* Skip myriad
2020-04-21 09:26:58 +00:00
Alexander Alekhin 150bd3aee6 Merge pull request #17106 from pauljurczak:patch-3 2020-04-20 18:00:01 +00:00
Alexander Alekhin f19d0ae41d Merge pull request #17109 from alalek:cmake_videoio_plugins_all 2020-04-20 17:24:18 +00:00
Paul Jurczak a748eba42e Added descriptions of randu and randn 2020-04-20 07:13:37 +00:00
Alexander Alekhin 850b1ea2d7 Merge pull request #17110 from alalek:videoio_msmf_fix_warning 2020-04-19 20:41:18 +00:00
Alexander Alekhin 10d2bcc8a2 videoio(msmf): fix build warning
- warning C4800: 'int': forcing value to bool 'true' or 'false'
2020-04-19 19:47:32 +00:00
Alexander Alekhin 7ce1bd5d88 cmake: handle VIDEOIO_PLUGIN_LIST=all 2020-04-19 19:29:07 +00:00
Alexander Alekhin 935420217c Merge pull request #17102 from dkurt:dnn_ie_flexible_inputs 2020-04-19 18:06:09 +00:00
Alexander Alekhin 81d4d4948e Merge pull request #17105 from benji1123:pointPolygonTest_demo 2020-04-19 17:38:23 +00:00
Ben 041da57e87 fix tuple error 2020-04-19 10:36:59 -04:00
Alexander Alekhin acf1be547d Merge pull request #17046 from alalek:core_inputarray_matexpr_cleanup 2020-04-18 21:41:59 +00:00
Dmitry Kurtaev 908bf935f7 Flexible inputs for OpenVINO IR models 2020-04-18 20:00:22 +03:00
Alexander Alekhin e59e978fcd Merge pull request #17096 from spectralio:java-cmake-fix 2020-04-17 21:24:41 +00:00
Alexander Alekhin fbaae7ac37 Merge pull request #17041 from alalek:core_simd_vector_ctors 2020-04-17 21:22:08 +00:00
Alexander Alekhin dcf7eb972e core(SIMD): align behavior of vector constructors
- setzero() calls are dropped due low-level API nature
- initialization is mandatory if necessary (not an output of other calls)
2020-04-17 14:34:34 +00:00
Maksim Shabunin 2840362868 Merge pull request #16769 from mshabunin:fix-ipp-install
* Do not copy standalone IPP libraries to install for static builds

* Restored IPP installation under option
2020-04-17 14:28:42 +00:00
jshiwam d4fc302c7e Merge pull request #16795 from jshiwam:qrsample
Added a sample file for qrcode detection in python

* sample python file for qrcode detection added in samples/python

* input taken using argparse and the indents were removed

* Removed unused variables

* updated the format and removed unused variables

Removed the use of global variables and used parameterised contructor instead

=set multi detection true by default

* added detection from camera

* samples(python): coding style in qrcode.py
2020-04-17 12:16:39 +00:00
spectralio 1cce9db710 fix missing underscore 2020-04-17 13:08:32 +02:00
Alexander Alekhin e92f1eaa3d Merge pull request #17071 from mshabunin:tickmeter-fps 2020-04-17 08:56:29 +00:00
Maksim Shabunin f84cae833a TickMeter: added FPS and AvgTime, improved docs, reformatted 2020-04-16 21:33:29 +03:00
Alexander Alekhin 2cef100303 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-16 18:28:27 +00:00
Alexander Alekhin ed58b5489f [move sift.cpp] sift: avoid inplace calls of GaussianBlur
- should unlock IPP optimizations

original commit: https://github.com/opencv/opencv_contrib/commit/ce7c8f2646ccf3f5e657ab1241e22c0c32cd9d41
2020-04-16 17:58:45 +00:00
Alexander Alekhin ef5fa498d4 [move sift.cpp] sift: perf tests and trace regions
original commit: https://github.com/opencv/opencv_contrib/commit/a15e105db12aa7a0bade47afb791682201e46f60
2020-04-16 17:58:45 +00:00
Alexander Alekhin 78e4fbd2d7 Merge pull request #17091 from tomoaki0705:fixHOGDetectorFailure 2020-04-16 16:34:45 +00:00
Tomoaki Teshima 96075ce0c9 avoid test failure on Arm platform 2020-04-17 00:59:15 +09:00
Alexander Alekhin c007228d0f Merge pull request #17075 from alalek:dnn_updates_from_openvino_2020.2 2020-04-16 12:19:58 +00:00
Alexander Alekhin dca9b4283b Merge pull request #17080 from dkurt:dnn_ngraph_future 2020-04-16 11:19:08 +00:00
Alexander Alekhin dcec3150f0 Merge pull request #17084 from tomoaki0705:fixQRInputCheck 2020-04-16 09:44:08 +00:00
Alexander Alekhin d015db3de8 Merge pull request #17083 from pauljurczak:patch-2 2020-04-16 09:43:44 +00:00
Alexander Alekhin ef7fb905aa Merge pull request #17074 from AlanLi7991:doc/python-svm-doc-formula-miss 2020-04-16 09:43:20 +00:00
Dmitry Kurtaev 5e5385a814 Remove NodeVector for nGraph 2020-04-16 11:13:49 +03:00
Alanli 7aaa918367 doc: formula miss 2020-04-16 09:05:00 +09:00
Tomoaki Teshima c2e484a465 fix wrong condition check 2020-04-16 08:24:14 +09:00
Paul Jurczak f64d807863 Added to description of WCube constructor
`WCube` constructor reorders `min_point`, `max_point` parameters when necessary. I added this info to the description.
2020-04-15 16:06:14 -06:00
Alexander Alekhin 81c2f3d194 Merge pull request #17081 from alalek:backport_17056 2020-04-15 18:33:41 +00:00
Alexander Alekhin 8c77f35fce Merge pull request #17079 from tomoaki0705:fixCUDABgSgmMOG 2020-04-15 18:30:09 +00:00
Alexander Alekhin ff4ce9f7b1 build: winpack_dldt with dldt 2020.2 2020-04-15 17:25:23 +00:00
Alexander Alekhin fecebea2e3 Merge pull request #17056 from alalek:build_opencv_winpack_dldt_2020.2 2020-04-15 17:24:34 +00:00
Tomoaki Teshima f39784c584 fix test failure on Jetson TX2 2020-04-15 23:25:12 +09:00
Alexander Alekhin 98e38b2a41 Merge pull request #17017 from VadimLevin:dev/vlevin/header-parser-explicit-support 2020-04-15 12:53:42 +00:00
Vadim Levin 1d8c73cf6c feature: Added explicit support to header parser
- It is safe to remove `explicit` keyword for constructors with 1
argument, because it is C++ specific keyword and does not affect any of
the generated binding.
2020-04-15 14:25:39 +03:00
Alexander Alekhin ef68cc3d5f dnn: use OpenVINO 2020.2 defines
original commit: 45263d7642
2020-04-15 11:14:43 +00:00
Vadim Levin 18550b4601 test: Added tests for VideoCapture constructors in java 2020-04-15 14:12:31 +03:00
Alexander Alekhin 07a0274507 build: winpack_dldt with dldt 2020.2 2020-04-15 05:19:49 +00:00
Alexander Alekhin 8ff0399432 Merge pull request #17048 from anton-potapov:ap/variant_get_if 2020-04-14 19:06:01 +00:00
Alexander Alekhin c8f1948d58 core: drop EXPR handing code in InputArray 2020-04-14 18:02:19 +00:00
Alexander Alekhin f6de25b6cb Merge pull request #17060 from dkurt:dnn_align_ie_pool 2020-04-14 15:15:44 +00:00
Alexander Alekhin b3514a5708 Merge pull request #17049 from ilya-lavrenov:il/nn-builder 2020-04-14 15:14:35 +00:00
Anton Potapov dd2c7c5140 GAPI: utils - variant::get_if
adding one more missing function to local version of std::variant
2020-04-14 15:12:31 +03:00
Ilya Lavrenov 91b0100287 Fixed compilation when NN builder is not built 2020-04-14 15:05:01 +03:00
Dmitry Kurtaev 870a775d7d Align DLIE and nGraph average pooling layers 2020-04-14 13:54:54 +03:00
Vahid Nikoofard 575a609b80 Update calcBackProject_Demo1.py
To round a ndarray it's necessary to use np.round() instead to Built-in Python round()
2020-04-14 00:23:53 -03:00
Alexander Alekhin ca9756f6a1 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-13 20:00:12 +00:00
Alexander Alekhin 675342ecd9 Merge pull request #17025 from tomoaki0705:fixTestFailureCUDABruteForceNonLocalMeans 2020-04-13 18:17:50 +00:00
Alexander Alekhin 245b2fec34 Merge pull request #16925 from dkurt:dnn_ssd.pytorch 2020-04-13 13:12:12 +00:00
Alexander Alekhin 49a75079f2 Merge pull request #17047 from alalek:fix_permissions 2020-04-13 12:34:08 +00:00
Dmitry Kurtaev d3f9ad1145 Enable ONNX SSD from https://github.com/amdegroot/ssd.pytorch 2020-04-13 15:12:27 +03:00
Alexander Alekhin 46615ffc4a Merge pull request #16985 from ashishkrshrivastava:padfusion 2020-04-13 11:26:13 +00:00
Pierre Chatelier f351653589 Merge pull request #13869 from chacha21:LineVirtualIterator
* LineVirtualIterator

Proposal of LineVirtualIterator, an alternative to "LineIterator not attached to any mat".
This is basically the same implementation, replacing the address difference by a single "offset" variable. elemsize becomes irrelevant and considered to be 1. "step" is thus equal to size.width since no stride is expected.

* Update drawing.cpp

fixed warning

* improvement of LineVirtualIterator

instead of being too conservative, the new implementation gets rid of "offset/step" and only keeps a "Point currentPos" up to date.

left_to_right is renamed to forceLeftToRight as suggested (even for the old LineIterator)

assert() replaced by CV_Assert() (even for the old LineIterator)

* fixed implementation

+fixed last commit so that LineVirtualIterator gives at least the same results as LineIterator

+added a new constructor that does not require any Size, so that no clipping is done and iteration occurs from pt1 to pt2. This is done by adding a spatial offset to pt1 and pt2 so that the same implementation is used, the size being in that case the spatial size between pt1 and pt2

* Update imgproc.hpp

fixed warnings

* Update drawing.cpp

fixed whitespace

* Update drawing.cpp

trailing whitespace

* Update imgproc.hpp

+added a new constructor that takes a Rect rather than a Size. It computes the line pt1->pt2 that clips that rect.
Yet again, this is still based on the same implementation, thanks to the Size and the currentPosOffset that can artifically consider the origin of the rect at (0,0)

* revert changes

revert changes on  original LineIterator implementation, that will be superseded by the new LineVirtualIterator anyway

* added test of LineVirtualIterator

* More tests

* refactoring

Use C++11 chained constructors
Improved code style

* improve test

Added offset as random test data.

* fixed order of initialization

* merged LineIterator and VirtualLineIterator

* merged LineIterator & VirtualLineIterator

* merged LineIterator & VirtualLineIterator

* merged LineIterator & VirtualLineIterator

* made LineIterator::operator ++() more efficient

added one perfectly predictable check; in theory, since ptmode is set in the end of the constructor in the header file, the compiler can figure out that it's always true/false and eliminate the check from the inline `LineIterator::operator++()` completely

* optimized Line() function

in the most common case (CV_8UC3) eliminated the check from the loop

Co-authored-by: Vadim Pisarevsky <vadim.pisarevsky@gmail.com>
2020-04-13 06:59:31 +00:00
Alexander Alekhin f0ffc52435 fix files permissions 2020-04-13 04:29:55 +00:00
Alexander Alekhin f7d029cfce Merge pull request #17039 from tomoaki0705:fixCudaImgprocFailure 2020-04-12 17:15:49 +00:00
Tomoaki Teshima 1eb63cfc42 fix test failure on Jetson TX1/TX2/Nano 2020-04-12 23:58:53 +09:00
Alexander Alekhin 43ff8f8e8d Merge pull request #17006 from tpoisonooo:patch-1 2020-04-11 17:24:36 +00:00
tpoisonooo b11a3a0820 Update grfmt_pxm.cpp
remove comment in .ppm
2020-04-11 17:41:51 +03:00
AshihsKrShrivastava bef6b6282c ReflecitonPad2d and ZeroPad2d Subgraph fusion added 2020-04-11 07:14:05 +05:30
Alexander Alekhin 9c58a7cb1e Merge pull request #16653 from alalek:core_inputarray_matexpr 2020-04-10 16:57:17 +00:00
Alexander Alekhin 69ac19d82d Merge pull request #17023 from poelmanc:patch-1 2020-04-10 16:32:15 +00:00
Conrad Poelman b77fe9d624 Remove std::binary_function as it's invalid C++
std::binary_function was deprecated with C++11 and removed in C++17. It provided just two typedefs which in this case were unused.
2020-04-10 16:16:52 +03:00
Alexander Alekhin 0556450801 Merge pull request #17000 from rgarnov:async_islands 2020-04-10 12:23:53 +00:00
Xiping Yan 5c7c80dd27 Merge pull request #17028 from xipingyan:patch-1
* Update OpenCVFindVA_INTEL.cmake

When set env VA_INTEL_IOCL_ROOT, "if($ENV{VA_INTEL_IOCL_ROOT})" don't work.
    My modification as follow.
    
    -    if($ENV{VA_INTEL_IOCL_ROOT})
    +    if(DEFINED ENV{VA_INTEL_IOCL_ROOT})
    
    Refer: https://cmake.org/cmake/help/latest/variable/ENV.html

* based on merge comment, update code
2020-04-10 12:23:13 +00:00
Alexander Alekhin d7abb641ca core(test): add InputArray(MatExpr) fetch test 2020-04-10 11:35:42 +00:00
Tomoaki Teshima 4e75f31c55 fix test failure on Jetson Nano/TX1/TX2 2020-04-10 06:15:16 +09:00
Alexander Alekhin 1537a5f253 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-09 19:19:20 +00:00
Ruslan Garnov ce772b346c Fixed standalone build, added cv::gapi::proto::ptr test 2020-04-09 17:19:11 +03:00
Alexander Alekhin e1f14fcac7 Merge pull request #16975 from shimat:Branch_4.3.0 2020-04-09 08:28:20 +00:00
shimat 39d3bbb601 fix error at #include <window_winrt_bridge.hpp> 2020-04-09 09:54:13 +09:00
Dmitry Matveev b1f42a6506 Implement asynchronous execution for islands 2020-04-08 20:48:23 +03:00
Dmitry Matveev cb5921b375 Introduced a newStreamSignal() callback for Island Executables 2020-04-08 20:48:23 +03:00
Alexander Alekhin 016f9ab16e Merge pull request #16788 from OrestChura:oc/optFlowPyrLK
G-API: gapi::calcOpticalFlowPyrLK() Implementation
2020-04-08 20:23:20 +03:00
Alexander Alekhin 499e20da4f Merge pull request #17018 from anton-potapov:ap/fix_control_may_reach_end_of_non_void_function_warning 2020-04-08 16:46:34 +00:00
OrestChura d50c21e571 gapi: Full calcOpticalFlowPyrLK implementation (2 overloads) and tests
- opencv_gapi module is linked with opencv_video module (optional dependency)
     - kernels added to a new cv::gapi::video namespace and a brand new files created to provide gapi_video environment
     - there are 2 different kernels as G-API should provide GMat AND GArray<GMat> implementation: cv::calcOptFlowPyrLK doesn't calculate pyramids if vector<Mat> is given so just the cast GMat -> GArray<GMat> wouldn't represent all the cv:: functionality
     - tests to check both kernels (based on cv::video tests for cv::calcOpticalFlowPyrLK())
     - tests for internal purposes added
     - vectors<T> comparison in tests implemented
     - new (and old too) common test structures refactored to avoid code copypasting
     - "modules/gapi/test/common/gapi_video_tests_common.hpp" created to share some code snippets between perf and acc tests and avoid code copypasting
2020-04-08 18:11:55 +03:00
Alexander Alekhin 4d35a46c48 Merge pull request #17010 from alalek:issue_16896 2020-04-08 14:50:00 +00:00
Anton Potapov 676d1dfd5b GAPI: Fix [-Wreturn-type] warning on standalone mac build
- added [[noreturn]] to standalone version of  GAPI_Assert
2020-04-08 17:13:33 +03:00
Alexander Alekhin 2c9d149ac2 Merge pull request #16993 from asmorkalov:as/faq_wiki 2020-04-08 13:56:57 +00:00
Alexander Alekhin 06bf845783 Merge pull request #16979 from dkurt:dnn_fused_resize_conv 2020-04-08 13:29:51 +00:00
Alexander Alekhin acede976e4 Merge pull request #17009 from mshabunin:msmf-plugin 2020-04-08 13:28:26 +00:00
Maksim Shabunin 90e7c29c46 videoio: set plugin output dir on windows to bin 2020-04-08 15:22:50 +03:00
Maksim Shabunin ca6a11e4d2 videoio: added plug-in support to MSMF backend 2020-04-08 15:22:50 +03:00
Alexander Smorkalov f496a37340 Migrated FAQ page to Github Wiki 2020-04-08 13:55:44 +03:00
Alexander Alekhin b8579f12be Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-08 10:19:09 +00:00
Alexander Alekhin b745e1c43a Merge pull request #17014 from dkurt:dnn_onnx_elu 2020-04-08 10:18:33 +00:00
Dmitry Kurtaev 21ed892489 Fix Elu import from ONNX 2020-04-08 12:09:45 +03:00
Alexander Alekhin 5504d94e36 cmake: update generation of 'uninstall' target
Details: https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
2020-04-07 22:03:12 +00:00
GFleishman 31ec9b2aa7 Merge pull request #16614 from GFleishman:estimateTranslation3D
added estimateTranslation3D to calib3d/ptsetreg

* added estimateTranslation3D; follows API and implementation structure for estimateAffine3D, but only allows for translation

* void variables in null function to suppress compiler warnings

* added test for estimateTranslation3D

* changed to Matx13d datatype for translation vector in ptsetreg and test; used short license in test

* removed iostream include

* calib3d: code cleanup
2020-04-07 19:58:25 +00:00
Alexander Alekhin 0c2a43923c Merge pull request #17007 from mshabunin:fix-openjpeg-vs 2020-04-07 19:55:37 +00:00
Alexander Alekhin 63320aba6c Merge pull request #16999 from rgarnov:exports_for_gisland_executable 2020-04-07 19:55:01 +00:00
Orest Chura 2fe9c87433 Merge pull request #16717 from OrestChura:oc/goodFeatures
- cv::gapi::goodFeaturesToTrack() kernel is implemented
- tests (for exact check with cv::goodFeaturesToTrack() and for internal cases) are implemented
- a custom comparison function for vectors and a custom test fixture implemented
  - some posiible issues as wrong/inexact sorting of two compared vectors are
 not taken into account
- initializations of an input Mat using a picture from opencv_extra implemented (function from gapi_streaming_test used)
2020-04-07 15:53:24 +00:00
Alexander Alekhin adf54d41d5 Merge pull request #16905 from dkurt:dnn_tf2_keras 2020-04-07 14:59:42 +00:00
Alexander Alekhin ab4dbff150 Merge pull request #15907 from rgarnov:rg/unique_ptr_for_priv_in_fluid 2020-04-07 14:51:14 +00:00
mehlukas 75bd9f86b2 Merge pull request #16889 from mehlukas:3.4-consolidateImshow
* consolidate tutorials on image read/display/write

* fix unsused variables

* apply requested changes

* apply requested changes

* fix mistake
2020-04-07 14:14:51 +00:00
Liubov Batanina 734771418e Merge pull request #16840 from l-bat:matmul_inputs
* Supported FullyConnected layer with two inputs

* Skipped test

* Fix conditions

* Added OpenCL support

* Supported ReduceMean3D

* Supported Expand layer

* Fix warning

* Added Normalize subgraph

* refactoring

* Used addLayer

* Fix check

* Used addLayer

* Skip failed test

* Added normalize1 subgraph

* Fix comments
2020-04-07 14:12:18 +00:00
Maksim Shabunin 01a85736e6 OpenJPEG: fixed compilation and warnings with VS 2020-04-07 16:03:17 +03:00
Alexander Alekhin 51a8885566 Merge pull request #16984 from CSharperMantle:argparse-patch-1 2020-04-07 12:54:27 +00:00
Alexander Alekhin 7d5a8053d7 Merge pull request #16640 from malfet:add-16-bit-otsu 2020-04-07 11:01:53 +00:00
Alexander Alekhin 60c382d8f1 Merge pull request #17005 from tomoaki0705:fixHoughKernelLocal 2020-04-07 10:05:44 +00:00
Tomoaki Teshima 3371e679ce fix OpenCL spec violation 2020-04-07 14:34:55 +09:00
Nikita Shulga b8cf5d8d5f Enable Otsu thresholding for CV_16UC1 images 2020-04-06 21:19:07 -07:00
Dmitry Matveev 43df944eb4 Added GAPI_EXPORTS to GIslandExecutable since now it needs to be exported 2020-04-06 23:42:52 +03:00
Alexander Alekhin ce5626db45 Merge pull request #16878 from dkurt:fix_16877 2020-04-06 18:14:35 +00:00
Alexander Alekhin 763a1d7392 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-06 15:57:43 +00:00
Alexander Alekhin 1377b9b736 Merge pull request #16970 from l-bat:fix_enet 2020-04-06 15:57:08 +00:00
Alexander Alekhin 5db3092a1f Merge pull request #16952 from anton-potapov:kw_fixes 2020-04-06 15:55:33 +00:00
Ruslan Garnov be1615b1c3 Merge pull request #16964 from rgarnov:rg/opaque_for_streaming_exec
* Added GOpaque support to GStreamingExecutor

* Added inter-island GOpaque support to GExecutor
2020-04-06 15:53:54 +00:00
Alexander Alekhin 936428cb3b core(MatExpr) fetch result before InputArray wrap
- avoid multiple expression evaluations
- avoid issues with reduced support of InputArray::EXPR
2020-04-06 15:28:32 +00:00
Maxim Pashchenkov ca9fd66744 Merge pull request #16886 from mpashchenkov:mp/ocv-gapi-add-disable
G-API: DISABLED_ in tests instead #if 0

* Removed if 0, replaced with DISABLED_

* boner

* Added tests for fluid

* -1 instead 0.0

* Added GMatDesc's tests for own::Mat

* IMGPROC_FLUID CORE_FLUID

* Added use_only, disabled tests without kernels
2020-04-06 15:21:08 +00:00
Alexander Alekhin bdc95d2c66 Merge pull request #16911 from anton-potapov:ap/variant_move_issue 2020-04-06 15:19:32 +00:00
Alexander Alekhin c305455cb2 Merge pull request #16967 from benji1123:patch-1 2020-04-06 15:17:23 +00:00
Adam Fowles 8334932a26 Merge pull request #16992 from afowles:fix-forEach-segfault
* Fixed divide by zero error in forEach

* Dedicated assertion for !empty
2020-04-06 14:49:02 +00:00
Alexander Alekhin a10385543b Merge pull request #16963 from rgarnov:rg/gframe 2020-04-06 14:35:52 +00:00
Alexander Alekhin 99d29c9d39 Merge pull request #16982 from tomoaki0705:houghLinesOCL 2020-04-06 14:35:14 +00:00
Liubov Batanina a448d3a6aa Fix ENet test with OpenVINO 2020.2 2020-04-06 17:29:43 +03:00
Alexander Alekhin e80adc0bc6 Merge pull request #16965 from rgarnov:in_out_island_interface 2020-04-06 14:06:40 +00:00
Ben Li 1a6b4d6ce6 typo fix 2020-04-06 14:56:31 +03:00
Alexander Alekhin a15417fe74 Merge pull request #16980 from albert-github:feature/bug_doxyfile 2020-04-06 11:37:18 +00:00
Dmitry Matveev 1b5730a799 Introduce a new abstraction layer over island input/output data
- Port GExecutor to this new interface
2020-04-06 12:24:19 +03:00
Bao "Mantle" Rong 3dcb775d16 switch to argparse 2020-04-05 11:57:04 +08:00
albert-github 2d387356de Incorrect PREDEFINED setting.
The PREDEFINED setting for  had a space between the define name and the equal sign and this is not allowed, it results in the warning:
```
error: Illegal PREDEFINED format '=', no define name specified
```
according to the documentation explicitly states that no space is allowed:
> The PREDEFINED tag can be used to specify one or more macro names that are defined before the preprocessor is started (similar to the -D option of e.g. gcc). The argument of the tag is a list of macros of the form: name or name=definition (no spaces). If the definition and the "=" are omitted, "=1" is assumed. To prevent a macro definition from being undefined via #undef or recursively expanded use the := operator instead of the = operator.
2020-04-04 16:50:15 +00:00
Tomoaki Teshima 07c3aae315 let the test pass on Mali G52 (ODROID-N2) 2020-04-05 01:39:47 +09:00
Dmitry Kurtaev b36eba7fab Support FusedResizeAndPadConv2D from TensorFlow 2020-04-04 16:02:17 +03:00
Dmitry Kurtaev 8574a757f9 Case sensitive dnn layers types 2020-04-04 15:03:56 +03:00
Alexander Alekhin 01dcfb0825 Merge tag '4.3.0' 2020-04-03 11:50:53 +00:00
Alexander Alekhin 01b2c5a77c release: OpenCV 4.3.0 2020-04-03 11:45:28 +00:00
Alexander Alekhin 3a45a65625 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-03 11:44:22 +00:00
Alexander Alekhin 0812207db7 Merge tag '3.4.10' 2020-04-03 11:24:31 +00:00
Ruslan Garnov c8776e6ebd Added GFrame 2020-04-03 01:21:51 +03:00
Alexander Alekhin cf2a3c8e74 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-04-02 21:52:32 +00:00
Alexander Alekhin 1cc1e6fa56 release: OpenCV 3.4.10 2020-04-02 19:59:58 +00:00
Maxim Pashchenkov 277f0d270f Merge pull request #16745 from Volskig:mp/ocv-gapi-standalone-size
G-API: Unification of own:: structures with cv:: (Size, Point, Rect)

* deowned Size Rect Point

* Deownded Size Rect Point

* With Scalar
2020-04-02 18:19:45 +00:00
Alexander Alekhin 6216bf9221 Merge pull request #16959 from alalek:winpack_dldt_update 2020-04-02 18:13:58 +00:00
Alexander Alekhin 388a7ce86e Merge pull request #16956 from alalek:ocl_control_buffer_mapping 2020-04-02 17:56:50 +00:00
Alexander Alekhin 5d95a500ad winpack_dldt: readme update 2020-04-02 16:52:46 +00:00
Alexander Alekhin 95341c2b1b Merge pull request #16953 from mshabunin:fix-msmf-writer-fps 2020-04-02 13:06:34 +00:00
Alexander Alekhin 54063c40de core(ocl): options to control buffer access flags
- control using of clEnqueueMapBuffer or clEnqueueReadBuffer[Rect]
- added benchmarks with OpenCL buffer access use cases
2020-04-02 11:11:06 +00:00
Maksim Shabunin 585593e9fc videoio: fixed MSMF writer fps handling 2020-04-02 12:52:38 +03:00
Alexander Alekhin f15e885baf Merge pull request #16950 from alalek:fix_16945 2020-04-02 09:26:09 +00:00
Alexander Alekhin 9109cb1ec6 Merge pull request #16948 from alalek:warning_16739 2020-04-02 09:25:47 +00:00
Anton Potapov 3ffed0bf6e GAPI - KW fixes
- remove unreachable code in GIsland::producer()
2020-04-02 12:05:34 +03:00
Alexander Alekhin dc9ee53ff5 stitching: fix range check in DpSeamFinder::computeCosts 2020-04-02 03:51:17 +00:00
Alexander Alekhin 1485968fc4 Merge pull request #16947 from mshabunin:fix-msmf-convert-format 2020-04-01 18:50:12 +00:00
Maxim Pashchenkov 557ac3dbaf Merge pull request #16805 from Volskig:mp/ocv-gapi-standalone-scalar
G-API: Unification of own:: Scalar with cv:: Scalar

* cvdefs.hpp

* Small changes

* Deowned Scalar. Does't work

* Something

* Removed to_ocv for Scalar

* Clear code

* Deleted whitespaces

* Added include<..own/scalar.hpp in cvdefs.hpp.

* Long string split on two now

* Comment about scalar

* Comment about crutch

* Removed second varible in scalar_wrapper

* Changed wrapper for scalar, alignment

* Alignment

* Whitespaces

* Removed scalar_wrapper
2020-04-01 18:40:38 +00:00
Alexander Alekhin 09134ac881 core: emit warning ONCE on ambiguous MatExpr processing 2020-04-01 18:34:20 +00:00
Maksim Shabunin 433c5199fd videoio: fixed conversion in MSMF backend 2020-04-01 14:40:11 +03:00
Alexander Alekhin d448a636f8 Merge pull request #16943 from alalek:winpack_samples_update_master 2020-04-01 01:46:26 +03:00
Alexander Alekhin 396f43d674 Merge pull request #16938 from alalek:winpack_samples_update 2020-04-01 01:46:13 +03:00
Alexander Alekhin 3c5fec6746 build: updates for winpack dldt 2020-03-31 22:18:21 +00:00
Alexander Alekhin e12b1c2209 build: updates for winpack dldt 2020-03-31 20:29:11 +00:00
Alexander Alekhin f6b2b49e4a Merge pull request #16932 from alalek:imgproc_resize_nn_cleanup 2020-03-30 15:38:40 +00:00
Alexander Alekhin e1322cf503 Merge pull request #16928 from alalek:fix_15075 2020-03-30 13:07:35 +00:00
Alexander Alekhin 67dfdee33f Merge pull request #16922 from alalek:imgcodecs_test_io_grayscale 2020-03-29 16:36:06 +00:00
Alexander Alekhin 61c4cfd896 imgproc(resize): drop unused 'pix_size4' 2020-03-29 02:41:50 +00:00
Alexander Alekhin be17f532e1 imgproc(resize): fix resizeNNInvoker handling of generic pixel size 2020-03-29 02:41:41 +00:00
Alexander Alekhin 6d85fa3fd2 imgcodecs(test): rework common I/O test, added grayscale mode 2020-03-27 21:34:51 +00:00
Alexander Alekhin 95a07ca11c Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-03-27 16:49:59 +00:00
Alexander Alekhin 222a48577f Merge pull request #16919 from alalek:backport_16860 2020-03-27 16:44:05 +00:00
Alexander Alekhin 353273579b Merge pull request #16918 from alalek:build_warnings_3.4 2020-03-27 16:43:23 +00:00
Alexander Alekhin 72c5ac37de Merge pull request #16915 from alalek:build_warnings 2020-03-27 16:42:53 +00:00
Alexander Alekhin 1eba7f60c2 Merge pull request #16913 from alalek:gapi_simd_initialization 2020-03-27 16:42:14 +00:00
Alexander Alekhin 7373ef0983 Merge pull request #16847 from alalek:build_opencv_winpack_dldt 2020-03-27 16:06:19 +00:00
Moritz Fischer-Gundlach 2740901378 -calib3d updates documentation
backporting commit 99436bb8cf
2020-03-27 16:02:29 +00:00
Alexander Alekhin 0c00d082cf Merge pull request #16860 from FischerGundlach:rework_docu 2020-03-27 16:00:48 +00:00
Alexander Alekhin e661ad2a67 eliminate build warnings 2020-03-27 11:39:07 +00:00
Alexander Alekhin 3a4b79173b Merge pull request #16916 from cyyever:fix_freebsd_build 2020-03-27 11:38:57 +00:00
Anton Potapov faceb05775 G-API utils - make variant converting constructor and assignment
operator properly forward it's argument
2020-03-27 14:30:16 +03:00
cyy bdc29cccb6 fix freebsd build 2020-03-27 18:12:10 +08:00
StefanBruens 8d78400052 Merge pull request #16494 from StefanBruens:jpeg2000_openjpeg_port
Jpeg2000 OpenJPEG port

* OpenJPEG based JPEG2000 decoder implementation

Currently, the following input color spaces and depth conversions are
supported:

- 8 bit -> 8 bit
- 16 bit -> 16 bit (IMREAD_UNCHANGED, IMREAD_ANYDEPTH)

- RGB(a) -> BGR
- RGBA -> BGRA (IMREAD_UNCHANGED)
- Y(a) -> Y(a) (IMREAD_ANYCOLOR, IMREAD_GRAY, IMREAD_UNCHANGED))
- YCC -> Y (IMREAD_GRAY)

* Check for OpenJPEG availability

This enables OpenJPEG based JPEG2000 imread support by default, which
can be disabled by -DWITH_OPENJPEG=OFF. In case OpenJPEG is enabled
and found, any checks for Jasper are skipped.

* Implement precision downscaling for precision > 8 without IMREAD_UNCHANGED

With IMREAD_UNCHANGED, values are kept from the input image, without it
components are downscaled to CV_8U range.

* Enable Jpeg2K tests when OpenJPEG is available

* Add support for some more color conversions

Support IMREAD_GRAY when input color space is RGB or unspecified.
Support YUV input color space for BGR output.

* fix: problems with unmanaged memory

* fix: CMake warning - HAVE_OPENJPEG is undefined

Removed trailing whitespaces

* fix: CMake find_package OpenJPEG add minimal version

* Basic JPEG2K encoder

Images with depth CV_8U and CV_16U are supported, with 1 to 4 channels.

* feature: Improved code for OpenJPEG2000 encoder/decoder

 - Removed code duplication
 - Added error handlers
 - Extracted functions

* feature: Update conversion openjpeg array from/to Mat

* feature: Extend ChannelsIterator to fulfill RandomAccessIterator named requirements

 - Removed channels split in copyFromMatImpl. With ChannelsIterator no allocations are performed.
 - Split whole loop into 2 parts in copyToMat -> where std::copy and std::transforms are called.

* fix: Applied review comments.

 - Changed `nullptr` in CV_LOG* functions to `NULL`
 - Added `falls through` comment in decoder color space `switch`
 - Added warning about unsupported parameters for the encoder

* feature: Added decode from in-memory buffers.

Co-authored-by: Vadim Levin <vadim.levin@xperience.ai>
2020-03-27 07:18:58 +00:00
Alexander Alekhin b4b4d21212 eliminate build warnings 2020-03-26 19:18:09 +00:00
Alexander Alekhin 99502e99cc gapi(simd): initialize accumulator values 2020-03-26 16:48:21 +00:00
Moritz Fischer-Gundlach 99436bb8cf -calib3d updates documentation 2020-03-26 15:22:39 +01:00
Alexander Alekhin 7465125f67 build: add winpack_dldt build scripts 2020-03-25 21:26:41 +00:00
Alexander Alekhin 340df65fb4 Merge pull request #16903 from alalek:fix_16823_3.4 2020-03-25 15:53:08 +00:00
Alexander Alekhin 9a463b74dc Merge pull request #16901 from alalek:cmake_ie_find_extra_libs 2020-03-25 15:52:15 +00:00
Dmitry Kurtaev 7e4b2057f2 Import TF2.0 network from Keras 2020-03-25 15:34:28 +03:00
Anatoliy Talamanov c303aaa94d Merge pull request #16841 from TolyaTalamanov:at/warp-perspective
G-API: Implement WarpPerspective

* Implement WarpPerspective kernel

* Fix comment to review
2020-03-25 11:23:32 +00:00
Alexander Alekhin c920b45fb8 core(persistence): fix resource leaks - force closing files
backporting commit 673eb2b006
2020-03-25 10:49:16 +00:00
Alexander Alekhin 2a9a2fff66 cmake: fix find process for InferenceEngine extra libraries 2020-03-25 02:43:42 +00:00
Ruslan Garnov 65ccafd494 Changed shared_ptr to unique_ptr for Priv storage in fluid::View 2020-01-21 18:03:03 +03:00
Ruslan Garnov 6c93e42d94 Changed sharev_ptr for Priv to unique_ptr for fluid::Buffer 2020-01-21 13:48:46 +03:00
ab-dragon 2947877871 [move sift.cpp] Merge pull request opencv/opencv_contrib#2301 from ab-dragon:conditionally_compute_dog_pyramid
Build DoG Pyramid if useProvideKeypoints is false

The buildDoGPyramid operation need not be performed unconditionally. In cases where it is not needed, both memory and speed performance can be improved

original commit: https://github.com/opencv/opencv_contrib/commit/e45887e1c097db6e5f75dc70d7723203bcafa5f1
2019-11-01 21:28:18 +03:00
Alexander Alekhin fadb90c579 [move sift.cpp] xfeatures2d: use updated TLS API
original commit: https://github.com/opencv/opencv_contrib/commit/3e4fb8f415ba68c56ba2cded1ab10a75c46d342e
2019-10-20 14:17:05 +00:00
Alexander Alekhin fd46684bf8 [move sift.cpp] opencv: use cv::AutoBuffer<>::data()
original commit: https://github.com/opencv/opencv_contrib/commit/fc69aa57bc021422d825a4331f7ddf7d9f7534e7
2018-06-13 19:11:18 +00:00
Alexander Alekhin 9badb0d903 [move sift.cpp] xfeatures2d: apply CV_OVERRIDE/CV_FINAL
original commit: https://github.com/opencv/opencv_contrib/commit/ec65e5b29c1c4928aee3d56a44bb399d4af6b61a
2018-03-28 16:50:00 +03:00
Vitaly Tuzov c5f06814bc [move sift.cpp] Updated internal calls to linear resize to use bit-exact version
original commit: https://github.com/opencv/opencv_contrib/commit/8c394a4f2e02994f21c3cf88706ad62d65b53431
2017-12-14 13:00:09 +03:00
woody.chow 69d43e2997 [move sift.cpp] Remove unnecessary _mm256_round_ps
original commit: https://github.com/opencv/opencv_contrib/commit/b5340f6428b6d48445947b16ef2df04552451330
2017-09-26 10:12:30 +09:00
Woody Chow 0f0dea79fc [move sift.cpp] Use TLS instead of mutex in SIFT
original commit: https://github.com/opencv/opencv_contrib/commit/ab43a3b2d99c490be8635987923e7571fd95a0c9
2017-05-31 15:08:32 +09:00
Woody Chow b6d636214e [move sift.cpp] Multithreading findScaleSpaceExtremaComputer. Sort the keypoints afterwards to make the output stable
original commit: https://github.com/opencv/opencv_contrib/commit/6be2945abb0dcff2e038b5f23c7c7716da69ede9
2017-05-31 10:02:09 +09:00
Woody Chow 4b64955a12 [move sift.cpp] Parallelize calcDescriptors and buildDoGPyramid. Simplify 2 lines of AVX2 instructions
original commit: https://github.com/opencv/opencv_contrib/commit/443f68cb71128d5ae27e8771a91f7641f9450685
2017-03-24 16:31:18 +09:00
Woody Chow 546239a3a8 [move sift.cpp] Optimize SIFT with AVX2
original commit: https://github.com/opencv/opencv_contrib/commit/c5e55dfde96307fef12fc55f63d6a600fd784582
2017-03-08 10:08:50 +09:00
Suleyman TURKMEN 8be0a3452d [move sift.cpp] Update sift.cpp
original commit: https://github.com/opencv/opencv_contrib/commit/cb7b59f203bf06586d6176ac812e0ee382cedcf1
2016-12-23 13:21:30 +03:00
Martin Nowak 99d914ea3b [move sift.cpp] fix overflow issue when computing diagonal
- with big images the int multiplication can overflow

original commit: https://github.com/opencv/opencv_contrib/commit/d4df727d380887fdd880fdb5430cf4680a4ad19b
2016-06-11 17:51:46 +02:00
Maksim Shabunin 24284d3d17 [move sift.cpp] Fixed HAL headers location
original commit: https://github.com/opencv/opencv_contrib/commit/f529a1df2b17bcada1179ddcaf1352e3a5ba97b8
2015-12-15 18:41:26 +03:00
Vadim Pisarevsky 9fc872b70b [move sift.cpp] fixed contrib code to match the HAL
original commit: https://github.com/opencv/opencv_contrib/commit/cdddcc8237627f667d66daffb3fcb3af39a3e673
2015-04-16 22:52:05 +03:00
Vadim Pisarevsky e3654d5416 [move sift.cpp] refactored xfeatures2d in the same style as features2d
original commit: https://github.com/opencv/opencv_contrib/commit/0cfd795303c414aada6d10701e0de4995841210c
2014-10-16 16:33:21 +04:00
Alexander Alekhin d92bee821d Merge upstream branch 2020-04-21 06:20:05 +00:00
Alexander Alekhin df10411e05 features2d(sift): patent expiration note 2020-04-21 06:19:16 +00:00
Alexander Alekhin 44e9fb306d features2d(sift): code from nonfree module 2020-04-21 04:14:18 +00:00
790 changed files with 41125 additions and 3852 deletions
+1
View File
@@ -24,3 +24,4 @@ bin/
build
node_modules
CMakeSettings.json
xcuserdata/
+5 -5
View File
@@ -1,8 +1,8 @@
# Binaries branch name: ffmpeg/master_20200311
# Binaries were created for OpenCV: 850414a501d5e6dba111c92d73fdd05794c7061d
ocv_update(FFMPEG_BINARIES_COMMIT "3d2e97081683265950316c65a52c2e8858ffba1b")
ocv_update(FFMPEG_FILE_HASH_BIN32 "3b094c37d270a30f0b20a0bc8d3ecafb")
ocv_update(FFMPEG_FILE_HASH_BIN64 "388ee23a7ca44eef2344e265fafd5940")
# Binaries branch name: ffmpeg/master_20200609
# Binaries were created for OpenCV: 5f3012fc9afbffbf53a38f1468523d3454b3e2f6
ocv_update(FFMPEG_BINARIES_COMMIT "1df9bf0c0c6c2cf225bd3d8e4cf5985198352454")
ocv_update(FFMPEG_FILE_HASH_BIN32 "854b3460c435d04277e1f1ecc06cb809")
ocv_update(FFMPEG_FILE_HASH_BIN64 "3a46d6356220796e044817ae3a21cc31")
ocv_update(FFMPEG_FILE_HASH_CMAKE "ad57c038ba34b868277ccbe6dd0f9602")
function(download_win_ffmpeg script_var)
Vendored Executable → Regular
View File
+1 -1
View File
@@ -63,7 +63,7 @@ Attribute::~Attribute () {}
namespace {
struct NameCompare: std::binary_function <const char *, const char *, bool>
struct NameCompare
{
bool
operator () (const char *x, const char *y) const
Vendored Executable → Regular
View File
View File
View File
View File
+54 -18
View File
@@ -225,7 +225,9 @@ class TextFormat::Parser::ParserImpl {
bool allow_unknown_enum,
bool allow_field_number,
bool allow_relaxed_whitespace,
bool allow_partial)
bool allow_partial,
int recursion_limit // backported from 3.8.0
)
: error_collector_(error_collector),
finder_(finder),
parse_info_tree_(parse_info_tree),
@@ -238,7 +240,9 @@ class TextFormat::Parser::ParserImpl {
allow_unknown_enum_(allow_unknown_enum),
allow_field_number_(allow_field_number),
allow_partial_(allow_partial),
had_errors_(false) {
had_errors_(false),
recursion_limit_(recursion_limit) // backported from 3.8.0
{
// For backwards-compatibility with proto1, we need to allow the 'f' suffix
// for floats.
tokenizer_.set_allow_f_after_float(true);
@@ -490,9 +494,9 @@ class TextFormat::Parser::ParserImpl {
if (TryConsume(":") && !LookingAt("{") && !LookingAt("<")) {
UnknownFieldSet* unknown_field = unknown_fields->AddGroup(unknown_fields->field_count());
unknown_field->AddLengthDelimited(0, field_name); // Add a field's name.
return SkipFieldValue(unknown_field);
return SkipFieldValue(unknown_field, recursion_limit_);
} else {
return SkipFieldMessage(unknown_fields);
return SkipFieldMessage(unknown_fields, recursion_limit_);
}
}
@@ -575,7 +579,14 @@ label_skip_parsing:
}
// Skips the next field including the field's name and value.
bool SkipField(UnknownFieldSet* unknown_fields) {
bool SkipField(UnknownFieldSet* unknown_fields, int recursion_limit) {
// OpenCV specific
if (--recursion_limit < 0) {
ReportError("Message is too deep (SkipField)");
return false;
}
string field_name;
if (TryConsume("[")) {
// Extension name.
@@ -594,9 +605,9 @@ label_skip_parsing:
if (TryConsume(":") && !LookingAt("{") && !LookingAt("<")) {
UnknownFieldSet* unknown_field = unknown_fields->AddGroup(unknown_fields->field_count());
unknown_field->AddLengthDelimited(0, field_name); // Add a field's name.
DO(SkipFieldValue(unknown_field));
DO(SkipFieldValue(unknown_field, recursion_limit));
} else {
DO(SkipFieldMessage(unknown_fields));
DO(SkipFieldMessage(unknown_fields, recursion_limit));
}
// For historical reasons, fields may optionally be separated by commas or
// semicolons.
@@ -608,6 +619,12 @@ label_skip_parsing:
const Reflection* reflection,
const FieldDescriptor* field) {
// backported from 3.8.0
if (--recursion_limit_ < 0) {
ReportError("Message is too deep");
return false;
}
// If the parse information tree is not NULL, create a nested one
// for the nested message.
ParseInfoTree* parent = parse_info_tree_;
@@ -624,6 +641,9 @@ label_skip_parsing:
delimiter));
}
// backported from 3.8.0
++recursion_limit_;
// Reset the parse information tree.
parse_info_tree_ = parent;
return true;
@@ -631,11 +651,17 @@ label_skip_parsing:
// Skips the whole body of a message including the beginning delimiter and
// the ending delimiter.
bool SkipFieldMessage(UnknownFieldSet* unknown_fields) {
bool SkipFieldMessage(UnknownFieldSet* unknown_fields, int recursion_limit) {
// OpenCV specific
if (--recursion_limit < 0) {
ReportError("Message is too deep (SkipFieldMessage)");
return false;
}
string delimiter;
DO(ConsumeMessageDelimiter(&delimiter));
while (!LookingAt(">") && !LookingAt("}")) {
DO(SkipField(unknown_fields));
DO(SkipField(unknown_fields, recursion_limit));
}
DO(Consume(delimiter));
return true;
@@ -775,7 +801,14 @@ label_skip_parsing:
return true;
}
bool SkipFieldValue(UnknownFieldSet* unknown_field) {
bool SkipFieldValue(UnknownFieldSet* unknown_field, int recursion_limit) {
// OpenCV specific
if (--recursion_limit < 0) {
ReportError("Message is too deep (SkipFieldValue)");
return false;
}
if (LookingAtType(io::Tokenizer::TYPE_STRING)) {
while (LookingAtType(io::Tokenizer::TYPE_STRING)) {
tokenizer_.Next();
@@ -785,9 +818,9 @@ label_skip_parsing:
if (TryConsume("[")) {
while (true) {
if (!LookingAt("{") && !LookingAt("<")) {
DO(SkipFieldValue(unknown_field));
DO(SkipFieldValue(unknown_field, recursion_limit));
} else {
DO(SkipFieldMessage(unknown_field));
DO(SkipFieldMessage(unknown_field, recursion_limit));
}
if (TryConsume("]")) {
break;
@@ -1156,6 +1189,7 @@ label_skip_parsing:
const bool allow_field_number_;
const bool allow_partial_;
bool had_errors_;
int recursion_limit_; // backported from 3.8.0
};
#undef DO
@@ -1306,17 +1340,19 @@ class TextFormat::Printer::TextGenerator
TextFormat::Finder::~Finder() {
}
TextFormat::Parser::Parser(bool allow_unknown_field)
TextFormat::Parser::Parser()
: error_collector_(NULL),
finder_(NULL),
parse_info_tree_(NULL),
allow_partial_(false),
allow_case_insensitive_field_(false),
allow_unknown_field_(allow_unknown_field),
allow_unknown_field_(false),
allow_unknown_enum_(false),
allow_field_number_(false),
allow_relaxed_whitespace_(false),
allow_singular_overwrites_(false) {
allow_singular_overwrites_(false),
recursion_limit_(std::numeric_limits<int>::max())
{
}
TextFormat::Parser::~Parser() {}
@@ -1335,7 +1371,7 @@ bool TextFormat::Parser::Parse(io::ZeroCopyInputStream* input,
overwrites_policy,
allow_case_insensitive_field_, allow_unknown_field_,
allow_unknown_enum_, allow_field_number_,
allow_relaxed_whitespace_, allow_partial_);
allow_relaxed_whitespace_, allow_partial_, recursion_limit_);
return MergeUsingImpl(input, output, &parser);
}
@@ -1353,7 +1389,7 @@ bool TextFormat::Parser::Merge(io::ZeroCopyInputStream* input,
ParserImpl::ALLOW_SINGULAR_OVERWRITES,
allow_case_insensitive_field_, allow_unknown_field_,
allow_unknown_enum_, allow_field_number_,
allow_relaxed_whitespace_, allow_partial_);
allow_relaxed_whitespace_, allow_partial_, recursion_limit_);
return MergeUsingImpl(input, output, &parser);
}
@@ -1388,7 +1424,7 @@ bool TextFormat::Parser::ParseFieldValueFromString(
ParserImpl::ALLOW_SINGULAR_OVERWRITES,
allow_case_insensitive_field_, allow_unknown_field_,
allow_unknown_enum_, allow_field_number_,
allow_relaxed_whitespace_, allow_partial_);
allow_relaxed_whitespace_, allow_partial_, recursion_limit_);
return parser.ParseField(field, output);
}
+16 -1
View File
@@ -457,7 +457,7 @@ class LIBPROTOBUF_EXPORT TextFormat {
// For more control over parsing, use this class.
class LIBPROTOBUF_EXPORT Parser {
public:
Parser(bool allow_unknown_field = false);
Parser();
~Parser();
// Like TextFormat::Parse().
@@ -508,10 +508,24 @@ class LIBPROTOBUF_EXPORT TextFormat {
Message* output);
// backported from 3.8.0
// When an unknown field is met, parsing will fail if this option is set
// to false(the default). If true, unknown fields will be ignored and
// a warning message will be generated.
// Please aware that set this option true may hide some errors (e.g.
// spelling error on field name). Avoid to use this option if possible.
void AllowUnknownField(bool allow) { allow_unknown_field_ = allow; }
void AllowFieldNumber(bool allow) {
allow_field_number_ = allow;
}
// backported from 3.8.0
// Sets maximum recursion depth which parser can use. This is effectively
// the maximum allowed nesting of proto messages.
void SetRecursionLimit(int limit) { recursion_limit_ = limit; }
private:
// Forward declaration of an internal class used to parse text
// representations (see text_format.cc for implementation).
@@ -533,6 +547,7 @@ class LIBPROTOBUF_EXPORT TextFormat {
bool allow_field_number_;
bool allow_relaxed_whitespace_;
bool allow_singular_overwrites_;
int recursion_limit_; // backported from 3.8.0
};
+2 -1
View File
@@ -32,8 +32,10 @@
#define QUIRC_PERSPECTIVE_PARAMS 8
#if QUIRC_MAX_REGIONS < UINT8_MAX
#define QUIRC_PIXEL_ALIAS_IMAGE 1
typedef uint8_t quirc_pixel_t;
#elif QUIRC_MAX_REGIONS < UINT16_MAX
#define QUIRC_PIXEL_ALIAS_IMAGE 0
typedef uint16_t quirc_pixel_t;
#else
#error "QUIRC_MAX_REGIONS > 65534 is not supported"
@@ -77,7 +79,6 @@ struct quirc_grid {
struct quirc {
uint8_t *image;
quirc_pixel_t *pixels;
int *row_average; /* used by threshold() */
int w;
int h;
+1 -1
View File
@@ -874,7 +874,7 @@ static quirc_decode_error_t decode_payload(struct quirc_data *data,
done:
/* Add nul terminator to all payloads */
if ((unsigned)data->payload_len >= sizeof(data->payload))
if (data->payload_len >= (int) sizeof(data->payload))
data->payload_len--;
data->payload[data->payload_len] = 0;
+10 -19
View File
@@ -27,10 +27,7 @@ struct quirc *quirc_new(void)
{
struct quirc *q = malloc(sizeof(*q));
if (!q)
return NULL;
memset(q, 0, sizeof(*q));
memset(q, 0, sizeof(*q));
return q;
}
@@ -39,9 +36,8 @@ void quirc_destroy(struct quirc *q)
free(q->image);
/* q->pixels may alias q->image when their type representation is of the
same size, so we need to be careful here to avoid a double free */
if (sizeof(*q->image) != sizeof(*q->pixels))
if (!QUIRC_PIXEL_ALIAS_IMAGE)
free(q->pixels);
free(q->row_average);
free(q);
}
@@ -49,7 +45,6 @@ int quirc_resize(struct quirc *q, int w, int h)
{
uint8_t *image = NULL;
quirc_pixel_t *pixels = NULL;
int *row_average = NULL;
/*
* XXX: w and h should be size_t (or at least unsigned) as negatives
@@ -82,35 +77,27 @@ int quirc_resize(struct quirc *q, int w, int h)
(void)memcpy(image, q->image, min);
/* alloc a new buffer for q->pixels if needed */
if (sizeof(*q->image) != sizeof(*q->pixels)) {
if (!QUIRC_PIXEL_ALIAS_IMAGE) {
pixels = calloc(newdim, sizeof(quirc_pixel_t));
if (!pixels)
goto fail;
}
/* alloc a new buffer for q->row_average */
row_average = calloc(w, sizeof(int));
if (!row_average)
goto fail;
/* alloc succeeded, update `q` with the new size and buffers */
q->w = w;
q->h = h;
free(q->image);
q->image = image;
if (sizeof(*q->image) != sizeof(*q->pixels)) {
if (!QUIRC_PIXEL_ALIAS_IMAGE) {
free(q->pixels);
q->pixels = pixels;
}
free(q->row_average);
q->row_average = row_average;
return 0;
/* NOTREACHED */
fail:
free(image);
free(pixels);
free(row_average);
return -1;
}
@@ -133,6 +120,10 @@ static const char *const error_table[] = {
const char *quirc_strerror(quirc_decode_error_t err)
{
if ((int)err < 8) { return error_table[err]; }
else { return "Unknown error"; }
if ((int) err >= 0) {
if ((unsigned long) err < (unsigned long) (sizeof(error_table) / sizeof(error_table[0])))
return error_table[err];
}
return "Unknown error";
}
+1 -10
View File
@@ -17,16 +17,7 @@
#include <quirc_internal.h>
const struct quirc_version_info quirc_version_db[QUIRC_MAX_VERSION + 1] = {
{ /* 0 */
.data_bytes = 0,
.apat = {0},
.ecc = {
{.bs = 0, .dw = 0, .ns = 0},
{.bs = 0, .dw = 0, .ns = 0},
{.bs = 0, .dw = 0, .ns = 0},
{.bs = 0, .dw = 0, .ns = 0}
}
},
{0},
{ /* Version 1 */
.data_bytes = 26,
.apat = {0},
+2 -2
View File
@@ -5,8 +5,8 @@ if (WIN32 AND NOT ARM)
message(FATAL_ERROR "BUILD_TBB option supports Windows on ARM only!\nUse regular official TBB build instead of the BUILD_TBB option!")
endif()
ocv_update(OPENCV_TBB_RELEASE "v2020.1")
ocv_update(OPENCV_TBB_RELEASE_MD5 "734f335d06ee80a7d4a20cc0da734c59")
ocv_update(OPENCV_TBB_RELEASE "v2020.2")
ocv_update(OPENCV_TBB_RELEASE_MD5 "5af6f6c2a24c2043e62e47205e273b1f")
ocv_update(OPENCV_TBB_FILENAME "${OPENCV_TBB_RELEASE}.tar.gz")
string(REGEX REPLACE "^v" "" OPENCV_TBB_RELEASE_ "${OPENCV_TBB_RELEASE}")
#ocv_update(OPENCV_TBB_SUBDIR ...)
+19 -5
View File
@@ -285,9 +285,12 @@ OCV_OPTION(WITH_INF_ENGINE "Include Intel Inference Engine support" OFF
OCV_OPTION(WITH_NGRAPH "Include nGraph support" WITH_INF_ENGINE
VISIBLE_IF TRUE
VERIFY TARGET ngraph::ngraph)
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON
OCV_OPTION(WITH_JASPER "Include JPEG2K support (Jasper)" ON
VISIBLE_IF NOT IOS
VERIFY HAVE_JASPER)
OCV_OPTION(WITH_OPENJPEG "Include JPEG2K support (OpenJPEG)" ON
VISIBLE_IF NOT IOS
VERIFY HAVE_OPENJPEG)
OCV_OPTION(WITH_JPEG "Include JPEG support" ON
VISIBLE_IF TRUE
VERIFY HAVE_JPEG)
@@ -449,6 +452,7 @@ OCV_OPTION(BUILD_FAT_JAVA_LIB "Create Java wrapper exporting all functions
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID )
OCV_OPTION(BUILD_CUDA_STUBS "Build CUDA modules stubs when no CUDA SDK" OFF IF (NOT APPLE_FRAMEWORK) )
OCV_OPTION(BUILD_JAVA "Enable Java support" (ANDROID OR NOT CMAKE_CROSSCOMPILING) IF (ANDROID OR (NOT APPLE_FRAMEWORK AND NOT WINRT)) )
OCV_OPTION(BUILD_OBJC "Enable Objective-C support" ON IF APPLE_FRAMEWORK )
# OpenCV installation options
# ===================================================
@@ -943,11 +947,11 @@ endif()
# for UNIX it does not make sense as LICENSE and readme will be part of the package automatically
if(ANDROID OR NOT UNIX)
install(FILES ${OPENCV_LICENSE_FILE}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DESTINATION ./ COMPONENT libs)
if(OPENCV_README_FILE)
install(FILES ${OPENCV_README_FILE}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DESTINATION ./ COMPONENT libs)
endif()
endif()
@@ -1249,8 +1253,12 @@ if(WITH_TIFF OR HAVE_TIFF)
status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY} (ver ${TIFF_VERSION} / ${TIFF_VERSION_STRING})" ELSE "build (ver ${TIFF_VERSION} - ${TIFF_VERSION_STRING})")
endif()
if(WITH_JASPER OR HAVE_JASPER)
status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY} (ver ${JASPER_VERSION_STRING})" ELSE "build (ver ${JASPER_VERSION_STRING})")
if(HAVE_OPENJPEG)
status(" JPEG 2000:" "OpenJPEG (ver ${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION})")
elseif(HAVE_JASPER)
status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY} (ver ${JASPER_VERSION_STRING})" ELSE "build Jasper (ver ${JASPER_VERSION_STRING})")
elseif(WITH_OPENJPEG OR WITH_JASPER)
status(" JPEG 2000:" "NO")
endif()
if(WITH_OPENEXR OR HAVE_OPENEXR)
@@ -1588,6 +1596,12 @@ if(BUILD_JAVA)
status(" Java tests:" BUILD_TESTS AND opencv_test_java_BINARY_DIR THEN YES ELSE NO)
endif()
# ========================== Objective-C =======================
if(BUILD_OBJC)
status("")
status(" Objective-C wrappers:" HAVE_opencv_objc THEN YES ELSE NO)
endif()
ocv_cmake_hook(STATUS_DUMP_EXTRA)
# ========================== auxiliary ==========================
+2
View File
@@ -3,10 +3,12 @@
### Resources
* Homepage: <https://opencv.org>
* Courses: <https://opencv.org/courses>
* Docs: <https://docs.opencv.org/master/>
* Q&A forum: <http://answers.opencv.org>
* Issue tracking: <https://github.com/opencv/opencv/issues>
### Contributing
Please read the [contribution guidelines](https://github.com/opencv/opencv/wiki/How_to_contribute) before starting work on a pull request.
+62 -31
View File
@@ -63,6 +63,12 @@ if(CUDA_FOUND)
message(STATUS "CUDA detected: " ${CUDA_VERSION})
set(_generations "Fermi" "Kepler" "Maxwell" "Pascal" "Volta" "Turing")
set(_arch_fermi "2.0")
set(_arch_kepler "3.0;3.5;3.7")
set(_arch_maxwell "5.0;5.2")
set(_arch_pascal "6.0;6.1")
set(_arch_volta "7.0")
set(_arch_turing "7.5")
if(NOT CMAKE_CROSSCOMPILING)
list(APPEND _generations "Auto")
endif()
@@ -86,30 +92,58 @@ if(CUDA_FOUND)
SET(DETECT_ARCHS_COMMAND ${DETECT_ARCHS_COMMAND} "-ccbin" "${host_compiler_bindir}")
endif()
set(__cuda_arch_ptx "")
if(CUDA_GENERATION STREQUAL "Fermi")
set(__cuda_arch_bin "2.0")
elseif(CUDA_GENERATION STREQUAL "Kepler")
set(__cuda_arch_bin "3.0 3.5 3.7")
elseif(CUDA_GENERATION STREQUAL "Maxwell")
set(__cuda_arch_bin "5.0 5.2")
elseif(CUDA_GENERATION STREQUAL "Pascal")
set(__cuda_arch_bin "6.0 6.1")
elseif(CUDA_GENERATION STREQUAL "Volta")
set(__cuda_arch_bin "7.0")
elseif(CUDA_GENERATION STREQUAL "Turing")
set(__cuda_arch_bin "7.5")
elseif(CUDA_GENERATION STREQUAL "Auto")
macro(ocv_filter_available_architecture result_list)
if(DEFINED CUDA_SUPPORTED_CC)
set(${result_list} "${CUDA_SUPPORTED_CC}")
else()
set(CC_LIST ${ARGN})
foreach(target_arch ${CC_LIST})
string(REPLACE "." "" target_arch_short ${target_arch})
set(NVCC_OPTION "-gencode;arch=compute_${target_arch_short},code=sm_${target_arch_short}")
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" ${NVCC_OPTION} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(_nvcc_res EQUAL 0)
set(${result_list} "${${result_list}} ${target_arch}")
endif()
endforeach()
string(STRIP ${${result_list}} ${result_list})
set(CUDA_SUPPORTED_CC ${${result_list}} CACHE INTERNAL "List of supported compute capability")
endif()
endmacro()
macro(ocv_detect_native_cuda_arch status output)
execute_process( COMMAND ${DETECT_ARCHS_COMMAND}
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
RESULT_VARIABLE ${status} OUTPUT_VARIABLE _nvcc_out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE ".*\n" "" _nvcc_out "${_nvcc_out}") #Strip leading warning messages, if any
string(REGEX REPLACE ".*\n" "" ${output} "${_nvcc_out}") #Strip leading warning messages, if any
endmacro()
macro(ocv_wipeout_deprecated _arch_bin_list)
string(REPLACE "2.1" "2.1(2.0)" ${_arch_bin_list} ${${_arch_bin_list}})
endmacro()
set(__cuda_arch_ptx "")
if(CUDA_GENERATION STREQUAL "Fermi")
set(__cuda_arch_bin ${_arch_fermi})
elseif(CUDA_GENERATION STREQUAL "Kepler")
set(__cuda_arch_bin ${_arch_kepler})
elseif(CUDA_GENERATION STREQUAL "Maxwell")
set(__cuda_arch_bin ${_arch_maxwell})
elseif(CUDA_GENERATION STREQUAL "Pascal")
set(__cuda_arch_bin ${_arch_pascal})
elseif(CUDA_GENERATION STREQUAL "Volta")
set(__cuda_arch_bin ${_arch_volta})
elseif(CUDA_GENERATION STREQUAL "Turing")
set(__cuda_arch_bin ${_arch_turing})
elseif(CUDA_GENERATION STREQUAL "Auto")
ocv_detect_native_cuda_arch(_nvcc_res _nvcc_out)
if(NOT _nvcc_res EQUAL 0)
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
else()
set(__cuda_arch_bin "${_nvcc_out}")
string(REPLACE "2.1" "2.1(2.0)" __cuda_arch_bin "${__cuda_arch_bin}")
string(REGEX MATCHALL "[0-9]+\\.[0-9]" __cuda_arch_bin "${_nvcc_out}")
endif()
endif()
@@ -118,29 +152,26 @@ if(CUDA_FOUND)
set(__cuda_arch_bin "3.2")
set(__cuda_arch_ptx "")
elseif(AARCH64)
execute_process( COMMAND ${DETECT_ARCHS_COMMAND}
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE ".*\n" "" _nvcc_out "${_nvcc_out}") #Strip leading warning messages, if any
ocv_detect_native_cuda_arch(_nvcc_res _nvcc_out)
if(NOT _nvcc_res EQUAL 0)
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
set(__cuda_arch_bin "5.3 6.2 7.2")
else()
set(__cuda_arch_bin "${_nvcc_out}")
string(REPLACE "2.1" "2.1(2.0)" __cuda_arch_bin "${__cuda_arch_bin}")
endif()
set(__cuda_arch_ptx "")
else()
if(CUDA_VERSION VERSION_LESS "9.0")
set(__cuda_arch_bin "2.0 3.0 3.5 3.7 5.0 5.2 6.0 6.1")
elseif(CUDA_VERSION VERSION_LESS "10.0")
set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2 6.0 6.1 7.0")
else()
set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2 6.0 6.1 7.0 7.5")
endif()
ocv_filter_available_architecture(__cuda_arch_bin
${_arch_fermi}
${_arch_kepler}
${_arch_maxwell}
${_arch_pascal}
${_arch_volta}
${_arch_turing}
)
endif()
endif()
ocv_wipeout_deprecated(__cuda_arch_bin)
set(CUDA_ARCH_BIN ${__cuda_arch_bin} CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
set(CUDA_ARCH_PTX ${__cuda_arch_ptx} CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for")
+2
View File
@@ -98,6 +98,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
set(PPC64 1)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips.*|MIPS.*)")
set(MIPS 1)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv.*|RISCV.*)")
set(RISCV 1)
else()
if(NOT OPENCV_SUPPRESS_MESSAGE_UNRECOGNIZED_SYSTEM_PROCESSOR)
message(WARNING "OpenCV: unrecognized target processor configuration")
+49 -12
View File
@@ -17,10 +17,34 @@
# INF_ENGINE_TARGET - set to name of imported library target representing InferenceEngine
#
macro(ocv_ie_find_extra_libraries find_prefix find_suffix)
file(GLOB libraries "${INF_ENGINE_LIB_DIRS}/${find_prefix}inference_engine*${find_suffix}")
foreach(full_path IN LISTS libraries)
get_filename_component(library "${full_path}" NAME_WE)
string(REPLACE "${find_prefix}" "" library "${library}")
if(library STREQUAL "inference_engine" OR library STREQUAL "inference_engined")
# skip
else()
add_library(${library} UNKNOWN IMPORTED)
set_target_properties(${library} PROPERTIES
IMPORTED_LOCATION "${full_path}")
list(APPEND custom_libraries ${library})
endif()
endforeach()
endmacro()
function(add_custom_ie_build _inc _lib _lib_rel _lib_dbg _msg)
if(NOT _inc OR NOT (_lib OR _lib_rel OR _lib_dbg))
return()
endif()
if(NOT _lib)
if(_lib_rel)
set(_lib "${_lib_rel}")
else()
set(_lib "${_lib_dbg}")
endif()
endif()
add_library(inference_engine UNKNOWN IMPORTED)
set_target_properties(inference_engine PROPERTIES
IMPORTED_LOCATION "${_lib}"
@@ -30,24 +54,31 @@ function(add_custom_ie_build _inc _lib _lib_rel _lib_dbg _msg)
)
set(custom_libraries "")
file(GLOB libraries "${INF_ENGINE_LIB_DIRS}/${CMAKE_SHARED_LIBRARY_PREFIX}inference_engine_*${CMAKE_SHARED_LIBRARY_SUFFIX}")
foreach(full_path IN LISTS libraries)
get_filename_component(library "${full_path}" NAME_WE)
string(REPLACE "${CMAKE_SHARED_LIBRARY_PREFIX}" "" library "${library}")
add_library(${library} UNKNOWN IMPORTED)
set_target_properties(${library} PROPERTIES
IMPORTED_LOCATION "${full_path}")
list(APPEND custom_libraries ${library})
set(__prefixes "${CMAKE_FIND_LIBRARY_PREFIXES}")
if(NOT __prefixes)
set(__prefixes "_empty_")
endif()
foreach(find_prefix ${__prefixes})
if(find_prefix STREQUAL "_empty_") # foreach doesn't iterate over empty elements
set(find_prefix "")
endif()
foreach(find_suffix ${CMAKE_FIND_LIBRARY_SUFFIXES})
ocv_ie_find_extra_libraries("${find_prefix}" "${find_suffix}")
endforeach()
if(NOT CMAKE_FIND_LIBRARY_SUFFIXES)
ocv_ie_find_extra_libraries("${find_prefix}" "")
endif()
endforeach()
if(NOT INF_ENGINE_RELEASE VERSION_GREATER "2018050000")
find_library(INF_ENGINE_OMP_LIBRARY iomp5 PATHS "${INF_ENGINE_OMP_DIR}" NO_DEFAULT_PATH)
if(NOT INF_ENGINE_OMP_LIBRARY)
message(WARNING "OpenMP for IE have not been found. Set INF_ENGINE_OMP_DIR variable if you experience build errors.")
else()
set_target_properties(inference_engine PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${INF_ENGINE_OMP_LIBRARY}")
endif()
endif()
if(EXISTS "${INF_ENGINE_OMP_LIBRARY}")
set_target_properties(inference_engine PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${INF_ENGINE_OMP_LIBRARY}")
endif()
set(INF_ENGINE_VERSION "Unknown" CACHE STRING "")
set(INF_ENGINE_TARGET "inference_engine;${custom_libraries}" PARENT_SCOPE)
message(STATUS "Detected InferenceEngine: ${_msg}")
@@ -64,6 +95,9 @@ endif()
if(NOT INF_ENGINE_TARGET AND INF_ENGINE_LIB_DIRS AND INF_ENGINE_INCLUDE_DIRS)
find_path(ie_custom_inc "inference_engine.hpp" PATHS "${INF_ENGINE_INCLUDE_DIRS}" NO_DEFAULT_PATH)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
find_library(ie_custom_lib_dbg "inference_engined" PATHS "${INF_ENGINE_LIB_DIRS}" NO_DEFAULT_PATH) # Win32 and MacOSX
endif()
find_library(ie_custom_lib "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}" NO_DEFAULT_PATH)
find_library(ie_custom_lib_rel "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}/Release" NO_DEFAULT_PATH)
find_library(ie_custom_lib_dbg "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}/Debug" NO_DEFAULT_PATH)
@@ -82,6 +116,9 @@ if(NOT INF_ENGINE_TARGET AND _loc)
endif()
set(INF_ENGINE_PLATFORM "${INF_ENGINE_PLATFORM_DEFAULT}" CACHE STRING "InferenceEngine platform (library dir)")
find_path(ie_custom_env_inc "inference_engine.hpp" PATHS "${_loc}/deployment_tools/inference_engine/include" NO_DEFAULT_PATH)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
find_library(ie_custom_env_lib_dbg "inference_engined" PATHS "${_loc}/deployment_tools/inference_engine/lib/${INF_ENGINE_PLATFORM}/intel64" NO_DEFAULT_PATH)
endif()
find_library(ie_custom_env_lib "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/${INF_ENGINE_PLATFORM}/intel64" NO_DEFAULT_PATH)
find_library(ie_custom_env_lib_rel "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/intel64/Release" NO_DEFAULT_PATH)
find_library(ie_custom_env_lib_dbg "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/intel64/Debug" NO_DEFAULT_PATH)
@@ -92,9 +129,9 @@ endif()
if(INF_ENGINE_TARGET)
if(NOT INF_ENGINE_RELEASE)
message(WARNING "InferenceEngine version has not been set, 2020.1 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
message(WARNING "InferenceEngine version has not been set, 2020.4 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
endif()
set(INF_ENGINE_RELEASE "2020010000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)")
set(INF_ENGINE_RELEASE "2020040000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)")
set_target_properties(${INF_ENGINE_TARGET} PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
)
+24 -6
View File
@@ -1,12 +1,30 @@
# VTK 9.0
if(NOT VTK_FOUND)
find_package(VTK 9 QUIET NAMES vtk COMPONENTS
FiltersExtraction
FiltersSources
FiltersTexture
IOExport
IOGeometry
IOPLY
InteractionStyle
RenderingCore
RenderingLOD
RenderingOpenGL2
NO_MODULE)
endif()
# VTK 6.x components
find_package(VTK QUIET COMPONENTS vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
IF(VTK_FOUND)
IF(VTK_RENDERING_BACKEND) #in vtk 7, the rendering backend is exported as a var.
if(NOT VTK_FOUND)
find_package(VTK QUIET COMPONENTS vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
IF(VTK_FOUND)
IF(VTK_RENDERING_BACKEND) #in vtk 7, the rendering backend is exported as a var.
find_package(VTK QUIET COMPONENTS vtkRendering${VTK_RENDERING_BACKEND} vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport vtkIOGeometry NO_MODULE)
ELSE(VTK_RENDERING_BACKEND)
ELSE(VTK_RENDERING_BACKEND)
find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
ENDIF(VTK_RENDERING_BACKEND)
ENDIF(VTK_FOUND)
ENDIF(VTK_RENDERING_BACKEND)
ENDIF(VTK_FOUND)
endif()
# VTK 5.x components
if(NOT VTK_FOUND)
+13 -8
View File
@@ -1,17 +1,22 @@
# ----------------------------------------------------------------------------
# Uninstall target, for "make uninstall"
# ----------------------------------------------------------------------------
CONFIGURE_FILE(
"${OpenCV_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY)
if(NOT TARGET uninstall) # avoid conflicts with parent projects
configure_file(
"${OpenCV_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY
)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(uninstall PROPERTIES FOLDER "CMakeTargets")
add_custom_target(uninstall
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
)
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(uninstall PROPERTIES FOLDER "CMakeTargets")
endif()
endif()
# ----------------------------------------------------------------------------
# target building all OpenCV modules
# ----------------------------------------------------------------------------
+1 -1
View File
@@ -148,7 +148,7 @@ macro(ipp_detect_version)
IMPORTED_LOCATION ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
)
list(APPEND IPP_LIBRARIES ipp${name})
if (NOT BUILD_SHARED_LIBS)
if (NOT BUILD_SHARED_LIBS AND (HAVE_IPP_ICV OR ";${OPENCV_INSTALL_EXTERNAL_DEPENDENCIES};" MATCHES ";ipp;"))
# CMake doesn't support "install(TARGETS ${IPP_PREFIX}${name} " command with imported targets
install(FILES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
+5 -4
View File
@@ -108,12 +108,13 @@ macro(ippiw_setup PATH BUILD)
message(STATUS "found Intel IPP Integration Wrappers binaries: ${IW_VERSION_MAJOR}.${IW_VERSION_MINOR}.${IW_VERSION_UPDATE}")
message(STATUS "at: ${IPP_IW_PATH}")
add_library(ippiw STATIC IMPORTED)
set_target_properties(ippiw PROPERTIES
add_library(ipp_iw STATIC IMPORTED)
set_target_properties(ipp_iw PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES ""
IMPORTED_LOCATION "${FILE}"
)
if (NOT BUILD_SHARED_LIBS)
if (NOT BUILD_SHARED_LIBS AND ";${OPENCV_INSTALL_EXTERNAL_DEPENDENCIES};" MATCHES ";ipp;")
# CMake doesn't support "install(TARGETS ${name} ...)" command with imported targets
install(FILES "${FILE}"
DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
@@ -122,7 +123,7 @@ macro(ippiw_setup PATH BUILD)
endif()
set(IPP_IW_INCLUDES "${IPP_IW_PATH}/include")
set(IPP_IW_LIBRARIES ippiw)
set(IPP_IW_LIBRARIES ipp_iw)
set(HAVE_IPP_IW 1)
set(BUILD_IPP_IW 0)
+17 -2
View File
@@ -153,8 +153,23 @@ if(NOT WEBP_VERSION AND WEBP_INCLUDE_DIR)
endif()
endif()
# --- libopenjp2 (optional, check before libjasper) ---
if(WITH_OPENJPEG)
find_package(OpenJPEG QUIET)
if(NOT OpenJPEG_FOUND OR OPENJPEG_MAJOR_VERSION LESS 2)
set(HAVE_OPENJPEG NO)
ocv_clear_vars(OPENJPEG_MAJOR_VERSION OPENJPEG_MINOR_VERSION OPENJPEG_BUILD_VERSION OPENJPEG_LIBRARIES OPENJPEG_INCLUDE_DIRS)
message(STATUS "Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1)")
else()
set(HAVE_OPENJPEG YES)
message(STATUS "Found OpenJPEG: ${OPENJPEG_LIBRARIES} "
"(found version \"${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION}\")")
endif()
endif()
# --- libjasper (optional, should be searched after libjpeg) ---
if(WITH_JASPER)
if(WITH_JASPER AND NOT HAVE_OPENJPEG)
if(BUILD_JASPER)
ocv_clear_vars(JASPER_FOUND)
else()
@@ -273,4 +288,4 @@ if(WITH_IMGCODEC_PFM)
set(HAVE_IMGCODEC_PFM ON)
elseif(DEFINED WITH_IMGCODEC_PFM)
set(HAVE_IMGCODEC_PFM OFF)
endif()
endif()
+25 -10
View File
@@ -6,9 +6,15 @@ if(NOT WITH_PROTOBUF)
return()
endif()
ocv_option(BUILD_PROTOBUF "Force to build libprotobuf from sources" ON)
ocv_option(BUILD_PROTOBUF "Force to build libprotobuf runtime from sources" ON)
ocv_option(PROTOBUF_UPDATE_FILES "Force rebuilding .proto files (protoc should be available)" OFF)
# BUILD_PROTOBUF=OFF: Custom manual protobuf configuration (see find_package(Protobuf) for details):
# - Protobuf_INCLUDE_DIR
# - Protobuf_LIBRARY
# - Protobuf_PROTOC_EXECUTABLE
function(get_protobuf_version version include)
file(STRINGS "${include}/google/protobuf/stubs/common.h" ver REGEX "#define GOOGLE_PROTOBUF_VERSION [0-9]+")
string(REGEX MATCHALL "[0-9]+" ver ${ver})
@@ -19,7 +25,9 @@ function(get_protobuf_version version include)
endfunction()
if(BUILD_PROTOBUF)
ocv_assert(NOT PROTOBUF_UPDATE_FILES)
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/protobuf")
set(Protobuf_LIBRARIES "libprotobuf")
set(HAVE_PROTOBUF TRUE)
else()
unset(Protobuf_VERSION CACHE)
@@ -44,10 +52,7 @@ else()
if(Protobuf_FOUND)
if(TARGET protobuf::libprotobuf)
add_library(libprotobuf INTERFACE IMPORTED)
set_target_properties(libprotobuf PROPERTIES
INTERFACE_LINK_LIBRARIES protobuf::libprotobuf
)
set(Protobuf_LIBRARIES "protobuf::libprotobuf")
else()
add_library(libprotobuf UNKNOWN IMPORTED)
set_target_properties(libprotobuf PROPERTIES
@@ -56,21 +61,31 @@ else()
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}"
)
get_protobuf_version(Protobuf_VERSION "${Protobuf_INCLUDE_DIR}")
set(Protobuf_LIBRARIES "libprotobuf")
endif()
set(HAVE_PROTOBUF TRUE)
endif()
endif()
if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP)
find_package(Protobuf QUIET)
if(NOT COMMAND PROTOBUF_GENERATE_CPP)
message(FATAL_ERROR "PROTOBUF_GENERATE_CPP command is not available")
endif()
message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})")
endif()
if(HAVE_PROTOBUF)
list(APPEND CUSTOM_STATUS protobuf)
if(NOT BUILD_PROTOBUF)
if(TARGET "${Protobuf_LIBRARIES}")
get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION_RELEASE)
if(NOT __location)
get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION)
endif()
elseif(Protobuf_LIBRARY)
set(__location "${Protobuf_LIBRARY}")
else()
set(__location "${Protobuf_LIBRARIES}")
endif()
endif()
list(APPEND CUSTOM_STATUS_protobuf " Protobuf:"
BUILD_PROTOBUF THEN "build (${Protobuf_VERSION})"
ELSE "${Protobuf_LIBRARY} (${Protobuf_VERSION})")
ELSE "${__location} (${Protobuf_VERSION})")
endif()
+3 -4
View File
@@ -5,10 +5,9 @@
# VA_INTEL_IOCL_ROOT - root of Intel OCL installation
if(UNIX AND NOT ANDROID)
if($ENV{VA_INTEL_IOCL_ROOT})
set(VA_INTEL_IOCL_ROOT $ENV{VA_INTEL_IOCL_ROOT})
else()
set(VA_INTEL_IOCL_ROOT "/opt/intel/opencl")
ocv_check_environment_variables(VA_INTEL_IOCL_ROOT)
if(NOT DEFINED VA_INTEL_IOCL_ROOT)
set(VA_INTEL_IOCL_ROOT "/opt/intel/opencl")
endif()
find_path(
+5
View File
@@ -30,6 +30,11 @@ if(BUILD_FAT_JAVA_LIB AND HAVE_opencv_java)
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_java)
endif()
if(BUILD_OBJC AND HAVE_opencv_objc)
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_objc)
endif()
# -------------------------------------------------------------------------------------------
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
# -------------------------------------------------------------------------------------------
+24 -2
View File
@@ -788,6 +788,7 @@ macro(ocv_glob_module_sources)
if (APPLE)
file(GLOB_RECURSE lib_srcs_apple
"${CMAKE_CURRENT_LIST_DIR}/src/*.mm"
"${CMAKE_CURRENT_LIST_DIR}/src/*.swift"
)
list(APPEND lib_srcs ${lib_srcs_apple})
endif()
@@ -1087,6 +1088,17 @@ macro(ocv_check_dependencies)
endforeach()
endmacro()
################################################################################
# OpenCV tests
################################################################################
if(DEFINED OPENCV_BUILD_TEST_MODULES_LIST)
string(REPLACE "," ";" OPENCV_BUILD_TEST_MODULES_LIST "${OPENCV_BUILD_TEST_MODULES_LIST}") # support comma-separated list (,) too
endif()
if(DEFINED OPENCV_BUILD_PERF_TEST_MODULES_LIST)
string(REPLACE "," ";" OPENCV_BUILD_PERF_TEST_MODULES_LIST "${OPENCV_BUILD_PERF_TEST_MODULES_LIST}") # support comma-separated list (,) too
endif()
# auxiliary macro to parse arguments of ocv_add_accuracy_tests and ocv_add_perf_tests commands
macro(__ocv_parse_test_sources tests_type)
set(OPENCV_${tests_type}_${the_module}_SOURCES "")
@@ -1127,7 +1139,12 @@ function(ocv_add_perf_tests)
endif()
set(perf_path "${CMAKE_CURRENT_LIST_DIR}/perf")
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}")
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}"
AND (NOT DEFINED OPENCV_BUILD_PERF_TEST_MODULES_LIST
OR OPENCV_BUILD_PERF_TEST_MODULES_LIST STREQUAL "all"
OR ";${OPENCV_BUILD_PERF_TEST_MODULES_LIST};" MATCHES ";${name};"
)
)
__ocv_parse_test_sources(PERF ${ARGN})
# opencv_imgcodecs is required for imread/imwrite
@@ -1212,7 +1229,12 @@ function(ocv_add_accuracy_tests)
ocv_debug_message("ocv_add_accuracy_tests(" ${ARGN} ")")
set(test_path "${CMAKE_CURRENT_LIST_DIR}/test")
if(BUILD_TESTS AND EXISTS "${test_path}")
if(BUILD_TESTS AND EXISTS "${test_path}"
AND (NOT DEFINED OPENCV_BUILD_TEST_MODULES_LIST
OR OPENCV_BUILD_TEST_MODULES_LIST STREQUAL "all"
OR ";${OPENCV_BUILD_TEST_MODULES_LIST};" MATCHES ";${name};"
)
)
__ocv_parse_test_sources(TEST ${ARGN})
# opencv_imgcodecs is required for imread/imwrite
Executable → Regular
View File
+23 -20
View File
@@ -1,25 +1,28 @@
# -----------------------------------------------
# File that provides "make uninstall" target
# We use the file 'install_manifest.txt'
#
# Details: https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
# -----------------------------------------------
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
endif()
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif()
endforeach()
+1
View File
@@ -81,6 +81,7 @@
#cmakedefine HAVE_IPP_IW_LL
/* JPEG-2000 codec */
#cmakedefine HAVE_OPENJPEG
#cmakedefine HAVE_JASPER
/* IJG JPEG codec */
+2 -3
View File
@@ -3,12 +3,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir_old=@includedir@/opencv
includedir_new=@includedir@
includedir=@includedir@
Name: OpenCV
Description: Open Source Computer Vision Library
Version: @OPENCV_VERSION_PLAIN@
Libs: @OPENCV_PC_LIBS@
Libs.private: @OPENCV_PC_LIBS_PRIVATE@
Cflags: -I${includedir_old} -I${includedir_new}
Cflags: -I${includedir}
View File
View File
View File
View File
View File
+1 -1
View File
@@ -246,7 +246,7 @@ PREDEFINED = __cplusplus=1 \
CV_WRAP_PHANTOM(x)= \
CV_WRAP_DEFAULT(x)= \
CV_CDECL= \
CV_Func = \
CV_Func= \
CV_DO_PRAGMA(x)= \
CV_SUPPRESS_DEPRECATED_START= \
CV_SUPPRESS_DEPRECATED_END= \
+1 -20
View File
@@ -1,23 +1,4 @@
Frequently Asked Questions {#faq}
==========================
- **What is InputArray?**
It can be seen that almost all OpenCV functions receive InputArray type.
What is it, and how can I understand the actual input types of parameters?
This is the proxy class for passing read-only input arrays into OpenCV functions.
Inside a function you should use cv::_InputArray::getMat() method to construct
a matrix header for the array (without copying data). cv::_InputArray::kind() can be used to distinguish Mat from vector<> etc.
but normally it is not needed.
for more information see cv::_InputArray
- **Which is more efficient, use contourArea() or count number of ROI non-zero pixels?**
In a case where you only want relative areas, which one is faster to compute:
calculate a contour area or count the number of ROI non-zero pixels?
cv::contourArea() uses Green formula (http://en.wikipedia.org/wiki/Green's_theorem) to compute the area, therefore its complexity is O(contour_number_of_vertices). Counting non-zero pixels in the ROI is O(roi_width*roi_height) algorithm, i.e. much slower. Note, however, that because of finite, and quite low, resolution of the raster grid, the two algorithms will give noticeably different results. For large and square-like contours the error will be minimal. For small and/or oblong contours the error can be quite large.
Compatibility page. FAQ migrated to the project [wiki](https://github.com/opencv/opencv/wiki/FAQ).
@@ -146,7 +146,7 @@ npm install canvas jsdom
@code{.js}
const { Canvas, createCanvas, Image, ImageData, loadImage } = require('canvas');
const { JSDOM } = require('jsdom');
const { writeFileSync } = require('fs');
const { writeFileSync, existsSync, mkdirSync } = require("fs");
// This is our program. This time we use JavaScript async / await and promises to handle asynchronicity.
(async () => {
@@ -1,6 +1,8 @@
Build OpenCV.js {#tutorial_js_setup}
===============================
@note
You don't have to build your own copy if you simply want to start using it. Refer the Using Opencv.js tutorial for steps on getting a prebuilt copy from our releases or online documentation.
Installing Emscripten
-----------------------------
@@ -4,7 +4,7 @@ Using OpenCV.js {#tutorial_js_usage}
Steps
-----
In this tutorial, you will learn how to include and start to use `opencv.js` inside a web page.
In this tutorial, you will learn how to include and start to use `opencv.js` inside a web page. You can get a copy of `opencv.js` from `opencv-{VERSION_NUMBER}-docs.zip` in each [release](https://github.com/opencv/opencv/releases), or simply download the prebuilt script from the online documentations at "https://docs.opencv.org/{VERISON_NUMBER}/opencv.js" (For example, [https://docs.opencv.org/3.4.0/opencv.js](https://docs.opencv.org/3.4.0/opencv.js). Use `master` if you want the latest build). You can also build your own copy by following the tutorial on Build Opencv.js.
### Create a web page
@@ -44,7 +44,7 @@ To run this web page, copy the content above and save to a local index.html file
Set the URL of `opencv.js` to `src` attribute of \<script\> tag.
@note For this tutorial, we host `opencv.js` at same folder as index.html.
@note For this tutorial, we host `opencv.js` at same folder as index.html. You can also choose to use the URL of the prebuilt `opencv.js` in our online documentation.
Example for synchronous loading:
@code{.js}
+1 -1
View File
@@ -28,7 +28,7 @@
#3 & \mbox{#4}\\
#5 & \mbox{#6}\\
\end{array} \right.}
\newcommand{\forkthree}[8]{
\newcommand{\forkfour}[8]{
\left\{
\begin{array}{l l}
#1 & \mbox{#2}\\
+1 -1
View File
@@ -620,7 +620,7 @@
volume = {1},
publisher = {IEEE}
}
@article{Lowe:2004:DIF:993451.996342,
@article{Lowe04,
author = {Lowe, David G.},
title = {Distinctive Image Features from Scale-Invariant Keypoints},
journal = {Int. J. Comput. Vision},
+84 -88
View File
@@ -16,110 +16,106 @@ python gen_pattern.py -o out.svg -r 11 -c 8 -T circles -s 20.0 -R 5.0 -u mm -w 2
-H, --help - show help
"""
import argparse
from svgfig import *
import sys
import getopt
class PatternMaker:
def __init__(self, cols,rows,output,units,square_size,radius_rate,page_width,page_height):
self.cols = cols
self.rows = rows
self.output = output
self.units = units
self.square_size = square_size
self.radius_rate = radius_rate
self.width = page_width
self.height = page_height
self.g = SVG("g") # the svg group container
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
self.rows = rows
self.output = output
self.units = units
self.square_size = square_size
self.radius_rate = radius_rate
self.width = page_width
self.height = page_height
self.g = SVG("g") # the svg group container
def makeCirclesPattern(self):
spacing = self.square_size
r = spacing / self.radius_rate
for x in range(1,self.cols+1):
for y in range(1,self.rows+1):
dot = SVG("circle", cx=x * spacing, cy=y * spacing, r=r, fill="black", stroke="none")
self.g.append(dot)
def make_circles_pattern(self):
spacing = self.square_size
r = spacing / self.radius_rate
for x in range(1, self.cols + 1):
for y in range(1, self.rows + 1):
dot = SVG("circle", cx=x * spacing, cy=y * spacing, r=r, fill="black", stroke="none")
self.g.append(dot)
def makeACirclesPattern(self):
spacing = self.square_size
r = spacing / self.radius_rate
for i in range(0,self.rows):
for j in range(0,self.cols):
dot = SVG("circle", cx= ((j*2 + i%2)*spacing) + spacing, cy=self.height - (i * spacing + spacing), r=r, fill="black", stroke="none")
self.g.append(dot)
def make_acircles_pattern(self):
spacing = self.square_size
r = spacing / self.radius_rate
for i in range(0, self.rows):
for j in range(0, self.cols):
dot = SVG("circle", cx=((j * 2 + i % 2) * spacing) + spacing, cy=self.height - (i * spacing + spacing),
r=r, fill="black", stroke="none")
self.g.append(dot)
def makeCheckerboardPattern(self):
spacing = self.square_size
xspacing = (self.width - self.cols * self.square_size) / 2.0
yspacing = (self.height - self.rows * self.square_size) / 2.0
for x in range(0,self.cols):
for y in range(0,self.rows):
if x%2 == y%2:
square = SVG("rect", x=x * spacing + xspacing, y=y * spacing + yspacing, width=spacing, height=spacing, fill="black", stroke="none")
self.g.append(square)
def make_checkerboard_pattern(self):
spacing = self.square_size
xspacing = (self.width - self.cols * self.square_size) / 2.0
yspacing = (self.height - self.rows * self.square_size) / 2.0
for x in range(0, self.cols):
for y in range(0, self.rows):
if x % 2 == y % 2:
square = SVG("rect", x=x * spacing + xspacing, y=y * spacing + yspacing, width=spacing,
height=spacing, fill="black", stroke="none")
self.g.append(square)
def save(self):
c = canvas(self.g,width="%d%s"%(self.width,self.units),height="%d%s"%(self.height,self.units),viewBox="0 0 %d %d"%(self.width,self.height))
c.save(self.output)
def save(self):
c = canvas(self.g, width="%d%s" % (self.width, self.units), height="%d%s" % (self.height, self.units),
viewBox="0 0 %d %d" % (self.width, self.height))
c.save(self.output)
def main():
# parse command line options, TODO use argparse for better doc
try:
opts, args = getopt.getopt(sys.argv[1:], "Ho:c:r:T:u:s:R:w:h:a:", ["help","output=","columns=","rows=",
"type=","units=","square_size=","radius_rate=",
"page_width=","page_height=", "page_size="])
except getopt.error as msg:
print(msg)
print("for help use --help")
sys.exit(2)
output = "out.svg"
columns = 8
rows = 11
p_type = "circles"
units = "mm"
square_size = 20.0
radius_rate = 5.0
page_size = "A4"
# parse command line options
parser = argparse.ArgumentParser(description="generate camera-calibration pattern", add_help=False)
parser.add_argument("-H", "--help", help="show help", action="store_true", dest="show_help")
parser.add_argument("-o", "--output", help="output file", default="out.svg", action="store", dest="output")
parser.add_argument("-c", "--columns", help="pattern columns", default="8", action="store", dest="columns",
type=int)
parser.add_argument("-r", "--rows", help="pattern rows", default="11", action="store", dest="rows", type=int)
parser.add_argument("-T", "--type", help="type of pattern", default="circles", action="store", dest="p_type",
choices=["circles", "acircles", "checkerboard"])
parser.add_argument("-u", "--units", help="length unit", default="mm", action="store", dest="units",
choices=["mm", "inches", "px", "m"])
parser.add_argument("-s", "--square_size", help="size of squares in pattern", default="20.0", action="store",
dest="square_size", type=float)
parser.add_argument("-R", "--radius_rate", help="circles_radius = square_size/radius_rate", default="5.0",
action="store", dest="radius_rate", type=float)
parser.add_argument("-w", "--page_width", help="page width in units", default="216", action="store",
dest="page_width", type=int)
parser.add_argument("-h", "--page_height", help="page height in units", default="279", action="store",
dest="page_width", type=int)
parser.add_argument("-a", "--page_size", help="page size, supersedes -h -w arguments", default="A4", action="store",
dest="page_size", choices=["A0", "A1", "A2", "A3", "A4", "A5"])
args = parser.parse_args()
show_help = args.show_help
if show_help:
parser.print_help()
return
output = args.output
columns = args.columns
rows = args.rows
p_type = args.p_type
units = args.units
square_size = args.square_size
radius_rate = args.radius_rate
page_size = args.page_size
# page size dict (ISO standard, mm) for easy lookup. format - size: [width, height]
page_sizes = {"A0": [840, 1188], "A1": [594, 840], "A2": [420, 594], "A3": [297, 420], "A4": [210, 297], "A5": [148, 210]}
page_sizes = {"A0": [840, 1188], "A1": [594, 840], "A2": [420, 594], "A3": [297, 420], "A4": [210, 297],
"A5": [148, 210]}
page_width = page_sizes[page_size.upper()][0]
page_height = page_sizes[page_size.upper()][1]
# process options
for o, a in opts:
if o in ("-H", "--help"):
print(__doc__)
sys.exit(0)
elif o in ("-r", "--rows"):
rows = int(a)
elif o in ("-c", "--columns"):
columns = int(a)
elif o in ("-o", "--output"):
output = a
elif o in ("-T", "--type"):
p_type = a
elif o in ("-u", "--units"):
units = a
elif o in ("-s", "--square_size"):
square_size = float(a)
elif o in ("-R", "--radius_rate"):
radius_rate = float(a)
elif o in ("-w", "--page_width"):
page_width = float(a)
elif o in ("-h", "--page_height"):
page_height = float(a)
elif o in ("-a", "--page_size"):
units = "mm"
page_size = a.upper()
page_width = page_sizes[page_size][0]
page_height = page_sizes[page_size][1]
pm = PatternMaker(columns,rows,output,units,square_size,radius_rate,page_width,page_height)
#dict for easy lookup of pattern type
mp = {"circles":pm.makeCirclesPattern,"acircles":pm.makeACirclesPattern,"checkerboard":pm.makeCheckerboardPattern}
pm = PatternMaker(columns, rows, output, units, square_size, radius_rate, page_width, page_height)
# dict for easy lookup of pattern type
mp = {"circles": pm.make_circles_pattern, "acircles": pm.make_acircles_pattern,
"checkerboard": pm.make_checkerboard_pattern}
mp[p_type]()
#this should save pattern to output
# this should save pattern to output
pm.save()
if __name__ == "__main__":
main()
@@ -44,7 +44,7 @@ img1 = cv.imread('box.png',0) # queryImage
img2 = cv.imread('box_in_scene.png',0) # trainImage
# Initiate SIFT detector
sift = cv.xfeatures2d.SIFT_create()
sift = cv.SIFT_create()
# find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,None)
@@ -110,7 +110,7 @@ img1 = cv.imread('box.png',cv.IMREAD_GRAYSCALE) # queryImage
img2 = cv.imread('box_in_scene.png',cv.IMREAD_GRAYSCALE) # trainImage
# Initiate SIFT detector
sift = cv.xfeatures2d.SIFT_create()
sift = cv.SIFT_create()
# find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,None)
@@ -174,7 +174,7 @@ img1 = cv.imread('box.png',cv.IMREAD_GRAYSCALE) # queryImage
img2 = cv.imread('box_in_scene.png',cv.IMREAD_GRAYSCALE) # trainImage
# Initiate SIFT detector
sift = cv.xfeatures2d.SIFT_create()
sift = cv.SIFT_create()
# find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,None)
@@ -119,7 +119,7 @@ import cv2 as cv
img = cv.imread('home.jpg')
gray= cv.cvtColor(img,cv.COLOR_BGR2GRAY)
sift = cv.xfeatures2d.SIFT_create()
sift = cv.SIFT_create()
kp = sift.detect(gray,None)
img=cv.drawKeypoints(gray,kp,img)
@@ -151,7 +151,7 @@ Now to calculate the descriptor, OpenCV provides two methods.
We will see the second method:
@code{.py}
sift = cv.xfeatures2d.SIFT_create()
sift = cv.SIFT_create()
kp, des = sift.detectAndCompute(gray,None)
@endcode
Here kp will be a list of keypoints and des is a numpy array of shape
Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

@@ -1,153 +1,4 @@
Getting Started with Images {#tutorial_py_image_display}
===========================
Goals
-----
- Here, you will learn how to read an image, how to display it, and how to save it back
- You will learn these functions : **cv.imread()**, **cv.imshow()** , **cv.imwrite()**
- Optionally, you will learn how to display images with Matplotlib
Using OpenCV
------------
### Read an image
Use the function **cv.imread()** to read an image. The image should be in the working directory or
a full path of image should be given.
Second argument is a flag which specifies the way image should be read.
- cv.IMREAD_COLOR : Loads a color image. Any transparency of image will be neglected. It is the
default flag.
- cv.IMREAD_GRAYSCALE : Loads image in grayscale mode
- cv.IMREAD_UNCHANGED : Loads image as such including alpha channel
@note Instead of these three flags, you can simply pass integers 1, 0 or -1 respectively.
See the code below:
@code{.py}
import numpy as np
import cv2 as cv
# Load a color image in grayscale
img = cv.imread('messi5.jpg',0)
@endcode
**warning**
Even if the image path is wrong, it won't throw any error, but `print img` will give you `None`
### Display an image
Use the function **cv.imshow()** to display an image in a window. The window automatically fits to
the image size.
First argument is a window name which is a string. Second argument is our image. You can create as
many windows as you wish, but with different window names.
@code{.py}
cv.imshow('image',img)
cv.waitKey(0)
cv.destroyAllWindows()
@endcode
A screenshot of the window will look like this (in Fedora-Gnome machine):
![image](images/opencv_screenshot.jpg)
**cv.waitKey()** is a keyboard binding function. Its argument is the time in milliseconds. The
function waits for specified milliseconds for any keyboard event. If you press any key in that time,
the program continues. If **0** is passed, it waits indefinitely for a key stroke. It can also be
set to detect specific key strokes like, if key a is pressed etc which we will discuss below.
@note Besides binding keyboard events this function also processes many other GUI events, so you
MUST use it to actually display the image.
**cv.destroyAllWindows()** simply destroys all the windows we created. If you want to destroy any
specific window, use the function **cv.destroyWindow()** where you pass the exact window name as
the argument.
@note There is a special case where you can create an empty window and load an image to it later. In
that case, you can specify whether the window is resizable or not. It is done with the function
**cv.namedWindow()**. By default, the flag is cv.WINDOW_AUTOSIZE. But if you specify the flag to be
cv.WINDOW_NORMAL, you can resize window. It will be helpful when an image is too large in dimension
and when adding track bars to windows.
See the code below:
@code{.py}
cv.namedWindow('image', cv.WINDOW_NORMAL)
cv.imshow('image',img)
cv.waitKey(0)
cv.destroyAllWindows()
@endcode
### Write an image
Use the function **cv.imwrite()** to save an image.
First argument is the file name, second argument is the image you want to save.
@code{.py}
cv.imwrite('messigray.png',img)
@endcode
This will save the image in PNG format in the working directory.
### Sum it up
Below program loads an image in grayscale, displays it, saves the image if you press 's' and exit, or
simply exits without saving if you press ESC key.
@code{.py}
import numpy as np
import cv2 as cv
img = cv.imread('messi5.jpg',0)
cv.imshow('image',img)
k = cv.waitKey(0)
if k == 27: # wait for ESC key to exit
cv.destroyAllWindows()
elif k == ord('s'): # wait for 's' key to save and exit
cv.imwrite('messigray.png',img)
cv.destroyAllWindows()
@endcode
**warning**
If you are using a 64-bit machine, you will have to modify `k = cv.waitKey(0)` line as follows :
`k = cv.waitKey(0) & 0xFF`
Using Matplotlib
----------------
Matplotlib is a plotting library for Python which gives you wide variety of plotting methods. You
will see them in coming articles. Here, you will learn how to display image with Matplotlib. You can
zoom images, save them, etc, using Matplotlib.
@code{.py}
import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
img = cv.imread('messi5.jpg',0)
plt.imshow(img, cmap = 'gray', interpolation = 'bicubic')
plt.xticks([]), plt.yticks([]) # to hide tick values on X and Y axis
plt.show()
@endcode
A screen-shot of the window will look like this :
![image](images/matplotlib_screenshot.jpg)
@note Plenty of plotting options are available in Matplotlib. Please refer to Matplotlib docs for more
details. Some, we will see on the way.
__warning__
Color image loaded by OpenCV is in BGR mode. But Matplotlib displays in RGB mode. So color images
will not be displayed correctly in Matplotlib if image is read with OpenCV. Please see the exercises
for more details.
Additional Resources
--------------------
-# [Matplotlib Plotting Styles and Features](http://matplotlib.org/api/pyplot_api.html)
Exercises
---------
-# There is some problem when you try to load color image in OpenCV and display it in Matplotlib.
Read [this discussion](http://stackoverflow.com/a/15074748/1134940) and understand it.
Tutorial content has been moved: @ref tutorial_display_image
@@ -1,7 +1,7 @@
Gui Features in OpenCV {#tutorial_py_table_of_contents_gui}
======================
- @subpage tutorial_py_image_display
- @ref tutorial_display_image
Learn to load an
image, display it, and save it back
@@ -80,7 +80,7 @@ Probabilistic Hough Transform
In the hough transform, you can see that even for a line with two arguments, it takes a lot of
computation. Probabilistic Hough Transform is an optimization of the Hough Transform we saw. It doesn't
take all the points into consideration. Instead, it takes only a random subset of points which is
sufficient for line detection. Just we have to decrease the threshold. See image below which compares
sufficient for line detection. We just have to decrease the threshold. See image below which compares
Hough Transform and Probabilistic Hough Transform in Hough space. (Image Courtesy :
[Franck Bettinger's home page](http://phdfb1.free.fr/robot/mscthesis/node14.html) )
@@ -4,20 +4,20 @@ OCR of Hand-written Data using kNN {#tutorial_py_knn_opencv}
Goal
----
In this chapter
- We will use our knowledge on kNN to build a basic OCR application.
- We will try with Digits and Alphabets data available that comes with OpenCV.
In this chapter:
- We will use our knowledge on kNN to build a basic OCR (Optical Character Recognition) application.
- We will try our application on Digits and Alphabets data that comes with OpenCV.
OCR of Hand-written Digits
--------------------------
Our goal is to build an application which can read the handwritten digits. For this we need some
train_data and test_data. OpenCV comes with an image digits.png (in the folder
Our goal is to build an application which can read handwritten digits. For this we need some
training data and some test data. OpenCV comes with an image digits.png (in the folder
opencv/samples/data/) which has 5000 handwritten digits (500 for each digit). Each digit is
a 20x20 image. So our first step is to split this image into 5000 different digits. For each digit,
we flatten it into a single row with 400 pixels. That is our feature set, ie intensity values of all
pixels. It is the simplest feature set we can create. We use first 250 samples of each digit as
train_data, and next 250 samples as test_data. So let's prepare them first.
a 20x20 image. So our first step is to split this image into 5000 different digit images. Then for each digit (20x20 image),
we flatten it into a single row with 400 pixels. That is our feature set, i.e. intensity values of all
pixels. It is the simplest feature set we can create. We use the first 250 samples of each digit as
training data, and the other 250 samples as test data. So let's prepare them first.
@code{.py}
import numpy as np
import cv2 as cv
@@ -28,10 +28,10 @@ gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
# Now we split the image to 5000 cells, each 20x20 size
cells = [np.hsplit(row,100) for row in np.vsplit(gray,50)]
# Make it into a Numpy array. It size will be (50,100,20,20)
# Make it into a Numpy array: its size will be (50,100,20,20)
x = np.array(cells)
# Now we prepare train_data and test_data.
# Now we prepare the training data and test data
train = x[:,:50].reshape(-1,400).astype(np.float32) # Size = (2500,400)
test = x[:,50:100].reshape(-1,400).astype(np.float32) # Size = (2500,400)
@@ -40,7 +40,7 @@ k = np.arange(10)
train_labels = np.repeat(k,250)[:,np.newaxis]
test_labels = train_labels.copy()
# Initiate kNN, train the data, then test it with test data for k=1
# Initiate kNN, train it on the training data, then test it with the test data with k=1
knn = cv.ml.KNearest_create()
knn.train(train, cv.ml.ROW_SAMPLE, train_labels)
ret,result,neighbours,dist = knn.findNearest(test,k=5)
@@ -52,13 +52,15 @@ correct = np.count_nonzero(matches)
accuracy = correct*100.0/result.size
print( accuracy )
@endcode
So our basic OCR app is ready. This particular example gave me an accuracy of 91%. One option
improve accuracy is to add more data for training, especially the wrong ones. So instead of finding
this training data every time I start application, I better save it, so that next time, I directly
read this data from a file and start classification. You can do it with the help of some Numpy
functions like np.savetxt, np.savez, np.load etc. Please check their docs for more details.
So our basic OCR app is ready. This particular example gave me an accuracy of 91%. One option to
improve accuracy is to add more data for training, especially for the digits where we had more errors.
Instead of finding
this training data every time I start the application, I better save it, so that the next time, I can directly
read this data from a file and start classification. This can be done with the help of some Numpy
functions like np.savetxt, np.savez, np.load, etc. Please check the NumPy docs for more details.
@code{.py}
# save the data
# Save the data
np.savez('knn_data.npz',train=train, train_labels=train_labels)
# Now load the data
@@ -71,36 +73,36 @@ In my system, it takes around 4.4 MB of memory. Since we are using intensity val
features, it would be better to convert the data to np.uint8 first and then save it. It takes only
1.1 MB in this case. Then while loading, you can convert back into float32.
OCR of English Alphabets
OCR of the English Alphabet
------------------------
Next we will do the same for English alphabets, but there is a slight change in data and feature
Next we will do the same for the English alphabet, but there is a slight change in data and feature
set. Here, instead of images, OpenCV comes with a data file, letter-recognition.data in
opencv/samples/cpp/ folder. If you open it, you will see 20000 lines which may, on first sight, look
like garbage. Actually, in each row, first column is an alphabet which is our label. Next 16 numbers
following it are its different features. These features are obtained from [UCI Machine Learning
like garbage. Actually, in each row, the first column is a letter which is our label. The next 16 numbers
following it are the different features. These features are obtained from the [UCI Machine Learning
Repository](http://archive.ics.uci.edu/ml/). You can find the details of these features in [this
page](http://archive.ics.uci.edu/ml/datasets/Letter+Recognition).
There are 20000 samples available, so we take first 10000 data as training samples and remaining
10000 as test samples. We should change the alphabets to ascii characters because we can't work with
alphabets directly.
There are 20000 samples available, so we take the first 10000 as training samples and the remaining
10000 as test samples. We should change the letters to ascii characters because we can't work with
letters directly.
@code{.py}
import cv2 as cv
import numpy as np
# Load the data, converters convert the letter to a number
# Load the data and convert the letters to numbers
data= np.loadtxt('letter-recognition.data', dtype= 'float32', delimiter = ',',
converters= {0: lambda ch: ord(ch)-ord('A')})
# split the data to two, 10000 each for train and test
# Split the dataset in two, with 10000 samples each for training and test sets
train, test = np.vsplit(data,2)
# split trainData and testData to features and responses
# Split trainData and testData into features and responses
responses, trainData = np.hsplit(train,[1])
labels, testData = np.hsplit(test,[1])
# Initiate the kNN, classify, measure accuracy.
# Initiate the kNN, classify, measure accuracy
knn = cv.ml.KNearest_create()
knn.train(trainData, cv.ml.ROW_SAMPLE, responses)
ret, result, neighbours, dist = knn.findNearest(testData, k=5)
@@ -110,10 +112,12 @@ accuracy = correct*100.0/10000
print( accuracy )
@endcode
It gives me an accuracy of 93.22%. Again, if you want to increase accuracy, you can iteratively add
error data in each level.
more data.
Additional Resources
--------------------
1. [Wikipedia article on Optical character recognition](https://en.wikipedia.org/wiki/Optical_character_recognition)
Exercises
---------
1. Here we used k=5. What happens if you try other values of k? Can you find a value that maximizes accuracy (minimizes the number of errors)?
@@ -4,61 +4,55 @@ Understanding k-Nearest Neighbour {#tutorial_py_knn_understanding}
Goal
----
In this chapter, we will understand the concepts of k-Nearest Neighbour (kNN) algorithm.
In this chapter, we will understand the concepts of the k-Nearest Neighbour (kNN) algorithm.
Theory
------
kNN is one of the simplest of classification algorithms available for supervised learning. The idea
is to search for closest match of the test data in feature space. We will look into it with below
kNN is one of the simplest classification algorithms available for supervised learning. The idea
is to search for the closest match(es) of the test data in the feature space. We will look into it with the below
image.
![image](images/knn_theory.png)
In the image, there are two families, Blue Squares and Red Triangles. We call each family as
**Class**. Their houses are shown in their town map which we call feature space. *(You can consider
a feature space as a space where all datas are projected. For example, consider a 2D coordinate
space. Each data has two features, x and y coordinates. You can represent this data in your 2D
coordinate space, right? Now imagine if there are three features, you need 3D space. Now consider N
features, where you need N-dimensional space, right? This N-dimensional space is its feature space.
In our image, you can consider it as a 2D case with two features)*.
In the image, there are two families: Blue Squares and Red Triangles. We refer to each family as
a **Class**. Their houses are shown in their town map which we call the **Feature Space**. You can consider
a feature space as a space where all data are projected. For example, consider a 2D coordinate
space. Each datum has two features, a x coordinate and a y coordinate. You can represent this datum in your 2D
coordinate space, right? Now imagine that there are three features, you will need 3D space. Now consider N
features: you need N-dimensional space, right? This N-dimensional space is its feature space.
In our image, you can consider it as a 2D case with two features.
Now a new member comes into the town and creates a new home, which is shown as green circle. He
should be added to one of these Blue/Red families. We call that process, **Classification**. What we
do? Since we are dealing with kNN, let us apply this algorithm.
Now consider what happens if a new member comes into the town and creates a new home, which is shown as the green circle. He
should be added to one of these Blue or Red families (or *classes*). We call that process, **Classification**. How exactly should this new member be classified? Since we are dealing with kNN, let us apply the algorithm.
One method is to check who is his nearest neighbour. From the image, it is clear it is the Red
Triangle family. So he is also added into Red Triangle. This method is called simply **Nearest
Neighbour**, because classification depends only on the nearest neighbour.
One simple method is to check who is his nearest neighbour. From the image, it is clear that it is a member of the Red
Triangle family. So he is classified as a Red Triangle. This method is called simply **Nearest Neighbour** classification, because classification depends only on the *nearest neighbour*.
But there is a problem with that. Red Triangle may be the nearest. But what if there are lot of Blue
Squares near to him? Then Blue Squares have more strength in that locality than Red Triangle. So
just checking nearest one is not sufficient. Instead we check some k nearest families. Then whoever
is majority in them, the new guy belongs to that family. In our image, let's take k=3, ie 3 nearest
families. He has two Red and one Blue (there are two Blues equidistant, but since k=3, we take only
But there is a problem with this approach! Red Triangle may be the nearest neighbour, but what if there are also a lot of Blue
Squares nearby? Then Blue Squares have more strength in that locality than Red Triangles, so
just checking the nearest one is not sufficient. Instead we may want to check some **k** nearest families. Then whichever family is the majority amongst them, the new guy should belong to that family. In our image, let's take k=3, i.e. consider the 3 nearest
neighbours. The new member has two Red neighbours and one Blue neighbour (there are two Blues equidistant, but since k=3, we can take only
one of them), so again he should be added to Red family. But what if we take k=7? Then he has 5 Blue
families and 2 Red families. Great!! Now he should be added to Blue family. So it all changes with
value of k. More funny thing is, what if k = 4? He has 2 Red and 2 Blue neighbours. It is a tie !!!
So better take k as an odd number. So this method is called **k-Nearest Neighbour** since
classification depends on k nearest neighbours.
neighbours and 2 Red neighbours and should be added to the Blue family. The result will vary with the selected
value of k. Note that if k is not an odd number, we can get a tie, as would happen in the above case with k=4. We would see that our new member has 2 Red and 2 Blue neighbours as his four nearest neighbours and we would need to choose a method for breaking the tie to perform classification. So to reiterate, this method is called **k-Nearest Neighbour** since
classification depends on the *k nearest neighbours*.
Again, in kNN, it is true we are considering k neighbours, but we are giving equal importance to
all, right? Is it justice? For example, take the case of k=4. We told it is a tie. But see, the 2
Red families are more closer to him than the other 2 Blue families. So he is more eligible to be
added to Red. So how do we mathematically explain that? We give some weights to each family
depending on their distance to the new-comer. For those who are near to him get higher weights while
those are far away get lower weights. Then we add total weights of each family separately. Whoever
gets highest total weights, new-comer goes to that family. This is called **modified kNN**.
all, right? Is this justified? For example, take the tied case of k=4. As we can see, the 2
Red neighbours are actually closer to the new member than the other 2 Blue neighbours, so he is more eligible to be
added to the Red family. How do we mathematically explain that? We give some weights to each neighbour
depending on their distance to the new-comer: those who are nearer to him get higher weights, while
those that are farther away get lower weights. Then we add the total weights of each family separately and classify the new-comer as part of whichever family
received higher total weights. This is called **modified kNN** or **weighted kNN**.
So what are some important things you see here?
- You need to have information about all the houses in town, right? Because, we have to check
the distance from new-comer to all the existing houses to find the nearest neighbour. If there
are plenty of houses and families, it takes lots of memory, and more time for calculation
also.
- There is almost zero time for any kind of training or preparation.
- Because we have to check
the distance from the new-comer to all the existing houses to find the nearest neighbour(s), you need to have information about all of the houses in town, right? If there are plenty of houses and families, it takes a lot of memory, and also more time for calculation.
- There is almost zero time for any kind of "training" or preparation. Our "learning" involves only memorizing (storing) the data, before testing and classifying.
Now let's see it in OpenCV.
Now let's see this algorithm at work in OpenCV.
kNN in OpenCV
-------------
@@ -67,11 +61,11 @@ We will do a simple example here, with two families (classes), just like above.
chapter, we will do an even better example.
So here, we label the Red family as **Class-0** (so denoted by 0) and Blue family as **Class-1**
(denoted by 1). We create 25 families or 25 training data, and label them either Class-0 or Class-1.
We do all these with the help of Random Number Generator in Numpy.
(denoted by 1). We create 25 neighbours or 25 training data, and label each of them as either part of Class-0 or Class-1.
We can do this with the help of a Random Number Generator from NumPy.
Then we plot it with the help of Matplotlib. Red families are shown as Red Triangles and Blue
families are shown as Blue Squares.
Then we can plot it with the help of Matplotlib. Red neighbours are shown as Red Triangles and Blue
neighbours are shown as Blue Squares.
@code{.py}
import cv2 as cv
import numpy as np
@@ -80,36 +74,36 @@ import matplotlib.pyplot as plt
# Feature set containing (x,y) values of 25 known/training data
trainData = np.random.randint(0,100,(25,2)).astype(np.float32)
# Labels each one either Red or Blue with numbers 0 and 1
# Label each one either Red or Blue with numbers 0 and 1
responses = np.random.randint(0,2,(25,1)).astype(np.float32)
# Take Red families and plot them
# Take Red neighbours and plot them
red = trainData[responses.ravel()==0]
plt.scatter(red[:,0],red[:,1],80,'r','^')
# Take Blue families and plot them
# Take Blue neighbours and plot them
blue = trainData[responses.ravel()==1]
plt.scatter(blue[:,0],blue[:,1],80,'b','s')
plt.show()
@endcode
You will get something similar to our first image. Since you are using random number generator, you
will be getting different data each time you run the code.
You will get something similar to our first image. Since you are using a random number generator, you
will get different data each time you run the code.
Next initiate the kNN algorithm and pass the trainData and responses to train the kNN (It constructs
a search tree).
Next initiate the kNN algorithm and pass the trainData and responses to train the kNN. (Underneath the hood, it constructs
a search tree: see the Additional Resources section below for more information on this.)
Then we will bring one new-comer and classify him to a family with the help of kNN in OpenCV. Before
going to kNN, we need to know something on our test data (data of new comers). Our data should be a
Then we will bring one new-comer and classify him as belonging to a family with the help of kNN in OpenCV. Before
running kNN, we need to know something about our test data (data of new comers). Our data should be a
floating point array with size \f$number \; of \; testdata \times number \; of \; features\f$. Then we
find the nearest neighbours of new-comer. We can specify how many neighbours we want. It returns:
find the nearest neighbours of the new-comer. We can specify *k*: how many neighbours we want. (Here we used 3.) It returns:
-# The label given to new-comer depending upon the kNN theory we saw earlier. If you want Nearest
Neighbour algorithm, just specify k=1 where k is the number of neighbours.
2. The labels of k-Nearest Neighbours.
3. Corresponding distances from new-comer to each nearest neighbour.
1. The label given to the new-comer depending upon the kNN theory we saw earlier. If you want the *Nearest
Neighbour* algorithm, just specify k=1.
2. The labels of the k-Nearest Neighbours.
3. The corresponding distances from the new-comer to each nearest neighbour.
So let's see how it works. New comer is marked in green color.
So let's see how it works. The new-comer is marked in green.
@code{.py}
newcomer = np.random.randint(0,100,(1,2)).astype(np.float32)
plt.scatter(newcomer[:,0],newcomer[:,1],80,'g','o')
@@ -124,21 +118,21 @@ print( "distance: {}\n".format(dist) )
plt.show()
@endcode
I got the result as follows:
I got the following results:
@code{.py}
result: [[ 1.]]
neighbours: [[ 1. 1. 1.]]
distance: [[ 53. 58. 61.]]
@endcode
It says our new-comer got 3 neighbours, all from Blue family. Therefore, he is labelled as Blue
family. It is obvious from plot below:
It says that our new-comer's 3 nearest neighbours are all from the Blue family. Therefore, he is labelled as part of the Blue
family. It is obvious from the plot below:
![image](images/knn_simple.png)
If you have large number of data, you can just pass it as array. Corresponding results are also
If you have multiple new-comers (test data), you can just pass them as an array. Corresponding results are also
obtained as arrays.
@code{.py}
# 10 new comers
# 10 new-comers
newcomers = np.random.randint(0,100,(10,2)).astype(np.float32)
ret, results,neighbours,dist = knn.findNearest(newcomer, 3)
# The results also will contain 10 labels.
@@ -146,8 +140,11 @@ ret, results,neighbours,dist = knn.findNearest(newcomer, 3)
Additional Resources
--------------------
-# [NPTEL notes on Pattern Recognition, Chapter
11](http://www.nptel.iitm.ac.in/courses/106108057/12)
1. [NPTEL notes on Pattern Recognition, Chapter
11](https://nptel.ac.in/courses/106/108/106108057/)
2. [Wikipedia article on Nearest neighbor search](https://en.wikipedia.org/wiki/Nearest_neighbor_search)
3. [Wikipedia article on k-d tree](https://en.wikipedia.org/wiki/K-d_tree)
Exercises
---------
1. Try repeating the above with more classes and different choices of k. Does choosing k become harder with more classes in the same 2D feature space?
@@ -83,7 +83,7 @@ Let us define a kernel function \f$K(p,q)\f$ which does a dot product between tw
\begin{aligned}
K(p,q) = \phi(p).\phi(q) &= \phi(p)^T \phi(q) \\
&= (p_{1}^2,p_{2}^2,\sqrt{2} p_1 p_2).(q_{1}^2,q_{2}^2,\sqrt{2} q_1 q_2) \\
&= p_1 q_1 + p_2 q_2 + 2 p_1 q_1 p_2 q_2 \\
&= p_{1}^2 q_{1}^2 + p_{2}^2 q_{2}^2 + 2 p_1 q_1 p_2 q_2 \\
&= (p_1 q_1 + p_2 q_2)^2 \\
\phi(p).\phi(q) &= (p.q)^2
\end{aligned}
@@ -80,7 +80,7 @@ Additional Resources
--------------------
-# A Quick guide to Python - [A Byte of Python](http://swaroopch.com/notes/python/)
2. [Basic Numpy Tutorials](http://wiki.scipy.org/Tentative_NumPy_Tutorial)
3. [Numpy Examples List](http://wiki.scipy.org/Numpy_Example_List)
2. [NumPy Quickstart tutorial](https://numpy.org/devdocs/user/quickstart.html)
3. [NumPy Reference](https://numpy.org/devdocs/reference/index.html#reference)
4. [OpenCV Documentation](http://docs.opencv.org/)
5. [OpenCV Forum](http://answers.opencv.org/questions/)
@@ -1,6 +1,10 @@
Camera calibration With OpenCV {#tutorial_camera_calibration}
==============================
@prev_tutorial{tutorial_camera_calibration_square_chess}
@next_tutorial{tutorial_real_time_pose}
Cameras have been around for a long-long time. However, with the introduction of the cheap *pinhole*
cameras in the late 20th century, they became a common occurrence in our everyday life.
Unfortunately, this cheapness comes with its price: significant distortion. Luckily, these are
@@ -1,6 +1,9 @@
Create calibration pattern {#tutorial_camera_calibration_pattern}
=========================================
@next_tutorial{tutorial_camera_calibration_square_chess}
The goal of this tutorial is to learn how to create calibration pattern.
You can find a chessboard pattern in https://github.com/opencv/opencv/blob/master/doc/pattern.png
@@ -1,6 +1,10 @@
Camera calibration with square chessboard {#tutorial_camera_calibration_square_chess}
=========================================
@prev_tutorial{tutorial_camera_calibration_pattern}
@next_tutorial{tutorial_camera_calibration}
The goal of this tutorial is to learn how to calibrate a camera given a set of chessboard images.
*Test data*: use images in your data/chess folder.
@@ -1,6 +1,9 @@
Interactive camera calibration application {#tutorial_interactive_calibration}
==============================
@prev_tutorial{tutorial_real_time_pose}
According to classical calibration technique user must collect all data first and when run @ref cv::calibrateCamera function
to obtain camera parameters. If average re-projection error is huge or if estimated parameters seems to be wrong, process of
selection or collecting data and starting of @ref cv::calibrateCamera repeats.
@@ -1,6 +1,10 @@
Real Time pose estimation of a textured object {#tutorial_real_time_pose}
==============================================
@prev_tutorial{tutorial_camera_calibration}
@next_tutorial{tutorial_interactive_calibration}
Nowadays, augmented reality is one of the top research topic in computer vision and robotics fields.
The most elemental problem in augmented reality is the estimation of the camera pose respect of an
object in the case of computer vision area to do later some 3D rendering or in the case of robotics
@@ -5,6 +5,8 @@ Although we get most of our images in a 2D format they do come from a 3D world.
- @subpage tutorial_camera_calibration_pattern
*Languages:* Python
*Compatibility:* \> OpenCV 2.0
*Author:* Laurent Berger
@@ -13,6 +15,8 @@ Although we get most of our images in a 2D format they do come from a 3D world.
- @subpage tutorial_camera_calibration_square_chess
*Languages:* C++
*Compatibility:* \> OpenCV 2.0
*Author:* Victor Eruhimov
@@ -21,6 +25,8 @@ Although we get most of our images in a 2D format they do come from a 3D world.
- @subpage tutorial_camera_calibration
*Languages:* C++
*Compatibility:* \> OpenCV 4.0
*Author:* Bernát Gábor
@@ -31,6 +37,8 @@ Although we get most of our images in a 2D format they do come from a 3D world.
- @subpage tutorial_real_time_pose
*Languages:* C++
*Compatibility:* \> OpenCV 2.0
*Author:* Edgar Riba
@@ -107,8 +107,9 @@ you may access it. For sequences you need to go through them to query a specific
then we have to specify if our output is either a sequence or map.
For sequence before the first element print the "[" character and after the last one the "]"
character. With Python, the "]" character could be written with the name of the sequence or
the last element of the sequence depending on the number of elements:
character. With Python, call `FileStorage.startWriteStruct(structure_name, struct_type)`,
where `struct_type` is `cv2.FileNode_MAP` or `cv2.FileNode_SEQ` to start writing the structure.
Call `FileStorage.endWriteStruct()` to finish the structure:
@add_toggle_cpp
@snippet cpp/tutorial_code/core/file_input_output/file_input_output.cpp writeStr
@end_toggle
@@ -6,6 +6,8 @@ understanding how to manipulate the images on a pixel level.
- @subpage tutorial_mat_the_basic_image_container
*Languages:* C++
*Compatibility:* \> OpenCV 2.0
*Author:* Bernát Gábor
@@ -15,6 +17,8 @@ understanding how to manipulate the images on a pixel level.
- @subpage tutorial_how_to_scan_images
*Languages:* C++
*Compatibility:* \> OpenCV 2.0
*Author:* Bernát Gábor
@@ -75,6 +79,8 @@ understanding how to manipulate the images on a pixel level.
- @subpage tutorial_file_input_output_with_xml_yml
*Languages:* C++, Python
*Compatibility:* \> OpenCV 2.0
*Author:* Bernát Gábor
@@ -84,6 +90,8 @@ understanding how to manipulate the images on a pixel level.
- @subpage tutorial_how_to_use_OpenCV_parallel_for_
*Languages:* C++
*Compatibility:* \>= OpenCV 2.4.3
You will see how to use the OpenCV parallel_for_ to easily parallelize your code.
@@ -1,5 +1,8 @@
# How to run deep networks on Android device {#tutorial_dnn_android}
@prev_tutorial{tutorial_dnn_halide_scheduling}
@next_tutorial{tutorial_dnn_yolo}
## Introduction
In this tutorial you'll know how to run deep learning networks on Android device
using OpenCV deep learning module.
@@ -12,7 +15,7 @@ Tutorial was written for the following versions of corresponding software:
- Download and install Android Studio from https://developer.android.com/studio.
- Get the latest pre-built OpenCV for Android release from https://github.com/opencv/opencv/releases and unpack it (for example, `opencv-4.3.0-android-sdk.zip`).
- Get the latest pre-built OpenCV for Android release from https://github.com/opencv/opencv/releases and unpack it (for example, `opencv-4.4.0-android-sdk.zip`).
- Download MobileNet object detection model from https://github.com/chuanqi305/MobileNet-SSD. We need a configuration file `MobileNetSSD_deploy.prototxt` and weights `MobileNetSSD_deploy.caffemodel`.
@@ -1,5 +1,7 @@
# Custom deep learning layers support {#tutorial_dnn_custom_layers}
@prev_tutorial{tutorial_dnn_javascript}
## Introduction
Deep learning is a fast growing area. The new approaches to build neural networks
usually introduce new types of layers. They could be modifications of existing
@@ -1,6 +1,8 @@
Load Caffe framework models {#tutorial_dnn_googlenet}
===========================
@next_tutorial{tutorial_dnn_halide}
Introduction
------------
@@ -1,5 +1,8 @@
# How to enable Halide backend for improve efficiency {#tutorial_dnn_halide}
@prev_tutorial{tutorial_dnn_googlenet}
@next_tutorial{tutorial_dnn_halide_scheduling}
## Introduction
This tutorial guidelines how to run your models in OpenCV deep learning module
using Halide language backend. Halide is an open-source project that let us
@@ -1,5 +1,8 @@
# How to schedule your network for Halide backend {#tutorial_dnn_halide_scheduling}
@prev_tutorial{tutorial_dnn_halide}
@next_tutorial{tutorial_dnn_android}
## Introduction
Halide code is the same for every device we use. But for achieving the satisfied
efficiency we should schedule computations properly. In this tutorial we describe
@@ -1,5 +1,8 @@
# How to run deep networks in browser {#tutorial_dnn_javascript}
@prev_tutorial{tutorial_dnn_yolo}
@next_tutorial{tutorial_dnn_custom_layers}
## Introduction
This tutorial will show us how to run deep learning models using OpenCV.js right
in a browser. Tutorial refers a sample of face detection and face recognition
@@ -1,6 +1,9 @@
YOLO DNNs {#tutorial_dnn_yolo}
===============================
@prev_tutorial{tutorial_dnn_android}
@next_tutorial{tutorial_dnn_javascript}
Introduction
------------
@@ -3,6 +3,8 @@ Deep Neural Networks (dnn module) {#tutorial_table_of_content_dnn}
- @subpage tutorial_dnn_googlenet
*Languages:* C++
*Compatibility:* \> OpenCV 3.3
*Author:* Vitaliy Lyudvichenko
@@ -11,6 +13,8 @@ Deep Neural Networks (dnn module) {#tutorial_table_of_content_dnn}
- @subpage tutorial_dnn_halide
*Languages:* Halide
*Compatibility:* \> OpenCV 3.3
*Author:* Dmitry Kurtaev
@@ -19,6 +23,8 @@ Deep Neural Networks (dnn module) {#tutorial_table_of_content_dnn}
- @subpage tutorial_dnn_halide_scheduling
*Languages:* Halide
*Compatibility:* \> OpenCV 3.3
*Author:* Dmitry Kurtaev
@@ -27,6 +33,8 @@ Deep Neural Networks (dnn module) {#tutorial_table_of_content_dnn}
- @subpage tutorial_dnn_android
*Languages:* Java
*Compatibility:* \> OpenCV 3.3
*Author:* Dmitry Kurtaev
@@ -35,6 +43,8 @@ Deep Neural Networks (dnn module) {#tutorial_table_of_content_dnn}
- @subpage tutorial_dnn_yolo
*Languages:* C++, Python
*Compatibility:* \> OpenCV 3.3.1
*Author:* Alessandro de Oliveira Faria
@@ -43,6 +53,8 @@ Deep Neural Networks (dnn module) {#tutorial_table_of_content_dnn}
- @subpage tutorial_dnn_javascript
*Languages:* JavaScript
*Compatibility:* \> OpenCV 3.3.1
*Author:* Dmitry Kurtaev
@@ -51,6 +63,8 @@ Deep Neural Networks (dnn module) {#tutorial_table_of_content_dnn}
- @subpage tutorial_dnn_custom_layers
*Languages:* C++, Python
*Compatibility:* \> OpenCV 3.4.1
*Author:* Dmitry Kurtaev
@@ -1,6 +1,9 @@
AKAZE local features matching {#tutorial_akaze_matching}
=============================
@prev_tutorial{tutorial_detection_of_planar_objects}
@next_tutorial{tutorial_akaze_tracking}
Introduction
------------
@@ -1,6 +1,9 @@
AKAZE and ORB planar tracking {#tutorial_akaze_tracking}
=============================
@prev_tutorial{tutorial_akaze_matching}
@next_tutorial{tutorial_homography}
Introduction
------------
@@ -1,6 +1,10 @@
Detection of planar objects {#tutorial_detection_of_planar_objects}
===========================
@prev_tutorial{tutorial_feature_homography}
@next_tutorial{tutorial_akaze_matching}
The goal of this tutorial is to learn how to use *features2d* and *calib3d* modules for detecting
known planar objects in scenes.
@@ -1,6 +1,9 @@
Feature Description {#tutorial_feature_description}
===================
@prev_tutorial{tutorial_feature_detection}
@next_tutorial{tutorial_feature_flann_matcher}
Goal
----
@@ -1,6 +1,9 @@
Feature Detection {#tutorial_feature_detection}
=================
@prev_tutorial{tutorial_corner_subpixels}
@next_tutorial{tutorial_feature_description}
Goal
----
@@ -1,6 +1,9 @@
Feature Matching with FLANN {#tutorial_feature_flann_matcher}
===========================
@prev_tutorial{tutorial_feature_description}
@next_tutorial{tutorial_feature_homography}
Goal
----
@@ -27,7 +30,7 @@ Binary descriptors (ORB, BRISK, ...) are matched using the <a href="https://en.w
This distance is equivalent to count the number of different elements for binary strings (population count after applying a XOR operation):
\f[ d_{hamming} \left ( a,b \right ) = \sum_{i=0}^{n-1} \left ( a_i \oplus b_i \right ) \f]
To filter the matches, Lowe proposed in @cite Lowe:2004:DIF:993451.996342 to use a distance ratio test to try to eliminate false matches.
To filter the matches, Lowe proposed in @cite Lowe04 to use a distance ratio test to try to eliminate false matches.
The distance ratio between the two nearest matches of a considered keypoint is computed and it is a good match when this value is below
a threshold. Indeed, this ratio allows helping to discriminate between ambiguous matches (distance ratio between the two nearest neighbors
is close to one) and well discriminated matches. The figure below from the SIFT paper illustrates the probability that a match is correct
@@ -1,6 +1,9 @@
Features2D + Homography to find a known object {#tutorial_feature_homography}
==============================================
@prev_tutorial{tutorial_feature_flann_matcher}
@next_tutorial{tutorial_detection_of_planar_objects}
Goal
----
@@ -1,6 +1,8 @@
Basic concepts of the homography explained with code {#tutorial_homography}
====================================================
@prev_tutorial{tutorial_akaze_tracking}
@tableofcontents
Introduction {#tutorial_homography_Introduction}
View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

@@ -89,6 +89,8 @@ OpenCV.
- @subpage tutorial_detection_of_planar_objects
*Languages:* C++
*Compatibility:* \> OpenCV 2.0
*Author:* Victor Eruhimov
@@ -108,6 +110,8 @@ OpenCV.
- @subpage tutorial_akaze_tracking
*Languages:* C++
*Compatibility:* \> OpenCV 3.0
*Author:* Fedor Morozov
@@ -116,6 +120,8 @@ OpenCV.
- @subpage tutorial_homography
*Languages:* C++, Java, Python
*Compatibility:* \> OpenCV 3.0
This tutorial will explain the basic concepts of the homography with some
@@ -1,6 +1,9 @@
Detecting corners location in subpixels {#tutorial_corner_subpixels}
=======================================
@prev_tutorial{tutorial_generic_corner_detector}
@next_tutorial{tutorial_feature_detection}
Goal
----
@@ -1,6 +1,10 @@
Creating your own corner detector {#tutorial_generic_corner_detector}
=================================
@prev_tutorial{tutorial_good_features_to_track}
@next_tutorial{tutorial_corner_subpixels}
Goal
----
@@ -1,6 +1,9 @@
Shi-Tomasi corner detector {#tutorial_good_features_to_track}
==========================
@prev_tutorial{tutorial_harris_detector}
@next_tutorial{tutorial_generic_corner_detector}
Goal
----
@@ -1,6 +1,8 @@
Harris corner detector {#tutorial_harris_detector}
======================
@next_tutorial{tutorial_good_features_to_track}
Goal
----
@@ -3,6 +3,8 @@ Similarity check (PNSR and SSIM) on the GPU {#tutorial_gpu_basics_similarity}
===========================================
@todo update this tutorial
@next_tutorial{tutorial_gpu_thrust_interop}
Goal
----
@@ -2,6 +2,8 @@
Using a cv::cuda::GpuMat with thrust {#tutorial_gpu_thrust_interop}
===========================================
@prev_tutorial{tutorial_gpu_basics_similarity}
Goal
----
@@ -7,6 +7,8 @@ run the OpenCV algorithms.
- @subpage tutorial_gpu_basics_similarity
*Languages:* C++
*Compatibility:* \> OpenCV 2.0
*Author:* Bernát Gábor
@@ -17,6 +19,8 @@ run the OpenCV algorithms.
- @subpage tutorial_gpu_thrust_interop
*Languages:* C++
*Compatibility:* \>= OpenCV 3.0
This tutorial will show you how to wrap a GpuMat into a thrust iterator in order to be able to
@@ -5,6 +5,8 @@ This section contains tutorials about how to read/save your image files.
- @subpage tutorial_raster_io_gdal
*Languages:* C++
*Compatibility:* \> OpenCV 2.0
*Author:* Marvin Smith

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 556 B

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