Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Setting exposure values on android with OpenCV (http://www.chiefdelphi.com/forums/showthread.php?t=148465)

jreneew2 05-16-2016 08:24 PM

Setting exposure values on android with OpenCV
 
Hello, I finished watching 254's presentation recently and have begun working on a similar android app where it would find the target and send the data back to the roborio. I have opencv running on my phone and can run opencv functions fine.

What i am having trouble with is setting the exposure / iso values from within the code. I am trying to use CaptureRequest.set() and the app instantly crashes saying:

Code:

AndroidRuntime: FATAL EXCEPTION: Thread-3171

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CaptureRequest$Builder.set(android.hardware.camera2.CaptureRequest$Key, java.lang.Object)' on a null object reference

My code is here: http://pastebin.com/3XgvKGQN

Any help is appreciated,
Drew (Team 2053)

Jared Russell 05-16-2016 09:07 PM

Re: Setting exposure values on android with OpenCV
 
Looks like you aren't constructing mPreviewRequestBuilder before you use it.

tomy 05-16-2016 09:14 PM

Re: Setting exposure values on android with OpenCV
 
Quote:

Originally Posted by jreneew2 (Post 1587194)
Hello, I finished watching 254's presentation recently and have begun working on a similar android app where it would find the target and send the data back to the roborio. I have opencv running on my phone and can run opencv functions fine.

What i am having trouble with is setting the exposure / iso values from within the code. I am trying to use CaptureRequest.set() and the app instantly crashes saying:

Code:

AndroidRuntime: FATAL EXCEPTION: Thread-3171

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CaptureRequest$Builder.set(android.hardware.camera2.CaptureRequest$Key, java.lang.Object)' on a null object reference

My code is here: http://pastebin.com/3XgvKGQN

Any help is appreciated,
Drew (Team 2053)

Not to get of topic but could you link the video. I'd be interested in watching it.

jreneew2 05-16-2016 09:46 PM

Re: Setting exposure values on android with OpenCV
 
Quote:

Originally Posted by tomy (Post 1587211)
Not to get of topic but could you link the video. I'd be interested in watching it.

Here you go:
https://www.youtube.com/watch?v=rLwO...ature=youtu.be

And the slides:
https://goo.gl/mppi4E

Also, I am new to android development and am wondering how I would construct the previewbuilder. My instinct tells me that going down this route opens a camera and changing the exposure would be easier this way, but then letting that photo stream into the opencv code would be challenging. Would opening the camera there prevent opencv from accessing it?

Jared Russell 05-17-2016 10:35 AM

Re: Setting exposure values on android with OpenCV
 
See: https://developer.android.com/refere...t.Builder.html

You want to use createCaptureRequest()


All times are GMT -5. The time now is 04:45 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi