Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mr. K

Pages: [1] 2
1
Support / Re: JPCT-AE With OpenCV Augmented Reality
« on: May 25, 2016, 09:37:54 am »
At first thanks for the reply

i found another solution for this using the following tutorial http://www.jpct.net/forum2/index.php?topic=1586.0, but i changed the CameraView class for another similar, but with OpenCV integrated, i will put here a llitle example if someone need to use OpenCV with JPCT-AE

Activity XML File:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=your application context>

    <android.opengl.GLSurfaceView
        android:id="@+id/glsurfaceview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <CameraView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:opencv="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/cameraView"
        opencv:show_fps="true"
        opencv:camera_id="any" >

    </CameraView>

</FrameLayout>

Activity Java File:
Code: [Select]
public class MainActivity extends AppCompatActivity {

    private GLSurfaceView glSurfaceView;
    private RendererJPCT renderer;
    private boolean gl2 = true;

    private CameraView cameraView;
    private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
        @Override
        public void onManagerConnected(int status) {
            switch (status) {
                case LoaderCallbackInterface.SUCCESS:
                {
                    Log.i(TAG, "OpenCV loaded successfully");
                    cameraView.enableView();
                } break;
                default:
                {
                    super.onManagerConnected(status);
                } break;
            }
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        if(masterMainActivity != null){
            copyActivity(masterMainActivity);
        }

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        getWindow().setFormat(PixelFormat.TRANSLUCENT);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.
                FLAG_FULLSCREEN);

        setContentView(R.layout.activity_main);

        cameraView = (CameraView) findViewById(R.id.cameraView);
        cameraView.setVisibility(SurfaceView.VISIBLE);
        cameraView.setCvCameraViewListener(cameraView);

        glSurfaceView = (GLSurfaceView) findViewById(R.id.glsurfaceview);

        if (gl2) {
            glSurfaceView.setEGLContextClientVersion(2);
        } else {
            glSurfaceView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
                public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
                    int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
                    EGLConfig[] configs = new EGLConfig[1];
                    int[] result = new int[1];
                    egl.eglChooseConfig(display, attributes, configs, 1, result);
                    return configs[0];
                }
            });

        }

        glSurfaceView.setEGLConfigChooser(8,8,8,8,16,0);
        renderer = new RendererJPCT(masterMainActivity);
        glSurfaceView.setRenderer(renderer);

        glSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    }
}


CameraView Java Class:
Code: [Select]

public class CameraView extends JavaCameraView implements CvCameraViewListener2{

    public CameraView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void onCameraViewStarted(int width, int height) {

    }

    @Override
    public void onCameraViewStopped() {

    }

    @Override
    public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
        return inputFrame.rgba();
    }
}

The class RendererJPCT its simple class extended of Renderer

I hope this will helpful, thanks EgonOlsen


2
Support / JPCT-AE With OpenCV Augmented Reality
« on: May 23, 2016, 10:26:16 am »
Hello it's me again, thanks for the help given previously and i hope don't be annoying

But someone haved used JPCT-AE with OpenCV? i dont have idea how to use OpenCV and JPCT-AE in the same activity, i mean do augmented reality, someone have a tutorial or example?

thanks and have a nice day.

3
Support / Re: Problem with textures
« on: April 29, 2016, 10:32:57 am »
Just for the record for load the texture, i put the attribute of material on null and then i followed the tutorial of the wiki

Code: [Select]
try{
                    skin= new Texture(getResources().getAssets().open("Katarina_pirate_diffuse.png"));
                    model = Object3D.mergeAll( Loader.loadOBJ(getResources().getAssets().open("Katarina_Pirate_object.obj"),null,10));
                }catch (Exception e){
                    Log.e(TAG,e.getMessage());
                }

                TextureManager.getInstance().addTexture("Katarina_pirate_diffuse",skin);
                model.setTexture("katarina_pirate_diffuse.png");
                model.build();
                world.addObject(model);

4
Support / Re: Problem with textures
« on: April 25, 2016, 11:52:43 am »
thanks for the reply i found the solution, really thanks Egon

5
Support / Re: Problem with textures
« on: April 25, 2016, 11:19:49 am »
Yes, the file obj has the coordinates of the texture, could be a problem whit the lights? or i must add another line of code?

6
Support / Re: Problem with textures
« on: April 25, 2016, 10:52:47 am »
the  coordinates were given in the mtl file? or in the obj file? wherever, i tried with another obj model and i have the same problem

7
Support / Problem with textures
« on: April 25, 2016, 10:23:40 am »
Hello it's me again, before thanks for the support
I have an issue with the texture when i use Loeader.LoadOBJ i have the following code

Code: [Select]
try{
                    model = Object3D.mergeAll( Loader.loadOBJ(getResources().getAssets().open("Katarina_Pirate_object.obj"),getResources().getAssets().open("Katarina_Pirate_material.mtl"),10));
                }catch (Exception e){
                    Log.e(TAG,e.getMessage());
                }
                model.setTexture("katarina_pirate_diffuse.png"); // it's the name of the texture in the TextureManager
                model.build();
                world.addObject(model);
but the texture isn't show

8
Support / Re: Change imago to white and black
« on: April 21, 2016, 10:36:35 am »
Thanks a lot Admin, this is what i want, really thanks

9
Support / Re: Change imago to white and black
« on: April 20, 2016, 03:57:56 pm »
Sorry i hope don't be annoying,  i did the convertion of pixels, but now i need to display on real time the image   :(

10
Support / Re: Change imago to white and black
« on: April 20, 2016, 03:33:00 pm »
Can i get an example code for do the NPOTTexture and GLShader i can't understend how it works

11
Support / BoundingBox
« on: April 20, 2016, 10:52:19 am »
Hi guys i got another question, how can i show the bounding Box of an object, i use the method getBoundingBow() for get the coordinates, there are a method for show it? or i must draw the lines, if i must draw, how can i draw a line?

thnx

12
Support / Re: Change imago to white and black
« on: April 18, 2016, 05:06:34 pm »
No, isn't for a real time is for save a "screenshot" but i will try your advice  thanks a lot for the information :)

13
Support / Re: Change imago to white and black
« on: April 18, 2016, 04:10:17 pm »
Yes it's for Android Version

14
Support / Change imago to white and black
« on: April 18, 2016, 03:35:32 pm »
Hi guys
i want to change the color of the frameBuffer displayed, i mean  change the colors to white and black, there are a method for do this or i must use the convertion of pixels?

thanks  8)

15
Support / Re: Object3D Screenshot
« on: April 15, 2016, 02:04:15 pm »
thanks for the information  :)

Pages: [1] 2