是否可以使用 BlackBerry OS5 API 对相机进行对焦?
我正在开发一个应用程序,它可以预览设备的相机并分析该信息。 我可以创建相机预览,但无法让相机自动调整焦点。
我知道底层硬件可以执行自动对焦,因为本机黑莓相机应用程序通过在拍照之前自动对焦图像来响应“拍照”媒体键。
但是,我并不是要拍照,而是要连续扫描输入源中的条形码。
这是我的代码:
Player _player = Manager.createPlayer("capture://video");
_player.realize();
_player.start();
_vc = (VideoControl) _player.getControl("VideoControl");
//this is added to the screen
_viewFinder = (Field) _vc.initDisplayMode(
VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
FocusControl focusControl = (FocusControl) _player.getControl("javax.microedition.amms.control.camera.FocusControl");
//this has no effect
focusControl.setFocus(FocusControl.AUTO);
我已经在运行 OS5 的 BlackBerry Storm 9500 和 Bold 9700 上进行了测试。
I am developing an app which takes a preview of the device's camera and analyses that feed.
I can create the camera preview, but cannot get the camera to adjust its focus automatically.
I know that the underlying hardware is possible of performing an auto focus because the native BlackBerry camera app responds to the 'take photo' media key by auto focussing the image prior to taking the photo.
However, I'm not trying to take a photo, I'm trying to continuously scan the input feed for a barcode.
Here's my code:
Player _player = Manager.createPlayer("capture://video");
_player.realize();
_player.start();
_vc = (VideoControl) _player.getControl("VideoControl");
//this is added to the screen
_viewFinder = (Field) _vc.initDisplayMode(
VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
FocusControl focusControl = (FocusControl) _player.getControl("javax.microedition.amms.control.camera.FocusControl");
//this has no effect
focusControl.setFocus(FocusControl.AUTO);
I have tested on BlackBerry Storm 9500 and Bold 9700 both running OS5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个
它对我有用!
Try this
It works for me !!!
OS5 中相机聚焦的唯一方法是使用 VideoControl.getSnapshot()。没有其他办法。
The only way to focus the camera in OS5 is to use VideoControl.getSnapshot(). There is no other way.