An Indicator Recognition Method and System Based on Color Gamut and Contour Features

By adopting indicator recognition method based on color gamut and contour characteristics in the substation, the subjective factors and high voltage risks of manual inspection, as well as the environmental interference problems of robot inspection, stable and accurate identification of split-combination status is achieved.

CN114066862BActive Publication Date: 2025-06-13FUJIAN STRAIT ZHIHUI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111387128.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-22
Publication Date
2025-06-13
Estimated Expiration
2041-11-22

AI Technical Summary

Technical Problem

In substations, manual inspection of the split-combination status indicators has subjective factors and high voltage risks, and robot inspections are easily disturbed by light and weather, resulting in unstable and inaccurate identification.

Method used

The indicator recognition method based on color gamut and contour features is adopted. By converting the original RGB image into HSV color space image, setting the upper and lower limit parameters of the color gamut for segmentation, performing binarization segmentation and bit calculation, converting it into a grayscale space image for Canny edge detection, and combining arc length and area for contour screening, and finally obtaining the recognition result.

Benefits of technology

It realizes the stable and accurate detection of the split and merge state of the substation status indicator in different external environments, avoids subjective factors and high voltage risks of manual inspection, and improves the accuracy and reliability of identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114066862B_ABST
    Figure CN114066862B_ABST
Patent Text Reader

Abstract

The present application provides an indicator recognition method and system based on color gamut and contour features. The method includes the following steps: converting the original RGB image into an HSV color space image, and setting the upper and lower limit parameters of the color gamut as segmentation conditions; within the range of the upper and lower limit parameters of the color gamut, performing binary segmentation on the HSV color space image, and performing a bit operation with the original RGB image to obtain a target image; converting the target image into a grayscale space image, and performing Canny edge detection on the grayscale space image to obtain a contour image; and setting the arc length and area as threshold conditions, performing contour screening on the contour image, and finally obtaining the recognition result. Through this method, the overall segmentation of the HSV color space image can be achieved simply through the color gamut, and then the arc length and area can be judged to output the recognition result, and the on-off state of the substation status indicator can be recognized stably and accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of industrial vision technology, and specifically relates to an indicator recognition method and system based on color gamut and contour features. Background Art

[0002] In recent years, with the development and progress of technology, the State Grid undertakes an increasingly important social responsibility and mission in aspects such as power supply and environmental protection. As an important part of the State Grid, the stable operation of substations provides an important guarantee for the safe operation of the power grid system.

[0003] In a substation, a switching status indicator is an indicator device that can indicate the operating status of a power line and is widely used. Correctly identifying the switching status indicator is an important prerequisite for judging the operating status of the substation and troubleshooting power system faults. The Chinese character type switch status in the substation is also very simple, only including two states: "open" and "closed". However, since manual inspection is not only affected by subjective factors but also involves high-voltage risks. Therefore, robot patrol inspection in the substation is usually used to perform a series of processing operations to replace manual inspection, thereby ensuring personal safety and improving work efficiency.

[0004] In actual scenarios, robots are easily interfered by external environments such as light and weather during outdoor patrol inspections. In view of this, it is of great significance to design a method for stably and accurately detecting the switching status of indicators in substations in different external environments. Summary of the Invention

[0005] An embodiment of this application proposes an indicator recognition method and system based on color gamut and contour features to solve the technical problems mentioned in the above background art section.

[0006] In a first aspect, an embodiment of this application provides an indicator recognition method based on color gamut and contour features, including the following steps:

[0007] S110. Convert the original RGB image into an HSV color space image, and set the upper and lower limit parameters of the color gamut as the segmentation condition;

[0008] S120. Perform binary segmentation on the HSV color space image within the range of the upper and lower limit parameters of the color gamut, and perform a bitwise operation with the original RGB image to obtain a target image;

[0009] S130. Convert the target image into a grayscale space image, and perform Canny edge detection on the grayscale space image to obtain a contour image; and

