jPCT-AE with Vuforia native Java

Started by rafael_afn, May 29, 2015, 08:44:50 AM

Previous topic - Next topic

rafael_afn

I'm trying to integrate jpct with Vuforia for Java. But all examples are meeting for Vuforia native c ++.

With the example posted on the forum <link>, I am unable to modify the image by java database.

What I am trying to say is, I need Vuforia java, because I want to change the Vuforia images database dynamically, so can not use Vuforia native c ++.

Can anyone help me? I'm trying to make it work days.

PS: sorry for the mistakes I'm not American.

rafael_afn

the link with the project I tried to use is https://github.com/fishkingsin/QCAR-JPCT-AE

but as I mentioned, with this example to change the database "StonesAndChips.xml" I build every time I modify the file.

I wish I could modify the database dynamically, it is possible with examples of native java Vuforia.

EgonOlsen

Personally, I've no experience with Vuforia integration, but I expect the JAVA-API to be similar in terms of the basic logic to the native one. While code will be different of course, the basic logic should apply to it as well. What's your exact problem when trying to integrate it?

rafael_afn

first thanks for the reply.

I am a beginner and I will try to explain what I want.

I want to use Vuforia to recognize my goals, and the jPCT to View My 3D objects.

I followed some tutorials Vuforia, and to modify the targets of the examples there are two ways: by using c ++ code and ndk or changing the java code.

How I want to change the targets dynamically, I can not use the code in C ++ because I can not perform build on the user's machine.

All examples that meet integration Vuforia with jPCT, use the native Vuforia code in C ++, and this is not helpful to me.

I have two questions:
It's possible I can integrate jPCT with Vuforia without using native code in C ++ Vuforia?
If you can not, can anyone help me to modify the native C ++ code Vuforia, moving to the Java responsibility of setting targets?

I know the question seems to be far more Vuforia side, but only saw the integration happen by jPCT staff, so I think you guys can help me more clearly.

If you need I can post code where this is done in native C ++ and Vuforia as is done in Java, to tell if it is possible.

Thank you.

EgonOlsen

Of course you can integrate the Java version as well. At the time at which this tutorial was created, there was no Java API available. The basic logic should be no different, just the API calls. Somebody once tried to use the Java API instead of the native one, but I don't know how far he got...

rafael_afn

Ok, I tried to follow in the footsteps of wiki http://www.jpct.net/wiki/index.php/Integrating_JPCT-AE_with_Vuforia

I was replacing the native parts in their parts in java.

I'm having problems in this excerpt:

public void updateCamera () {
        Matrix m = new Matrix ();
        m.setDump (modelViewMat);
        cam.setBack (m);
    }



The object modelViewMat this nullo, this triggers an exception and closes the app.

I believe that the problem may be happening here (on renderFrame method, on ImageTargetRenderer):
for (int tIdx = 0; tIdx <state.getNumTrackableResults (); tIdx ++) {
            TrackableResult result = state.getTrackableResult (tIdx);
            Trackable trackable result.getTrackable = ();
            printUserData (trackable);
            Matrix44F modelViewMatrix_Vuforia = Tool.convertPose2GLMatrix (result.getPose ());
            float [] = modelViewMatrix modelViewMatrix_Vuforia.getData ();
            // Should rotate the object data.

            updateModelviewMatrix (modelViewMatrix);
}


Because running debug, this loop is never executed. Causing the modelViewMatrix attribute is null.

Can you help me or indicate some literature?

EgonOlsen

If that loop never does anything, getNumTrackableResults() seems to return something <=0. I would try to work my way through the Vuforia documentation to find out what that means. It's not a jPCT and maybe not even a porting issue. It might simply be a wrong setup on your side. Either that, or it's normal and you have to deal with the fact that there might be no objects to track.

rafael_afn

EgonOlsen thanks for the answers, I could figure out the problem, it was a setting in Vuforia. I was not using the proper target image.

I am now able to view the cube, as in the example hello world. I tried two things:
  - Set up the camera, because the hub of the movement behaves very strangely, I believe it is the exchange of Vuforia coordinates for jpct.

  - View my own 3d object (.obj).

Following the tutorials, I see the answers in the forums and yet, I can not make it work. I will resume it next week and come back with more questions.

thank you again

anusha.r04

Im also facing the same problem
public void updateCamera() {


    com.threed.jpct.Matrix m = new com.threed.jpct.Matrix();
    m.setDump(modelViewMat);
    cam.setBack(m);


modelViewMatrix is null, could you let me know how you fixed it

rafael_afn

Hello anusha.r04, See if it helps you

public void updateCamera() {
        if (modelViewMatrix != null) {
            com.threed.jpct.Matrix m = new com.threed.jpct.Matrix();
            m.setDump(modelViewMatrix);
            cam.setBack(m);

            cam.setOrientation(mCameraDirection, mCameraUp);
            cam.setPosition(mCameraPosition);
        }
    }

in 'renderFrame' is necessary to capture the Vuforia coordinates and turn to jpct, you are already managing to do this?