Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building visp_java module #323

Merged
merged 96 commits into from Jul 2, 2018

Conversation

Projects
None yet
3 participants
@AKS1996
Copy link
Contributor

commented Apr 9, 2018

  • Equivalent to the opencv_java module - providing basic conversion functions and the JNI support too.
  • Made a few edits. Will soon run the tests and provide results.
  • Yet to be edited: android_test folder, CMakeLists.txt, generators/src folder, some files in pure_test folder

Unknown added some commits Mar 12, 2018

Unknown
started editing cmake files for android build
took opencv's cmake files as reference. started editing those VISP cmake files whose corresponding OpenCV cmake file had android build flags
Unknown
Unknown
replaced all ocv macros by vp macros
defined 3 extra macros
Unknown
Unknown
started editing cmake files for android build
took opencv's cmake files as reference. started editing those VISP cmake files whose corresponding OpenCV cmake file had android build flags
Unknown
replaced all ocv macros by vp macros
defined 3 extra macros
Unknown
building visp_core works. error in linking the lapac 3rd party
resolved the wordexp() error in vpIOTools
extra CFlags in the android.toolchain file itself
Unknown
libvisp_core.so build. edited clapack 3rd party
resolved 64 bit offset issues
Unknown
Unknown
Unknown
initial commit
Made a few edits. Files to be edited: android_test folder, CMakeLists.txt, generators/src folder, some files in pure_test folder
Unknown
need to create java.hpp files
+ python gen scripts for java added
+ removed extra .sh files
+ small changes in old cmake files
@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2018

Hi @fspindle @s-trinh

Need to define some java files as of OpenCV for the java module. But their directory structure is different from that of ViSP. Should separate the files in core/src and core/test?

@fspindle

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2018

If it helps, we could introduce core/misc/java/src and core/misc/java/test as OpenCV

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented May 9, 2018

Do vpMatrix, vpRect, vpPoint support any data type other than double? And vpPoint is a 3D point. Coz then there will be fewer functions for usage and testing in java - can develop it faster.

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2018

@fspindle @s-trinh
Should I keep class name qualifiers as CamelCase - VpMatrix/VpException instead of vpMatrix/vpException in java?

@fspindle

This comment has been minimized.

Copy link
Contributor

commented May 10, 2018

For me vpMatrix, vpRect, vpPoint should support only double as it is by now.

Concerning the class name, could you give us more details. I don't see why this is needed and didn't find similar things in OpenCV.

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2018

You can refer here, C++ classes in OpenCV are named CamelCase way by default(like Mat and Rect). So there's no need to change class name in Java. But ViSP C++ classes like vpImage, vpRGBa are not CamelCase.

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2018

@fspindle @s-trinh
Recently I made some edits in visp_java module. The build ran successfully on my device but fails on Travis (Refer here). Am I missing some code or header file? Does Travis CI has necessary JNI library?

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented May 15, 2018

hi @fspindle @s-trinh
Do you have Travis configured to provide NDK support? I can't find sign of either JNI or NDK in this PR or in #307. You can refer this thread that the SDK that Travis provides by default is old/buggy. To get the support, refer this.

@fspindle

This comment has been minimized.

Copy link
Contributor

commented May 15, 2018

Hi @AKS1996

We were in vacation last week and busy yesterday. I will check for travis today

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Jun 26, 2018

Hi @fspindle. Have a look at visp_io module demo eclipse project here

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Jun 26, 2018

Also get the visp_gui module demo eclipse project here. As @s-trinh recommended, I've used Java Swing for GUI - it's simple, platform independent and many developers will find it easy to use it.

Note that I haven't wrapped visp_gui for Java support. I think Android developers won't need visp_gui or visp_io modules at all (in fact the getPixels function in VpImageUChar and VpImageRGBa classes will suffice in Android).

I guess we should add these set of Java tutorials to the doc/tutorial/java folder.

@fspindle

This comment has been minimized.

Copy link
Contributor

commented Jun 26, 2018

I don't know what I'm doing wrong, but I'm unable to run vpCore-Demo-Manual

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
	VpCameraParameters cannot be resolved to a type
	VpCameraParameters cannot be resolved to a type
	at Main.main(Main.java:39)

After a fresh ViSP build, what I have done in Eclipse:

  • create a user library adding .../visp-build/bin/visp-320.jar external jar and set native library location to .../visp-build/lib
  • open project vpCore-Demo-Manual from file system
  • press button run