[0010] S140. Set the arc length and area as threshold conditions, perform contour screening on the contour image, and finally obtain the recognition result.

[0011] Through this method, the overall segmentation of the HSV color space image can be achieved simply through the color gamut, and then the arc length and area can be judged, and the recognition result can be output, so as to stably and accurately recognize the opening and closing states of the substation status indicator.

[0012] In some embodiments, in step S140, it specifically includes the following steps:

[0013] S141. Obtain a contour set through the contour extraction function, traverse the contour set and calculate the arc length and area of all contours respectively, and store them in the corresponding arc length list and area list;

[0014] S142. Obtain the largest elements in the arc length list and product list, and record them as the largest arc length and the largest area respectively;

[0015] S143. Obtain the first color arc length and the second color arc length from the largest arc length, and obtain the first color area and the second color area from the largest area;

[0016] S144. Output the recognition result. In response to determining that the first color area is greater than the second color area and the first color arc length is greater than the second color arc length, the output recognition result is "open", otherwise it is "closed"; and

[0017] S145. Return to step S144 for the next round of judgment and output the recognition result.

[0018] Since the original RGB image taken may contain not only the main body of the status indicator but also the background environment, the lengths of the first color arc length and the second color arc length and the sizes of the first color area and the second color area are respectively compared, and the final accurate result is obtained through comprehensive analysis.

[0019] In some embodiments, in step S141, the area of the contour is obtained by calculating through Green's formula; in step S142, the largest elements in the arc length list and area list are obtained through the operation function, and the index value of the maximum value in the array obtained by an operation function is returned through the parameter set function. If multiple maximum values appear in the same array at the same time, the index value of the first maximum value is returned.

[0020] Through this operation, the largest green arc length, red arc length, and the largest green area and red area can be obtained quickly and conveniently.

[0021] In some embodiments, in step S120, it specifically includes the following steps:

[0022] S121. Set the upper and lower limits of the first color and the second color in the HSV color space image respectively;

[0023] S122. Calculate the upper and lower limits through the inRange threshold operation function, and convert the HSV color space image into a corresponding binary image, which are respectively recorded as the first color mask and the second color mask; and

[0024] S123. Perform a bitwise operation on the original RGB image with the first color mask and the second color mask to obtain an image of the original RGB image minus the first color mask and the second color mask, and record the obtained image as the target image.

[0025] Regarding the mask as a template, on the original RGB image, the interested part at the corresponding position in the original RGB image can be obtained through the bitwise operation of this template.

[0026] In some embodiments, in step S121, the first color is green and the second color is red.

[0027] In some embodiments, in step S130, it specifically includes the following steps:

[0028] S131. Convert the target image into a grayscale space image;

[0029] S132. Smooth the grayscale space image using a Gaussian filter;

[0030] S133. Calculate the gradient intensity and direction of each pixel point in the grayscale space image, apply non-maximum suppression to eliminate the spurious responses brought by edge detection, and apply double-threshold detection to determine the real and potential edges; and

[0031] S134. Complete edge detection by suppressing isolated weak edges to obtain a contour image, and finally obtain a contour set and a hierarchical relationship.

[0032] Convert the target image into a grayscale space image for subsequent further operations on the image. To minimize the influence of noise on the edge detection result, it is necessary to filter out the noise to prevent false detection caused by noise, and use a Gaussian filter to convolve with the image. Non-maximum suppression can help suppress all gradient values outside the local maximum to 0. To solve the spurious response, it is necessary to filter the edge pixels with weak gradient values and retain the edge pixels with high gradient values, which is achieved by selecting high and low thresholds. Suppress the weak edges caused by noise or color changes to ensure accurate results are obtained.

[0033] In some embodiments, in step S131, use the formula Gray = 0.299×R + 0.587×G + 0.114×B to convert the target image into the grayscale space image, where Gray represents the grayscale level corresponding to a color pixel point, and R, G, and B respectively represent the values of the red, green, and blue components of the color pixel point.

