-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Samples: Add CaptureWithSettingsFromJSON sample
Add a new sample which reads settings from a .json file and captures an image in Hdev.
- Loading branch information
1 parent
a67b479
commit 3c56216
Showing
4 changed files
with
112 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<hdevelop file_version="1.2" halcon_version="21.11.0.0"> | ||
<procedure name="main"> | ||
<interface/> | ||
<body> | ||
<c>*</c> | ||
<c>* Capture a 3D color point cloud from the camera and use it to generate a HALCON ObjectModel3D which is then visualized.</c> | ||
<c>*</c> | ||
<c>* Please note that you first need to install Zivid Software and correctly set the environment variables. After this, you can access the camera with the HALCON</c> | ||
<c>* GenICamTL interface.</c> | ||
<c>*</c> | ||
<c/> | ||
<c>* Preparing graphics windows</c> | ||
<l>dev_close_window ()</l> | ||
<l>WinWidth := 960</l> | ||
<l>WinHeight := 800</l> | ||
<l>dev_open_window (0, 0, WinWidth, WinHeight, 'blue', Window3D)</l> | ||
<l>dev_open_window (0, WinWidth, WinWidth, WinHeight, 'black', Window2D)</l> | ||
<c/> | ||
<c>*Getting first available Zivid device</c> | ||
<l>info_framegrabber ('GenICamTL','device', Information, Devices)</l> | ||
<l>import './../../Procedures'</l> | ||
<l>get_first_available_zivid_device (Devices, Device)</l> | ||
<c/> | ||
<c>* Connecting to Zivid camera</c> | ||
<l>open_framegrabber ('GenICamTL',1, 1, 0, 0, 0, 0, 'progressive', -1, 'default', -1, 'false', 'default', Device, 0, 0, AcqHandle)</l> | ||
<c/> | ||
<c>* Loading settings from file</c> | ||
<l>get_zivid_sample_data_dir(ZividDataDir)</l> | ||
<l>get_framegrabber_param (AcqHandle, 'DeviceModelName', DeviceModelName)</l> | ||
<l>get_zivid_model_folder_name (DeviceModelName, DeviceModelFolder)</l> | ||
<l>read_dict (ZividDataDir + '/SettingsJson/' + DeviceModelFolder + '/Settings01.json', [], [], JsonSettings)</l> | ||
<l>read_zivid_json_params (AcqHandle, JsonSettings)</l> | ||
<c/> | ||
<c>* Configuring acquisition</c> | ||
<l>set_framegrabber_param (AcqHandle, 'create_objectmodel3d', 'enable')</l> | ||
<l>set_framegrabber_param (AcqHandle, 'add_objectmodel3d_overlay_attrib', 'enable')</l> | ||
<l>set_framegrabber_param (AcqHandle, 'grab_timeout', -1)</l> | ||
<c/> | ||
<c>* Capturing frame</c> | ||
<l>grab_data (Image, Region, Contours, AcqHandle, ObjectModel3D)</l> | ||
<c/> | ||
<c>* Extracting the following images: X, Y, Z, SNR, and RGB</c> | ||
<l>select_obj (Image, X, 1)</l> | ||
<l>select_obj (Image, Y, 2)</l> | ||
<l>select_obj (Image, Z, 3)</l> | ||
<l>select_obj (Image, Confidence, 4)</l> | ||
<l>select_obj (Image, RGBA, 5)</l> | ||
<c/> | ||
<c>* Displaying 2D color image</c> | ||
<l>dev_set_window (Window2D)</l> | ||
<l>dev_display (RGBA)</l> | ||
<c/> | ||
<c>* Displaying 3D color point cloud, press the button to continue</c> | ||
<l>Instructions[0] := 'Rotate: Left button'</l> | ||
<l>Instructions[1] := 'Zoom: Shift + left button'</l> | ||
<l>Instructions[2] := 'Move: Ctrl + left button'</l> | ||
<l>visualize_object_model_3d (Window3D, ObjectModel3D, [], [], ['red_channel_attrib','green_channel_attrib','blue_channel_attrib'], ['&overlay_red','&overlay_green','&overlay_blue'], [], [], [Instructions], PoseOut)</l> | ||
<c/> | ||
<c>* Disconnecting from Zivid Camera</c> | ||
<l>close_framegrabber (AcqHandle)</l> | ||
<c/> | ||
<c>* Closing graphics windows</c> | ||
<l>dev_set_window (Window2D)</l> | ||
<l>dev_close_window ()</l> | ||
<l>dev_set_window (Window3D)</l> | ||
<l>dev_close_window ()</l> | ||
</body> | ||
<docu id="main"> | ||
<parameters/> | ||
</docu> | ||
</procedure> | ||
</hdevelop> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters