Commit Graph

24488 Commits

Author SHA1 Message Date
Rostislav Vasilikhin
69af621ef6
Merge pull request #25506 from savuor:rv/hal_mul16
HAL mul8x8to16 added #25506

Fixes #25034

### 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
2024-05-20 10:43:18 +03:00
Rostislav Vasilikhin
83e32c4d37
Merge pull request #25511 from savuor:rv/hal_projectpoints
HAL for projectPoints() added #25511

### 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.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-05-20 10:42:17 +03:00
Cristian Dobre
e05ad56f6e
Merge pull request #24903 from cristidbr-adapta:feature-barcode-detector-parameters
Feature barcode detector parameters #24903

Attempt to solve #24902 without changing the default detector behaviour. 
Megre with extra: https://github.com/opencv/opencv_extra/pull/1150

**Introduces new parameters and methods to `cv::barcode::BarcodeDetector`**.

### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-05-20 09:53:22 +03:00
Maksim Shabunin
6350bfbf79
Merge pull request #25564 from mshabunin:cleanup-imgproc-2
imgproc: C-API cleanup, drawContours refactor #25564

Changes:
* moved several macros from types_c.h to cvdef.h (assuming we will continue using them)
* removed some cases of C-API usage in _imgproc_ module (`CV_TERMCRIT_*` and `CV_CMP_*`)
* refactored `drawContours` to use C++ API instead of calling `cvDrawContours` + test for filled contours with holes (case with non-filled contours is simpler and is covered in some other tests)

#### Note:
There is one case where old drawContours behavior doesn't match the new one - when `contourIdx == -1` (means "draw all contours") and `maxLevel == 0` (means draw only selected contours, but not what is inside).

From the docs:
> **contourIdx**	Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

> **maxLevel**	Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.


