MIL_ID ContextId, | //in |
MIL_ID TargetImageOrEdgeResultId, | //in |
MIL_ID ModResultId | //in |
This function searches for the model(s) defined in the specified Model Finder context, in a target image or an Edge Finder result buffer, and writes the results in the provided result buffer. When an Edge Finder result buffer is specified, MmodFind() will search for the models only in the included edges in the Edge Finder result buffer. The search is performed using both the global search settings of the Model Finder context and each model's current search settings (see MmodControl()). The resulting values can be read with the MmodGetResult() function.
If an occurrence has both a score and target score greater than or equal to its model's respective certainty levels (specified using MmodControl() with M_CERTAINTY and M_CERTAINTY_TARGET), it is automatically considered an occurrence (default 80%); the remaining occurrences will be the best of those greater than or equal to the model's acceptance levels (specified using MmodControl() with M_ACCEPTANCE and M_ACCEPTANCE_TARGET).
The maximum number of occurrences found depends on the maximum number specified for the context (specified using MmodControl() with Index set to M_CONTEXT and ControlType set to M_NUMBER). If it is set to M_ALL, MmodFind() tries to find the maximum number of occurrences specified for each model (specified using MmodControl() with Index set to an index value and ControlType set to M_NUMBER), greater than or equal to the acceptance levels.
Note, the Model Finder context must be preprocessed (MmodPreprocess()) before calling this function.
If you are using a Model Finder context whose models are calibrated, the target image or Edge Finder results must also be calibrated. Conversely, if the models are uncalibrated, the target must be uncalibrated as well. If you are using an M_SHAPE_CIRCLE type of Model Finder context, the model does not need to be calibrated and will inherit the calibration of the target image or of the target Edge Finder result buffer.
Note, however, that if you calibrate the models using McalUniform() to apply a uniform calibration of pixel size equal to 1, the target image or Edge Finder results need not be calibrated. Conversely, if the models are uncalibrated, they can be used with a calibrated target only if it has been calibrated using McalUniform() to apply a uniform calibration of pixel size equal to 1.
If the target image or Edge Finder results are calibrated, results are calculated in the world coordinate system, otherwise they are calculated in the pixel coordinate system.
If the target image or Edge Finder results are calibrated, you can retrieve results in real-world or in pixel units. However, in the presence of distortion, some results are meaningless when converted from real-world to pixel units (for example, angle, scale, and transformation coefficient results). For example, if a model appears warped in the target image, but the calibration context of the target image compensates for this during the model search, the resulting angle is meaningful in the real-world coordinate system, and meaningless in the pixel coordinate system.
If the target image or Edge Finder results are not calibrated and the nominal search aspect ratio is not set to 1 (MmodControl() with M_ASPECT_RATIO), the nominal search aspect ratio is taken into account horizontally when performing the search, adjusting the target pixel width to equal the pixel height (the model's aspect ratio is not adjusted). As such, results will be returned for this corrected target coordinate system.
If you are searching for model(s) in an Edge Finder result buffer, you can speed up the search by setting M_EXTRACTION_SCALE in MedgeControl() prior to calling MedgeCalculate(). For more information on speeding up your search, see the Interfacing with Geometric Model Finder section of Chapter 8: Edge Finder.
Specifies the Model Finder context to use for the search. The Model Finder context must have been previously allocated on the system using MmodAlloc().
Specifies the target image or Edge Finder result buffer in which to search for the models.
Target images must be 1-band 8-bit unsigned images. The minimum and maximum target image sizes are 16x16 and 32768x32768 pixels, respectively. It is important to note that the minimum and maximum target image sizes are MIL limits. To make sure that you have enough memory, you can call MmodFind(); if you don't have enough memory, you will get a MIL error.
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.
The Edge Finder result buffer must have been previously allocated on the required system using MedgeAllocResult(); MedgeCalculate() must have already been called. In addition, the Edge Finder result buffer must be compatible with the Model Finder context. Enable compatibility using MedgeControl() with M_MODEL_FINDER_COMPATIBLE prior to calling MedgeCalculate().
Note that Edge Finder result buffers are not supported for an M_SHAPE_CIRCLE type of Model Finder context.
Specifies the result buffer in which to write the results of the search. If you are using an M_SHAPE_CIRCLE type of Model Finder context, you need to specify an appropriate M_SHAPE_CIRCLE type of Model Finder result buffer.
Header | Include mil.h. |
Library | Use mil.lib; milmod.lib. |
DLL | Requires mil.dll; milmod.dll. |