Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Re: Tutorial 1 with LG Optimus 3D / Api 10

200 views
Skip to first unread message

Rui Marques

unread,
Aug 17, 2012, 1:39:30 PM8/17/12
to
I have runned some samples on LG Optimus p500 with success.

All i remember doing was commenting the code like this:

public void setPreview() throws IOException {
           
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
               
//mCamera.setPreviewTexture( new SurfaceTexture(10) );
           
//else
                mCamera
.setPreviewDisplay(null);

}

Choosing the appropriate target Android SDK version supported by your phone.

And going to SampleViewBase.java and selecting camera sizes that my phone supported.

You can do that by playing around with this code:


//method setupCamera @ SampleViewBase.java

Camera
.Parameters params = mCamera.getParameters();
List<Camera.Size> sizes = params.getSupportedPreviewSizes();

//(...)
// This will print to logcat everything your camera supports, including preview sizes.
Log.d(TAG, "Camera flatten: "+params.flatten());

// this will also print the preview sizes
Log.d(TAG, "Camera sizes: "+ sizes.toString());

//(...)
// This will hardcode the size that can be found in 'position' - up to you to make this value dynamic if you want.
mFrameWidth
= (int) sizes.get(position).width;
mFrameHeight
= (int) sizes.get(position).height;



Geomod

unread,
Sep 3, 2012, 5:44:53 PM9/3/12
to android...@googlegroups.com
Hallo

I'm using the same workaround (the one on the first link) in my Optimus Black, and I have made it run with 2.3.4 but you have to modify a lot of things on the Activity class, so try it, check the app tha is at the end of the first link and if the app works for your phone then the solution should work as well.

Greetings.

El viernes, 17 de agosto de 2012 12:18:04 UTC-5, njaa escribió:
Hello,

I'm at my wit´s and. All I want to do is getting the Add OpenCV Sample running with my LG Phone.
The problem is the following snippet:


    public void setPreview() throws IOException {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
                mCamera.setPreviewTexture( new SurfaceTexture(10) );
            else
                mCamera.setPreviewDisplay(null);
    }

Since I have API Version 10, SurfaceTexture isn't available. So setPreviewDisplay is used.
But passing null to this method isn't allowed for LG Phones so the Screen stays black. If I
pass the SurfaceHolder Object the preview is displayed, but I obviously can't use the
canvas to display the processed Images.

In the following thread the same problem is discussed, but the solutions don't work for me,
maybe because several things have changed up to now (e.g. using OpenCV Manager):

https://groups.google.com/forum/?fromgroups#!msg/android-opencv/KVqUzyF8e3A/Op4qFeAATe0J[1-25]

Here another description of the problem:

http://developer.lgmobile.com/lge.mdn.frm.RetrieveJavaForumDetail.dev?forumId=FRM00000054&contentId=FCO00211753

Normally the workaround with the faked Preview should be working, but I can't get it running. Is there maybe someone who has
a adjusted version of this sample (or any other) that is working with the LG Optimus?

Many thanks,
njaa
Reply all
Reply to author
Forward
0 new messages