Commit Graph

33113 Commits

Author SHA1 Message Date
Alexander Smorkalov
6d2cbc4055
Merge pull request #23761 from LaurentBerger:typeblobfromimages
checktype in blobFromImages and blobFromImagesWithParams
2023-06-08 09:59:01 +03:00
Alexander Smorkalov
6d0add4285
Merge pull request #23762 from TolyaTalamanov:at/gapi-ov-backend-hotfix
G-API: OpenVINO Backend Hotfix
2023-06-08 09:50:34 +03:00
Christine Poerschke
f597838685 imgproc: optimise local cost computation in IntelligentScissorsMB::buildMap 2023-06-07 22:06:52 +01:00
TolyaTalamanov
af95395fe7 Fix ifdef condition 2023-06-07 15:42:54 +01:00
unknown
5f8e43da85 checktype in blobFromImages and blobFromImagesWithParams 2023-06-07 16:15:58 +02:00
Abduragim Shtanchaev
6b53fe8f7b
Merge pull request #23746 from Abdurrahheem:ash/graph_simplifier
Assertion Fix in Split Layer #23746

### Pull Request Readiness Checklist

This PR fixes issue mentioned in [#23663](https://github.com/opencv/opencv/issues/23663)
Merge with https://github.com/opencv/opencv_extra/pull/1067

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-06-07 16:01:42 +03:00
Christine Poerschke
d3e7968927
Merge pull request #23688 from cpoerschke:4.x-pr-21959-prep
imgproc: add contour values check to IntelligentScissorsMB tests

Preparation for the #21959 changes as per @asmorkalov's https://github.com/opencv/opencv/pull/21959#issuecomment-1560511500 suggestion.

### 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
- [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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2023-06-07 11:32:17 +03:00
Alexander Smorkalov
b9ce87e8e2
Merge pull request #23750 from mshabunin:fix-bgr2hls-access
imgproc/cvtColor: fixed invalid read in BGR2HLS
2023-06-06 11:34:08 +03:00
Alexander Smorkalov
af03e000c7
Merge pull request #23732 from vekkuli:vekkuli-patch-create-featherblender
Fix missuse of try_gpu in stitching/FeatherBlender
2023-06-06 10:00:36 +03:00
Alexander Smorkalov
635bbfe92b
Merge pull request #23748 from AleksandrPanov:fix_cornerRefinementMethod_binding
fix Java bindings for cornerRefinementMethod binding
2023-06-06 09:59:13 +03:00
Maksim Shabunin
adab462e42 imgproc/cvtColor: fixed invalid read in BGR2HLS 2023-06-05 23:25:44 +03:00
Alex
b5ac7ef2f2 fix cornerRefinementMethod binding 2023-06-05 11:04:11 +03:00
Wang Kai
983925c685 fixing typo 2023-06-04 19:06:26 +08:00
Alexander Smorkalov
84457a5dcd
Merge pull request #23729 from asmorkalov:as/create_samples_overflow
Fixed potential buffer overflow of user file name in create_samples_app
2023-06-03 10:13:11 +03:00
Jaakko Rantala
385003e9fe
Update blenders.cpp
Removed passing try_gpu parameter to FeatherBlender constructor because it only has sharpness parameter.
2023-06-02 16:46:05 +03:00
Alexander Panov
9fa014edcd
Merge pull request #23264 from AleksandrPanov:add_detect_qr_with_aruco
Add detect qr with aruco #23264

Using Aruco to detect finder patterns to search QR codes.

TODO (in next PR):
- add single QR detect (update `detect()` and `detectAndDecode()`)
- need reduce full enumeration of finder patterns
- need add finder pattern info to `decode` step
- need to merge the pipeline of the old and new algorithm

[Current results:](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit#gid=1192415584)
+20% total detect, +8% total decode in OpenCV [QR benchmark](https://github.com/opencv/opencv_benchmarks/tree/develop/python_benchmarks/qr_codes) 

![res1](https://user-images.githubusercontent.com/22337800/231228556-191d3eae-a318-44e1-af99-e7d420bf6248.png)


78.4% detect, 58.7% decode vs 58.5 detect, 50.5% decode in default

[main.py.txt](https://github.com/opencv/opencv/files/10762369/main.py.txt)

![res2](https://user-images.githubusercontent.com/22337800/231229123-ed7f1eda-159a-444b-a3ff-f107d8eb4a20.png)


add new info to [google docs](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit?usp=sharing)


### 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
2023-06-02 16:18:24 +03:00
Anatoliy Talamanov
5330112f05
Merge pull request #23595 from TolyaTalamanov:at/implement-openvino-backend
[G-API] Implement OpenVINO 2.0 backend #23595

### Pull Request Readiness Checklist

Implemented basic functionality for `OpenVINO` 2.0 G-API backend.

#### Overview
- [x] Implement `Infer` kernel with some of essential configurable parameters + IR/Blob models format support.
- [ ] Implement the rest of kernels: `InferList`, `InferROI`, `Infer2` + other configurable params (e.g reshape)
- [x] Asyncrhonous execution support
- [ ] Remote context support

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
- [ ] The PR is proposed to the proper branch
- [ ] 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-06-02 14:31:03 +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
Alexander Smorkalov
36d6ca529d
Merge pull request #23721 from asmorkalov:as/openjpeg_2.5_warning_fix
Fixed OpenJPEG 2000 compiler warning for some GCC versions (#23710)
2023-06-02 09:40:45 +03:00
Alexander Smorkalov
2104d61d4a
Merge pull request #23668 from TolyaTalamanov:at/fix-resize-applying-logic-ie-backend
WIP: [G-API] IE Backend: Update the condition for applying the resize preprocessing
2023-06-01 13:55:07 +03:00
Alexander Smorkalov
fe7c5e3f64
Merge pull request #23722 from asmorkalov:as/python_classifiers_update
Python package classifiers sync with OpenCV-Python repo
2023-06-01 13:53:36 +03:00
Alexander Smorkalov
0787c31f41 Python package classifiers sync with OpenCV-Python repo. 2023-06-01 10:49:27 +03:00
Alexander Smorkalov
2f805ff7ad Fixed OpenJPEG 2000 compiler warning for some GCC versions (#23710). 2023-06-01 10:21:43 +03:00
Anna Khakimova
6d3dd24622
Merge pull request #21797 from anna-khakimova:ak/merge3_extend_supported_types
GAPI Fluid SIMD:Add support of new several types for the Merge3

- Support of the new several types was added.
- Fixes for the Split/Merge and ConvertTo issues.
2023-05-31 14:59:39 +03:00
Dmitry Matveev
fc5d412ba7
Merge pull request #23597 from dmatveev:dm/gapi_onnx_py_integration
G-API: Integration branch for ONNX & Python-related changes #23597

# Changes overview

## 1. Expose ONNX backend's Normalization and Mean-value parameters in Python

* Since Python G-API bindings rely on `Generic` infer to express Inference, the `Generic` specialization of `onnx::Params` was extended with new methods to control normalization (`/255`) and mean-value; these methods were exposed in the Python bindings
* Found some questionable parts in the existing API which I'd like to review/discuss (see comments)

UPD:
1. Thanks to @TolyaTalamanov normalization inconsistencies have been identified with `squeezenet1.0-9` ONNX model itself; tests using these model were updated to DISABLE normalization and NOT using mean/value.
2. Questionable parts were removed and tests still pass.

### Details (taken from @TolyaTalamanov's comment):

`squeezenet1.0.*onnx` - doesn't require scaling to [0,1] and mean/std because the weights of the first convolution already scaled. ONNX documentation is broken. So the correct approach to use this models is:

1. ONNX: apply preprocessing from the documentation: https://github.com/onnx/models/blob/main/vision/classification/imagenet_preprocess.py#L8-L44 but without normalization step:
```
# DON'T DO IT:
# mean_vec = np.array([0.485, 0.456, 0.406])
# stddev_vec = np.array([0.229, 0.224, 0.225])
# norm_img_data = np.zeros(img_data.shape).astype('float32')
# for i in range(img_data.shape[0]):
#     norm_img_data[i,:,:] = (img_data[i,:,:]/255 - mean_vec[i]) / stddev_vec[i]
#     # add batch channel
#     norm_img_data = norm_img_data.reshape(1, 3, 224, 224).astype('float32')
#     return norm_img_data

# INSTEAD
return img_data.reshape(1, 3, 224, 224)
```

2. G-API: Convert image from BGR to RGB and then pass to `apply` as-is with configuring parameters:
```
net = cv.gapi.onnx.params('squeezenet', model_filename)
net.cfgNormalize('data_0', False)
```
**Note**: Results might be difference because `G-API` doesn't apply central crop but just do resize to model resolution.

---

`squeezenet1.1.*onnx` - requires scaling to [0,1] and mean/std - onnx documentation is correct.
1. ONNX: apply preprocessing from the documentation: https://github.com/onnx/models/blob/main/vision/classification/imagenet_preprocess.py#L8-L44
2. G-API: Convert image from BGR to RGB and then pass to `apply` as-is with configuring parameters:
```
net = cv.gapi.onnx.params('squeezenet', model_filename)
net.cfgNormalize('data_0', True) // default
net.cfgMeanStd('data_0', [0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
```
**Note**: Results might be difference because `G-API` doesn't apply central crop but just do resize to model resolution.

## 2. Expose Fluid & kernel package-related functionality in Python

* `cv::gapi::combine()`
* `cv::GKernelPackage::size()` (mainly for testing purposes)
* `cv::gapi::imgproc::fluid::kernels()`

Added a test for the above.

## 3. Fixed issues with Python stateful kernel handling

Fixed error message when `outMeta()` of custom python operation fails.

## 4. Fixed various issues in Python tests

1. `test_gapi_streaming.py` - fixed behavior of Desync test to avoid sporadic issues
2. `test_gapi_infer_onnx.py` - fixed model lookup (it was still using the ONNX Zoo layout but was NOT using the proper env var we use to point to one).

### 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-30 17:52:17 +03:00
Pierre Chatelier
93d490213f
Merge pull request #23690 from chacha21:rotatedRectangleIntersection_precision
better accuracy for _rotatedRectangleIntersection() (proposal for #23546) #23690

_rotatedRectangleIntersection() can be (statically) customized to use double instead of float for better accuracy
this is a proposal for experimentation around #23546

for better accuracy, _rotatedRectangleIntersection() could use double. It will still return cv::Point2f list for backward compatibility, but the inner computations are controlled by a typedef

- [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-30 17:46:39 +03:00
Alexander Smorkalov
c55aee1e79
Merge pull request #23707 from Orange-OpenSource:ONNX_Squeeze_negative_index_for_the_axes_attribute
Addition of normalize_axis to ONNXImporter::parseSqueeze
2023-05-30 16:33:25 +03:00
Olivier Hotel
0442c6fa81 Addition of normalize_axis to ONNXImporter::parseSqueeze to support negative values for the axes attribut.
Negative values are part of the ONNX optset>=11.

Signed-off-by: Olivier Hotel <olivier.hotel@orange.com>
2023-05-30 10:21:27 +02:00
Alexander Smorkalov
1457320702
Merge pull request #23703 from Abdurrahheem:ash/graph_simplifier
Added missing index for skipping subgraph simplification
2023-05-30 10:31:00 +03:00
Abduragim Shtanchaev
ecd2e8ff47 added index that check all inputs of nodes that
match
2023-05-29 14:48:42 +03:00
Alexander Smorkalov
02397ef851
Merge pull request #23567 from seanm:UBSan-overflow
Reformulated some pointer arithmetic to avoid (unsigned) overflow
2023-05-29 12:19:34 +03:00
Alexander Smorkalov
f1076541d1
Merge pull request #23514 from tappytaps:mac-catalyst-fix
updated mac catalyst target to be compatible with latest xCode / macos
2023-05-29 12:18:16 +03:00
Christine Poerschke
b5e9eb742c
Merge pull request #23698 from cpoerschke:4.x-pr-21959-perf
imgproc: add basic IntelligentScissorsMB performance test #23698

Adding basic performance test that can be used before and after the #21959 changes etc. as per @asmorkalov's https://github.com/opencv/opencv/pull/21959#issuecomment-1565240926 comment.

### 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
- [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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2023-05-29 11:02:59 +03:00
Alexander Smorkalov
6ad77b2319
Merge pull request #23682 from asmorkalov:as/openjpeg_2.5.0
3rdparty: OpenJPEG update 2.4.0 => 2.5.0
2023-05-29 08:56:57 +03:00
Alexander Smorkalov
67e0ed93a9
Merge pull request #23695 from triple-Mu:triplemu/fix-python-binding
Update setup.py
2023-05-27 18:29:33 +03:00
triple Mu
1bffe170e1
Update setup.py
Fix error:
UnboundLocalError: local variable 'typing_stub_files' referenced before assignment
2023-05-27 17:23:32 +08:00
Alexander Smorkalov
7b998c30e7
Merge pull request #23694 from dkurt:update_matchTemplateMask
Update matchTemplate with mask
2023-05-27 09:42:55 +03:00
Sean McBride
2083fdc9c0 Fixed UBSan warning about undefined pointer arithmetic overflow
Pointer arithmetic overflow is always undefined, whether signed or unsigned.

It warned here:

`Addition of unsigned offset to 0x00017fd31b97 overflowed to 0x00017fd30c97`

Convert the offset to a signed number, so that we can offset either forward or backwards.

In my own use of OpenCV at least, this is the only case of pointer arithmetic overflow.
2023-05-26 15:54:52 -04:00
Alexander Smorkalov
d1b158b9dd
Merge pull request #23692 from asmorkalov:as/ffmpeg_fps_3.4
backport to 3.4: Fixed FPS computation on some videos for FFmpeg backend
2023-05-26 20:47:13 +03:00
Dmitry Kurtaev
380caa1a87
Merge pull request #23691 from dkurt:pycv_float16_fixes
Import and export np.float16 in Python #23691

### Pull Request Readiness Checklist

* Also, fixes `cv::norm` with `NORM_INF` and `CV_16F`

resolves https://github.com/opencv/opencv/issues/23687

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-26 18:56:21 +03:00
Alexander Smorkalov
900f17d563
Merge pull request #23677 from asmorkalov:as/objc_naming_backport
ObjC naming backport from 5.x
2023-05-26 18:54:34 +03:00
Dmitry Kurtaev
c97942cf78 Fix mask thresholding 2023-05-26 18:51:33 +03:00
captain-n3m0
6157db6462 Fixed matchTemplate function. #23585 2023-05-26 18:51:01 +03:00
Duong Dac
a9424868a1
Merge pull request #20370 from ddacw:stub-gen-next
Python typing stub generation #20370

Add stub generation to `gen2.py`, addressing #14590.

### 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 other license that is incompatible with OpenCV
- [x] The PR is proposed to proper branch
- [x] There is reference to 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
2023-05-26 18:25:46 +03:00
Alexander Smorkalov
749935866d
Merge pull request #23664 from asmorkalov:as/solveLP_infeasible
Added final constrants check to solveLP to filter out flating-point numeric issues
2023-05-26 15:13:49 +03:00
Alexander Smorkalov
cbda161c39 Fixed FPS computation on some videos for FFmpeg backend. 2023-05-26 14:36:13 +03:00
Alexander Smorkalov
a63636171e Re-integrated OpenJPEG 2.5.0 to OpenCV. 2023-05-26 14:14:30 +03:00
Alexander Smorkalov
cf0ba039c3
Merge pull request #23625 from zihaomu:improve_conv
DNN: Remove unnecessary flags for convolution
2023-05-26 12:59:36 +03:00
Alexander Smorkalov
c75d0b8ca3
Merge pull request #23684 from LaurentBerger:I23683
solve Issue I23683
2023-05-26 12:01:50 +03:00
Alexander Smorkalov
a2b679bc26
Merge pull request #23686 from LaurentBerger:I23685
solve Issue 23685
2023-05-26 10:53:29 +03:00