1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #29074 from varun-jaiswal17:data-layout-wrapper-java

Add missing DataLayout constants in generated bindings for 5.x #29074

- Added DATA_LAYOUT_* constants to missing_consts so they
  are manually injected into Core.java (same approach used for CV_8U, FILLED etc.)
- Added DataLayout entry to type_dict so the generator correctly maps
  DataLayout 

### Tests

modules/dnn/misc/java/test/DnnBlobFromImageWithParamsTest.java:

New test added:
- testDataLayoutConstants: verifies all DATA_LAYOUT_*  constants are accessible from Core
  
Pre-existing tests enabled (were commented out earlier):
- testBlobFromImageWithParamsNHWCScalarScale: verifies blobFromImageWithParams
  produces correct output with DATA_LAYOUT_NHWC and per-channel scalar scaling
- testBlobFromImageWithParams4chMultiImage: verifies blobFromImagesWithParams
  correctly handles a batch of images with DATA_LAYOUT_NHWC layout
  
Closes : #27264 

### 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
This commit is contained in:
Varun Jaiswal
2026-05-21 21:39:11 +05:30
committed by GitHub
parent 4d44d22d41
commit 2bf262441f
2 changed files with 25 additions and 7 deletions
+12 -1
View File
@@ -20,7 +20,10 @@
"public" : [
["SVD_MODIFY_A", 1], ["SVD_NO_UV", 2], ["SVD_FULL_UV", 4],
["FILLED", -1],
["REDUCE_SUM", 0], ["REDUCE_AVG", 1], ["REDUCE_MAX", 2], ["REDUCE_MIN", 3]
["REDUCE_SUM", 0], ["REDUCE_AVG", 1], ["REDUCE_MAX", 2], ["REDUCE_MIN", 3],
["DATA_LAYOUT_UNKNOWN", 0], ["DATA_LAYOUT_ND", 1], ["DATA_LAYOUT_NCHW", 2],
["DATA_LAYOUT_NCDHW", 3], ["DATA_LAYOUT_NHWC", 4], ["DATA_LAYOUT_NDHWC", 5],
["DATA_LAYOUT_PLANAR", 6], ["DATA_LAYOUT_BLOCK", 7]
]
}
},
@@ -166,6 +169,14 @@
"suffix": "II",
"j_import": "org.opencv.core.Range"
},
"DataLayout": {
"cast_from": "int",
"cast_to": "cv::DataLayout",
"j_type": "int",
"jn_type": "int",
"jni_type": "jint",
"suffix": "I"
},
"CvTermCriteria": {
"j_type": "TermCriteria",
"jn_args": [