MIL_ID ContextId, | //in |
MIL_ID SrcImageBufId, | //in |
MIL_ID ResultId, | //in |
MIL_INT PeakWidthNominal, | //in |
MIL_INT PeakWidthDelta, | //in |
MIL_DOUBLE MinContrast, | //in |
MIL_INT64 ControlFlag, | //in |
MIL_DOUBLE ControlValue | //in |
This function detects the position and the intensity of a peak in every lane (row or column) of an image. It is well suited for applications that generate 3D data based on laser line or sheet of light profiling.
The function iterates through each lane. For each lane, the function determines the pixels that are in the peak neighborhood, as defined by PeakWidthNominal, PeakWidthDelta, and MinContrast. For each such region, it finds the position of the highest intensity with sub-pixel accuracy, and calculates the average intensity around that position. The position can be retrieved in a fixed-point representation, with 0 to 7 fractional bits.
For optimal performance, preprocess the result buffer by calling MimLocatePeak1d() with M_PREPROCESS. You can choose to preprocess with or without an image. When preprocessing with an image, specify a typical image in the series of images that you will process with MimLocatePeak1d(). The preprocessed image's size and bit-depth are stored. When preprocessing without an image (SrcImageBufId set to M_NULL), you must specify the number of scan lanes in a typical image in the series with ControlFlag. When preprocessing without an image, it is assumed that all images are 8-bit unsigned.
If the preprocess operation is not done explicitly (using M_PREPROCESS) or correctly, MimLocatePeak1d() will preprocess the result buffer internally when it is first called. If a new image in the series has a different size or bit-depth than the image used to preprocess, MimLocatePeak1d() will preprocess the result buffer again, given the new image's characteristics.
In a noisy image, or any image that might have multiple peaks in a single lane, such as when the object or surface is highly reflective, MimLocatePeak1d() can record the position and intensity of multiple peaks in a lane. You can create custom applications that sift through the multiple peaks in each lane to determine the best peak in the lane for your needs. To record multiple peaks in a lane, use MimControl() with M_NUMBER_OF_PEAKS set to the maximum number of peaks to record. For more information, see the Multiple peaks in a single lane subsection of the Peak intensity detection and depth maps section of Chapter 4: Advanced image processing.
You can retrieve the calculated results from the result buffer using MimGetResultSingle().
For results obtained from laser line images, you can draw an uncorrected depth map or intensity map using MimDraw() with M_DRAW_DEPTH_MAP_ROW or M_DRAW_INTENSITY_MAP_ROW, respectively. For more information, see the Generating an uncorrected depth map subsection of the Peak intensity detection and depth maps section of Chapter 4: Advanced image processing.
To verify that the peak was found at the right location, you can draw the calculated peak intensities at the calculated positions into an image buffer using MimDraw() with M_DRAW_PEAKS.
Specifies the identifier of the image processing context.
The image processing context must have been previously allocated using MimAlloc() with M_LOCATE_PEAK_1D_CONTEXT.
Specifies the identifier of the source image buffer.
Note that this function only supports 8- and 16-bit unsigned source image buffers.
This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.
This image buffer must not have an associated calibration context. Using an image buffer with an associated calibration context will cause an error.
When preprocessing (M_PREPROCESS), you can specify an image in the series, or you can set this parameter to M_NULL.
Specifies the identifier of the image processing result buffer in which to store results. The result buffer must have been allocated using MimAllocResult() with M_LOCATE_PEAK_1D_RESULT.
Specifies the nominal (expected average) width of the peak neighborhood. In laser line images, this is the average width of the laser line.
For specifying the nominal width of the
peak
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies to use the value of the control type M_PEAK_WIDTH_NOMINAL, set using MimControl(). (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to ignore this parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value > 0 |
Specifies the average width, in pixels. |
Specifies the number of pixels that can be added to or subtracted from the nominal width, when determining the range of allowable widths of the peak neighborhood.
PeakWidthNominal plus PeakWidthDelta defines the maximum width of the peak neighborhood. PeakWidthNominal minus PeakWidthDelta defines the minimum width of the peak neighborhood.
For specifying the variance of the width
of the peak
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies to use the value of the control type M_PEAK_WIDTH_DELTA, set using MimControl(). (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to ignore this parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value > 0 |
Specifies the maximum amount of variance from the nominal width, in pixels. |
Specifies the minimum contrast (difference) between the intensity of the local background and the minimum acceptable intensity of pixels in the peak neighborhood.
For specifying the contrast that defines
the peak
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies to use the value of the control type M_MINIMUM_CONTRAST, set using MimControl(). (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to ignore this parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
0 <= Value <= 65534 |
Specifies the minimum difference in intensity. (more details...) |
Specifies whether to explicitly preprocess the image processing result buffer.
For specifying whether or not to
preprocess
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies to perform the peak intensity detection on the specified image. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_PREPROCESS |
Specifies to preprocess the specified image processing result buffer. |
Specifies the number of scan lanes in subsequent source images, when preprocessing without an image (ControlFlag set to M_PREPROCESS and SrcImageBufId set to M_NULL).
In all other cases, set this parameter to M_DEFAULT.
Header | Include mil.h. |
Library | Use mil.lib; milim.lib. |
DLL | Requires mil.dll; milim.dll. |