open_framegrabber (AcqName, 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, 'false', CameraType, myBoard, -1, -1, AcqHandle)
When opening a connection to an image acquisition device with the operator open_framegrabber, the main parameter is the name of the corresponding HALCON acquisition interface. As a result, you get a so-called handle (AcqHandle) with which you can access the image acquisition device, for example, when calling the operator grab_image.
Figure 2.1: a) Acquired image; b) Processed image (automatic segmentation)
In the examples, most other parameters use default values ('default' or -1).
Step 2: Capture the image
grab_image(Image, AcqHandle)
After successfully connecting to your image acquisition device, you can grab an image by calling the operator grab_image with the corresponding handle AcqHandle.
Step 3: Loop through the images
while (Button != 1)
grab_image(Image, AcqHandle)
dev_set_window (WindowHandle)
dev_display (Image)
* -》 process image (segment with an automatically determined threshold)
auto_threshold (Image, Regions, 4)
connecon (Regions, ConnecdRegions)
dev_set_window (WindowHandleProcess)
dev_display (ConnectedRegions)
* -》 check for a click into the window (error handling switched off, otherwise the cuor must always be in the window)
dev_set_check ('~give_error')
get_mposition (WindowHandleButton, Row, Column, Button)
dev_set_check ('give_error')
endwhile
In the example, the grabbed image is then automatically segmented using the operator auto_threshold (see Figure 2.1). This is done in a loop that can be exited by clicking in the window with the left mouse button.
3. Connect to your image acquisition device
In this section we will show how to connect to frame grabbers and cameras in different configurations, from simple cases where one camera is connected to one frame grabber to more complex cases such as multiple synchronized cameras connected to one or more boards.
3.1 Open the connection with the specified configuration
With the operator open_framegrabber you can open a connection to an image acquisition device. Such a connection is described by four parameters (see Figure 3.1): First, you select an acquisition interface with the parameter Name. The parameter Device specifies the actual board or camera; depending on the acquisition interface, this parameter can contain a string describing the board or a simple number (in the form of a string!). Usually, cameras can be connected to the frame grabber at different ports, whose number can be selected with the parameter Port (or LineIn in rare cases). The parameter CameraType describes the connected camera: For cameras, this parameter usually specifies the used norm, for example, 'ntsc'. For cameras, this parameter usually specifies the camera model; more complex acquisition interfaces use this parameter to select a camera profile.
Therefore, open_framegrabber returns the handle of the open connection in the parameter AcqHandle. Note that if you use HALCON's COM or interfaces and call the operator via the corresponding class, such as HFramegrabber in C++, no handle is returned, because the instance of the class itself acts as your handle.
Using HDevelop's Image Acquisition Assistant you can easily connect to your image acquisition device and select the appropriate parameters.
3.2 Connecting multiple boards and cameras
Most HALCON acquisition interfaces allow the use of multiple frame grabbers and cameras. However, there is more than one way to connect cameras and boards and to access these configurations from within HALCON. Below, we describe different configurations; please check the online documentation of the HALCON interface for your image acquisition device (see %HALCONROOT%dochtmlmanuals, the HALCON folder in the Windows start menu, or http://www.halcon.com/image-acquisition) to find out which configurations it supports.
3.2.1 Single Camera
Figure 3.2a shows the simplest configuration: a single camera connected to a single board, accessible through a single handle. Some frame grabbers, especially digital ones, support only this configuration; you can still use multiple cameras with such frame grabbers by connecting each camera to a separate circuit board, as described in the following section. Note that this configuration is typical for digital cameras connected via 2.0, IEEE 1394, or GigE.
3.2.2 Multiple Boards
Figure 3.2b shows a configuration with multiple cameras, each connected to a separate board. In this case, you call the operator open_framegrabber once for each connection in the HDevelop example program solution_guideimage_acquisitionmultiple_boards.hdev.
Figure 3.2: a) Single board with single camera; b) Multiple boards, each with one camera; c) Multiple boards with one or more cameras; d) Multiple cameras on a single board and port switching; e) Multiple cameras on a single board for simultaneous capture; f) Simultaneous capture using multiple boards and cameras
open_framegrabber (AcqName, 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, 'default', 'default', Board0, -1, -1, AcqHandle0)
open_framegrabber (AcqName, 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, 'default', 'default', Board1, -1, -1, AcqHandle1)
In this example, the two calls differ only in the value of the parameter Device ("0" and "1"); of course, you can use different values for the other parameters and even connect to different image acquisition interfaces.
To grab images from two cameras, you only need to call the operator grab_image once with the two handles returned by two calls to open_framegrabber:
grab_image (Image0, AcqHandle0)
grab_image (Image1, AcqHandle1)
3.2.3 Multiple handles per board
Many frame grabbers offer multiple input ports, thus allowing multiple cameras to be connected to the board. Depending on the HALCON acquisition interface, this configuration can be accessed in different ways as described in this and the following sections.
The standard HALCON way of connecting cameras is shown in Figure 3.2c: Each connection has its own handle, i.e. open_framegrabber is called once for each camera with a different value for the parameter Port, as in the HDevelop example program solution_guideimage_acquisition multiple_ports.hdev:
open_framegrabber(AcqName, 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1,
'default', 'default', Board0, Port0, -1, AcqHandle0)
open_framegrabber(AcqName, 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1,
'default', 'default', Board1, Port1, -1, AcqHandle1)
grab_image (Image0, AcqHandle0) grab_image (Image1, AcqHandle1)
As shown in Figure 3.2c, you can also use multiple boards to connect multiple cameras.
3.2.4 Port Switching
Some image acquisition interfaces do not access the camera via multiple handles, but rather by dynamically switching the input ports (see Figure 3.2d). Therefore, open_framegrabber is called only once, as in the HDevelop example program solution_guideimage_acquisitionport_switching.hdev:
open_framegrabber (AcqName, 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, 'default', 'default', 'default', 0, -1, AcqHandle)
Between grabbing images you switch the port using the operator set_fegrabber_param
set_framegrabber_param (AcqHandle, 'port', Port0)
dev_set_window (WindowHandle0)
grab_image (Image0, AcqHandle)
set_framegrabber_param (AcqHandle, 'port', Port1)
dev_set_window (WindowHandle1)
grab_image(Image1, AcqHandle)
Note that port switching only works for compatible (similar) cameras, since open_framegrabber is only called once, i.e. the same set of parameter values is used for all cameras. In contrast, when using multiple handles as described above, you can specify different parameter values for individual cameras (with some board-specific restrictions).
3.2.5 Simultaneous capture (only for specific interfaces)
In the above configuration, images are grabbed from a single camera by calling the operator grab_image multiple times. In contrast, some acquisition interfaces allow grabbing images from multiple cameras with a single call to grab_image, which then returns a multi-channel image (see Figure 3.2e; Appendix A.1 on page 51 contains more information on multi-channel images). This mode is called simultaneous grabbing (or parallel grabbing); like port switching, it only works with compatible (similar) cameras. For example, you can use this mode to grab synchronized images from a stereo camera system. Note that simultaneous grabbing is only available with very few image acquisition interfaces.
In this mode, open_framegrabber is called only once, as can be seen in the HDevelop example program solution_guideimage_acquisitionsimultaneous_grabbing.hdev:
open_framegrabber (AcqName, 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, 'default', 'default', 'default', 0, -1, AcqHandle)
You can check the number of returned images (channels) using the operator count_channels
grab_image (SimulImages, AcqHandle)
count_channels (SimulImages, num_channels)
And extract individual images based on the number of images, for example using decomposition 2, decomposition 3, etc.:
if (num_channels == 2)
decompose2 (SimulImages, Image0, Image1)
Alternatively, you can convert the multi-channel image to an array of images using image_to_channels and then select a single image via select_obj.
3.3 Requesting information about the image acquisition interface
As mentioned before, the individual HALCON acquisition interfaces are described in detail on HTML pages which can be found in the directory %HALCONROOT%\doc\html\manuals or in the HALCON folder in the Windows start menu (if you installed the documentation). Another way to access information about the image acquisition interfaces is to use the operator info_framegrabber.
In the HDevelop sample program solution_guideimage_acquisitioninfo_framegrabber.hdev (preconfigured for the HALCON 1394IIDC interface, adjust the interface name according to your own image acquisition device), call this operator multiple times to query the interface version number, available devices, port number, camera type, and the default values of all parameters of open_framegrabber; the results, that is, the values displayed in the HDevelop variable window, are shown in Figure 3.3.
Previous article:Halcon Knowledge: Rectangle Measurement
Next article:KUKA robot electric servo welding clamp configuration and force establishment process V4.21
- Popular Resources
- Popular amplifiers
- Using IMU to enhance robot positioning: a fundamental technology for accurate navigation
- Researchers develop self-learning robot that can clean washbasins like humans
- Universal Robots launches UR AI Accelerator to inject new AI power into collaborative robots
- The first batch of national standards for embodied intelligence of humanoid robots were released: divided into 4 levels according to limb movement, upper limb operation, etc.
- New chapter in payload: Universal Robots’ new generation UR20 and UR30 have upgraded performance
- Humanoid robots drive the demand for frameless torque motors, and manufacturers are actively deploying
- MiR Launches New Fleet Management Software MiR Fleet Enterprise, Setting New Standards in Scalability and Cybersecurity for Autonomous Mobile Robots
- Nidec Drive Technology produces harmonic reducers for the first time in China, growing together with the Chinese robotics industry
- DC motor driver chip, low voltage, high current, single full-bridge driver - Ruimeng MS31211
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Io Development Notes] Gizwits Smart Watering Device Practice (3) - Automatically Generate Code Transplantation
- MSP430 Series Embedded Experiment Tutorial---Basics
- Which of the current mainstream smart home wireless protocols is better?
- About MicroPython ESP8266 WIFI settings problem - thanks!
- [STM32WB55 review]——by freebsder
- DSP 28335
- There is a large supply of microcontrollers!
- Share the C language program of FIR filter implemented by MSP430 microcontroller
- [2022 Digi-Key Innovation Design Competition] CAN Communication Data Display Terminal
- How to design high frequency (>100K) ultrasonic sensor processing circuit