Go to Post One day the code will be written first, and then a robot built around it - dag0620 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-05-2016, 20:24
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 189
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
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)
Reply With Quote
  #2   Spotlight this post!  
Unread 16-05-2016, 21:07
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,068
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Setting exposure values on android with OpenCV

Looks like you aren't constructing mPreviewRequestBuilder before you use it.
Reply With Quote
  #3   Spotlight this post!  
Unread 16-05-2016, 21:14
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 490
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: Setting exposure values on android with OpenCV

Quote:
Originally Posted by jreneew2 View Post
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 16-05-2016, 21:46
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 189
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
Re: Setting exposure values on android with OpenCV

Quote:
Originally Posted by tomy View Post
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?
Reply With Quote
  #5   Spotlight this post!  
Unread 17-05-2016, 10:35
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,068
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Setting exposure values on android with OpenCV

See: https://developer.android.com/refere...t.Builder.html

You want to use createCaptureRequest()
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:05.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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