[0034] In some embodiments, in step S110, the following algorithm is used to convert the original RGB image into an HSV color space image:

[0035] Max = max(R, G, B)

[0036] Min = min(R, G, B)

[0037]

[0038] Where f(x) represents the function for converting the original RGB image into an HSV color space image, R, G, and B respectively represent the values of the red, green, and blue components of the color pixel point, Max represents the maximum value, and Min represents the minimum value.

[0039] Through this algorithm, the original RGB image can be simply and conveniently converted into an HSV color space image.

[0040] In a second aspect, the present application provides an indicator recognition system based on color gamut and contour features. The system includes:

[0041] A conversion module for converting the original RGB image into an HSV color space image and setting the upper and lower limit parameters of the color gamut as segmentation conditions; and

[0042] A segmentation module for performing binary segmentation on the HSV color space image within the range of the upper and lower limit parameters of the color gamut and performing a bit operation with the original RGB image to obtain a target image;

[0043] A detection module for converting the target image into a grayscale space image and performing Canny edge detection on the grayscale space image to obtain a contour image; and

[0044] An output module for screening the contour image with arc length and area as threshold conditions to finally obtain the recognition result.

[0045] In a third aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method according to any one of the above is implemented.

[0046] The indicator recognition method and system based on color gamut and contour features provided by the embodiments of the present application can filter out irrelevant noise and small contour areas through the conditions of contour area and arc length, finally obtain the relevant information of the on-off state indicator, and judge the two colors (red, green) in the calculation result. Finally, it can stably and accurately detect the on-off state of the substation state indicator under different external environments. Description of the Drawings

[0047] Other features, objects, and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments read in conjunction with the accompanying drawings:

[0048] Figure 1 is a flowchart of an indicator recognition method based on color gamut and contour features according to the present application;

[0049] Figure 2 is a schematic diagram of a specific embodiment of an indicator recognition method based on color gamut and contour features according to the present application;

[0050] Figure 3 is a schematic diagram of an original RGB image according to an embodiment of the present application;

[0051] Figure 4 is a schematic diagram of a binary image according to an embodiment of the present application;

[0052] Figure 5 is a schematic diagram of a target image according to an embodiment of the present application;

[0053] Figure 6 is a schematic diagram of a grayscale space image according to an embodiment of the present application;

[0054] Figure 7 is a schematic diagram of a contour image according to an embodiment of the present application;

[0055] Figure 8 is a schematic diagram of a system for an indicator recognition method based on color gamut and contour features according to the present application;

[0056] Figure 9 is a schematic diagram of the structure of a computer system of an electronic device suitable for implementing the embodiments of the present application. Detailed Embodiments

[0057] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only for explaining the related invention and not for limiting the invention. Additionally, it should be noted that for the sake of description, only parts related to the relevant invention are shown in the drawings.

[0058] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0059] Figure 1 shows a flowchart of an indicator recognition method based on color gamut and contour features of the present application, Figure 2The figure shows a schematic diagram of a specific embodiment of the indicator recognition method based on color gamut and contour features of the present application. With reference to Figure 1 and Figure 2 , the method 100 includes the following steps:

[0060] S110. Convert the original RGB image (as shown in Figure 3 ) into an HSV color space image, and set the upper and lower limit parameters of the color gamut as the segmentation condition;

[0061] In this embodiment, the HSV color space image is a way to represent colors using hue, saturation, and value.

[0062] Among them, hue: represents colors from 0° to 360°, that is, the common color names in daily life, such as red, blue, etc.; saturation: the purity of the color, the lower the saturation, the darker the color (0 <= S < 1); value: that is, the brightness of the color, the higher the value, the closer it is to white, and the lower the value, the closer it is to black (0 <= V < 1).

[0063] Specifically, the algorithm for converting the image from the RGB color space to the HSV color space is as follows:

[0064] Max = max(R, G, B)

