问题描述
我一直在开发一个Android应用程序,它要求每个帧的摄像机preVIEW数据,以及除了我想间距(角度)值(从旋转传感器),同时捕捉frame.I想在球场值,同时映射捕捉实时框架,现在,我一直在previewframe映射间距值,但我没有得到,因为由于帧延迟的正确的结果越来越输送至previewframe回调。
I have been developing an android app which requires camera preview data for each frames,with addition to that I want pitch (Angle) values (From Rotation sensor) while capturing frame.I want to map the pitch values while capturing frames in real time, for now ,I have been mapping the pitch values in onpreviewframe, but I am not getting the correct results because of delay due to frame getting delivered to onpreviewframe callback.
我已经注册了previewcallbackwithbuffer回调在previewframe获得每个帧的数据method.And我已经越来越从onSensorChanged回调传感器值。
I have registered the previewcallbackwithbuffer callback to get each frames data in onpreviewframe method.And I have been getting the sensor value from onSensorChanged callback.
有没有一种方法,同时捕捉帧的音调值映射?
Is there a way to map the pitch values while capturing the frame?.
如果上面的问题是不是可以理解的,我已经准备好张贴code也..
If the above question is not understandable ,I am ready to post the code also..
推荐答案
一个用上previewFrame常见的陷阱()
回调是,默认情况下,这些回调将抵达主UI线程上,从而可以取消$ p $别的东西发生在UI线程上pdictably推迟。我已经解释了如何轻松地使用相机回调的独立处理器线程elsewhere.另外,按 onSensorChanged()
回调关闭UI线程。
One of the common pitfalls with onPreviewFrame()
callbacks is that by default these callbacks will arrive on the main UI thread, and thus can be unpredictably delayed by something else happening on the UI thread. I have explained how to easily switch to using a separate Handler Thread for camera callbacks elsewhere. Also, push the onSensorChanged()
callbacks off the UI thread.
在我的经验,归结音高preVIEW框架与上面的设置相当可靠。我应该承认,我的调节对preVIEW流〜5 FPS。我们不需要更高的帧速率,并让每个我们接受帧相当重的简历。
In my experience, attributing pitch to preview frames is quite reliable with the above setup. I should confess that my current app throttles the preview stream to ~5 FPS. We don't need higher frame rate, and have quite heavy CV on each frame that we accept.
这篇关于Android的相机previewframe回调和旋转传感器的同步回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!