Using File Cameras¶
Starting from EnsensoSDK 2.1, NxView and the NxLib API support file cameras. A file camera simulates a hardware camera from saved images and a corresponding calibration file and can be opened just like a hardware camera.
Note
Only signed images can be used in a file camera without requiring an additional license. Unsigned images cannot be displayed in NxView. Images are signed if they are from a hardware camera and got saved as explained below.
Note
Make sure to choose a unique serial number for your file camera which does not collide with any attached hardware camera.
Note
File cameras currently only work with png and tiff image formats.
Using File Cameras in NxView¶
Saving Image Data¶
There are two ways to save the data for a file camera from NxView:
Via save dialog
Create an .enscam file via
File
→Save...
→Raw Images
/Raw Images As...
containing a single image set. An .enscam file is a zip compressed archive whose file extension is associated with NxView.Capture and save again to add another image set to the same .enscam file.
Via record dialog
Save a sequence of image sets via
Capture
→Record
or the recording button to a folder.Record again and further image sequences are saved to the same folder.
Check the
Subfolder
checkbox in theSequence Setup
box to create a new subfolder for each sequence.Check the
Subfolder
checkbox in the camera tabs to create a subfolder for each camera in the sequence subfolder.
Creating a File Camera¶
After you saved the necessary data sets into a folder or .enscam file you can open NxView and click Create...
→ File Camera
.
In the following dialog you can select either the folder or an .enscam file with your data sets and enter a serial number for the file camera. After clicking OK the camera will be created and is now available in your camera list.
You can also drag and drop the folder or .enscam file direcly onto the camera list to automatically open it as a file camera.
Using File Cameras With the API¶
You can also create and use file cameras in your application.
Saving Image Data¶
Camera images can be saved via the NxLib in a format suitable for file cameras using the command SaveFileCamera.
Creating a File Camera¶
To create a file camera from existing data, you can use the CreateFileCamera command. Use DeleteCamera to remove it again.
There are a few things to note when working with file cameras:
Because the image acquisition is done by reading the raw image files, you cannot choose any capture parameters. Most nodes below Parameters/Capture are not present or cannot be modified.
The Capture and Trigger commands simply load the next image set from the folder instead of grabbing it from a hardware camera.
Trigger loads the image data from disk, whereas Retrieve exchanges the image nodes in the NxLib tree.
The parameter ImageSet for the Capture and Trigger commands can be used to load a specific data set.
The nodes Parameters/ImageName, Parameters/ImageSet and Parameters/NumberOfImages provide information about the image files that were loaded by the last Capture or Retrieve command.
Loading Original Camera Parameters¶
The original parameters at the time of saving the images are available from the file camera tree.
For example, the original parameters can be loaded with the following snippet:
NxLibItem camera = NxLibItem()[itmCameras][serial];
camera[itmParameters] << camera[itmOriginal][itmParameters];
Loading the Original Position of File Cameras¶
By default, the original workspace position of file cameras is preserved. When the file camera loads a new image it adjusts its Link to the workspace position it had when the images were saved. This behavior can be changed with the Follow/Link parameter.