Download HALCON Version 5.2 HALCON/C++ User's Manual
Transcript
Chapter 7
Typical Image Processing Problems
This chapter shows the power of the HALCON system to offer or find solutions for image
processing problems. Some typical problems are introduced and sample solutions provided.
7.1 Thresholding an Image
Some of the most common sequences of HALCON operators may look like the following one:
HByteImage
HRegion
HRegionArray
HRegionArray
Image("file_xyz");
Threshold
= Image.Threshold(0,120);
ConnectedRegions = Threshold.Connection();
ResultingRegions =
ConnectedRegions.SelectShape("area","and",10,100000);
This terse program performs the following:
• All pixel are selected with gray values between the range 0 and 120.
• A connected component analysis is performed.
• Only regions of at least 10 pixel size are selected. This step can be considered as a step
to remove some of the noise from the image.
7.2 Edge Detection
For the detection of edges the following sequence of HALCON/C++ operators can be applied:
HByteImage
HByteImage
HRegion
HRegion
Image("file_xyz");
Sobel = Image.SobelAmp("sum_abs",3);
Max
= Sobel.Threshold(30,255);
Edges = Max.Skeleton();
A brief explanation:
• Before applying the sobel operator it might be useful to apply first a low-pass filter to the
image in order to suppress noise.
39