Commit Graph

357 Commits

Author SHA1 Message Date
Maksim Shabunin
26ea34c4cb Merge branch '4.x' into '5.x' 2024-06-26 19:01:34 +03:00
Yuantao Feng
bc0618b688
Merge pull request #25582 from fengyuentau:dnn/dump_pbtxt
Current net exporter `dump` and `dumpToFile` exports the network structure (and its params) to a .dot file which works with `graphviz`. This is hard to use and not friendly to new user. What's worse, the produced picture is not looking pretty.
dnn: better net exporter that works with netron #25582

This PR introduces new exporter `dumpToPbtxt` and uses this new exporter by default with environment variable `OPENCV_DNN_NETWORK_DUMP`. It mimics the string output of a onnx model but modified with dnn-specific changes, see below for an example.

![image](https://github.com/opencv/opencv/assets/17219438/0644bed1-da71-4019-8466-88390698e4df)

## Usage

Call `cv::dnn::Net::dumpToPbtxt`:

```cpp
TEST(DumpNet, dumpToPbtxt) {
    std::string path = "/path/to/model.onnx";
    auto net = readNet(path);

    Mat input(std::vector<int>{1, 3, 640, 480}, CV_32F);
    net.setInput(input);

    net.dumpToPbtxt("yunet.pbtxt");
}
```

Set `export OPENCV_DNN_NETWORK_DUMP=1`

```cpp
TEST(DumpNet, env) {
    std::string path = "/path/to/model.onnx";
    auto net = readNet(path);

    Mat input(std::vector<int>{1, 3, 640, 480}, CV_32F);
    net.setInput(input);

    net.forward();
}
```

---

Note:
- `pbtxt` is registered as one of the ONNX model suffix in netron. So you can see `module: ai.onnx` and such in the model.
- We can get the string output of an ONNX model with the following script

```python
import onnx
net = onnx.load("/path/to/model.onnx")
net_str = str(net)
file = open("/path/to/model.pbtxt", "w")
file.write(net_str)
file.close()
```

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-05-17 11:07:05 +03:00
Kumataro
c577b24406
Merge pull request #25445 from Kumataro:fix25403
apps: createsamples: fix comment to remove last backslash #25445

Close #25403

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-04-18 18:11:07 +03:00
WU Jia
aa5ea340f7
Move objdetect HaarCascadeClassifier and HOGDescriptor to contrib xobjdetect (#25198)
* Move objdetect parts to contrib

* Move objdetect parts to contrib

* Minor fixes.
2024-03-21 23:40:10 +03:00
Maksim Shabunin
8cbdd0c833
Merge pull request #25075 from mshabunin:cleanup-imgproc-1
C-API cleanup: apps, imgproc_c and some constants #25075

Merge with https://github.com/opencv/opencv_contrib/pull/3642

* Removed obsolete apps - traincascade and createsamples (please use older OpenCV versions if you need them). These apps relied heavily on C-API
* removed all mentions of imgproc C-API headers (imgproc_c.h, types_c.h) - they were empty, included core C-API headers
* replaced usage of several C constants with C++ ones (error codes, norm modes, RNG modes, PCA modes, ...) - most part of this PR (split into two parts - all modules and calib+3d - for easier backporting)
* removed imgproc C-API headers (as separate commit, so that other changes could be backported to 4.x)

Most of these changes can be backported to 4.x.
2024-03-05 12:18:31 +03:00
Alexander Smorkalov
daa8f7dfc6 Partially back-port #25075 to 4.x 2024-03-05 12:15:39 +03:00
Alexander Smorkalov
12b7aac1a0 Dump board poses human-readable and machine-readable format. 2024-02-14 15:17:01 +03:00
lpanaf
0957437bbe Save ground truth in calibration data generator. 2024-02-14 14:26:18 +03:00
Alexander Smorkalov
fdab565711 Merge branch 4.x 2023-09-13 14:49:25 +03:00
Yuriy Chernyshov
494d201fda Add missing <sstream> includes 2023-09-05 22:04:26 +03:00
Alexander Smorkalov
47188b7c7e Merge branch 4.x 2023-07-28 13:05:36 +03:00
Alexander Smorkalov
5af40a0269 Merge branch 4.x 2023-07-05 15:51:10 +03:00
Alexander Smorkalov
004801f1c5 Merge remote-tracking branch 'origin/3.4' into merge-3.4 2023-06-20 09:56:57 +03:00
Alexander Smorkalov
66f86e898c Fixed potential buffer overflow of user file name in create_samples_app 2023-06-02 10:33:24 +03:00
Fabrizio Di Vittorio
044a322519
Merge pull request #23594 from fdivitto:fdivitto-traincascade-patch
fix: traincascade, use C++ persistence API #23594

This pull allows to compile traincascade application with OpenCV 4.6. Changes uses new persistence C++ API in place of legacy one.
2023-05-23 09:19:27 +03:00
Vladimir Ponomarev
9931da772d
Merge pull request #23363 from vovka643:4.x_generate_charuco
Added charuco board generation to gen_pattern.py #23363

added charuco board generation in gen_pattern.py
moved aruco_dict_utils.cpp to samples from opencv_contrib (https://github.com/opencv/opencv_contrib/pull/3464)

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2023-05-19 20:25:59 +03:00
unknown
2c4079fa4b remove unused var 2023-05-15 17:51:12 +02:00
Alexander Smorkalov
f7bee7883b
Merge pull request #23479 from vovka643:4.x_charuco_calib
Charuco board into interactive calibration
2023-05-05 11:25:36 +03:00
vovka643
f7e52076b6 Define charuco board parameters with command line 2023-05-05 10:08:21 +03:00
Sean McBride
47bea69322
Merge pull request #23055 from seanm:sprintf2
* Replaced most remaining sprintf with snprintf
* Deprecated encodeFormat and introduced new method that takes the buffer length
* Also increased buffer size at call sites to be a little bigger, in case int is 64 bit
2023-04-18 09:22:59 +03:00
Maksym Ivashechkin
67a3d35b4e
Merge pull request #22363 from ivashmak:multiview-calib
Add multiview calibration [GSOC 2022]

### Pull Request Readiness Checklist

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake

The usage tutorial is on Google Docs following this link: https://docs.google.com/document/d/1k6YpD0tpSVqnVnvU2nzE34K3cp_Po6mLWqXV06CUHwQ/edit?usp=sharing
2023-03-23 15:42:41 +03:00
Alexander Alekhin
f33598f55e Merge branch 4.x 2023-01-28 17:31:32 +00:00
Alexander Alekhin
18cbfa4a4f Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2023-01-23 00:11:12 +00:00
Alexander Alekhin
593a376566 Merge branch 4.x 2023-01-09 11:08:02 +00:00
Christoph Rackwitz
a64b51dd94
Merge pull request #23108 from crackwitz:issue-23107
Usage of imread(): magic number 0, unchecked result

* docs: rewrite 0/1 to IMREAD_GRAYSCALE/IMREAD_COLOR in imread()

* samples, apps: rewrite 0/1 to IMREAD_GRAYSCALE/IMREAD_COLOR in imread()

* tests: rewrite 0/1 to IMREAD_GRAYSCALE/IMREAD_COLOR in imread()

* doc/py_tutorials: check imread() result
2023-01-09 09:55:31 +00:00
Alexander Panov
121034876d
Merge pull request #22986 from AleksandrPanov:move_contrib_charuco_to_main_objdetect
merge with https://github.com/opencv/opencv_contrib/pull/3394

move Charuco API from contrib to main repo:

- add CharucoDetector:
```
CharucoDetector::detectBoard(InputArray image, InputOutputArrayOfArrays markerCorners, InputOutputArray markerIds, 
                             OutputArray charucoCorners, OutputArray charucoIds) const // detect charucoCorners and/or markerCorners
CharucoDetector::detectDiamonds(InputArray image, InputOutputArrayOfArrays _markerCorners,
                                InputOutputArrayOfArrays _markerIds, OutputArrayOfArrays _diamondCorners,
                                OutputArray _diamondIds) const
```

- add `matchImagePoints()` for `CharucoBoard`
- remove contrib aruco dependencies from interactive-calibration tool
- move almost all aruco tests to objdetect

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2022-12-28 17:28:59 +03:00
Alexander Panov
b4b35cff15
Merge pull request #22368 from AleksandrPanov:move_contrib_aruco_to_main_objdetect
Megre together with https://github.com/opencv/opencv_contrib/pull/3325

1. Move aruco_detector, aruco_board, aruco_dictionary, aruco_utils to objdetect
1.1 add virtual Board::draw(), virtual ~Board()
1.2 move `testCharucoCornersCollinear` to Board classes (and rename to `checkCharucoCornersCollinear`)
1.3 add wrappers to keep the old api working
3. Reduce inludes
4. Fix java tests (add objdetect import)
5. Refactoring

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake

```
**WIP**
force_builders=linux,win64,docs,Linux x64 Debug,Custom
Xbuild_contrib:Docs=OFF

build_image:Custom=ubuntu:22.04
build_worker:Custom=linux-1
```
2022-12-16 12:28:47 +03:00
Alexander Alekhin
c25f776151 Merge branch 4.x 2022-08-21 15:27:31 +00:00
rogday
04e01e2b31 Add new params 2022-08-05 15:08:16 +03:00
Alexander Smorkalov
47a59d72c9 Merge pull request #22135 from rogday:force_reopen 2022-08-05 11:14:23 +00:00
Alexander Smorkalov
163770f99a Merge pull request #22146 from rogday:symcircles 2022-08-05 11:13:14 +00:00
Smirnov Egor
08696d92ea Add option to force reopen camera in interactive calibration tool 2022-07-26 15:43:40 +03:00
Smirnov Egor
2c2466fb25 Add symmetric circles board 2022-07-26 15:39:33 +03:00
rogday
33b1e76e48 fix save_frames parameter 2022-07-18 12:53:04 +03:00
rogday
b91f173680
Merge pull request #22147 from rogday:zoom_factor
Add zoom factor to interactive calibration tool

* add zoom factor

* address review comments
2022-06-30 23:31:52 +03:00
Alexander Alekhin
2a4926f417 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2022-06-26 14:22:24 +00:00
Sean McBride
35f1a90df7
Merge pull request #22149 from seanm:sprintf
Replaced sprintf with safer snprintf

* Straightforward replacement of sprintf with safer snprintf

* Trickier replacement of sprintf with safer snprintf

Some functions were changed to take another parameter: the size of the buffer, so that they can pass that size on to snprintf.
2022-06-25 06:48:22 +03:00
Christine Poerschke
db5b22e895
Merge pull request #22065 from cpoerschke:3.4-apps-visualisation-configurable-codec
* apps/opencv_visualisation: configurable video codec

* Update apps/visualisation/opencv_visualisation.cpp
2022-06-17 14:48:30 +03:00
Alexander Smorkalov
533bb035cf Save Frames option for interactive calibration tool
The option to save all frames that contribute to final calibration result.
Useful for dataset collection and further offline tuning.
2022-06-10 09:32:58 +03:00
Lukas-Alexander Weber
8ca394efaf
Merge pull request #22005 from lukasalexanderweber:delete_stitching_tool
Move stitching package and tool to a dedicated repository

* deleted moved files

* Update README.md
2022-05-26 22:30:24 +03:00
Alexander Alekhin
d9bf522b27 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2022-05-23 16:06:14 +00:00
Alexander Alekhin
89f8d4ae12 build: GCC12 warnings 2022-05-15 16:21:16 +00:00
Alexander Alekhin
899b4d1452 Merge branch 4.x 2022-02-22 19:55:26 +00:00
Lukas-Alexander Weber
d37bcbdc92
Merge pull request #21420 from lukasalexanderweber:4.x
Introduce Cropping to OpenCV Stitching Tool

* Introduced Cropping

* integrate https://github.com/opencv/opencv/pull/21413/

* fixed failing subsetter tests

* updated stuff
2022-02-01 16:56:44 +00:00
Alexander Alekhin
a0d5277e0d Merge branch 4.x 2021-12-30 21:43:45 +00:00
Alexander Alekhin
c78a8dfd2d fix 4.x links 2021-12-22 13:24:30 +00:00
Lukas-Alexander Weber
fa5c7a9e75
Merge pull request #21020 from lukasalexanderweber:squash
Created Stitching Tool based on stitching_detailed.py
2021-11-08 11:54:06 +00:00
Alexander Alekhin
7ba26ada12 Merge branch 4.x 2021-10-15 21:53:39 +00:00
rogday
6801dd043d
Merge pull request #20494 from rogday:onnx_diagnostic_fix
fix ONNXImporter diagnostic mode layer registration issue

* fix layer registration, thread unsafe access and align the behavior of DNN_DIAGNOSTICS_RUN between onnx and tf importers

* move skipModelInput

* print all missing layers

* address TF issue
2021-08-20 14:43:47 +00:00
Smirnov Egor
dc5199feea skipping missing layers and layer failures 2021-06-25 11:26:37 +03:00