Ask Your Question
1

OpenCV with camera feed issues

asked 2014-09-15 01:05:59 -0600

tskythe gravatar image

updated 2014-09-15 01:07:52 -0600

Hello,

I am currently trying to execute the Android application with:

  • Android 4.4.2
  • Google Glass
  • OpenCV 2.4.9

I am able to run the application with a launcher but the screen is glitched as shown below. You can see the ceiling's florescent lights at the top of the image. Searching have indicated this to be an issue due to encoding mismatch.

image description

A suggested solution was to try to set the FPS preview range in Camera.Parameters. However, the sample code in camera-preview and face-detection indicates that org.opencv.android.CameraBridgeViewBase is being used rather than android.hardware.Camera that was suggested.

I have attempted to do this by first detecting the number of cameras, followed by Camera.Open(0) and Camera.setParameters(). Unfortunately, I get an error that I have failed to connect to the camera service when I attempt to open the camera.

Is there a way to solve this issue? I welcome any that can help on existing camera-preview/face-detection code, or to perform this in a relatively new way instead too.

Thank you very much.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-09-19 01:38:53 -0600

tskythe gravatar image

I managed to side step this issue using 2 methods.

1) The first method is to assign CameraBridgeViewBase.setMaxFrameSize(639, 359) in the java file.

This is because the resolution of the Glass is 640x360, so setting it 1 pixel smaller displays correctly.

2) The second method is to declare <android:layout_margin="1dp"> in the layout xml file.

This is similar to the solution #1, by putting a margin around the surfaceview.

Thank you.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-09-15 01:05:59 -0600

Seen: 381 times

Last updated: Sep 19 '14