Skip to content

Expose more C++ functionality in the Java wrapper of the Mat class - #13956

Merged
alalek merged 2 commits into
opencv:3.4from
komakai:java-mat-class-improvements
Mar 9, 2019
Merged

alalek merged 2 commits into
opencv:3.4from
komakai:java-mat-class-improvements

Conversation

@komakai

@komakai komakai commented Mar 3, 2019 •

Copy link
Copy Markdown
Contributor

resolves #13955

This pullrequest exposes additional C++ functionality in the Java wrapper of the Mat class

In particular it exposes methods for handling Mat with more than 2 dimensions.

  • add constructors taking an array of dimension sizes
  • add constructor taking an existing Mat and an array of Ranges
  • add override of the create method taking an array of dimension sizes
  • add overrides of the ones and zeros methods taking an array of dimension sizes
  • add override of the submat method taking an array of ranges
  • add overrides of put and get taking arrays of indices
  • add wrapper for copySize method
  • fix crash in the JNI wrapper of the reshape(int cn, int[] newshape) method

@alalek

alalek commented Mar 3, 2019

Copy link
Copy Markdown
Member

Thank you for contribution!

Please add tests for new features.

@komakai

komakai commented Mar 3, 2019

Copy link
Copy Markdown
Contributor Author

Please add tests for new features.

I think I have found where the tests are located: modules/core/misc/java/test
But I am not able to work out how to run them.
Any pointers would be welcome!

@alalek

alalek commented Mar 4, 2019

Copy link
Copy Markdown
Member

You can run tests from the command line terminal - take a look on build/test logs for commands samples.

@komakai

komakai commented Mar 5, 2019

Copy link
Copy Markdown
Contributor Author

Please add tests for new features.

Fixed the failing tests and added new tests for the new methods

Comment thread modules/java/generator/src/cpp/Mat.cpp Resolved
Comment thread modules/java/generator/src/cpp/Mat.cpp Resolved
Comment thread modules/java/generator/src/cpp/Mat.cpp Resolved
@alalek

alalek commented Mar 7, 2019 •

Copy link
Copy Markdown
Member

Well done!

Please rebase this patch onto 3.4 branch first, so it will be available in next 3.4 release.
We will merge changes from 3.4 into master regularly (weekly/bi-weekly).

So, please:

  • change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
  • rebase your commits from master onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/master
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".


Please squash commits into one if possible.

@komakai
komakai changed the base branch from master to 3.4 March 8, 2019 00:22
@komakai
komakai force-pushed the java-mat-class-improvements branch from 60423c1 to ec36115 Compare March 8, 2019 00:39
In particular expose methods for handling Mat with more than 2 dimensions
* add constructors taking an array of dimension sizes
* add constructor taking an existing Mat and an array of Ranges
* add override of the create method taking an array of dimension sizes
* add overrides of the ones and zeros methods taking an array of dimension sizes
* add override of the submat method taking an array of ranges
* add overrides of put and get taking arrays of indices
* add wrapper for copySize method
* fix crash in the JNI wrapper of the reshape(int cn, int[] newshape) method
* add test for each method added to Mat.java
@komakai
komakai force-pushed the java-mat-class-improvements branch from ec36115 to 62b2a58 Compare March 8, 2019 01:00

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Thank you for contribution 👍

@alalek
alalek merged commit 11dbd86 into opencv:3.4 Mar 9, 2019
@alalek alalek mentioned this pull request Mar 11, 2019
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
* Expose more C++ functionality in the Java wrapper of the Mat class
In particular expose methods for handling Mat with more than 2 dimensions
* add constructors taking an array of dimension sizes
* add constructor taking an existing Mat and an array of Ranges
* add override of the create method taking an array of dimension sizes
* add overrides of the ones and zeros methods taking an array of dimension sizes
* add override of the submat method taking an array of ranges
* add overrides of put and get taking arrays of indices
* add wrapper for copySize method
* fix crash in the JNI wrapper of the reshape(int cn, int[] newshape) method
* add test for each method added to Mat.java

* Fix broken test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants