| Customize Help

Search targets



You can search for instances of a model in an image, or you can search for instances of it in an Edge Finder result buffer. If you are searching for instances of a M_RECTANGLE model that is in a shape-specific context, you can also search for it in an M_SHAPE_SEGMENT Model Finder result buffer. In all cases, use MmodFind() to find the model. This function will write the results of the search in a specified Model Finder result buffer.

Finding models in an image

To search for instances of models in an image, the target image must be a 1-band, 8-bit unsigned image. 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.

For an M_GEOMETRIC or M_GEOMETRIC_CONTROLLED type of Model Finder context, the target image must be in the same calibrated state as the models. If the models are calibrated, the target must be; if the models are not calibrated, the target must not be.

For a synthetic model in an M_SHAPE_... type of Model Finder context, the model cannot be calibrated and will inherit the camera calibration of the target image. If the target is calibrated, the model will be interpreted in world units, and conversely, if the target does not have a camera calibration context associated with it, the model will be interpreted in pixel units.

You can search for a synthetic model in a calibrated or non-calibrated target image. If the target is calibrated, the model units should be the same as the calibrated units. In addition, you must associate the camera calibration context of the target image with the model using MmodControl() with M_ASSOCIATED_CALIBRATION. MIL needs the camera calibration context for internal purposes at preprocessing time. Note that MIL will not use the camera calibration context to compensate for incongruencies between the model and the target, nor will MIL map the model's coordinate system to that of the target.

Note that the edge extraction process, applied to the target image, uses the same denoising operation and detail level as the one for all image-type models in the Model Finder context. For more information, see the Extracting edges subsection of the Defining and adding models to your Model Finder context section earlier in this chapter.

Finding models in an Edge Finder result buffer

When using an Edge Finder result buffer as the target, Model Finder searches for active edges of the models only in the included edges of the result buffer. Therefore, using the Edge Finder result buffer as a target, instead of an image, allows you to be more specific about the edges in which to search. For example, you could select out unwanted edges in the target, which will speed up the search and further calculations, or create a target that is composed of user-defined edges.

Some things have to be done before you can search for instances of a model in an Edge Finder result buffer:

If the models in an M_GEOMETRIC or M_GEOMETRIC_CONTROLLED type of Model Finder context are calibrated, the results in the Edge Finder result buffer must also be calibrated. If the models are not calibrated, the results must not be calibrated either.

In the case of synthetic models, the same rules apply as when using a calibrated image as a target.

Finding models in an M_SHAPE_SEGMENT Model Finder result buffer

If you are searching for instances of a M_RECTANGLE model that is in a shape-specific context, you can also search for it in an M_SHAPE_SEGMENT Model Finder result buffer. This can be useful if you want to restrict the search to segment-type edges.