Skip to content

Conversation

akshay326
Copy link
Contributor

  • 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 19 commits March 12, 2018 11:43
took opencv's cmake files as reference. started editing those VISP cmake files whose corresponding OpenCV cmake file had android build flags
defined 3 extra macros
took opencv's cmake files as reference. started editing those VISP cmake files whose corresponding OpenCV cmake file had android build flags
defined 3 extra macros
resolved the wordexp() error in vpIOTools
extra CFlags in the android.toolchain file itself
resolved 64 bit offset issues
Made a few edits. Files to be edited: android_test folder, CMakeLists.txt, generators/src folder, some files in pure_test folder
+ python gen scripts for java added
+ removed extra .sh files
+ small changes in old cmake files
@akshay326
Copy link
Contributor Author

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
Copy link
Contributor

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

@akshay326
Copy link
Contributor Author

akshay326 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.

@akshay326
Copy link
Contributor Author

akshay326 commented May 10, 2018

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

@fspindle
Copy link
Contributor

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.

@akshay326
Copy link
Contributor Author

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.

@akshay326
Copy link
Contributor Author

akshay326 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?

@akshay326
Copy link
Contributor Author

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
Copy link
Contributor

Hi @Aks1996

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

@akshay326
Copy link
Contributor Author

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

@akshay326
Copy link
Contributor Author

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
Copy link
Contributor

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 ?

@akshay326
Copy link
Contributor Author

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

@fspindle
Copy link
Contributor

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

@akshay326
Copy link
Contributor Author

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

@s-trinh
Copy link
Contributor

s-trinh 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?

@akshay326
Copy link
Contributor Author

akshay326 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

@fspindle
Copy link
Contributor

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 Building visp_java module #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...

@akshay326
Copy link
Contributor Author

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
Copy link
Contributor

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

@akshay326
Copy link
Contributor Author

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

@akshay326
Copy link
Contributor Author

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

@akshay326
Copy link
Contributor Author

@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
Copy link
Contributor

fspindle 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants