Ask Your Question
2

OpenCV Tutorial 1 - Add OpenCV on API 8

asked 2012-09-24 02:37:40 -0600

Droidkie gravatar image

i'd like to run OpenCV Tutorial 1 - Add OpenCV (VIEW_MODE_RGBA, VIEW_MODE_GRAY, VIEW_MODE_CANNY) on API 8 and not API 11 but SampleViewBase.java has an import problem (import android.graphics.SurfaceTexture;) because SurfaceTexture did not exist yet on API 8.

is there an object on API 8 that can replace SurfaceTexture so that the code will work? a sample code will help a lot.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2012-09-25 03:41:39 -0600

Rui Marques gravatar image

Yes, if i remember correctly SurfaceTexture is used in this method, you can comment it like this, comment the import, and it works with API 8 (but will have problems with API >= honeycomb, of course).

    public void setPreview() throws IOException {
        //if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        //    mCamera.setPreviewTexture( new SurfaceTexture(10) );
        //else
            mCamera.setPreviewDisplay(null);
    }
edit flag offensive delete link more

Comments

thank you for the reply! why will API >= HONEYCOMB have a problem? i thought the later APIs support the older APIs? there's also an error in the codes below. what do these codes do? if(FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)){params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);}

Droidkie gravatar imageDroidkie ( 2012-09-26 10:05:24 -0600 )edit
1

You can also delete/comment that code if you are targeting an API8 device. That code is to set a camera parameter, that in my guess, did not exist before HONEYCOMB API. Like its name says, it makes the video camera to continuously auto focus, or something :P

Rui Marques gravatar imageRui Marques ( 2012-09-26 10:17:10 -0600 )edit

thank you! ^_^

Droidkie gravatar imageDroidkie ( 2012-09-26 12:22:53 -0600 )edit

Question Tools

Stats

Asked: 2012-09-24 02:37:40 -0600

Seen: 1,442 times

Last updated: Sep 25 '12