Ask Your Question
0

How to contribute my code for Java bindings?

asked 2018-01-01 09:58:39 -0500

Genom gravatar image

Hi,

I would like to improve Java bindings and add missing functions for Java bindings. As far as I can see, Java bindings are generated automatically. I am not familiar with automatically generated bindings, if this is indeed the case. Is there any way to change somehow generated .java files? For instance if I manipulate the generated java files, I can improve the code the way I want. I suppose, others can also benefit from my changes. I would like to submit it, but those files don't even exist in the repository on Github (since they are auto-generated). I suppose the auto-generator script also doesn't work properly. For instance function function Core.abs() doesn't exist in Java bindings. I would like to improve that as well.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2018-01-02 02:27:05 -0500

berak gravatar image

updated 2018-01-02 02:32:11 -0500

  • "I would like to improve Java bindings and add missing functions for Java" -- that's a nice idea !. please have a look here , to understand the mechanism behind it (it's the same for python and java) , and another here

  • "For instance if I manipulate the generated java files, I can improve the code " -- this won't work, those will get overwritten again in the next compiler run. IF you want to change something, you need to change the way those generator scripts run, not the (intermediary) output of it.

  • " For instance function function Core.abs() doesn't exist in Java bindings." -- that's for a reason. e.g. it has an abs() function already in python, also there's convertScaleAbs() doing about the same already.

edit flag offensive delete link more

Comments

Thanks a lot. But convertScaleAbs doesn't exactly do the same. It converts to 8-bit results. I would like to have 16 or 32 bit results as well. Therefore, I will try to implement the abs() binding as well. Maybe, there is another way (subtracting from 0-filled matrix and taking max of the result and the original matrix). But they don't seem to be as clean as a straightforward abs() method. Also I have found files such as core+MatOfByte.java utils+Converters.java, which I needed to change and submit. I did the changes and tested the code and submitted it.

Genom gravatar imageGenom ( 2018-01-02 18:03:10 -0500 )edit
0

answered 2018-01-04 09:21:29 -0500

Genom gravatar image

As an alternative for some classes, one can modify files named such as core+Mat.java or core+MatOfByte.java. These files will be used to generate the java files in build dir.

edit flag offensive delete link more

Comments

^^ those are actually "hand-written" sources, not machine generated ones (and thus they will not be overwritten)

berak gravatar imageberak ( 2018-01-04 11:16:07 -0500 )edit
1

Yes, but I meant other .java files in build dir in my question, which are machine generated. I discovered core+... utils+....java files recently.

Genom gravatar imageGenom ( 2018-01-04 11:28:13 -0500 )edit

yea, sure. (nice pr, btw. ! knock on wood !)

berak gravatar imageberak ( 2018-01-04 11:32:23 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-01-01 09:58:39 -0500

Seen: 108 times

Last updated: Jan 04 '18