If I comment line 39 that brings the error I got an other one with VpMatrix

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.visp.core.VpMatrix.n_vpMatrix(IID)J
	at org.visp.core.VpMatrix.n_vpMatrix(Native Method)
	at org.visp.core.VpMatrix.<init>(VpMatrix.java:26)
	at Main.main(Main.java:22)

Did I miss something ?

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Jun 27, 2018

Strange. Can you see libvisp_java320.so in .../visp-build/lib folder?

@fspindle

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2018

Yes. I'm on OSX and I have libvisp_java320.dylib in .../visp-build/lib

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Jun 27, 2018

@fspindle I installed Eclipse on mac virtualbox. vpCore demo worked fine
virtualbox_sierra_27_06_2018_15_29_37

@s-trinh

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2018

@AKS1996 This looks great!

I think you can add frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); in VpDisplay to really close the window otherwise the application looks still running in Eclipse.

Maybe public String dump() could be replaced by the overrided public String toString()? I think this should allow using something like:

VpImageRGBa colorImage = new VpImageRGBa(3, 5, new VpRGBa((char)255,(char)0,(char)0,(char)255));
System.out.println(colorImage);

and public static void print(Object ... objs) in the demo project could be removed also?

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Jun 27, 2018

@s-trinh thanks for the suggestion, I'll add it now

@fspindle Are you able to run the demo now? I couldn't find anything except threads like this. Anyway try to clean the project and re-run

AKS1996 added some commits Jun 27, 2018

turn uchar to unsigned char
in mac, uchar is reported missing on a fresh install
@fspindle

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2018

Yes I succeed cleaning the project ;-)
It was nice to see that all your 3 demos were working on OSX and Ubuntu 16.04.

Current evaluation period will end July 9. Regarding your proposal we would be interested:

  • to have a merge commit of PR #323 as soon as your work arround visp_java with existing bindings (visp_core, visp_gui, visp_io) becomes stable. I think that we are very close. More than 100 files were modified yet. Waiting more will lead to too much changes to follow your work
  • visp_gui binding could be improved with display functionalities of simple drawings (lines, cross) for Java
  • then adding new java bindings for visp_imgproc, visp_detection (vpApriltag) could be a new PR for each
  • next step would be to make a new java demo that uses an image as input, and detect the Apriltags

Then for Android we are interested :

  • to have a tutorial for beginners to start with ViSP and Android (we are beginners ;-) It could be based on the project you already have done
  • then to have the same demo (apriltag) but using the java bindings
  • a PR with Android toolchain potential changes + a demo with live images that are displayed + filtered using visp_imgproc or using visp_core - vpImageFilter like in this tutorial could be also nice

I don't know if this is ok for you or if you have an other planned schedule ?
If you want, there is also the possibility to have a skype to discuss about that.
Let us know...

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Jun 27, 2018

First of all, thanks. It would've taken me a lot of time to draft such a concrete plan.
I'm all good with this plan(actually I was going to discuss closing of PR #323 with you in a few days). I understand that by making smaller PR's, the code will be easy to review later and changes easy to track.

Just want to make sure - are all the things(mentioned above) to be done before 9th July. Coz then I'll have to speed up a bit.

@fspindle

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2018

No, all the plan is not to do before July 9, it was just a reminder. Do just your best

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Jun 29, 2018

We should close the PR now. I've executed the tutorials on Windows, with MinGW and it worked well.
Note that

  • The appveyor is missing ant. So the java module is not building in appveyor tests
  • On Windows, to use the IO module u need to have libpng and libjpeg. These are provided by GNU as 32 bit binaries only. So we need to use 32 bit JDK and Eclipse only
  • In order to have 64 bit installation, I guess we need to compile libpng source code to generate binaries
@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Jun 29, 2018

Once the PR is merged, I'll begin with simple GUI features - displayLine and others

@AKS1996

This comment has been minimized.

Copy link
Contributor Author

commented Jun 30, 2018

@fspindle ant is installed on appveyor but not detected during java build - its working well on mac.

Shall I push the GUI changes in this PR or make another PR?

@fspindle

This comment has been minimized.

Copy link
Contributor

commented Jul 2, 2018

We will investigate why ant is not detected on appveyor. In the mean time, I will merge this PR. Next dev could be introduced in new PR. Thanks

@fspindle fspindle merged commit d0b416e into lagadic:master Jul 2, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.