android


get data of each android.hardware.camera2 frame before it is displayed on the surfacetexture


In my android application, I need to get each frame that is returned by the android.hardware.camera2, make some processing with it's data and only then display it on the surfacetexture.
This question is similar to mine, but it didn't help me:
Camera preview image data processing with Android L and Camera2 API
I've tried to get the frame from here (as suggested in the answer to the question):
private final ImageReader.OnImageAvailableListener mOnImageAvailableListener
= new ImageReader.OnImageAvailableListener() {
#Override
public void onImageAvailable(ImageReader reader) {
Log.d("Img", "onImageAvailable");
mBackgroundHandler.post(new ImageSaver(reader.acquireNextImage(), mFile));
}
};
This was not useful, as the callback is called only after the user performed capture of image. And I don't need it only on capture, I need to get each frame that is sent to the camerapreview surface.
I wonder, maybe the farme can be taken here (from the texture):
public void onSurfaceTextureUpdated(SurfaceTexture texture) {
Log.d("Img", "onSurfaceTextureUpdated");
}
If yes, how?
I'm using this sample from google, as a basis:
https://github.com/googlesamples/android-Camera2Basic
Yes, you definitely can get the buffer from camera callback. You can provide your own texture and update it when you wish, and even modify the pixel data for this buffer.
You should push the 'original' SurfaceTexture (specified in createCaptureSession()) off screen, otherwise it will interfere with your filtered/modified buffers.
The main caveat of this approach is that it is now your responsibility to produce pseudo-preview buffers timely.
I want to do some image processing too. I've been studding the code on github.com/googlesamples/android-Camera2Basic, and I believe that mCaptureSession redirects the camera's pipeline to the preview texture and to the capture itself but not both at same time. The preview texture is 'refreshed' by mCaptureSession.setRepeatingRequest and the mOnImageAvailableListener is called when 'capture' is fired on captureStillPicture(), but if you disable the 'preview texture' and you set Repeating Request with the same builder that the 'preview texture' has to try call mOnImageAvailableListener it just won't work. Has anyone else been working on it? Any enlightenment?

Related Links

Can I listening port in native code on Android?
How to get user data out of PayPalAuthorization
Android Studio SDK location not found. Define location with sdk.dir or with an ANDROID_HOME environment variable
Gradle error version 1.2.3
Android Studio including OsmAnd code
SSL Error during Facebook Login in Android
The better way of dealing with RelativeLayout
android -recycleview using notifyItemRemoved not working properly
Floating button not working in Pre-lollipop version
Google Fit History API readDailyTotal: non-static method in static context
White overlay in WebView after update to AppCompat with Xamarin Forms
Circling certain dates in CalendarView without a custom library
Using ShareCompat and FileProvider from Android service instead of activity
Error inflating class android.support.v7.widget.Toolbar
Unable to select the navigation drawer icons
Updating ImageView based on URL

Categories

HOME
sonarqube
scikit-learn
string
ecmascript-6
gpu
flex
zend-framework
battery
jsf-2.2
appcelerator
spring-session
mvc5
crystal-lang
lanczos
discrete-mathematics
fabric.io
little-proxy
drop-down-menu
pega
rtf
heat
capistrano3
coin3d
azure-iot-hub
aws-sdk
google-content-api
pyramid
topology
rubymotion
gmock
draft-js-plugins
windows-server-2003
surveymonkey
bringtofront
corenlp-server
send
aws-codecommit
android-sugarorm
twos-complement
gnat-gps
activexobject
pop3
lubridate
roblox
apic
openproject
tex
odroid
verifiable-c
setup.py
dcmtk
install.packages
flask-login
optimizely
puredata
chai-as-promised
globalize
tf
manova
convex-optimization
scalding
stdmap
lsyncd
d3-force-directed
android-instrumentation
testrail
cubism.js
xcode-server
beamer
eigenvector
lean
respondcms
android-wake-lock
data-protection
sklearn-pandas
halcon
false-sharing
libvlc
iced-coffeescript
atoi
ocra
omnifaces
kubuntu
j-security-check
cross-join
rapidsvn
viewer
iiop
post-commit-hook
appserver
ora-00904
spring-remoting
scrypt
diem
joomla-template
server-administration
ilasm
pinch
jquery-tools
catransform3d
google-ajax-api
dataform
appledoc
socketserver
twitterizer
load-time
web-garden
lxr
build-environment
strtod
silverlight-oob
firefox-3
commercial-application

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile