Circular indicator lamp positioning and state recognition method for power distribution cabinet
1. A circular indicator lamp positioning and state identification method of a power distribution cabinet is characterized by comprising a positioning process of a circular indicator lamp position and an identification process of the circular indicator lamp state, wherein the specific positioning process of the circular indicator lamp position comprises the following steps:
s101: original color image I based on RGB three primary colors of circular indicator lightrgbConversion to grey scaleFIG. IgrayThe converted gray scale map IgrayThe gray value gray of (1) is 0.299 × r +0.587 × g +0.114 × b, where r, g and b are the original color image I respectivelyrgbRed, green and blue pixel values;
s102: for the gray scale image IgrayCarrying out bilateral filtering;
s103: utilizing Canny edge detection operator to carry out alignment on the gray scale image IgrayPerforming bilateral detection to obtain edge characteristic diagram Iedge;
S104: for the edge feature map I obtained in the step S103edgeCarrying out Hough circle detection to obtain a circular estimation area of the circular indicator light;
s105: calculating the edge feature map IedgeThe distance between each edge point and the circle center of the circular estimation area is saved, and the edge points meeting the preset distance threshold range are saved;
s106: sorting the edge points meeting the preset distance threshold range according to the size of an included angle between a straight line passing through the edge point and the circle center of the circular estimation area and a horizontal axis so as to obtain an edge point set;
s107: dividing the edge point set in the step S106 into n edge point sets, wherein n is more than 0, sampling m edge point sets, wherein m is more than 0 and less than or equal to n, performing secondary circle fitting on the sampled m edge point sets according to a least square method, repeatedly sampling and performing secondary circle fitting, thereby obtainingA fitting circle result, wherein the fitting circle result comprises an estimated value of the circle center and the radius of the circular indicator light;
s108: screening fitting circle results meeting a preset threshold, and respectively calculating an average value of the circle center of the circular indicator light and the radius of the circular indicator light corresponding to the fitting circle results meeting the preset threshold to obtain the circle center position and the radius of the circular indicator light, so as to determine the positioning area of the circular indicator light;
after the positioning area of the circular indicator light is determined in the step S108, identifying the state of the circular indicator light, specifically, the identifying process of the state of the circular indicator light includes the following steps:
s109: the original color image I of the RGB three primary colors of the circular indicator lightrgbConversion into a grey-scale image Igray2The converted gray scale map Igray2The gray value gray2 of (r + g + b-min { r, g, b }) is 0.5 × (r + g + b-min), where r, g, and b are the original color image I, respectivelyrgbRed, green and blue pixel values;
s110, respectively calculating the average brightness of the positioning area of the circular indicator light and the average brightness of a background area of the circular indicator light through the gray value gray2, wherein the background area of the circular indicator light is an area except the positioning area of the circular indicator light in a preset rectangular area, the preset rectangular area takes the circle center position of the circular indicator light as a center point, and the side length of the preset rectangular area is greater than the diameter of the circular indicator light;
s111: original color image I based on RGB three primary colors of circular indicator lightrgbRespectively calculating pixel average values of red, green and blue primary color channels in the positioning area of the circular indicator light;
s112: and calculating the difference value between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light, and when the difference value between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light meets a first preset condition, and simultaneously, when the pixel average values of the red, green and blue primary color channels corresponding to the positioning area of the circular indicator light meet a second preset condition, judging that the state of the circular indicator light is in an on state.
2. The method for positioning and status recognition of the circular indicator light of the power distribution cabinet according to claim 1, wherein the step S105 specifically comprises: establishing a two-dimensional coordinate system by taking the central point of the preliminary estimation area of the circular indicator lamp as an origin, and thenThe circle center of the circular indicator light is defined as (a, b), the radius of the circular indicator light is defined as r, and the edge characteristic diagram I is calculatededgeAnd storing the Euclidean distance dis between each edge point and the circle center (a, b) of the circular indicator lamp in an edgeArray array, wherein the Euclidean distance dis satisfies the condition that (1-lambda) x r is not more than dis and not more than (1+ lambda) x r, and the condition that 0 is more than lambda and less than 1 is satisfied.
3. The circular indicator lamp positioning and status identification method of the power distribution cabinet according to claim 1 or 2, wherein the sorting method in the step S106 comprises: and performing ascending or descending according to the size of an included angle between a horizontal axis and a straight line formed by the edge points meeting the preset distance range threshold and the circle center.
4. The circular indicator lamp positioning and status identification method for the power distribution cabinet according to claim 2, wherein the step S108 specifically comprises:
s1081: obtained in the step S107Sorting the fitting circle results according to the Euclidean distance from the initial position of the circle center of the circular indicator lamp to the origin of the two-dimensional coordinate system, and deleting the fitting circle results which satisfy the condition that the ratio is beta 1 between the first arrangement and the last arrangement of the sorted fitting circle results respectively, wherein the value range of beta 1 is more than 0 and less than beta 1 and less than 0.5;
s1082: sorting the fitting circle results screened in the step S1081 according to the preliminary numerical value of the radius of the circular indicator light, and deleting the fitting circle results which are sorted and satisfy the condition that the ratio of beta 2 is the foremost in arrangement and the last in arrangement respectively, wherein the value range of beta 2 is more than 0 and less than beta 2 and less than 0.5;
s1083: calculating the average value of the vector coordinates of the circle center of the circular indicator light in the fitting circle result screened in the step S1082Average value with radiusThereby determining the location area of the circular indicator light.
5. The method according to claim 1, wherein the first preset condition in step S112 is that a difference between an average brightness of a positioning area of the circular indicator and an average brightness of a background area of the circular indicator is greater than a preset first threshold; the second preset condition is that the pixel average values of the red, green and blue primary color channels in the positioning area of the circular indicator light are all larger than a preset second threshold value.
Background
At present, with the enhancement of public safety awareness, the importance of the inspection robot on the market is increasingly prominent. In the aspect of the power industry, intelligent inspection is taken as an important ring of the power industry, and a corresponding intelligent inspection robot plays an increasingly important role. In the intelligent inspection process, the states of indicator lamps in various instruments, switches and other objects are often distinguished, so that the working states of the switches of the relevant instruments are obtained.
Generally, the method for identifying the state of the circular indicator lamp can be divided into two steps, wherein the first step is positioning, and the position of the circular indicator lamp to be identified is positioned; the second step is state judgment, and the on-off state of the indicator light is judged by combining some characteristics inside and outside the indicator light area. However, if the first step of positioning the indicator light is not accurate, the calculation of the relevant characteristics of the second step is affected, and the on-off state judgment of the final indicator light is further affected.
The traditional positioning method of the circular indicator lamp is that a circular target in an original image is detected; the current commonly used circle detection algorithm is circle detection based on Hough transform, firstly, a filtering operation is carried out on an image, and noise within a certain degree is reduced; then extracting edge features of the image by using some common edge detection algorithms (such as Canny algorithm); and then, taking out the circular target on the basis of the edge feature map by using a Hough transform method. Under the condition of large noise, the method can generate large deviation on the calculation of the circle center and the radius of the circular indicator light, thereby influencing the positioning accuracy.
In addition, after the indicator light is positioned, some statistical characteristics in the area of the indicator light can be extracted to judge the state of the indicator light. The traditional method generally only uses a gray-scale map to calculate whether the difference between the average brightness in the indicator light area and the average brightness outside the indicator light area is greater than a certain preset threshold value to judge the state of the indicator light, but the method has unsatisfactory effects in the conditions of uneven brightness, shadow and the like, so that errors can be caused in the judgment of the final state of the indicator light.
Disclosure of Invention
The application provides a circular indicator lamp positioning and state recognition method of a power distribution cabinet, which is used for solving the technical problem that the existing circular indicator lamp positioning and state recognition method has larger errors in positioning and working state judgment of the circular indicator lamp.
In view of this, the present application provides a method for positioning and identifying a state of a circular indicator light of a power distribution cabinet, including a positioning process of a position of the circular indicator light and an identification process of a state of the circular indicator light, where the positioning process of the position of the circular indicator light specifically includes the following steps:
s101: original color image I based on RGB three primary colors of circular indicator lightrgbConversion into a grey-scale image IgrayThe converted gray scale map IgrayThe gray value gray of (1) is 0.299 × r +0.587 × g +0.114 × b, where r, g and b are the original color image I respectivelyrgbRed, green and blue pixel values;
s102: for the gray scale image IgrayCarrying out bilateral filtering;
s103: utilizing Canny edge detection operator to carry out alignment on the gray scale image IgrayPerforming bilateral detection to obtain edge characteristic diagram Iedge;
S104: for the edge feature map I obtained in the step S103edgeCarrying out Hough circle detection to obtain a circular estimation area of the circular indicator light;
s105: calculating the edge feature map IedgeThe distance between each edge point and the circle center of the circular estimation area is saved, and the edge points meeting the preset distance threshold range are saved;
s106: sorting the edge points meeting the preset distance threshold range according to the size of an included angle between a straight line passing through the edge point and the circle center of the circular estimation area and a horizontal axis so as to obtain an edge point set;
s107: dividing the edge point set in the step S106 into n edge point sets, wherein n is more than 0, sampling m edge point sets, wherein m is more than 0 and less than or equal to n, and performing least square methodPerforming quadratic circle fitting on the m sampled edge point sets, repeatedly sampling and performing quadratic circle fitting to obtainA fitting circle result, wherein the fitting circle result comprises an estimated value of the circle center and the radius of the circular indicator light;
s108: screening fitting circle results meeting a preset threshold, and respectively calculating an average value of the circle center of the circular indicator light and the radius of the circular indicator light corresponding to the fitting circle results meeting the preset threshold to obtain the circle center position and the radius of the circular indicator light, so as to determine the positioning area of the circular indicator light;
after the positioning area of the circular indicator light is determined in the step S108, identifying the state of the circular indicator light, specifically, the identifying process of the state of the circular indicator light includes the following steps:
s109: the original color image I of the RGB three primary colors of the circular indicator lightrgbConversion into a grey-scale image Igray2The converted gray scale map Igray2The gray value gray2 of (r + g + b-min { r, g, b }) is 0.5 × (r + g + b-min), where r, g, and b are the original color image I, respectivelyrgbRed, green and blue pixel values;
s110, respectively calculating the average brightness of the positioning area of the circular indicator light and the average brightness of a background area of the circular indicator light through the gray value gray2, wherein the background area of the circular indicator light is an area except the positioning area of the circular indicator light in a preset rectangular area, the preset rectangular area takes the circle center position of the circular indicator light as a center point, and the side length of the preset rectangular area is greater than the diameter of the circular indicator light;
s111: original color image I based on RGB three primary colors of circular indicator lightrgbRespectively calculating pixel average values of red, green and blue primary color channels in the positioning area of the circular indicator light;
s112: and calculating the difference value between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light, and when the difference value between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light meets a first preset condition, and simultaneously, when the pixel average values of the red, green and blue primary color channels corresponding to the positioning area of the circular indicator light meet a second preset condition, judging that the state of the circular indicator light is in an on state.
Preferably, the step S105 specifically includes: establishing a two-dimensional coordinate system by taking the central point of the preliminary estimation area of the circular indicator light as an origin, defining the circle center of the circular indicator light as (a, b), defining the radius of the circular indicator light as r, and calculating the edge characteristic graph IedgeAnd storing the Euclidean distance dis between each edge point and the circle center (a, b) of the circular indicator lamp in an edgeArray array, wherein the Euclidean distance dis satisfies the condition that (1-lambda) x r is not more than dis and not more than (1+ lambda) x r, and the condition that 0 is more than lambda and less than 1 is satisfied.
Preferably, the sorting method in step S106 includes: and performing ascending or descending according to the size of an included angle between a horizontal axis and a straight line formed by the edge points meeting the preset distance range threshold and the circle center.
Preferably, the step S108 specifically includes:
s1081: obtained in the step S107Sorting the fitting circle results according to the Euclidean distance from the initial position of the circle center of the circular indicator lamp to the origin of the two-dimensional coordinate system, and deleting the fitting circle results which satisfy the condition that the ratio is beta 1 between the first arrangement and the last arrangement of the sorted fitting circle results respectively, wherein the value range of beta 1 is more than 0 and less than beta 1 and less than 0.5;
s1082: sorting the fitting circle results screened in the step S1081 according to the preliminary numerical value of the radius of the circular indicator light, and deleting the fitting circle results which are sorted and satisfy the condition that the ratio of beta 2 is the foremost in arrangement and the last in arrangement respectively, wherein the value range of beta 2 is more than 0 and less than beta 2 and less than 0.5;
s1083: calculating the average value of the vector coordinates of the circle center of the circular indicator light in the fitting circle result screened in the step S1082Average value with radiusThereby determining the location area of the circular indicator light.
Preferably, the first preset condition in step S112 is that when the difference between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light is greater than a preset first threshold; the second preset condition is that the pixel average values of the red, green and blue primary color channels in the positioning area of the circular indicator light are all larger than a preset second threshold value.
According to the technical scheme, the embodiment of the application has the following advantages:
the embodiment of the application provides a circular indicator lamp positioning and state recognition method of a power distribution cabinet, firstly, noise can be reduced by carrying out bilateral filtering on a gray scale map, the influence of the noise on a positioning result of the gray scale map is reduced, and the positioning accuracy is improved; after the circular indicator lamp is accurately positioned, the indicator lamp state identification method combining the average brightness difference inside and outside the indicator lamp area and the RGB three-channel color characteristics avoids singly utilizing the brightness information judgment basis, and greatly improves the accuracy of state identification.
Drawings
Fig. 1 is a flowchart of a positioning process of a circular indicator light position in a method for positioning and status identifying a circular indicator light of a power distribution cabinet according to an embodiment of the present application;
fig. 2 is a flowchart of a recognition process of a state of a circular indicator light in a method for positioning and recognizing a state of a circular indicator light of a power distribution cabinet according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The following is an embodiment of a circular indicator lamp positioning and state identification method of a power distribution cabinet provided by the present application.
The method for positioning and identifying the state of the circular indicator light of the power distribution cabinet provided by the embodiment comprises a positioning process of the position of the circular indicator light and an identification process of the state of the circular indicator light, and referring to fig. 1, the specific positioning process of the position of the circular indicator light comprises the following steps:
s101: original color image I based on RGB three primary colors of circular indicator lightrgbConversion into a grey-scale image IgrayConverted gray scale map IgrayThe gray value gray of (1) is 0.299 × r +0.587 × g +0.114 × b, where r, g and b are the original color image I respectivelyrgbRed, green and blue pixel values;
s102: for gray scale image IgrayCarrying out bilateral filtering;
it can be understood that for the gray scale image IgrayThe bilateral filtering can reduce noise and reduce the influence of the noise on the calculation result.
S103: utilizing Canny edge detection operator to carry out alignment on gray level image IgrayPerforming bilateral detection to obtain edge characteristic diagram Iedge;
It should be noted that the Canny edge detection operator is the prior art, and is not described herein.
S104: for the edge obtained in step S103Characteristic diagram IedgeCarrying out Hough circle detection to obtain a circular estimation area of the circular indicator light;
s105: computing an edge feature map IedgeThe distance between each edge point and the circle center of the circular estimation area is saved, and the edge points meeting the preset distance threshold range are saved;
s106: sorting the edge points meeting a preset distance threshold range according to the size of an included angle between a straight line passing through the edge point and the circle center of the circular estimation area and a horizontal axis so as to obtain an edge point set;
s107: dividing the edge point set in the step S106 into n edge point sets, wherein n is more than 0, sampling m edge point sets, wherein m is more than 0 and less than or equal to n, performing secondary circle fitting on the sampled m edge point sets according to a least square method, repeatedly sampling and performing secondary circle fitting, thereby obtainingPlanting a fitting circle result, wherein the fitting circle result comprises estimated values of the circle center and the radius of the circular indicator light;
it can be understood that m pieces of edge points are collectively sampled at n pieces of edge points according to the principle of permutation and combination
The set is subjected to quadratic circle fitting, and the finally obtained fitting circle result isMeanwhile, secondary circle fitting is carried out on the m sampled edge point sets according to a least square method, and positioning robustness and positioning accuracy can be improved.
S108: screening fitting circle results meeting a preset threshold, and respectively calculating the average value of the circle center of the circular indicator lamp corresponding to the fitting circle results meeting the preset threshold and the radius of the circular indicator lamp to obtain the circle center position and the radius of the circular indicator lamp, so as to determine the positioning area of the circular indicator lamp;
after the positioning area of the circular indicator light is determined in step S108, the status of the circular indicator light is identified, and referring to fig. 2, the specific identification process of the status of the circular indicator light includes the following steps:
s109: original color image I of RGB three primary colors of circular indicator lightrgbConversion into a grey-scale image Igray2The converted gray value gray2 is 0.5 × (r + g + b-min { r, g, b }), where r, g, and b are the original color image I, respectivelyrgbRed, green and blue pixel values;
it should be noted that, in step S109, the original color image I of the three primary colors RGB of the circular indicator light is processedrgbThe conversion mode of converting into the gray scale map focuses more on the color characteristic of the indicator light, and can truly reflect the true brightness of the indicator light, so that the accuracy of judging the state of the indicator light is improved.
S110, respectively calculating the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light through gray value gray2, wherein the background area of the circular indicator light is an area except the positioning area of the circular indicator light in a preset rectangular area, the preset rectangular area takes the circle center position of the circular indicator light as a center point, and the side length of the preset rectangular area is larger than the diameter of the circular indicator light;
s111: original color image I of RGB three primary colors based on circular indicator lightrgbRespectively calculating pixel average values of red, green and blue primary color channels in a positioning area of the circular indicator light;
s112: and calculating the difference value between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light, and when the difference value between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light meets a first preset condition, and simultaneously, when the pixel average values of the red, green and blue three primary color channels corresponding to the positioning area of the circular indicator light meet a second preset condition, judging that the state of the circular indicator light is in an on state.
According to the embodiment, firstly, noise can be reduced by carrying out bilateral filtering on the gray-scale map, the influence of the noise on the positioning result of the gray-scale map is reduced, and the positioning accuracy is improved; after the circular indicator lamp is accurately positioned, the indicator lamp state identification method combining the average brightness difference inside and outside the indicator lamp area and the RGB three-channel color characteristics avoids singly utilizing the brightness information judgment basis, and greatly improves the accuracy of state identification. Simultaneously, this embodiment can be applied to and patrol and examine the robot, can help patrolling and examining the in-process that the robot can discern the on-off state of circular pilot lamp more accurately patrolling and examining.
The round indicator lamp positioning and state recognition method for the power distribution cabinet provided by the application comprises the following another embodiment of the round indicator lamp positioning and state recognition method for the power distribution cabinet provided by the application.
The circular indicator lamp positioning and state recognition method for the power distribution cabinet comprises a positioning process of a circular indicator lamp position and a recognition process of a circular indicator lamp state, wherein the specific positioning process of the circular indicator lamp position comprises the following steps:
s201: original color image I based on RGB three primary colors of circular indicator lightrgbConversion into a grey-scale image IgrayConverted gray scale map IgrayThe gray value gray of (1) is 0.299 × r +0.587 × g +0.114 × b, where r, g and b are the original color image I respectivelyrgbRed, green and blue pixel values;
s202: for gray scale image IgrayCarrying out bilateral filtering;
it can be understood that for the gray scale image IgrayThe bilateral filtering can reduce noise and reduce the influence of the noise on the calculation result.
S203: utilizing Canny edge detection operator to carry out alignment on gray level image IgrayPerforming bilateral detection to obtain edge characteristic diagram Iedge;
It should be noted that the Canny edge detection operator is the prior art, and is not described herein.
S204: for the edge feature map I obtained in step S203edgeCarrying out Hough circle detection to obtain a circular estimation area of the circular indicator light;
s205: computing an edge feature map IedgeThe distance between each edge point and the circle center of the circular estimation area is saved, and the edge points meeting the preset distance threshold range are saved;
s206: sorting the edge points meeting a preset distance threshold range according to the size of an included angle between a straight line passing through the edge point and the circle center of the circular estimation area and a horizontal axis so as to obtain an edge point set;
s207: dividing the edge point set in the step S206 into n edge point sets, wherein n is more than 0, sampling m edge point sets, wherein m is more than 0 and less than or equal to n, performing secondary circle fitting on the sampled m edge point sets according to a least square method, repeatedly sampling and performing secondary circle fitting, thereby obtainingPlanting a fitting circle result, wherein the fitting circle result comprises estimated values of the circle center and the radius of the circular indicator light;
it can be understood that according to the permutation and combination principle, m edge point sets are sampled from n edge point sets for secondary circle fitting, and the finally obtained fitting circle result isMeanwhile, secondary circle fitting is carried out on the m sampled edge point sets according to a least square method, and positioning robustness and positioning accuracy can be improved.
S208: screening fitting circle results meeting a preset threshold, and respectively calculating the average value of the circle center of the circular indicator lamp corresponding to the fitting circle results meeting the preset threshold and the radius of the circular indicator lamp to obtain the circle center position and the radius of the circular indicator lamp, so as to determine the positioning area of the circular indicator lamp;
after the positioning area of the circular indicator light is determined in step S208, the status of the circular indicator light is identified, and the specific identification process of the status of the circular indicator light includes the following steps:
s209: original color image I of RGB three primary colors of circular indicator lightrgbConversion into a grey-scale image Igray2After conversionThe gray value gray2 of (r + g + b-min { r, g, b }) is 0.5 × (r + g + b-min), where r, g, and b are the original color image I, respectivelyrgbRed, green and blue pixel values;
it should be noted that, in step S209, the original color image I of the three primary colors RGB of the circular indicator light is processedrgbThe conversion mode of converting into the gray scale map focuses more on the color characteristic of the indicator light, and can truly reflect the true brightness of the indicator light, so that the accuracy of judging the state of the indicator light is improved.
S210, respectively calculating the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light through gray value gray2, wherein the background area of the circular indicator light is an area except the positioning area of the circular indicator light in a preset rectangular area, the preset rectangular area takes the circle center position of the circular indicator light as a center point, and the side length of the preset rectangular area is greater than the diameter of the circular indicator light;
it should be noted that the positioning area of the circular indicator light is a circular area, and the center of the circular area is defined asThe radius of the circular area is defined asCalculating the average value of pixel values in the positioning area of the circular indicator light through gray value gray2, namely calculating the average value of the pixel values in the circular area as the average brightness of the circular indicator light; then, with the center of the circleIs the center point and the side length are all(ω is greater than 2) that the rectangular region is the background region of the circular annunciator lamp except for the circular region, and then, the average value of the pixel values within the background region of the circular annunciator lamp is calculated as the average brightness of the background region of the circular annunciator lamp.
S211: original color image I of RGB three primary colors based on circular indicator lightrgbRespectively calculating pixel average values of red, green and blue primary color channels in a positioning area of the circular indicator light;
s212: and calculating the difference value between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light, and when the difference value between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light meets a first preset condition, and simultaneously, when the pixel average values of the red, green and blue three primary color channels corresponding to the positioning area of the circular indicator light meet a second preset condition, judging that the state of the circular indicator light is in an on state.
Further, step S205 specifically includes: establishing a two-dimensional coordinate system by taking the central point of the initial estimation area of the circular indicator light as an origin, defining the circle center of the circular indicator light as (a, b), defining the radius of the circular indicator light as r, and calculating an edge characteristic diagram IedgeAnd storing the Euclidean distance dis between each edge point and the circle center (a, b) of the circular indicator lamp in an edgeArray array, wherein the Euclidean distance dis meets the condition that (1-lambda) x r is not less than dis and not more than (1+ lambda) x r, and lambda is more than 0 and less than 1.
Further, the sorting method in step S206 includes: and performing ascending or descending according to the size of an included angle between a horizontal axis and a straight line formed by the edge points meeting the preset distance range threshold and the circle center.
Further, step S208 specifically includes:
s2081: obtained in step S207Sorting the fitting circle results according to the Euclidean distance from the initial position of the circle center of the circular indicator lamp to the origin of the two-dimensional coordinate system, and deleting the fitting circle results which satisfy the condition that the ratio of beta 1 is the foremost of the sorted fitting circle results and the last of the sorted fitting circle results, wherein the value range of beta 1 is more than 0 and less than beta 1 and less than 0.5;
s2082: sorting the fitting circle results screened in the step S2081 according to the preliminary numerical value of the radius of the circular indicator lamp, and deleting the fitting circle results which are sorted at the top and at the last and satisfy the condition that the ratio is beta 2, wherein the value range of beta 2 is more than 0 and less than beta 2 and less than 0.5;
s2083: calculating the average value of the vector coordinates of the circle centers of the circular indicator lamps in the fitting circle result screened in the step S2082Average value with radiusThereby determining the location area of the circular indicator light.
It should be noted that the execution sequence between step S2081 and step S2082 is not limited, and in another example, step S207 may be obtained firstSorting the fitting circle results according to the initial numerical value of the radius of the circular indicator light, respectively deleting the fitting circle results which satisfy the condition that the ratio is beta 2 at the top and the bottom of the sorted fitting circle results, then sorting the screened fitting circle results according to the Euclidean distance from the initial position of the circle center of the circular indicator light to the origin of the two-dimensional coordinate system, respectively deleting the fitting circle results which satisfy the condition that the ratio is beta 1 at the top and the bottom of the sorted fitting circle results, and calculating the vector coordinate average value of the circle centers of the circular indicator lights in the fitting circle results after twice screeningAverage value with radiusThereby determining the location area of the circular indicator light.
Further, the first preset condition in step S212 is that when the difference between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light is greater than a preset first threshold; the second preset condition is that the pixel average values of the red, green and blue primary color channels in the positioning area of the circular indicator light are all larger than a preset second threshold value.
In one example, first, the average brightness of the circular indicator light is denoted as LobjThe average brightness of the background area of the circular indicator light is recorded as LgtJudging whether the difference value between the average brightness of the positioning area of the circular indicator light and the average brightness of the background area of the circular indicator light is larger than a preset first threshold value or not, namely recording a first preset condition as C1=Lobj-LgtIs greater than T1, wherein T1 is a preset first threshold when L isobj-LgtIf T1 is satisfied, the first predetermined condition C is satisfied1True, otherwise false; secondly, the pixel average values of the red, green and blue three primary color channels in the positioning area of the circular indicator light are respectively recorded as LR、 LGAnd LBJudging whether the pixel average values of the red, green and blue primary color channels in the positioning area of the circular indicator light are all larger than a preset second threshold value, namely judging whether the minimum pixel average values of the red, green and blue primary color channels in the positioning area of the circular indicator light are larger than the preset second threshold value, namely recording the second preset condition as C2=min{LR、LG、LBWhen min is { L } > T2, T2 is a preset second threshold valueR、LG、LBWhen the ratio is greater than T2, a second preset condition C is satisfied2True, otherwise false. And the first preset condition C is required1And a second predetermined condition C2Meanwhile, under the condition of being true, the state of the circular indicator lamp can be judged to be the on state, and otherwise, the state is the off state. In addition, the thresholds T1 and T2 are both obtained by actual experiments or user requirements.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:一种基于辐射成像的集装箱空箱检测方法