Viewfinder Window

By default, the Camera library creates a viewfinder window.

The viewfinder window is a child Screen window that's managed by the Sensor service. This conveniently allows you to create a parent Screen window in your application and then join the viewfinder window to your application. This simplifies the application code you need to write to work with the image buffers (because the Sensor service handles the logic of managing these buffers) and to refresh the video stream.

Depending on the requirements of your application, there are situations where you won't require this viewfinder window to be created. For example, you might want to:
  • encode the image buffers and write them to files
  • run algorithms on the image buffers
  • process the image buffers and manipulate them
  • handle posting the image buffers in your application
In these situations, when you don't require the viewfinder window, you can disable the automatic creation of it. To tell the Sensor service to not create a viewfinder window, call camera_set_vf_property() with the CAMERA_IMGPROP_CREATEWINDOW property set to 0 (zero):
camera_set_vf_property(cameraHandle, CAMERA_IMGPROP_CREATEWINDOW, 0);

Start the viewfinder using camera_start_viewfinder(). When you are finished using the camera, you can call camera_stop_viewfinder() to stop the viewfinder.

If you want to change the video mode, you must first stop the viewfinder, then call camera_set_vf_mode() to change its mode. Keep in mind that any previous settings on the camera are lost when you do this. For that reason, you may want to reapply any sensor configuration settings before you do anything else. To start getting image buffers again, you must restart the viewfinder.

Page updated: