Separation Method
Syntax
CWIMAQVision.Separation SourceImage, DestImage [, NumberOfErosions = 1] [, StructuringElement]
Return Type
On success, this method returns 0. On failure, this method returns a negative number.
Purpose
Separates touching particles, particularly small isthmuses found between particles. This method performs n erosions (n = NumberOfErosions), and then reconstructs the final image based on the results of the erosion. If an existing isthmus is broken or removed during the erosion process, the particles are reconstructed without the isthmus. The reconstructed particles, however, have the same size as the initial particles except that they are separated. If no isthmus is broken during the erosion process, the particles are reconstructed as they were initially found, and no change is made.
Remarks
This method modifies the source image. If you need the original source image, create a copy of the image using the CWIMAQVision.Copy method before using this method.
All source and destination images must be U8 images.
The source image for a morphological transformation must have been created with a border capable of supporting the size of the structuring element. A 3 x 3 structuring element requires a minimal border of 1, a 5 x 5 structuring element requires a minimal border of 2, and so on. The border size of the destination image is not important.
Parameters
SourceImage As CWIMAQImage
The image containing particles to separate.
DestImage As CWIMAQImage
The resulting image.
NumberOfErosions As Variant
[Optional] The number of erosions to perform.
This parameter has a default value of 1.
StructuringElement As Variant
[Optional] A CWIMAQStructuringElement object that describes the structuring element applied to the image. The method applies a 3 x 3 structuring element if you do not set this parameter.
Example
Private Sub Run_Click() Dim i As New CWIMAQImage Dim structuringElement As New CWIMAQStructuringElement ' Threshold the image in Viewer1 to make it a binary image. CWIMAQVision1.Threshold CWIMAQViewer1.Image, CWIMAQViewer1.Image, _ 128, 255, , 255 ' Separate the particles in the image on Viewer1. CWIMAQVision1.Separation CWIMAQViewer1.Image, i, , _ structuringElement End Sub