Instrument curve extraction method based on machine vision
Automatically identifying instrument curves through machine vision technology solves the problems of low efficiency of manual observation and high cost of neural networks in existing technologies, and realizes efficient automatic collection of instrument data and simplified secondary development.
Patent Information
- Application Number
- CN202510755467.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-09-16
AI Technical Summary
The existing instrumentation data collection is subject to strong subjectivity and low efficiency due to manual observation, and the neural network algorithm is complex and the hardware cost is high, making it difficult to achieve automation and secondary development.
A machine vision-based method is used to shoot the instrument curve display window through a USB camera, and the curve extraction algorithm is used to process the image, automatically identify the curve features, and output them in a standard format.
It realizes the automatic collection of instrument data, improves collection efficiency and data accuracy, reduces hardware costs and code maintenance difficulty, and facilitates secondary development.
Smart Images

Figure CN120655673A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automation technology, and in particular to a method for extracting instrument curves based on machine vision. Background Art
[0002] Driven by the trend of intelligent manufacturing, automation technology is moving toward higher precision and greater intelligence. In this process, closed-loop control systems, with their ability to provide real-time feedback and dynamic adjustment, have become the core of modern industrial automation. In the operation of numerous precision equipment and complex systems, digital instruments serve as data acquisition terminals, monitoring equipment operating status and collecting key parameters, providing a basis for decision-making regarding control strategy adjustments.
[0003] However, devices like oscilloscopes and network analyzers typically rely on manual observation of curves, identification of curve features, and subsequent intervention in the device's operating status, resulting in significant subjectivity and low efficiency. While many oscilloscopes and network analyzers support data output, these devices face challenges with different data transmission protocols, formats, and data formats, making it difficult to access instrumentation data. Furthermore, other researchers have proposed methods for extracting instrumentation data, mostly using various neural network algorithms. While neural network algorithms offer advantages in automating extraction, their code is complex and bulky, resulting in high hardware costs and a significant workload for code maintenance and modification, hindering code porting or secondary development. Summary of the Invention
[0004] The purpose of the present invention is to solve the above technical problems and provide an instrument curve extraction method based on machine vision. The curve extraction method uses a general camera to shoot the curve display window of the instrument, extracts the curve data through an algorithm, and outputs it in a standard format. It can realize equipment automation, and the algorithm logic is transparent and streamlined, which is convenient for maintenance and secondary development.
[0005] The technical solution of the present invention is:
[0006] A method for extracting instrument curves based on machine vision. The extraction device of the extraction method comprises a USB camera, an industrial computer, and a curve display window of the instrument. The USB camera is connected to the industrial computer and is set up in front of the curve display window of the instrument. The USB camera captures the curve display interface image. The industrial computer is installed with a curve extraction algorithm. The curve extraction algorithm includes the following curve extraction steps:
[0007] (1) Convert the captured image into a grayscale image and correct the perspective deformation of the image according to the four corner points of the curve display area;
[0008] (2) According to multiple clicks on the curve, the maximum value Qmax and the minimum value Qmin of the grayscale value of the curve are obtained, and the grayscale range of the curve is determined;
[0009] (3) Based on multiple clicks on the background, the maximum value Bmax and the minimum value Bmin of the background grayscale are obtained, and the background grayscale range is determined;
[0010] (4) Determine the curve resolution threshold and background resolution threshold according to the curve grayscale range and the background grayscale range, respectively;
[0011] (5) According to the background discrimination threshold, the grayscale of the pixel points judged as background is changed to 0, and according to the curve discrimination threshold, the grayscale of the pixel points judged as curve is changed to 1, and the grayscale image of the curve is converted into a binary image;
[0012] (6) Process each column of the binary image and extract a column of the binary image. Since the value of the background pixel is 0 and the value of the curve pixel is 1, find the pixel coordinates of the pixel value 1. If the number of pixel points with a value of 1 in a column exceeds 5, then the curve is a rising edge or a falling edge in this column, and the value of this column is ignored. After processing each column in this way, arrange the series of vertical coordinates of the curve pixel points in order to obtain the vertical coordinates of the entire curve feature;
[0013] (7) Based on the maximum value Ymax and the minimum value Ymin of the number of vertical pixels in each column of the curve extraction area, the ratio of the vertical pixels to the vertical coordinate can be obtained. The vertical coordinate of the curve feature is multiplied by this ratio to correct the vertical coordinate of the extracted curve and obtain the corrected vertical coordinate of the entire curve feature;
[0014] (8) The corrected vertical coordinate of the entire curve feature is output through the serial port of the industrial computer to complete the instrument curve feature extraction.
[0015] Furthermore, the first operation steps of the extraction device are as follows:
[0016] (1) Use a USB camera to shoot the curve display window of the instrument to obtain a complete curve display interface;
[0017] (2) The image of the curve display interface is transmitted to the industrial computer, the curve extraction algorithm is run on the industrial computer and the curve display interface is displayed. The four corners of the curve display area on the curve display interface are clicked to determine the curve extraction area;
[0018] (3) In the curve extraction area, click three times on the curve. The three clicks include the maximum color intensity position and the minimum color intensity position of the curve. The curve extraction algorithm obtains the color characteristics of the curve.
[0019] (4) Click three times on the curve background. The three clicks include the maximum color intensity position and the minimum color intensity position of the curve background. The curve extraction algorithm determines the background color characteristics.
[0020] (5) Input the maximum value Ymax and minimum value Ymin of the vertical coordinate of the curve coordinate within the curve extraction area.
[0021] Furthermore, the first operation step is automatically implemented through a program mode based on machine vision;
[0022] Furthermore, after the first operation steps, if the collection object has not changed, there is no need to collect it again when the machine is turned on next time.
[0023] The present invention provides a method for extracting instrument curves based on machine vision, which has the following beneficial effects:
[0024] 1. Compared with the existing working method of manually observing and identifying curves and then manually intervening in the working status of the equipment, this curve extraction method uses a general camera to shoot the curve display window of the instrument, extracts the curve data through an algorithm, and outputs it in a standard format. It is highly efficient, the data is objective and accurate, and it can realize equipment automation;
[0025] 2. Compared with various neural network algorithms for existing instrument data extraction, the curve extraction method has transparent and streamlined algorithm logic, lower hardware cost, convenient secondary development, low code maintenance and modification cost, and no dependence on training samples. It is more suitable for modern equipment automation research. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 , which is a structural diagram of an extraction device for an instrument curve extraction method based on machine vision according to the present invention;
[0027] Figure 2 , is a flow chart of a method for extracting instrument curves based on machine vision according to the present invention;
[0028] Figure 3 , which is a schematic diagram of processing each column of a binary image in the curve extraction step (6) of the instrument curve extraction method based on machine vision of the present invention;
[0029] Figure 4 , for the general Figure 3 The curve graph is drawn by taking out the set of pixels in the Nth column. DETAILED DESCRIPTION
[0030] The present invention will be further described below in conjunction with embodiment:
[0031] Example:
[0032] like Figures 1 to 4A method for extracting instrument curves based on machine vision. In this embodiment, the instrument is an oscilloscope. The extraction device of the extraction method comprises a USB camera 1, an industrial computer 2, and a curve display window 3 of the instrument. The industrial computer 2 includes a display screen 21. The USB camera is connected to the industrial computer and is mounted directly in front of the curve display window of the instrument. The USB camera captures an image of the curve display interface. The industrial computer is installed with a curve extraction algorithm. The curve extraction algorithm performs the following curve extraction steps:
[0033] (1) Use a USB camera to shoot the curve display window of the instrument to obtain a complete curve display interface;
[0034] (2) The image of the curve display interface is transmitted to the industrial computer, and the curve extraction algorithm is run on the industrial computer and the curve display interface is displayed, such as Figure 1 , click the four corners A, B, C, and D of the curve display area on the curve display interface to determine the curve extraction area;
[0035] (3) Convert the captured image into a grayscale image and correct the perspective deformation of the image according to the four corner points A, B, C, and D of the curve display area;
[0036] (3) In the curve extraction area, click three times on the curve. The three clicks include the maximum color intensity position and the minimum color intensity position of the curve. In this embodiment, the maximum grayscale value of the waveform curve is 210 and the minimum grayscale value is 190. The curve extraction algorithm obtains the color characteristics of the curve and determines the grayscale range of the curve (190, 210);
[0037] (4) Click three times on the curve background. The three clicks include the maximum color intensity position and the minimum color intensity position of the curve background. In this embodiment, the maximum grayscale value of the oscilloscope background is 180, and the minimum grayscale value is 55. The curve extraction algorithm determines the background color characteristics and determines the background grayscale range (55, 180);
[0038] (5) According to the grayscale range of the curve and the grayscale range of the background, determine the curve resolution threshold (190, 210) and the background resolution threshold (55, 180) respectively. If the curve threshold and the background threshold do not overlap, the operation is feasible. If the curve threshold and the background threshold overlap, adjust the camera angle and lighting and repeat the above steps.
[0039] (6) According to the background discrimination threshold, the grayscale of the pixel points identified as the curve is changed to 1, that is, the grayscale value of the pixel point in (190, 210) is 1, and the grayscale of the pixel points not identified as the curve is changed to 0, that is, the grayscale value of the pixel point outside (190, 210) is 0, and the grayscale image of the curve is converted into a binary image;
[0040] (7) Process each column of the binary image and extract a column of the binary image. Since the value of the background pixel is 0 and the value of the curve pixel is 1, find the pixel coordinates of the pixel value 1. If there are more than 5 pixels with a value of 1 in a column, the curve is a rising edge or a falling edge in this column, and the value of this column is ignored. After processing each column in this way, the series of vertical coordinates of the obtained curve pixel points are arranged in order to obtain the vertical coordinates of the entire curve feature, such as Figure 3 , the waveform is: Y = 3 + 4X (0 ≤ X ≤ 3), Y = 24 - 3X (3 ≤ X ≤ 7) ..., if we extract the second column, X = 2, the vertical coordinate of the pixel value 1 is 11, and so on, we can get the vertical coordinate of the entire curve feature;
[0041] (8) Input the maximum value Ymax and minimum value Ymin of the vertical coordinate of the curve coordinate within the curve extraction area. The minimum value is 2.2 and the maximum value is 35.
[0042] (9) Based on the maximum value Ymax and the minimum value Ymin of the number of vertical pixels in each column of the curve extraction area, the ratio of the vertical pixels to the vertical coordinate can be obtained. The vertical coordinate of the curve feature is multiplied by this ratio to correct the vertical coordinate of the extracted curve and obtain the corrected vertical coordinate of the entire curve feature;
[0043] (8) The corrected vertical coordinate of the entire curve feature is output through the serial port of the industrial computer to complete the instrument curve feature extraction.
[0044] The present invention has been described in detail above. The above description is only a preferred embodiment of the present invention and should not limit the scope of implementation of the present invention. That is, any addition, reduction or replacement of general technical means made within the scope of this application should still fall within the scope of the present invention.
Claims
1. A method for extracting instrument curves based on machine vision, characterized by: The extraction device of the extraction method is composed of a USB camera, an industrial computer, and a curve display window of an instrument. The USB camera is connected to the industrial computer and is set up in front of the curve display window of the instrument. The curve display interface image is captured by the USB camera. The industrial computer is installed with a curve extraction algorithm, which includes the following curve extraction steps: (1) Convert the captured image into a grayscale image and correct the perspective deformation of the image according to the four corner points of the curve display area; (2) According to multiple clicks on the curve, the maximum value Qmax and the minimum value Qmin of the grayscale value of the curve are obtained, and the grayscale range of the curve is determined; (3) Based on multiple clicks on the background, the maximum value Bmax and the minimum value Bmin of the background grayscale are obtained, and the background grayscale range is determined; (4) Determine the curve resolution threshold and background resolution threshold according to the curve grayscale range and the background grayscale range, respectively; (5) According to the background discrimination threshold, the grayscale of the pixel points judged as background is changed to 0, and according to the curve discrimination threshold, the grayscale of the pixel points judged as curve is changed to 1, and the grayscale image of the curve is converted into a binary image; (6) Process each column of the binary image and extract a column of the binary image. Since the value of the background pixel is 0 and the value of the curve pixel is 1, find the pixel coordinates of the pixel value 1. If the number of pixel points with a value of 1 in a column exceeds 5, then the curve is a rising edge or a falling edge in this column, and the value of this column is ignored. After processing each column in this way, arrange the series of vertical coordinates of the curve pixel points in order to obtain the vertical coordinates of the entire curve feature; (7) Based on the maximum value Ymax and the minimum value Ymin of the number of vertical pixels in each column of the curve extraction area, the ratio of the vertical pixels to the vertical coordinate can be obtained. The vertical coordinate of the curve feature is multiplied by this ratio to correct the vertical coordinate of the extracted curve and obtain the corrected vertical coordinate of the entire curve feature; (8) The corrected vertical coordinate of the entire curve feature is output through the serial port of the industrial computer to complete the instrument curve feature extraction.
2. The method for extracting instrument curves based on machine vision according to claim 1, characterized in that: The first operation steps of the extraction device are as follows: (1) Use a USB camera to shoot the curve display window of the instrument, adjust the lighting and camera angle to obtain a complete and clear curve display interface; (2) The image of the curve display interface is transmitted to the industrial computer, the curve extraction algorithm is run on the industrial computer and the curve display interface is displayed. The four corners of the curve display area on the curve display interface are clicked to determine the curve extraction area; (3) In the curve extraction area, click three times on the curve. The three clicks include the maximum color intensity position and the minimum color intensity position of the curve. The curve extraction algorithm obtains the color characteristics of the curve. (4) Click three times on the curve background. The three clicks include the maximum color intensity position and the minimum color intensity position of the curve background. The curve extraction algorithm determines the background color characteristics. (5) Input the maximum value Ymax and minimum value Ymin of the vertical coordinate of the curve coordinate within the curve extraction area.
3. The method for extracting instrument curves based on machine vision according to claim 2, characterized in that: The first operation steps are automatically implemented through a program mode based on machine vision.
4. The method for extracting instrument curves based on machine vision according to claim 2, characterized in that: After the first operation steps, if the collection object has not changed, there is no need to collect it again when you start the machine next time.
5. The method for extracting instrument curves based on machine vision according to claim 1, characterized in that: Step (4) also includes: if the curve resolution threshold and the background resolution threshold do not overlap, then proceed to the subsequent steps; if the curve resolution threshold and the background resolution threshold overlap, then the camera angle and lighting need to be adjusted and the above steps (1) to (3) are performed again.
6. The method for extracting instrument curves based on machine vision according to claim 1, characterized in that: Step (5) includes: according to the curve discrimination threshold, changing the grayscale of the pixel points judged as the curve to 1, changing the grayscale of the pixel points not judged as the curve to 0, and converting the grayscale image of the curve into a binary image.