[0065] Min = min(R, G, B

[0066]

[0067] Among them, R, G, and B respectively represent the values of the red, green, and blue components of the color pixel point, Max represents the maximum value, and Min represents the minimum value.

[0068] Regarding the calculation of the above conversion formula, there is the following calculation example table:

[0069] RGB HSV Result (1,0,0) (0°,1,1) Red (0.5,0.5,0.5) (120°,0.5,1) Green (0,0,0.5) (240°,1,0.5) Blue

[0070] S120. Within the range of the upper and lower limit parameters of the color gamut, perform binary segmentation on the HSV color space image, and perform a bit operation with the original RGB image to obtain the target image;

[0071] Since in practical applications, the "open" and "closed" states of the substation status indicator are a set of opposing relationships, an original RGB image includes green "open" or red "closed".

[0072] Therefore, in this embodiment, the upper and lower limits of the first color and the second color are respectively set in the HSV color space image, where the first color is green and the second color is red, which are respectively denoted as red lower limit (redlower), red upper limit (redupper), green lower limit (greenlower), and green upper limit (greenupper).

[0073] The value ranges of the upper and lower limits of red and green are as follows:

[0074] redlower = np.array([0, 100, 0])

[0075] redupper = np.array([10, 255, 234])

[0076] greenlower = np.array([50, 30, 0])

[0077] greenupper = np.array([185, 65, 45])

[0078] Within the range of the upper and lower limit parameters of this color gamut, the HSV color space image is binarized. Specifically, the HSV color space image is converted into a corresponding binary image by calculating the upper and lower limits of the threshold operation function (inRange) (as shown in Figure 4 ), which are respectively denoted as red mask (redmask) and green mask (greenmask). The original RGB image is subjected to a bitwise operation with the red mask (redmask) and the green mask (greenmask) to obtain an image of the original RGB image minus the red mask and the green mask, and the obtained image is denoted as the target image (dst).

[0079] Among them, cv2.inRange() is a threshold operation function in the OpenCV open-source computer vision library. The function of this inRange function is to extract the desired color and set the area of this color to white, and the rest to black.

[0080] Its principle is as follows: In the RGB three-channel image, this inRange function needs to input a low-value array and a high-value array. Then, this inRange function scans each pixel of the picture, and the value of each pixel is each value of this array. If correspondingly, all are within the ranges of the two input low-value array and high-value array, then this value will be set to white. Otherwise, as long as one is not within this range, it will be set to black.

[0081] For example: low-value array: np.array([1, 2, 3]); high-value array: np.array([4, 5, 6])

[0082] If the area where a pixel is located is to be set to white, then the first element of the pixel value should be between 1 and 4, the second between 2 and 5, and the third between 3 and 6.

[0083] In this embodiment, the binary image obtained by converting with the inRange function is used as a mask, and the corresponding target image is obtained through image bitwise operation (cv2.bitwise_and()) (as Figure 5 shown). Here, the mask can be regarded as a template, and the interesting part at the corresponding position in the original RGB image can be obtained through the bitwise operation of this template on the original RGB image.

[0084] Among them, the image bitwise operation (cv2.bitwise_and()) performs an "AND" operation on binary data, that is, performs a binary "AND" operation on each pixel value of the image (both grayscale images and color images are acceptable), 1&1 = 1, 1&0 = 0, 0&1 = 0, 0&0 = 0. Using the mask for the "AND" operation means that the white area of the mask image retains the pixels of the image to be processed, the black area eliminates the pixels of the image to be processed, and the principle of the rest of the bitwise operation is similar but the effects are different.

[0085] S130. Convert the target image into a grayscale space image, and perform Canny edge detection on the grayscale space image to obtain a contour image;

[0086] In this embodiment, preprocessing is performed on the obtained target image (dst). First, the target image needs to be grayscale processed to obtain a grayscale space image (as Figure 6 shown). The color of each pixel in a color image is determined by three components of R, G, and B, and each component can take 255 values. A pixel point can have a color change range of more than 16 million (255 * 255 * 255). A grayscale image is a special color image with the same R, G, and B components, and the change range of a pixel point is 255 kinds. Therefore, in digital image processing, generally, various formats of images are first converted into grayscale images to reduce the subsequent calculation amount of the images. The description of a grayscale image, like that of a color image, still reflects the distribution and characteristics of the overall and local chromaticity and brightness levels of the entire image.

[0087] The conversion between RGB values and grayscale is actually the conversion from the human eye's perception of color to the perception of brightness, and is performed through the following formula:

[0088] Gray = 0.299×R + 0.587×G + 0.114×B

[0089] Among them, Gray represents the gray scale corresponding to a color pixel point, and R, G, and B respectively represent the values of the red, green, and blue components of the color pixel point.

[0090] Perform Canny edge detection on the grayscale space image, and record the obtained image as the edge detection image (imgcanny). Specifically, first use a Gaussian filter to smooth the grayscale space image; calculate the gradient intensity and direction of each pixel point in the grayscale space image, apply non-maximum suppression to eliminate the spurious responses brought by edge detection, apply double-threshold detection to determine real and potential edges; complete edge detection by suppressing isolated weak edges to obtain a contour image, and finally obtain a contour set and a hierarchical relationship.

[0091] Specifically, in OpenCV, there is an implementation of the Canny edge detection algorithm, and the usage method is canny = cv2.Canny(gray, 0, 128).

[0092] The Canny edge detection operator is a multi-level detection algorithm proposed by John F. Canny in 1986. At the same time, three major criteria for edge detection were proposed: 1. Edge detection with a low error rate: The detection algorithm should accurately find as many edges as possible in the image and minimize missed detections and false detections. 2. Optimal localization: The detected edge points should be accurately located at the center of the edge. 3. Any edge in the image should be marked only once, and at the same time, image noise should not generate false edges. To meet these requirements, Canny used the calculus of variations. The optimal function in the Canny detector is described by the sum of four exponential terms, and it can be approximated by the first derivative of the Gaussian function. Among the commonly used edge detection methods at present, the Canny edge detection algorithm is one of the methods with strict definitions and can provide good and reliable detections.

[0093] Convert the target image into a grayscale space image for subsequent further operations on the image; to minimize the influence of noise on the edge detection result, it is necessary to filter out the noise to prevent false detections caused by noise, and use a Gaussian filter to convolve with the image. Non-maximum suppression can help suppress all gradient values outside the local maximum to 0. To solve the spurious response, it is necessary to filter the edge pixels with weak gradient values and retain the edge pixels with high gradient values, which is achieved by selecting high and low thresholds. Suppress the weak edges caused by noise or color changes to ensure accurate results.

[0094] S140. Set the arc length and area as threshold conditions, perform contour screening on the contour image, and finally obtain the recognition result.

[0095] In this embodiment, the contour extraction function (findcontours) is used to find the contours of the edge detection map (imgcanny), obtaining the contour set (coutours) and the hierarchical relationship (hierachy). Among them, the hierarchical relationship refers to the one generated according to the hierarchical relationship and index during contour extraction. Traverse the contour set (coutours) and calculate the arc length (arclength) and area (area) of all contours respectively, and store them in the corresponding arc length list (arclist) and area list (arealist).

[0096] Each contour of the image is obtained, so that the arc length and area of the contour can be calculated. Based on the area and arc length of the contour, different-sized objects can be filtered, and the ROI area and parameters of interest can be found. The API function of OpenCV for calculating the area of the contour point set is as follows:

[0097] double cv::contourArea(

[0098] InputArray contour,

[0099] bool oriented = false )

[0101] Calculate the area of the contour. Its principle is based on Green's formula. The parameter contour represents the input contour point set. The parameter oriented is default false and the returned area is positive. If the direction parameter is true, it means that the positive or negative area will be returned according to the clockwise or counterclockwise direction to calculate the arc length of the contour curve.

[0102] double cv::arcLength(

[0103] InputArray curve,

[0104] bool closed)

[0105] Among them, the parameter curve represents the input contour point set, and the parameter closed default indicates whether it is a closed area.

[0106] Find the maximum elements in the area list (arealist) and the arc length list (arclist) respectively, denote them as the maximum area (maxarea) and the maximum arc length (maxarclength) and return them; at the same time, obtain the maximum area and the maximum arc length corresponding to red and green, that is, the red area (redarea), the red arc length (redarclength) and the green area (greenarea), the green arc length (greenarclength). In the application of identifying the substation status indicator, the values of the red area (redarea) and the green area (greenarea) are 20, and the values of the red arc length (redarclength) and the green arc length (greenarclength) are 100.

[0107] Here, mainly in traversing all the contour sets, the calculated sub - contour areas and arc lengths are stored in the corresponding lists. Here, the list is a kind of element container list in Python language, which can store elements of any type. At the same time, for the method of obtaining the maximum element in the list, the operation function of numpy is used. The function argmax(array, axis) for finding the function of the parameter set is used to return the index value of the maximum value in a numpy array. When there are several maximum values in a group at the same time, the index value of the first maximum value is returned. During the operation, it is equivalent to removing a layer of square brackets and returning an array, which is divided into one - dimensional and multi - dimensional. After removing a layer of square brackets from a one - dimensional array, it becomes an index value, which is a number, while after removing a layer of square brackets from an n - dimensional array, an (n - 1) - dimensional array will be returned, and which layer of square brackets to remove depends on the value of axis.

[0108] In this embodiment, the recognition result is output. In response to determining that the green area is greater than the red area and the green arc length is greater than the red arc length, the output recognition result is "open", otherwise it is "closed"; return the recognition result for the next round of judgment and output.

[0109] Through this method, the overall segmentation of the HSV color space image can be realized simply through the color gamut, and then the arc length and area are judged, and the recognition result is output, so that the opening and closing states of the substation status indicator can be recognized stably and accurately. Since the original RGB image taken may contain not only the main body of the status indicator but also the background environment, the lengths of the green arc length and the red arc length and the sizes of the green area and the red area are respectively compared, and the final accurate result is obtained through comprehensive analysis.

[0110] Further refer to Figure 8 As an implementation of the above - mentioned method, this application provides an embodiment of an indicator recognition system based on color gamut and contour features. This system embodiment is related to Figure 1The method embodiments shown are corresponding, and this system can be specifically applied to various electronic devices. This system 200 includes:

[0111] A conversion module 210, configured to convert an original RGB image into an HSV color space image, and set the upper and lower limit parameters of the color gamut as segmentation conditions;

[0112] A segmentation module 220, configured to perform binary segmentation on the HSV color space image within the range of the upper and lower limit parameters of the color gamut, and perform a bit operation with the original RGB image to obtain a target image;

[0113] A detection module 230, configured to convert the target image into a grayscale space image, and perform Canny edge detection on the grayscale space image to obtain a contour image;

[0114] An output module 240, configured to screen the contour image by using the arc length and area as threshold conditions, and finally obtain an identification result.

[0115] This application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements any one of the above methods.

[0116] As Figure 9 shown, the computer system 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 302 or the program loaded from the storage part 308 into the random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the system 300 are also stored. The CPU 301, ROM 302, and RAM 303 are connected to each other through a bus 304. The input / output (I / O) interface 305 is also connected to the bus 304.

[0117] The following components are connected to the I / O interface 305: an input part 306 including a keyboard, a mouse, etc.; an output part 307 including a liquid crystal display (LCD), etc. and a speaker, etc.; a storage part 308 including a hard disk, etc.; and a communication part 309 including a network interface card such as a LAN card, a modem, etc. The communication part 309 performs communication processing via a network such as the Internet. The drive 310 is also connected to the I / O interface 305 as needed. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as needed, so that the computer program read from it can be installed into the storage part 308 as needed.

[0118] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes program code for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 309, and / or installed from the removable medium 311. When the computer program is executed by the central processing unit (CPU) 301, the above functions defined in the methods of the present application are performed. It should be noted that the computer-readable medium described in the present application can be a computer-readable signal medium or a computer-readable medium or any combination of the two. The computer-readable medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. And in the present application, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0119] Computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, by connecting through the Internet using an Internet service provider).

