# Camera Simulator

Camera Simulator is a function that allows AlignPlus program to acquire images by reading image files from designated local folders instead of acquiring from physical cameras when cameras are not available. This function can be found under System category in setup mode.

To make camera simulator work, you need to assign specific folders and put images into these folders. There are two ways to do it: simple mode and advanced mode.

## Simple Mode

In simple mode, AlignPlus will automatically create all sub folders for each camera at each acquisition position once the root directory is appointed. However, after that, it takes time to put correct images into each sub folder.

Here are the steps:

#### 1. Enable camera simulator

Enable camera simulator by checking on Simulator Cameras at the upper left corner of this page.

Once the camera simulator is enabled, the background color of title bar will change from yellow to blue to remind user that real cameras are not used for image acquisition. When is disabled, the background color will change back to yellow and the application will acquire images from real cameras.

- Using cameras:

- Using camera simulator:

#### 2. Select directory

Click "" icon and select one existing empty folder for Directory. If the selected directory is empty, the application will pop up a dialog asking if you want sub directories to be created automatically. If click Yes, then the program will automatically generate empty sub directories for all image acquisitions needed in this application.

The number of sub directories and their names are based on the wizard configuration. One sub directory is for one camera at one acquisition position. In the example below, HECalib0 task will have two sub directories, one for Camera0Pos0, another for Camera1Pos0. It is the same case with HECalib1: one for Camera2Pos0, another for Camera3Pos0.

As for CrossCalib, since it has four pins connected(two cameras at two positions), it will have four sub directories: Camera0Pos0, Camera1Pos0, Camera0Pos1, Camera1Pos1. For Features0, it also requires four sub directories since it also acquires images from two cameras at two positions. Features1 will have two sub directories similar as HECalib1.

Here are all the generated sub directories:

In most cases, one camera will only acquire one image at each position in feature finder task. However, if it is configured as acquiring two images in the wizard configuration, then the corresponding sub directories will be doubled with different exposure indexes, such as below:

#### 3. Copy simulation Images into each sub directory

All these automatically generated sub directories are empty inside, we need to manually put images in to make the program be able to read images from these directories. The supported image formats are: BMP, JPG, PNG and TIF.

These images should come from real cameras on a real machine in a real alignment or assembly application so that when they are used in this new project, the calibration and feature finding will make sense. Otherwise, the calibration may fail using some random calibration images. Or even if the calibration passes, the feature finding may still fail as the corrected images out of the wrong calibration results are so distorted.

For hand-eye calibration sub directories, the image quantity and order for each camera should match with the loop settings in the hand-eye calibration parameter.

Calibration Loop | Corresponding Images

For other directories, images should be put in an order that every time when the application reads images from each cameras' sub directories, the images are loaded in a way as if they were acquired of a real part from real cameras.

#### 4. Confirm playback order

After putting all necessary images under each sub directory, come back to camera simulator page, and choose the playback order from its drop-down list. The default option is Name(Ascending). You can also use Data if it describes the order better. Random is not recommended as it will break the order how those images were acquired.

#### 5. Rewind and Rescan

Click Rewind and Rescan button to let the application scan once for all images under each sub directory to register their names and numbers so that when it is time to play back, the program knows which image to read.

Rewind and Rescan should be clicked every time there is any image quantity or name changes under any sub directory. Otherwise, the program will assume the original images are still there and would continue to load them, which typically results in an acquisition exception.

During hand-eye calibration, if any exception(such as no valid data matrix code is found) occurs in the middle which caused the cancellation of the calibration, Rewind and Rescan should be clicked again after the exception is handled and before a new hand-eye calibration process starts to make sure all images will be loaded from the beginning. Otherwise, the application will continue to load the next images from the point where last hand-eye calibration is canceled, which will result in calibration failure in the end.

## Advanced Mode

When you have already created a bunch of sub folders and images for other projects, you may feel reluctant to copy those images again one by one into new project's sub directories just because they have different sub directory names. Advanced mode can help you on this.

In advanced mode, you re-navigate the path for each sub directory instead of copying images inside from directory to directory. This may make sub directory names quite colorful, however it does not affect the new program to load images correctly from each directory since it maintains a mapping between new directory names and default sub directory names.

Click the Advance button at the upper right corner to enter advanced mode. The setting page will change to as above: each default sub directory will have one directory browser that you can assign a new path. In the example above, all hand-eye calibration sub directories have been re-directed to some already existed image folders to avoid copying images around.

After all folders have been configured, double check playback order and then click Rewind and Rescan for the program to register all the changes.

## Run

After all settings are done either in simple mode or advanced mode, you are ready to run the program as if cameras were all set.