《NIVISION边缘检测》由会员分享,可在线阅读,更多相关《NIVISION边缘检测(17页珍藏版)》请在金锄头文库上搜索。
1、Definition of an EdgeAn edge is a significant change in the grayscale values between adjacent pixels in an image. In NI Vision, edge detection works on a 1D profile of pixel values along a search region, as shown in the following figure. The 1D search region can take the form of a line, the perimete
2、r of a circle or ellipse, the boundary of a rectangle or polygon, or a freehand region. The software analyzes the pixel values along the profile to detect significant intensity changes. You can specify characteristics of the intensity changes to determine which changes constitute an edge.2 Edges1 Se
3、arch LinesCharacteristics of an EdgeThe following figure illustrates a common model that is used to characterize an edge.Gray Level Inten sitiesSearchDirection1 Grayscale Profile3 Edge Stre ngth2 Edge Len gth4 Edge Locati onThe following list includes the main parameters of this model. Edge strength
4、 Defines the minimum difference in the grayscale values between the background and the edge. The edge strength is also called the edge contrast. The following figure shows an image that has different edge strengths. The strength of an edge can vary for the following reasons: Lighting conditions If t
5、he overall light in the scene is low, the edges in image will have lowstrengths. The following figure illustrates a change in the edge strength along the boundary ofan object relative to different lighting conditions. Objects with different grayscale characteristicsThe presence of a very bright obje
6、ct causesother objects in the image with lower overall intensities to have edges with smaller strengths.ABC* Edge length Defines the distance in which the desired grayscale difference between the edge and the background must occur. The length characterizes the slope of the edge. Use a longer edge le
7、ngth, defined by the size of the kernel used to detect edges, to detect edges with a gradual transition between the background and the edge.* Edge location The x, y location of an edge in the image.Edge polarityDefines whether an edge is rising or falling. A rising edge is characterized byan increas
8、e in grayscale values as you cross the edge. A falling edge is characterized by a decrease in grayscale values as you cross the edge. The polarity of an edge is linked to the search direction. The following figure shows examples of edge polarities.jFaling Edge Negatlwe PdaritYRising Edge Positive Pa
9、rityRisingPositiveNagathfE11Edge Detection Methods |NI Vision offers two ways to perform edge detection. Both methods compute the edge strength ateach pixel along the 1D profile.An edge occurs when the edge strength is greater than a minimumstrength. Additional checks find the correct location of th
10、e edge. You can specify the minimum strength by using the Minimum Edge Strength or Threshold Levelparameter in the software.Simple Edge DetectionThe software uses the pixel value at any point along the pixel profile to define the edge strength at that point. To locate an edge point, the software sca
11、ns the pixel profile pixel by pixel from the beginning to the end. A rising edge is detected at the first point at which the pixel value is greater than a threshold value plus a hysteresis value. Set this threshold value to define the minimum edge strength required for qualifying edges. Use the hyst
12、eresis value to declare different edge strengths for the rising and falling edges. When a rising edge is detected, the software looks for a falling edge. A falling edge is detected when the pixel value falls below the specified threshold value. This process is repeated until the end of the pixel pro
13、file. The first edge along the profile can be either a rising or falling edge. The following figure illustrates the simple edge model.The simple edge detection method works well when there is little noise in the image and when there is a distinct demarcation between the object and the background.Gra
14、y LevelInten sities1 Grayscale Profile2 Threshold Value4 Rising Edge Locatio n5 Falling Edge Location3 HysteresisAdvanced Edge DetectionThe edge detection algorithm uses a kernel operator to compute the edge strength. The kernel operator is a local approximation of a Fourier transform of the first d
15、erivative. The kernel is applied to each point in the search region where edges are to be located. For example, for a kernel size of 5, the operator is a ramp function that has 5 entries in the kernel. The entries are -2,- 1,0, 1,2. The width of the kernel size is user-specified and should be based on theexpected sharpness, or slope, of the edges to be located. The following figure shows the pixeldata along a search line and the equivalent edge magnitudes computed using a kernel of size 5.Peaks in the edge magnitude profile above a user-specified threshold are the edge points dete