[0120] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of the code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks can occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0121] The modules described in the embodiments of this application can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: a processor includes an acquisition module, an analysis module, and an output module. Among them, the names of these modules do not constitute a limitation to the module itself in some cases.

[0122] The above description is only a preferred embodiment of this application and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the technical solutions formed by mutually replacing the above features with the (but not limited to) technical features having similar functions disclosed in this application.

Claims

1. An indicator recognition method based on color gamut and contour features, characterized in that, it includes the following steps: S110. Convert the original RGB image into an HSV color space image, and set the upper and lower limit parameters of the color gamut as the segmentation conditions. Among them, the following algorithm is used for the conversion: Max = max(R, G, B) Min = min(R, G, B) where f(x) represents the function for converting the original RGB image into an HSV color space image, R, G, and B respectively represent the values of the red, green, and blue components of a color pixel point, Max represents the maximum value, and Min represents the minimum value; S120. Within the range of the upper and lower limit parameters of the color gamut, perform binary segmentation on the HSV color space image and perform a bit operation with the original RGB image to obtain a target image. Among them, the binary segmentation specifically includes: converting the HSV color space image into a corresponding binary image by calculating the upper and lower limits of the threshold operation function, which are respectively recorded as a red mask and a green mask; performing a bit operation on the original RGB image with the red mask and the green mask, obtaining an image of the original RGB image minus the red mask and the green mask, and recording the obtained image as the target image; S130. Convert the target image into a grayscale space image, and perform Canny edge detection on the grayscale space image to obtain a contour image. Among them, the formula Gray = 0.299×R + 0.587×G + 0.114×B is used to convert the target image into the grayscale space image, where Gray represents the grayscale level corresponding to a color pixel point, and R, G, and B respectively represent the values of the red, green, and blue components of a color pixel point; further, performing Canny edge detection on the grayscale space image specifically includes: S131. Convert the target image into the grayscale space image; S132. Smooth the grayscale space image using a Gaussian filter; S133. Calculate the gradient intensity and direction of each pixel point in the grayscale space image, apply non-maximum suppression to eliminate the spurious response brought by edge detection, and apply double-threshold detection to determine real and potential edges; and S134. Complete edge detection by suppressing isolated weak edges to obtain a contour image, and finally obtain a contour set and a hierarchical relationship; and S140. Set the arc length and area as threshold conditions, perform contour search on the edge detection map through a contour extraction function to obtain a contour set, and perform contour screening on the contour image by traversing the contour set, and finally obtain the recognition result. Specifically, it includes: S141. Obtain a contour set through a contour extraction function, traverse the contour set and calculate the arc length and area of all contours respectively, and store them in the corresponding arc length list and area list; S142. Obtain the largest elements in the arc length list and the area list, which are respectively recorded as the maximum arc length and the maximum area; S143. Obtain the first color arc length and the second color arc length from the maximum arc length, and obtain the first color area and the second color area from the maximum area; S144. Output the recognition result. If it is determined that the area of the first color is greater than the area of the second color and the arc length of the first color is greater than the arc length of the second color, then output the recognition result as "fen" (divide), otherwise as "he" (combine); and S145. Return to step S144 for the next round of judgment and output the recognition result.

