Main Menu
Menu

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.

Show posts Menu

Messages - Mr. K

#1
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:
<?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:

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:


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


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
April 25, 2016, 11:52:43 AM
thanks for the reply i found the solution, really thanks Egon
#5
Support / Re: Problem with textures
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
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
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


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
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
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
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
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
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
April 18, 2016, 04:10:17 PM
Yes it's for Android Version
#14
Support / Change imago to white and black
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
April 15, 2016, 02:04:15 PM
thanks for the information  :)