With the SAL3D SDK distribution package comes example code. These examples come in both source and binary form. You can check the location of the example files in Distribution Files.
Along with the examples, you will find wxWidgets widgets ready to be used in a Widgets directory. The final example applications use them. You can take them into your application in order to quickly develop wxWidgets User Interfaces managing the SAL3D data structures.
The wxRangeMapExample is a wxWidgets example that demonstrates the use of the RangeMap class. It shows how to convert Frame objects with information from 3D cameras to RangeMap object, how to define the transformation factors, how to set the calibration matrix, and how to save and load RangeMap objects in files (usually with the extension .arm)
Import a Frame containing 3D data from a file with the Import Image... menu option under File. This converts the data from the Frame into a RangeMap object. Once it has created the RangeMap from the Frame, it shows the result in both 2D and 3D representations.
The user can save the created RangeMap to a file with Save.... This tells the RangeMap object to save itself to a new file or to replace an existing file. It is possible to load again the RangeMap from the file with Load... which creates a new RangeMap from the specified file.
The 2D view can show the RangeMap either in gray scale or color. Both modes are just representing visually the height of each RangeMap's profile. In grayscale, a darker color means lower height while lighter color means higher height. In color, blue is lower height and red is higher height. To change the current representation use the View menu.
The 3D view only uses color to represent the RangeMap's height and uses the same meaning as the 2D color representation but can show the RangeMap's representation in three different views: points, wireframe, and solid. The points view shows the RangeMap's profiles without connection between them. The wireframe shows the RangeMap profiles with lines between the points that shows the RangeMap's skeleton. Finally, the solid view shows the RangeMap in surfaces to show a virtual view of the real view object that the RangeMap represents. To change the current view representation use the View menu.
Once a RangeMap is created, it is also possible to change the 3D factors and the calibration matrices used to convert them to metric. Change the 3D transformation factors with Change 3D factors... under Range Map. Instead of the 3D factors, it is possible to change the calibration matrix with Load matrices... in Range Map. The example will ask for a text file with the calibration matrices coming from SAL3D's Metric tool.
The wxMetricExample demonstrates the use of the calibrate() function. It shows how to compute calibration parameters from a calibration pattern range map.
The user should load a range map by selecting a RangeMap (with the extension .arm) of the Calibration pattern in the File Name field.
By clicking on Calibrate button, the GUI computes the calibration parameters.
The Results field displays the transformation parameters from range map to 3D metric coordinates and from 3D metric coordinates to range map representation.
In case of wrong input, a message box appears indicating the calibration range map is not valid. If that case, make sure that:
The user can store the calibration parameters as a plain text file by clicking on the Save to File button. This text file can be used in the wxRangeMapExample to transform a range map to metric coordinates.
The wxMergerExample demonstrates the use of the Merger functions. It shows how to load Base and Auxiliary range maps, how to compute the Merger calibration parameters, and how to save and load these parameters in plain text files.
This demo is designed for an acquisition system composed by two cameras (base and auxiliary) acquiring images of the same scene. The use of two cameras is intended to decrease the number of acquisition occlusions. The goal of this demo is to generate a merger range map as a combination of both base and auxiliary range maps.
This GUI contains four windows. Both top window displays base and auxiliary range maps. Bottom left window displays the merged range map. Bottom right window displays the selected profile of the merger range map. User can modify the profile using the slider.
Merger tool requires its own parameters to combine information from both cameras. In order to compute them, user could load two calibration pattern range maps; one corresponding to the base camera and the other one to the auxiliary camera. After that, parameters can be computed clicking Import Image under Menu
In case of wrong input, a message box appears indicating one of both calibration range maps is not valid. If this message appears, make sure that:
User can store or load these parameters as plain text files.
When these parameters are computed (or loaded), for each pair of base and auxiliary range maps, a merged range map is generated and displayed in the appropriate window.
The wxMatch3DExample demonstrates the use of the Match3D class. It shows how to load RangeMap objects from files (usually with the extension .arm), how to set a range map as a reference object, how to align a part with the reference model, and how to compute the disparity map. User can find more information about the alignment and the disparity map in the Match3D documentation.
User can set a range map as the reference model with Open Model under File menu. Similarly, user can load a part object to inspect with Open Part under the same menu.
The top left window shows the 3D representation of both range maps (model in green, part in red). User can zoom (Ctrl+left mouse button), pan (left mouse button), and rotate(right mouse button) both surfaces.
The user can align both surfaces with Align under Match menu. This tells the RangeMap part to be aligned and compared with reference model.
Once the RangeMap is aligned, top right window displays both aligned surfaces, and the bottom window displays the disparity map.
User can change the color scale of the disparity map using the Set Tolerance under Disparity menu. Disparity map values higher than the tolerance are displayed in blue/red depending on their sign. Values between [-tolerance, tolerance] are scaled from blue to red.
The wxPeakFinderExample demonstrates the use of the PeakFinder class. It shows how to convert images to Frame objects, how to compute a Profile from a Frame, how to create a RangeMap from Profiles, and how to save RangeMap objects in files (usually with the extension .arm)
The user can extract a Profile from a Frame with Open Image... under File menu. This converts the image file to a Frame. Once it has computed the Profile from the Frame, it shows the result by overlapping the Profile over the image.
The user can also created a RangeMap with Grab... under Grabber menu. The GUI application displays a Grab Parameters dialog where user should define the frame grabber driver, the time out, and the maximum number of profiles.
The frame grabbers drivers, which are not the same as the vendor's drivers, instructs the application how to initialize a particular frame grabber and how to talk to the frame grabber in order to receive the image from the camera. The default installation path for these drivers is C:\Program Files\AQSENSE\SAL3D\drivers\.
This demo works using a virtual frame grabber too (fileframegrabber). This means that several files can be loaded to simulate the acquisition.
The timeout, in milliseconds, is the time that the frame grabber will use to wait for images from the camera.
The number of profiles defines the size of the range map. When the range map is composed by the same number of profiles as user has previously defined, the application ends the range map grabbing. As both conditions (timeout and number of profiles) are always used, the grabbing stops when one of both conditions is satisfied.
User can stop the Grabbing with Freeze under Grabber menu. In that case, the acquisition of the RangeMap stops without returning the acquired profiles.
Once a RangeMap is created, user can view it with Range Map... under View menu. Although this application only allows the user to view a color bidimensional representation of the RangeMap, user can save it and can use the coreExample for other range map representations.
by
1.7.6.1