2. The method for identifying an indicator based on color gamut and contour features according to claim 1,[[]] wherein,[[]] in step S141, the area of the contour is obtained by calculating through Green's formula: in step S142, the maximum element in the arc length list and the area list is obtained through an operation function, and the index value of the maximum value in an array obtained by the operation function is returned through a function for finding a parameter set. If multiple maximum values appear simultaneously in the same array, then the index value of the first maximum value is returned.

3. The method for identifying an indicator based on color gamut and contour features according to claim 1,[[]] wherein,[[]] in step S120, it specifically includes the following steps:[[]] S121. Set the upper and lower limits of the first color and the second color in the HSV color space image respectively; S122. Calculate the upper and lower limits through the inRange threshold operation function, and convert the HSV color space image into a corresponding binary image, respectively denoted as the first color mask and the second color mask; and S123. Perform a bitwise operation on the original RGB image with the first color mask and the second color mask to obtain an image of the original RGB image minus the first color mask and the second color mask, and denote the obtained image as the target image.

4. The method for identifying an indicator based on color gamut and contour features according to claim 3,[[]] wherein,[[]] in step S121, the first color is green and the second color is red.

5. An indicator recognition system based on color gamut and contour features,[[]] wherein,[[]] the system includes:[[]] A conversion module for converting the original RGB image into an HSV color space image and setting the upper and lower limit parameters of the color gamut as segmentation conditions. Among them, the following algorithm is used in the conversion: Max = max(R, G, B) Min = min(R, G, B) where f(x) represents the function for converting the original RGB image into an HSV color space image, R, G, and B respectively represent the red, green, and blue components of a color pixel point, Max represents the maximum value, and Min represents the minimum value; and A segmentation module for performing binary segmentation on the HSV color space image within the range of the upper and lower limit parameters of the color gamut and performing a bitwise operation with the original RGB image to obtain a target image. Among them, the binary segmentation specifically includes: converting the HSV color space image into a corresponding binary image by calculating the upper and lower limits of the threshold operation function, respectively denoted as the red mask and the green mask; performing a bitwise operation on the original RGB image with the red mask and the green mask to obtain an image of the original RGB image minus the red mask and the green mask, and denote the obtained image as the target image; and A detection module, configured to convert the target image into a grayscale space image, and perform Canny edge detection on the grayscale space image to obtain a contour image; wherein, the target image is converted into the grayscale space image by using the formula Gray = 0.299×R + 0.587×G + 0.114×B, Gray represents the grayscale level corresponding to a color pixel point, and R, G, and B respectively represent the values of the red, green, and blue components of the color pixel point; further, performing Canny edge detection on the grayscale space image specifically includes: S131. Convert the target image into the grayscale space image; S132. Smooth the grayscale space image using a Gaussian filter; S133. Calculate the gradient intensity and direction of each pixel point in the grayscale space image, apply non-maximum suppression to eliminate spurious responses brought by edge detection, and apply double-threshold detection to determine real and potential edges; and S134. Complete edge detection by suppressing isolated weak edges to obtain a contour image, and finally obtain a contour set and a hierarchical relationship; and An output module, configured to screen the contour image with arc length and area as threshold conditions, and finally obtain an identification result. The contour image is screened by traversing the contour set, and finally an identification result is obtained, specifically including: S141. Obtain a contour set through a contour extraction function, traverse the contour set and calculate the arc length and area of all contours respectively, and store them in the corresponding arc length list and area list; S142. Obtain the largest elements in the arc length list and the area list, and record them as the maximum arc length and the maximum area respectively; S143. Obtain the first color arc length and the second color arc length from the maximum arc length, and obtain the first color area and the second color area from the maximum area; S144. Output the identification result. If it is determined that the first color area is greater than the second color area and the first color arc length is greater than the second color arc length, then output the identification result as "fen", otherwise as "he"; and S145. Return to step S144 for the next round of judgment and output the identification result.

6. A computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method according to any one of claims 1-4 is implemented.

Citation Information

Patent Citations

  • Method for recognizing converse vehicle driving in vehicle lanes on the basis of image processing

    CN106022243A

  • State judgment method and equipment of transformer substation switching-off and switching-on indicator

    CN111898425A