Old behavior - only one first contour is drawn:
![actual_screenshot_08 05 2024](https://github.com/opencv/opencv/assets/3304494/d0ae1d64-ddad-46bb-8acc-6f696874f71b)
a
New behavior (also expected by the test) - all contours are drawn:
![expected_screenshot_08 05 2024](https://github.com/opencv/opencv/assets/3304494/57ccd980-9dde-4006-90ee-19d6ce76912a)
2024-05-17 15:01:05 +03:00
Alexander Smorkalov
8aa129dce1
Merge pull request #25603 from asmorkalov:as/skip_vulkan_concat
Skip Test_Caffe_layers.Concat with Vulkan due to sporadic failures
2024-05-17 12:55:51 +03:00
Alexander Smorkalov
5f509e2ec1 Skip Test_Caffe_layers.Concat with Vulkan due to sporadic failures. 2024-05-17 11:54:25 +03:00
Alexander Smorkalov
5e7887897a
Merge pull request #25525 from sturkmen72:png-spng-test
improvements on tests of imagecodecs module
2024-05-17 11:37:12 +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
Alexander Smorkalov
0044047782
Merge pull request #25598 from asmorkalov:as/tables_range_check_core
Check range for type-dependant function tables #25598

Address https://github.com/opencv/opencv/issues/24703

### 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-05-17 10:48:40 +03:00
Alexander Smorkalov
78ed6de518
Merge pull request #25594 from LaurentBerger:I25587
typo
2024-05-16 08:46:56 +03:00
Suleyman TURKMEN
7d6b6161cc Update imgcodecs tests 2024-05-15 22:24:21 +03:00
CNOCycle
7713c84465
Merge pull request #25297 from CNOCycle:tflite/transpose
Support Transpose op in TFlite #25297

**Merge with extra**: https://github.com/opencv/opencv_extra/pull/1168

The purpose of this PR is to introduce support for the Transpose op in TFlite format and to add a shape comparison between the output tensors and the references. In some occasional cases, the shape of the output tensor is `[1,4,1,1]`, while the shape of the reference tensor is `[1,4]`. Consequently, the norm check incorrectly reports that the test has passed, as the residual is zero.

Below is a Python script for generating testing data. The generated data can be integrated into the repo `opencv_extra`.

```python
import numpy as np
import tensorflow as tf

PREFIX_TFL = '/path/to/opencv_extra/testdata/dnn/tflite/'

def generator(input_tensor, model, saved_name):

    # convert keras model to .tflite format
    converter = tf.lite.TFLiteConverter.from_keras_model(model)
    #converter.optimizations = [tf.lite.Optimize.DEFAULT]
    converter.optimizations = [None]
    tflite_model = converter.convert()
    with open(f'{PREFIX_TFL}/{saved_name}.tflite', 'wb') as f:
        f.write(tflite_model)

    # save the input tensor to .npy
    if input_tensor.ndim == 4:
        opencv_tensor = np.transpose(input_tensor, (0,3,1,2))
    else:
        opencv_tensor = input_tensor
    opencv_tensor = np.copy(opencv_tensor, order='C').astype(np.float32)
    np.save(f'{PREFIX_TFL}/{saved_name}_inp.npy', opencv_tensor)

    # generate output tenosr and save it to .npy
    mat_out = model(input_tensor).numpy()
    mat_out = np.copy(mat_out, order='C').astype(np.float32)
    if mat_out.ndim == 4:
        mat_out = np.transpose(mat_out, (0,3,1,2))
    interpreter = tf.lite.Interpreter(model_content=tflite_model)
    out_name = interpreter.get_output_details()[0]['name']
    np.save(f'{PREFIX_TFL}/{saved_name}_out_{out_name}.npy', mat_out)

def build_transpose():

    model_name = "keras_permute"
    mat_in = np.array([[[1,2,3], [4,5,6]]], dtype=np.float32)

    model = tf.keras.Sequential()
    model.add(tf.keras.Input(shape=(2,3)))
    model.add(tf.keras.layers.Permute((2,1)))
    model.summary()

    generator(mat_in, model, model_name)

if __name__ == '__main__':
    build_transpose()
```

### 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
- [ ] 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-15 20:07:25 +03:00
unknown
5009109167 typo 2024-05-15 16:16:07 +02:00
Laurent Berger
76d9f7aaeb
Merge pull request #25591 from LaurentBerger:I25589
Remove dnn::layer::allocate in doc #25591

### 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 #25589 
- [ ] 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-05-15 17:08:52 +03:00
Alexander Smorkalov
c034c46e69 Disable more streaming test in G-API due to instability. 2024-05-15 15:41:23 +03:00
Alexander Smorkalov
2e07ec1f87 Restored and extended Highgui test logic for small windows. 2024-05-15 12:47:22 +03:00
Kumataro
47a6ffb73c
Merge pull request #25561 from Kumataro:fix25560
highgui: wayland: expand image width if title bar cannot be shown

Close #25560

### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-05-15 11:00:46 +03:00
alexlyulkov
03507e06b4
Merge pull request #25518 from alexlyulkov:al/fixed-gemm-openvino
Fixed OpenVINO gemm layer #25518

Fixed OpenVINO gemm layer
The problem was that our layer didn't properly handle all the possible gemm options in OpenVINO mode
Fixes #25472

### 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
2024-05-14 17:41:19 +03:00
Alexander Smorkalov
f4e5438401
Merge pull request #25566 from asmorkalov:as/moments_documentation
Synchornized cv::moments documentation with actual implementation.
2024-05-14 17:19:41 +03:00
Alexander Smorkalov
58e007e183
Merge pull request #25583 from mshabunin:fix-emd-32bit
imgproc: fix allocation issue in EMD
2024-05-14 16:43:02 +03:00
Maksim Shabunin
1614b8df4e imgproc: fix allocation issue in EMD 2024-05-14 12:51:26 +03:00
Kumataro
8dc9ff5624
Merge pull request #25551 from Kumataro:fix25550
highgui: wayland: fix to pass highgui test #25551

Close #25550

- optimize Mat to XRGB8888 conversion with OpenCV functions
  - extend to support CV_8S/16U/16S/32F/64F
  - extend to support 1/4 channels
- fix to update value timing
 - initilize slider_ value if value is not nullptr.
 - Update user-ptr value and call on_change() function if cv_wl_trackbar::draw() is not called.
- Update usage of WAYLAND/XDG macro to avoid reference undefined macro.
- Update documents

### 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
2024-05-13 14:26:24 +03:00
Rostislav Vasilikhin
1d9a4120fa
Merge pull request #25565 from savuor:rv/hal_eq_hist
Merge pull request #25565 from savuor/rv/hal_eq_hist

HAL for equalizeHist() added #25565

fixes #25530

### 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
2024-05-09 08:37:55 +03:00
Alexander Smorkalov
55eebe81c3 Synchornized cv::moments documentation with actual implementation. 2024-05-09 08:30:36 +03:00
Alexander Smorkalov
1f1ba7e402
Merge pull request #25563 from asmorkalov:as/HAL_min_max_idx
Transform offset to indeces for MatND in minMaxIdx HAL #25563

Address comments in https://github.com/opencv/opencv/pull/25553

### 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-05-08 18:57:02 +03:00
Rostislav Vasilikhin
5bd64e09a3
Merge pull request #25554 from savuor:rv/hal_lut
Merge pull request #25554 from savuor:rv/hal_lut

HAL for LUT added #25554

### 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
2024-05-08 17:45:08 +03:00
Alexander Smorkalov
faa259ab34
Merge pull request #25553 from asmorkalov:as/HAL_min_max_idx
Fix HAL interface for hal_ni_minMaxIdx #25553

Fixes https://github.com/opencv/opencv/issues/25540

The original implementation call HAL with the same parameters independently from amount of channels. The patch uses HAL correctly for the case cn > 1.

### 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-05-07 20:46:17 +03:00
Alexander Smorkalov
392fd4edd1 Tune sanity threshold in Moments performance test for Android aarch64. 2024-05-07 18:24:43 +03:00
Alexander Smorkalov
ba65d2eb0d
Merge pull request #25549 from mshabunin:fix-cap-images-noise
videoio: decreased log level for failed backends in capture and writer open
2024-05-07 09:01:50 +03:00
Alexander Smorkalov
8bc90a4bff
Merge pull request #25484 from mshabunin:bounding-rect-alignment
imgproc: improved test for boundingRect
2024-05-07 08:58:07 +03:00
Maksim Shabunin
7127161426 videoio: decreased log level for failed backends in VideoCapture and VideoWriter open 2024-05-06 20:48:17 +03:00
Alexander Smorkalov
26a5730f0d
Merge pull request #25542 from mshabunin:fix-disable-diagram
doc: disable inheritance graphs
2024-05-06 11:08:18 +03:00
Alexander Smorkalov
a4486c0e20
Merge pull request #25541 from mshabunin:fix-numpy2x-test
python: adapt test to NumPy 2.x
2024-05-06 08:39:00 +03:00
Alexander Smorkalov
70d333d336
Merge pull request #25483 from asmorkalov:as/HAL_meanStdDev
HAL API for meanStdDev
2024-05-06 08:19:43 +03:00
Maksim Shabunin
a8df49f170 doc: fixed modern Javadoc issue 2024-05-03 22:09:19 +03:00
Maksim Shabunin
c4ce94232b imgproc: fixed alignment issue and improved test for boundingRect 2024-05-03 21:26:40 +03:00
Maksim Shabunin
af4531b378 python: adapt test to NumPy 2.x 2024-05-03 20:10:41 +03:00
Alexander Smorkalov
b94cb5bc68 HAL interface for meanStdDev. 2024-05-03 16:36:43 +03:00
Alexander Smorkalov
d8e18f4576 Made fcn-resnet50-12.onnx model optional. 2024-05-03 16:14:22 +03:00
Alexander Smorkalov
ac9a858377
Merge pull request #25524 from alexlyulkov:al/openvino-layers
Added more OpenVINO layers to dnn
2024-05-03 13:16:56 +03:00
Alexander Smorkalov
6e5a53c37a
Merge pull request #25532 from asmorkalov:as/HAL_moments_bug
Fix moments integration to OpenCV HAL
2024-05-03 12:34:51 +03:00
Alexander Smorkalov
d9555dbdd1
Merge pull request #25535 from asmorkalov:as/convertfp16_imgcodecs
Got rid of deprecated convertFp16 in imgcodecs module.
2024-05-03 12:33:36 +03:00
Alexander Smorkalov
c539cfd31a
Merge pull request #25435 from WanliZhong:fcn2onnx
change fcn8s-heavy-pascal tests from caffe to onnx
2024-05-03 11:13:13 +03:00
Alexander Smorkalov
9fe5615f2f Got rid of deprecated convertFp16 in imgcodecs module. 2024-05-03 11:05:08 +03:00
Alexander Smorkalov
02c3132f02 Fix moments integration to OpenCV HAL. 2024-05-03 08:40:43 +03:00
Alexander Smorkalov
7ea4364c63
Merge pull request #25528 from asmorkalov:as/python_hdr_parser_fix
Fixed SyntaxWarning: invalid escape sequence '\w' in header parser.
2024-05-03 08:01:14 +03:00
Rostislav Vasilikhin
bc95f27e56
Merge pull request #25509 from savuor:rv/hal_otsu
HAL added for Otsu threshold #25509

fixes #25393

### 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
2024-05-02 20:50:08 +03:00
Alexander Smorkalov
5aaa570fef Fixed SyntaxWarning: invalid escape sequence '\w' in header parser. 2024-05-02 20:38:23 +03:00
Wanli
ed47cce1c5 change fcn8s-heavy-pascal tests from caffe to onnx 2024-05-03 00:15:09 +08:00
Alexander Smorkalov
ce642e994d
Merge pull request #25510 from Kumataro:fix25497
highgui: wayland: support imshow() without pre-calling namedWindow()
2024-05-02 14:41:14 +03:00