CN111103533A - Vision-based ten-position rotary dial switch reset system and reset method - Google Patents
Vision-based ten-position rotary dial switch reset system and reset method Download PDFInfo
- Publication number
- CN111103533A CN111103533A CN201911292517.1A CN201911292517A CN111103533A CN 111103533 A CN111103533 A CN 111103533A CN 201911292517 A CN201911292517 A CN 201911292517A CN 111103533 A CN111103533 A CN 111103533A
- Authority
- CN
- China
- Prior art keywords
- area
- pointer
- dial switch
- rotary dial
- region
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 22
- 238000001514 detection method Methods 0.000 claims abstract description 99
- 230000000877 morphologic effect Effects 0.000 claims description 18
- 238000005260 corrosion Methods 0.000 claims description 12
- 230000007797 corrosion Effects 0.000 claims description 12
- 238000003708 edge detection Methods 0.000 claims description 10
- 238000004364 calculation method Methods 0.000 claims description 9
- 230000005540 biological transmission Effects 0.000 claims description 6
- 230000011218 segmentation Effects 0.000 claims description 4
- 238000004519 manufacturing process Methods 0.000 abstract description 6
- 238000010586 diagram Methods 0.000 description 20
- 230000000007 visual effect Effects 0.000 description 10
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008030 elimination Effects 0.000 description 1
- 238000003379 elimination reaction Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01R—MEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
- G01R31/00—Arrangements for testing electric properties; Arrangements for locating electric faults; Arrangements for electrical testing characterised by what is being tested not provided for elsewhere
- G01R31/327—Testing of circuit interrupters, switches or circuit-breakers
- G01R31/3277—Testing of circuit interrupters, switches or circuit-breakers of low voltage devices, e.g. domestic or industrial devices, such as motor protections, relays, rotation switches
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01M—TESTING STATIC OR DYNAMIC BALANCE OF MACHINES OR STRUCTURES; TESTING OF STRUCTURES OR APPARATUS, NOT OTHERWISE PROVIDED FOR
- G01M13/00—Testing of machine parts
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01R—MEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
- G01R1/00—Details of instruments or arrangements of the types included in groups G01R5/00 - G01R13/00 and G01R31/00
- G01R1/02—General constructional details
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
- G06T5/30—Erosion or dilatation, e.g. thinning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
The invention provides a system and a method for resetting a tens rotary dial switch based on vision, belongs to the technical field of resetting of the tens rotary dial switch, and particularly relates to a system and a method for resetting the tens rotary dial switch based on vision. The problems that whether the coding state and the indication position correspond to each other or not in the existing ten-position rotary dial switch production process, the manual reset mode is adopted, the cost is high, the efficiency is low, and the accuracy is poor are solved. The device comprises a reset system and a reset method, wherein the reset system comprises a PLC control system, a bus, an indicating bit detection device and an indicating bit reset device, the indicating bit detection device comprises an industrial camera and an industrial personal computer, the indicating bit reset device comprises an air cylinder, a servo motor and a batch head, and the reset method comprises an indicating bit detection algorithm, a circular area detection algorithm, a pointer area detection algorithm and a pointer angle detection algorithm. The reset device is mainly used for resetting the ten-position rotary dial switch.
Description
Technical Field
The invention belongs to the technical field of tens rotary dial switch reset, and particularly relates to a system and a method for resetting a tens rotary dial switch based on vision.
Background
Whether the coded state and the indicating position are in one-to-one correspondence needs to be detected in the production process of the ten-position rotary dial switch, and the detection steps are as follows: firstly, rotating the pointer of the ten-bit rotary dial switch to an indication bit 0, then rotating the pointer from the indication bit 0 to an indication bit 9 clockwise, and respectively detecting whether the coding state corresponds to the indication bit one by one. For example, when the indication bit is 1, the coding state should be 1, i.e. pin 1 is connected to the common terminal; when the indication bit is 6, the coding state should be 6, i.e. pin 2 and pin 4 are both conducting to common. However, due to problems in the manufacturing process, the pointer of the ten-bit rotary dial switch manufactured on the production line usually points to any indicating bit. At present, in the process of detecting whether the coding state corresponds to the indication position or not, a production enterprise mainly adopts a manual mode for resetting the ten-position rotary dial switch, and after the ten-position rotary dial switch to be detected enters a clamp of a detection station, a pointer is manually rotated to the indication position 0 for detection. The manual reset mode is high in cost, low in efficiency and difficult to guarantee accuracy for a long time.
Disclosure of Invention
The invention provides a visual-based ten-position rotary dial switch reset system and a visual-based ten-position rotary dial switch reset method for solving the problems in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme: a ten-position rotary dial switch reset system based on vision comprises a PLC control system, a bus, an indicating position detection device and an indicating position reset device, wherein the PLC control system is in communication connection with the bus, the indicating position detection device comprises an industrial camera and an industrial personal computer, the industrial camera is installed right above a ten-position rotary dial switch clamp to be reset, the industrial camera is in communication connection with the industrial personal computer, the industrial personal computer is in communication connection with the PLC control system, and an area where the indicating position detection device is located is an indicating position detection station; the indicating position resetting device comprises a cylinder, a servo motor and a batch head, wherein the cylinder is in communication connection with a bus through an I/O module, the servo motor is in communication connection with the bus, a telescopic rod of the cylinder is connected with the servo motor, an output shaft of the servo motor is fixedly connected with the batch head, the indicating position resetting device is positioned right above a ten-position rotary dial switch clamp to be reset, and an area where the indicating position resetting device is positioned is an indicating position resetting station.
Further, the bus is a TCP/IP bus.
Furthermore, the industrial camera is in communication connection with the industrial personal computer through the GigE.
Furthermore, the industrial personal computer is in communication connection with the PLC control system through the RS232 module.
Furthermore, the batch head is a linear batch head.
The invention also provides a visual-based reset method of the ten-position rotary dial switch, which comprises the following steps:
step 1.1: when the ten-position rotary dial switch enters a clamp of the indicating position detection station, the PLC control system sends an indicating position detection station ready signal to the industrial personal computer through the RS232 module;
step 1.2: after the industrial personal computer obtains the indicating position detection station ready signal, a trigger signal is sent to the industrial camera through the GigE;
step 1.3: after the industrial camera obtains the trigger signal, shooting an image, and transmitting the shot image to the industrial personal computer through the GigE;
step 1.4: after the industrial personal computer obtains the image, calculating a current indicator bit k according to an indicator bit detection algorithm, and transmitting the current indicator bit k to a PLC control system through an RS232 module;
step 1.5: after the PLC control system obtains a current indicating position k, the current indicating position k is transmitted to a servo motor in an indicating position resetting device through a TCP/IP bus, and meanwhile, a transmission mechanism is informed through the TCP/IP bus to transmit a ten-position rotary dial switch to an indicating position resetting station;
step 1.6: after a servo motor in the indicating position resetting device obtains a current indicating position k, the servo motor rotates clockwise by k multiplied by 36 degrees from 90 degrees, and a servo motor ready signal is sent to a PLC control system through a TCP/IP bus after the rotation is finished;
step 1.7: after the ten-position rotary dial switch enters a clamp of the indicating position resetting station, an indicating position resetting station ready signal is sent to the PLC control system through a TCP/IP bus;
step 1.8: after receiving a servo motor ready signal and an indicator bit reset station ready signal at the same time, the PLC control system sends a trigger signal to the cylinder through a TCP/IP bus;
step 1.9: after receiving the trigger signal, the cylinder moves downwards from a high position to a low position, so that the linear batch head enters a pointer groove of the ten-position rotary dial switch, and after the linear batch head finishes the operation, a cylinder extension signal is sent to the PLC control system through a TCP/IP bus;
step 1.10: after receiving the cylinder extension signal, the PLC control system sends a trigger signal to the servo motor through a TCP/IP bus;
step 1.11: after receiving the trigger signal, the servo motor rotates anticlockwise by k multiplied by 36 degrees to reset the indicating bit to 0, and after the resetting is finished, an indicating bit resetting finishing signal is sent to the PLC control system through a TCP/IP bus;
step 1.12: after receiving the indication position reset completion signal, the PLC control system informs the air cylinder to move upwards from the low position to the high position through the TCP/IP bus, informs the servo motor to rotate to 90 degrees, and simultaneously informs the transmission mechanism to transmit the ten-position rotary dial switch to the coding state and the indication position detection station.
Further, the indicator bit detection algorithm comprises the following steps:
step 2.1: intercepting a rectangular image sub-block with the size of 600 multiplied by 800 (width multiplied by height) pixels from the center of an image shot by an industrial camera of an indication bit detection station as an input image of an indication bit detection algorithm;
step 2.2: detecting a circular area at the center of a ten-bit rotary dial switch from an input image by using a circular area detection algorithm;
step 2.3: calculating area descriptor for the detected circular area to obtain the centroid coordinate [ x ] of the circular areao,yo]Taking the circular area as the center of a circle;
step 2.4: adopting Sobel operator to carry out edge detection on the detected circular area, and utilizing all pixel points [ x ] on the edgei,yi],i∈[1,n]And the center of a circle [ xo,yo]Calculating the radius r of the circular area by the mean value of the distances betweenoThe calculation formula is as follows:
wherein n is the number of pixel points on the edge of the circular area;
step 2.5: around the center of a circle [ xo,yo]The angle is an original point, the horizontal right is 0 degrees, a default angle value of indication bits 0 to 9 is constructed in the anticlockwise direction, wherein the interval between two adjacent indication bits is 36 degrees, and the obtained default angle value of the indication bits 0 to 9 is 90 degrees, 54 degrees, 18 degrees, 342 degrees, 306 degrees, 270 degrees, 234 degrees, 198 degrees, 162 degrees and 126 degrees in sequence;
step 2.6: detecting a pointer area from the circular area obtained in the step 2.2 by using a pointer area detection algorithm;
step 2.7, calculating the detected pointer area by using a pointer angle detection algorithm to obtain a pointer angle value β;
and 2.8, sequentially comparing the pointer angle value β with default angle values of the indication positions 0 to 9, and judging that the current indication position of the ten-position rotary dial switch is k when the difference between the pointer angle value β and the angle value of the indication position k, which belongs to [0,9], is within +/-5 degrees.
Further, the circular region detection algorithm comprises the following steps:
step 3.1: performing global threshold segmentation on an input image of the indicator bit detection algorithm by using an Otsu threshold to obtain a binary image of the input image, wherein black is an image background, and white is a foreground region;
step 3.2: filling holes in the binary image to fill up the background part in the foreground area;
step 3.3: removing the boundary area of the result after the hole filling so as to remove the foreground area communicated with the image boundary in the hole filling result;
step 3.4: constructing a square structural element with the side length of 30 pixels, and carrying out corrosion operation on the result of removing the boundary area;
step 3.5: taking the corrosion result as a mark, taking the boundary region removal result as a mask, and performing morphological reconstruction;
step 3.6: calculating a region descriptor for the result of the morphological reconstruction to obtain all foreground regions in the result of the morphological reconstruction and the area of each foreground region;
step 3.7: the area with the largest area is selected from all the foreground areas, and the area is judged to be a circular area at the center of the ten-position rotary dial switch.
Further, the pointer region detection algorithm comprises the following steps:
step 4.1: using the center [ x ] of a circular area at the center of a ten-position rotary dial switcho,yo]And radius roOnly a circular area image is reserved in an input image of the indication bit detection algorithm, and the rest part of the input image is filled with black to be used as the input image of the pointer area detection algorithm;
step 4.2: converting an input image of a pointer area detection algorithm into a gray scale image;
step 4.3: carrying out edge detection on the gray level image by adopting a Canny operator to obtain an edge image;
step 4.4: calculating each pixel and circle center [ x ] in the edge mapo,yo]And will exceed ro-20 pixel culling to clean out edge pixels on the circumference, leaving only edge pixels of the lower pointer region;
step 4.5: constructing a square structural element with the side length of 3 pixels, and performing expansion operation on the edge pixels of the reserved pointer area;
step 4.6: filling holes in the expansion result to communicate with pixels in the pointer area;
step 4.7: constructing a square structural element with the side length of 30 pixels, and carrying out corrosion operation on the hole filling result;
step 4.8: taking the corrosion result as a mark, taking the hole filling result as a mask, and performing morphological reconstruction;
step 4.9: calculating a region descriptor for the result of the morphological reconstruction to obtain all foreground regions in the result of the morphological reconstruction and the area of each foreground region;
step 4.10: the region having the largest area is selected from all the foreground regions, and is determined as the pointer region in the circular region.
Further, the pointer angle detection algorithm comprises the following steps:
step 5.1, calculating a region descriptor for the pointer region to obtain the main shaft angle α E [ -90 DEG ], 90 DEG ] of the pointer region]And using the center of the circle [ x ] of the circular areao,yo]And a main axis angle α, constructing the main axis of the pointer region;
step 5.2: adopting a Canny operator to carry out edge detection on the pointer region to obtain the edge of the pointer region;
step 5.3: obtaining two intersection point coordinates of the main axis and the edge by using the pixels of the pointer region where the main axis and the edge intersectAnd
step 5.4: respectively in the coordinates of the intersection pointAndas a center, two rectangular areas with the same size and perpendicular to the main axis are constructed, wherein the side length of the rectangle perpendicular to the main axis is 100 pixels, and the side length of the rectangle parallel to the main axis is 50 pixels;
step 5.5: multiplying the two rectangular areas and the pointer area by the image between the pixel pairs to obtain all overlapped areas of the rectangular areas and the pointer area;
step 5.6: in all the overlapping areas, respectively calculating an area descriptor for each connected overlapping area to obtain the centroid coordinate and the area of each connected overlapping area;
step 5.7: the areas of all the communication overlapping areas are arranged in a descending order from large to small, the communication overlapping area with the largest area is determined as the tail area of the pointer, and the communication overlapping area with the second largest area is determined as the head area of the pointer;
step 5.8: calculating area descriptor for pointer head area to obtain barycenter coordinate [ x ] of pointer head areac,yc];
Step 5.9: using the centroid x of the pointer header regionc,yc]Center of circle [ x ] of circular areao,yo]And the main shaft angle α of the pointer area, and the pointer angle value β belongs to [0 DEG, 360 DEG ] is obtained through calculation, and the calculation formula is as follows:
compared with the prior art, the invention has the beneficial effects that: the invention solves the problems of high cost, low efficiency and poor accuracy caused by the adoption of a manual reset mode for detecting whether the coding state corresponds to the indicating position in the existing ten-position rotary dial switch production process. The invention collects the image information of the ten-position rotary dial switch to be reset through the indicating position detection device, detects the current indicating position of the ten-position rotary dial switch through a defined indicating position detection algorithm, and then realizes the automatic resetting operation of the indicating position of the ten-position rotary dial switch by utilizing the indicating position resetting device; the device has the advantages of remarkably reducing the manual reset cost, increasing the reset accuracy of the indicating position, improving the detection efficiency, having small investment, being convenient for operation and having great market prospect.
Drawings
FIG. 1 is a schematic view of a visual-based ten-position rotary dial switch reset system according to the present invention;
FIG. 2 is a block diagram of an indicator bit detection algorithm for a visual-based ten-position rotary dial switch reset method according to the present invention;
FIG. 3 is a block diagram of a circular area detection algorithm for a visual-based ten-position rotary dial switch reset method according to the present invention;
FIG. 4 is a block diagram of a pointer region detection algorithm for a visual-based ten-position rotary dial switch reset method according to the present invention;
FIG. 5 is a block diagram of a pointer angle detection algorithm for a visual-based ten-position rotary dial switch reset method according to the present invention;
FIG. 6 is a schematic diagram of a ten-bit rotary dial switch of an indicator bit 0 collected by the indicator bit detection algorithm according to the present invention;
FIG. 7 is a schematic diagram of a ten-position rotary dial switch of an indicator bit 1 collected by the indicator bit detection algorithm according to the present invention;
FIG. 8 is a schematic diagram illustrating the result of Otsu binary segmentation performed on FIG. 7 by the circular region detection algorithm according to the present invention;
FIG. 9 is a schematic diagram illustrating the result of hole filling and boundary area clearing performed by the circular area detection algorithm of FIG. 8 according to the present invention;
FIG. 10 is a schematic diagram of a circular region detection result obtained by the circular region detection algorithm of the present invention from the morphologically reconstructed region of FIG. 9 with the largest area;
FIG. 11 is a circle center [ x ] calculated from the circular area of FIG. 10 by the indicator bit detection algorithm according to the present inventiono,yo]And radius roSchematic diagram of the results of (1);
FIG. 12 is a diagram illustrating the result of the indication bit detection algorithm of the present invention using the center of circle of FIG. 11 as the origin for the default angle values of the indication bits 0 to 9 constructed in FIG. 7;
FIG. 13 is a schematic diagram illustrating the result of the pointer region detection algorithm of the present invention using the circle center and the radius of FIG. 11, and only retaining the circular region image in FIG. 7 and converting it into a gray scale image;
FIG. 14 is a diagram illustrating the Canny edge detection and elimination of the peripheral edge pixels of FIG. 13 by the pointer region detection algorithm according to the present invention;
FIG. 15 is a graphical illustration of the results of the pointer region detection algorithm of the present invention on the inflation and hole filling of FIG. 14;
FIG. 16 is a schematic diagram of a pointer region detection result obtained by the pointer region detection algorithm of the present invention from the morphologically reconstructed region of FIG. 15 with the largest area;
FIG. 17 is a diagram illustrating the results of the pointer angle detection algorithm of the present invention calculating α the spindle angle of the pointer region of FIG. 16 and using the spindle angle and the spindle axis of the pointer region constructed at the center of the circle of FIG. 11;
FIG. 18 is a diagram illustrating the result of the pointer angle detection algorithm of the present invention performing Canny edge detection on the pointer region edge of FIG. 16 and calculating the coordinates of the intersection point of the edge and the main axis of FIG. 17;
FIG. 19 is a schematic diagram of the results of the pointer angle detection algorithm of the present invention using the two intersections of FIG. 18 to construct a rectangular region perpendicular to the main axis centered at each intersection;
FIG. 20 is a diagram of an overlapping region obtained by pixel-by-pixel image multiplication of the rectangular region in FIG. 19 and the pointer region in FIG. 16 according to the pointer angle detection algorithm of the present invention, then calculating a region descriptor for each connected overlapping region and taking the second largest connected overlapping region as the head region of the pointer, and then calculating a region descriptor for the head region of the pointer to obtainHead region centroid coordinate [ x ]c,yc]Schematic diagram of the results of (1);
FIG. 21 is a diagram of the pointer angle detection algorithm of the present invention using the centroid of the pointer header region [ x ]c,yc]Center of circle [ x ] of circular areao,yo]And the principal axis angle α of the pointer region, the resulting calculated pointer angle value β.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely explained below with reference to the drawings in the embodiments of the present invention.
The embodiment is described with reference to fig. 1, the visual sense-based ten-position rotary dial switch reset system comprises a PLC control system, a bus, an indication position detection device and an indication position reset device, wherein the PLC control system is in communication connection with the bus, the indication position detection device comprises an industrial camera and an industrial personal computer, the industrial camera is installed right above a ten-position rotary dial switch clamp to be reset, the industrial camera is in communication connection with the industrial personal computer, the industrial personal computer is in communication connection with the PLC control system, and an area where the indication position detection device is located is an indication position detection station; the indicating position resetting device comprises a cylinder, a servo motor and a batch head, wherein the cylinder is in communication connection with a bus through an I/O module, the servo motor is in communication connection with the bus, a telescopic rod of the cylinder is connected with the servo motor, an output shaft of the servo motor is fixedly connected with the batch head, the indicating position resetting device is positioned right above a ten-position rotary dial switch clamp to be reset, and an area where the indicating position resetting device is positioned is an indicating position resetting station.
In this embodiment, the bus is a TCP/IP bus, the industrial camera is connected with the industrial personal computer through the communication of GigE, the industrial personal computer is connected with the PLC control system through the communication of an RS232 module, the batch head is a linear batch head
The invention also provides a visual-based reset method of the ten-position rotary dial switch, which comprises the following steps:
step 1.1: when the ten-position rotary dial switch enters a clamp of the indicating position detection station, the PLC control system sends an indicating position detection station ready signal to the industrial personal computer through the RS232 module;
step 1.2: after the industrial personal computer obtains the indicating position detection station ready signal, a trigger signal is sent to the industrial camera through the GigE;
step 1.3: after the industrial camera obtains the trigger signal, shooting an image, and transmitting the shot image to the industrial personal computer through the GigE;
step 1.4: after the industrial personal computer obtains the image, calculating a current indicator bit k according to an indicator bit detection algorithm, and transmitting the current indicator bit k to a PLC control system through an RS232 module;
step 1.5: after the PLC control system obtains a current indicating position k, the current indicating position k is transmitted to a servo motor in an indicating position resetting device through a TCP/IP bus, and meanwhile, a transmission mechanism is informed through the TCP/IP bus to transmit a ten-position rotary dial switch to an indicating position resetting station;
step 1.6: after a servo motor in the indicating position resetting device obtains a current indicating position k, the servo motor rotates clockwise by k multiplied by 36 degrees from 90 degrees, and a servo motor ready signal is sent to a PLC control system through a TCP/IP bus after the rotation is finished;
step 1.7: after the ten-position rotary dial switch enters a clamp of the indicating position resetting station, an indicating position resetting station ready signal is sent to the PLC control system through a TCP/IP bus;
step 1.8: after receiving a servo motor ready signal and an indicator bit reset station ready signal at the same time, the PLC control system sends a trigger signal to the cylinder through a TCP/IP bus;
step 1.9: after receiving the trigger signal, the cylinder moves downwards from a high position to a low position, so that the linear batch head enters a pointer groove of the ten-position rotary dial switch, and after the linear batch head finishes the operation, a cylinder extension signal is sent to the PLC control system through a TCP/IP bus;
step 1.10: after receiving the cylinder extension signal, the PLC control system sends a trigger signal to the servo motor through a TCP/IP bus;
step 1.11: after receiving the trigger signal, the servo motor rotates anticlockwise by k multiplied by 36 degrees to reset the indicating bit to 0, and after the resetting is finished, an indicating bit resetting finishing signal is sent to the PLC control system through a TCP/IP bus;
step 1.12: after receiving the indication position reset completion signal, the PLC control system informs the air cylinder to move upwards from the low position to the high position through the TCP/IP bus, informs the servo motor to rotate to 90 degrees, and simultaneously informs the transmission mechanism to transmit the ten-position rotary dial switch to the coding state and the indication position detection station.
Further, the indicator bit detection algorithm comprises the following steps:
step 2.1: intercepting a rectangular image sub-block with the size of 600 multiplied by 800 (width multiplied by height) pixels from the center of an image shot by an industrial camera of an indication bit detection station as an input image of an indication bit detection algorithm;
step 2.2: detecting a circular area at the center of a ten-bit rotary dial switch from an input image by using a circular area detection algorithm;
step 2.3: calculating area descriptor for the detected circular area to obtain the centroid coordinate [ x ] of the circular areao,yo]Taking the circular area as the center of a circle;
step 2.4: adopting Sobel operator to carry out edge detection on the detected circular area, and utilizing all pixel points [ x ] on the edgei,yi],i∈[1,n]And the center of a circle [ xo,yo]Calculating the radius r of the circular area by the mean value of the distances betweenoThe calculation formula is as follows:
wherein n is the number of pixel points on the edge of the circular area;
step 2.5: around the center of a circle [ xo,yo]The angle is an original point, the horizontal right is 0 degrees, a default angle value of indication bits 0 to 9 is constructed in the anticlockwise direction, wherein the interval between two adjacent indication bits is 36 degrees, and the obtained default angle value of the indication bits 0 to 9 is 90 degrees, 54 degrees, 18 degrees, 342 degrees, 306 degrees, 270 degrees, 234 degrees, 198 degrees, 162 degrees and 126 degrees in sequence;
step 2.6: detecting a pointer area from the circular area obtained in the step 2.2 by using a pointer area detection algorithm;
step 2.7, calculating the detected pointer area by using a pointer angle detection algorithm to obtain a pointer angle value β;
and 2.8, sequentially comparing the pointer angle value β with default angle values of the indication positions 0 to 9, and judging that the current indication position of the ten-position rotary dial switch is k when the difference between the pointer angle value β and the angle value of the indication position k, which belongs to [0,9], is within +/-5 degrees.
Further, the circular region detection algorithm comprises the following steps:
step 3.1: performing global threshold segmentation on an input image of the indicator bit detection algorithm by using an Otsu threshold to obtain a binary image of the input image, wherein black is an image background, and white is a foreground region;
step 3.2: filling holes in the binary image to fill up the background part in the foreground area;
step 3.3: removing the boundary area of the result after the hole filling so as to remove the foreground area communicated with the image boundary in the hole filling result;
step 3.4: constructing a square structural element with the side length of 30 pixels, and carrying out corrosion operation on the result of removing the boundary area;
step 3.5: taking the corrosion result as a mark, taking the boundary region removal result as a mask, and performing morphological reconstruction;
step 3.6: calculating a region descriptor for the result of the morphological reconstruction to obtain all foreground regions in the result of the morphological reconstruction and the area of each foreground region;
step 3.7: the area with the largest area is selected from all the foreground areas, and the area is judged to be a circular area at the center of the ten-position rotary dial switch.
Further, the pointer region detection algorithm comprises the following steps:
step 4.1: using the center [ x ] of a circular area at the center of a ten-position rotary dial switcho,yo]And radius roOnly the circular area image is reserved in the input image of the indication bit detection algorithm, and the rest part is filled inBlack as the input image of the pointer area detection algorithm;
step 4.2: converting an input image of a pointer area detection algorithm into a gray scale image;
step 4.3: carrying out edge detection on the gray level image by adopting a Canny operator to obtain an edge image;
step 4.4: calculating each pixel and circle center [ x ] in the edge mapo,yo]And will exceed ro-20 pixel culling to clean out edge pixels on the circumference, leaving only edge pixels of the lower pointer region;
step 4.5: constructing a square structural element with the side length of 3 pixels, and performing expansion operation on the edge pixels of the reserved pointer area;
step 4.6: filling holes in the expansion result to communicate with pixels in the pointer area;
step 4.7: constructing a square structural element with the side length of 30 pixels, and carrying out corrosion operation on the hole filling result;
step 4.8: taking the corrosion result as a mark, taking the hole filling result as a mask, and performing morphological reconstruction;
step 4.9: calculating a region descriptor for the result of the morphological reconstruction to obtain all foreground regions in the result of the morphological reconstruction and the area of each foreground region;
step 4.10: the region having the largest area is selected from all the foreground regions, and is determined as the pointer region in the circular region.
Further, the pointer angle detection algorithm comprises the following steps:
step 5.1, calculating a region descriptor for the pointer region to obtain the main shaft angle α E [ -90 DEG ], 90 DEG ] of the pointer region]And using the center of the circle [ x ] of the circular areao,yo]And a main axis angle α, constructing the main axis of the pointer region;
step 5.2: adopting a Canny operator to carry out edge detection on the pointer region to obtain the edge of the pointer region;
step 5.3: obtaining the main axis and the edge by using the pixel of the pointer region with the intersection of the main axis and the edgeCoordinates of two intersections of edgesAnd
step 5.4: respectively in the coordinates of the intersection pointAndas a center, two rectangular areas with the same size and perpendicular to the main axis are constructed, wherein the side length of the rectangle perpendicular to the main axis is 100 pixels, and the side length of the rectangle parallel to the main axis is 50 pixels;
step 5.5: multiplying the two rectangular areas and the pointer area by the image between the pixel pairs to obtain all overlapped areas of the rectangular areas and the pointer area;
step 5.6: in all the overlapping areas, respectively calculating an area descriptor for each connected overlapping area to obtain the centroid coordinate and the area of each connected overlapping area;
step 5.7: the areas of all the communication overlapping areas are arranged in a descending order from large to small, the communication overlapping area with the largest area is determined as the tail area of the pointer, and the communication overlapping area with the second largest area is determined as the head area of the pointer;
step 5.8: calculating area descriptor for pointer head area to obtain barycenter coordinate [ x ] of pointer head areac,yc];
Step 5.9: using the centroid x of the pointer header regionc,yc]Center of circle [ x ] of circular areao,yo]And the main shaft angle α of the pointer area, and the pointer angle value β belongs to [0 DEG, 360 DEG ] is obtained through calculation, and the calculation formula is as follows:
the ten-bit rotary dial switch reset system and the reset method based on vision provided by the invention are introduced in detail, a specific example is applied in the text to explain the principle and the implementation mode of the invention, and the description of the embodiment is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. The utility model provides a ten rotatory dial switch reset systems based on vision which characterized in that: the industrial camera is arranged right above a ten-position rotary dial switch clamp to be reset, the industrial camera is in communication connection with the industrial personal computer, the industrial personal computer is in communication connection with the PLC control system, and an area where the indicating position detection device is located is an indicating position detection station; the indicating position resetting device comprises a cylinder, a servo motor and a batch head, wherein the cylinder is in communication connection with a bus through an I/O module, the servo motor is in communication connection with the bus, a telescopic rod of the cylinder is connected with the servo motor, an output shaft of the servo motor is fixedly connected with the batch head, the indicating position resetting device is positioned right above a ten-position rotary dial switch clamp to be reset, and an area where the indicating position resetting device is positioned is an indicating position resetting station.
2. The vision-based ten-position rotary dial switch reset system of claim 1, wherein: the bus is a TCP/IP bus.
3. The vision-based ten-position rotary dial switch reset system of claim 1, wherein: and the industrial camera is in communication connection with an industrial personal computer through the GigE.
4. The vision-based ten-position rotary dial switch reset system of claim 1, wherein: the industrial personal computer is in communication connection with the PLC control system through the RS232 module.
5. The vision-based ten-position rotary dial switch reset system of claim 1, wherein: the batch head is a linear batch head.
6. A method of resetting the vision-based ten-position rotary dial switch reset system of claim 1, wherein: it comprises the following steps:
step 1.1: when the ten-position rotary dial switch enters a clamp of the indicating position detection station, the PLC control system sends an indicating position detection station ready signal to the industrial personal computer through the RS232 module;
step 1.2: after the industrial personal computer obtains the indicating position detection station ready signal, a trigger signal is sent to the industrial camera through the GigE;
step 1.3: after the industrial camera obtains the trigger signal, shooting an image, and transmitting the shot image to the industrial personal computer through the GigE;
step 1.4: after the industrial personal computer obtains the image, calculating a current indicator bit k according to an indicator bit detection algorithm, and transmitting the current indicator bit k to a PLC control system through an RS232 module;
step 1.5: after the PLC control system obtains a current indicating position k, the current indicating position k is transmitted to a servo motor in an indicating position resetting device through a TCP/IP bus, and meanwhile, a transmission mechanism is informed through the TCP/IP bus to transmit a ten-position rotary dial switch to an indicating position resetting station;
step 1.6: after a servo motor in the indicating position resetting device obtains a current indicating position k, the servo motor rotates clockwise by k multiplied by 36 degrees from 90 degrees, and a servo motor ready signal is sent to a PLC control system through a TCP/IP bus after the rotation is finished;
step 1.7: after the ten-position rotary dial switch enters a clamp of the indicating position resetting station, an indicating position resetting station ready signal is sent to the PLC control system through a TCP/IP bus;
step 1.8: after receiving a servo motor ready signal and an indicator bit reset station ready signal at the same time, the PLC control system sends a trigger signal to the cylinder through a TCP/IP bus;
step 1.9: after receiving the trigger signal, the cylinder moves downwards from a high position to a low position, so that the linear batch head enters a pointer groove of the ten-position rotary dial switch, and after the linear batch head finishes the operation, a cylinder extension signal is sent to the PLC control system through a TCP/IP bus;
step 1.10: after receiving the cylinder extension signal, the PLC control system sends a trigger signal to the servo motor through a TCP/IP bus;
step 1.11: after receiving the trigger signal, the servo motor rotates anticlockwise by k multiplied by 36 degrees to reset the indicating bit to 0, and after the resetting is finished, an indicating bit resetting finishing signal is sent to the PLC control system through a TCP/IP bus;
step 1.12: after receiving the indication position reset completion signal, the PLC control system informs the air cylinder to move upwards from the low position to the high position through the TCP/IP bus, informs the servo motor to rotate to 90 degrees, and simultaneously informs the transmission mechanism to transmit the ten-position rotary dial switch to the coding state and the indication position detection station.
7. The vision-based ten-position rotary dial switch resetting method of claim 6, wherein: the indicator bit detection algorithm comprises the following steps:
step 2.1: intercepting a rectangular image sub-block with the size of 600 multiplied by 800 (width multiplied by height) pixels from the center of an image shot by an industrial camera of an indication bit detection station as an input image of an indication bit detection algorithm;
step 2.2: detecting a circular area at the center of a ten-bit rotary dial switch from an input image by using a circular area detection algorithm;
step 2.3: calculating area descriptor for the detected circular area to obtain the centroid coordinate [ x ] of the circular areao,yo]Taking the circular area as the center of a circle;
step 2.4: detected by Sobel operator pairEdge detection is carried out on the circular area, and all pixel points [ x ] on the edge are utilizedi,yi],i∈[1,n]And the center of a circle [ xo,yo]Calculating the radius r of the circular area by the mean value of the distances betweenoThe calculation formula is as follows:
wherein n is the number of pixel points on the edge of the circular area;
step 2.5: around the center of a circle [ xo,yo]The angle is an original point, the horizontal right is 0 degrees, a default angle value of indication bits 0 to 9 is constructed in the anticlockwise direction, wherein the interval between two adjacent indication bits is 36 degrees, and the obtained default angle value of the indication bits 0 to 9 is 90 degrees, 54 degrees, 18 degrees, 342 degrees, 306 degrees, 270 degrees, 234 degrees, 198 degrees, 162 degrees and 126 degrees in sequence;
step 2.6: detecting a pointer area from the circular area obtained in the step 2.2 by using a pointer area detection algorithm;
step 2.7, calculating the detected pointer area by using a pointer angle detection algorithm to obtain a pointer angle value β;
and 2.8, sequentially comparing the pointer angle value β with default angle values of the indication positions 0 to 9, and judging that the current indication position of the ten-position rotary dial switch is k when the difference between the pointer angle value β and the angle value of the indication position k, which belongs to [0,9], is within +/-5 degrees.
8. The vision-based ten-position rotary dial switch resetting method of claim 7, wherein: the circular region detection algorithm comprises the following steps:
step 3.1: performing global threshold segmentation on an input image of the indicator bit detection algorithm by using an Otsu threshold to obtain a binary image of the input image, wherein black is an image background, and white is a foreground region;
step 3.2: filling holes in the binary image to fill up the background part in the foreground area;
step 3.3: removing the boundary area of the result after the hole filling so as to remove the foreground area communicated with the image boundary in the hole filling result;
step 3.4: constructing a square structural element with the side length of 30 pixels, and carrying out corrosion operation on the result of removing the boundary area;
step 3.5: taking the corrosion result as a mark, taking the boundary region removal result as a mask, and performing morphological reconstruction;
step 3.6: calculating a region descriptor for the result of the morphological reconstruction to obtain all foreground regions in the result of the morphological reconstruction and the area of each foreground region;
step 3.7: the area with the largest area is selected from all the foreground areas, and the area is judged to be a circular area at the center of the ten-position rotary dial switch.
9. The vision-based ten-position rotary dial switch resetting method of claim 7, wherein: the pointer region detection algorithm comprises the following steps:
step 4.1: using the center [ x ] of a circular area at the center of a ten-position rotary dial switcho,yo]And radius roOnly a circular area image is reserved in an input image of the indication bit detection algorithm, and the rest part of the input image is filled with black to be used as the input image of the pointer area detection algorithm;
step 4.2: converting an input image of a pointer area detection algorithm into a gray scale image;
step 4.3: carrying out edge detection on the gray level image by adopting a Canny operator to obtain an edge image;
step 4.4: calculating each pixel and circle center [ x ] in the edge mapo,yo]And will exceed ro-20 pixel culling to clean out edge pixels on the circumference, leaving only edge pixels of the lower pointer region;
step 4.5: constructing a square structural element with the side length of 3 pixels, and performing expansion operation on the edge pixels of the reserved pointer area;
step 4.6: filling holes in the expansion result to communicate with pixels in the pointer area;
step 4.7: constructing a square structural element with the side length of 30 pixels, and carrying out corrosion operation on the hole filling result;
step 4.8: taking the corrosion result as a mark, taking the hole filling result as a mask, and performing morphological reconstruction;
step 4.9: calculating a region descriptor for the result of the morphological reconstruction to obtain all foreground regions in the result of the morphological reconstruction and the area of each foreground region;
step 4.10: the region having the largest area is selected from all the foreground regions, and is determined as the pointer region in the circular region.
10. The vision-based ten-position rotary dial switch resetting method of claim 7, wherein: the pointer angle detection algorithm comprises the following steps:
step 5.1, calculating a region descriptor for the pointer region to obtain the main shaft angle α E [ -90 DEG ], 90 DEG ] of the pointer region]And using the center of the circle [ x ] of the circular areao,yo]And a main axis angle α, constructing the main axis of the pointer region;
step 5.2: adopting a Canny operator to carry out edge detection on the pointer region to obtain the edge of the pointer region;
step 5.3: obtaining two intersection point coordinates of the main axis and the edge by using the pixels of the pointer region where the main axis and the edge intersectAnd
step 5.4: respectively in the coordinates of the intersection pointAndby forming two rectangular zones of equal size and perpendicular to the main axisA domain in which a side of a rectangle perpendicular to the major axis direction is 100 pixels and a side of a rectangle parallel to the major axis direction is 50 pixels;
step 5.5: multiplying the two rectangular areas and the pointer area by the image between the pixel pairs to obtain all overlapped areas of the rectangular areas and the pointer area;
step 5.6: in all the overlapping areas, respectively calculating an area descriptor for each connected overlapping area to obtain the centroid coordinate and the area of each connected overlapping area;
step 5.7: the areas of all the communication overlapping areas are arranged in a descending order from large to small, the communication overlapping area with the largest area is determined as the tail area of the pointer, and the communication overlapping area with the second largest area is determined as the head area of the pointer;
step 5.8: calculating area descriptor for pointer head area to obtain barycenter coordinate [ x ] of pointer head areac,yc];
Step 5.9: using the centroid x of the pointer header regionc,yc]Center of circle [ x ] of circular areao,yo]And the main shaft angle α of the pointer area, and the pointer angle value β belongs to [0 DEG, 360 DEG ] is obtained through calculation, and the calculation formula is as follows:
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911292517.1A CN111103533B (en) | 2019-12-12 | 2019-12-12 | Reset method of ten-position rotary dial switch reset system based on vision |
PCT/CN2020/083116 WO2021114521A1 (en) | 2019-12-12 | 2020-04-03 | Vision-based ten-bit rotary dial switch reset system and reset method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911292517.1A CN111103533B (en) | 2019-12-12 | 2019-12-12 | Reset method of ten-position rotary dial switch reset system based on vision |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111103533A true CN111103533A (en) | 2020-05-05 |
CN111103533B CN111103533B (en) | 2020-09-25 |
Family
ID=70421810
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911292517.1A Active CN111103533B (en) | 2019-12-12 | 2019-12-12 | Reset method of ten-position rotary dial switch reset system based on vision |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111103533B (en) |
WO (1) | WO2021114521A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112066914A (en) * | 2020-08-14 | 2020-12-11 | 常州机电职业技术学院 | 3362 potentiometer mechanical angle resetting system and method based on machine vision |
WO2022032648A1 (en) * | 2020-08-14 | 2022-02-17 | 常州机电职业技术学院 | Machine vision-based resetting system and resetting method for resetting mechanical angle of 3362 potentiometer |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050169374A1 (en) * | 2004-01-30 | 2005-08-04 | Detlev Marpe | Video frame encoding and decoding |
US20070247421A1 (en) * | 2006-04-25 | 2007-10-25 | Timothy James Orsley | Capacitive-based rotational positioning input device |
CN201450494U (en) * | 2009-05-08 | 2010-05-05 | 徐军 | Coding type hand-held pulse generator capable of pulse number adjustment and long distance transmission |
CN204029688U (en) * | 2014-08-13 | 2014-12-17 | 石家庄八五零电子有限公司 | There is the rotary switch of Self-resetting function |
CN110456254A (en) * | 2019-08-20 | 2019-11-15 | 南京优倍自动化***有限公司 | A kind of automatic checkout equipment and method for pcb board |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE102005015826A1 (en) * | 2005-04-06 | 2006-10-19 | Infineon Technologies Ag | Contact areas and/or contact pads optical inspecting method for use in e.g. integrated computing circuit, involves analyzing output image to detect contrasts and/or impressions that leave contact unit on contact pads during contacting |
CN107292310B (en) * | 2017-06-19 | 2020-10-09 | 电子科技大学 | Visual positioning and automatic reading method for circular pointer type dial plate |
CN107679535B (en) * | 2017-09-16 | 2021-02-26 | 西安电子科技大学 | Automatic reading identification system and method for pointer type water meter based on template matching |
CN108460327B (en) * | 2018-01-12 | 2021-09-28 | 河南大学 | Automatic identification method for reading of pointer instrument based on image processing |
CN109146974A (en) * | 2018-09-07 | 2019-01-04 | 广东中粤电力科技有限公司 | A kind of readings of pointer type meters recognition methods and system |
CN109459970B (en) * | 2018-10-26 | 2019-10-25 | 常州机电职业技术学院 | Elliptical hole potentiometer angle reset system and reset method based on vision |
CN109544628B (en) * | 2018-11-23 | 2021-08-31 | 福州大学 | Accurate reading identification system and method for pointer instrument |
CN109977831A (en) * | 2019-03-19 | 2019-07-05 | 河海大学常州校区 | A kind of knob recognition methods based on Digital Image Processing |
-
2019
- 2019-12-12 CN CN201911292517.1A patent/CN111103533B/en active Active
-
2020
- 2020-04-03 WO PCT/CN2020/083116 patent/WO2021114521A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050169374A1 (en) * | 2004-01-30 | 2005-08-04 | Detlev Marpe | Video frame encoding and decoding |
US20070247421A1 (en) * | 2006-04-25 | 2007-10-25 | Timothy James Orsley | Capacitive-based rotational positioning input device |
CN201450494U (en) * | 2009-05-08 | 2010-05-05 | 徐军 | Coding type hand-held pulse generator capable of pulse number adjustment and long distance transmission |
CN204029688U (en) * | 2014-08-13 | 2014-12-17 | 石家庄八五零电子有限公司 | There is the rotary switch of Self-resetting function |
CN110456254A (en) * | 2019-08-20 | 2019-11-15 | 南京优倍自动化***有限公司 | A kind of automatic checkout equipment and method for pcb board |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112066914A (en) * | 2020-08-14 | 2020-12-11 | 常州机电职业技术学院 | 3362 potentiometer mechanical angle resetting system and method based on machine vision |
CN112066914B (en) * | 2020-08-14 | 2021-12-21 | 常州机电职业技术学院 | 3362 potentiometer mechanical angle resetting system and method based on machine vision |
WO2022032648A1 (en) * | 2020-08-14 | 2022-02-17 | 常州机电职业技术学院 | Machine vision-based resetting system and resetting method for resetting mechanical angle of 3362 potentiometer |
Also Published As
Publication number | Publication date |
---|---|
WO2021114521A1 (en) | 2021-06-17 |
CN111103533B (en) | 2020-09-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101398907B (en) | Two-dimension code structure and decoding method for movable robot | |
CN109525194B (en) | Photovoltaic panel fault light spot detection and identification method and system | |
CN108388641B (en) | Traffic facility map generation method and system based on deep learning | |
CN111103533B (en) | Reset method of ten-position rotary dial switch reset system based on vision | |
CN107392849B (en) | Target identification and positioning method based on image subdivision | |
CN104021588A (en) | System and method for recovering three-dimensional true vehicle model in real time | |
CN108763996B (en) | Plane positioning coordinate and direction angle measuring method based on two-dimensional code | |
CN109708658B (en) | Visual odometer method based on convolutional neural network | |
CN109975759B (en) | Underwater unmanned aerial vehicle positioning method and device based on three-color laser | |
CN103438834A (en) | Hierarchy-type rapid three-dimensional measuring device and method based on structured light projection | |
CN111080640B (en) | Hole detection method, device, equipment and medium | |
CN106813569A (en) | A kind of automobile tire 3-D positioning method based on line-structured light | |
CN107133623A (en) | A kind of pointer position accurate detecting method positioned based on background subtraction and the center of circle | |
CN110705433A (en) | Bridge deformation monitoring method, device and equipment based on visual perception | |
CN113989766A (en) | Road edge detection method and road edge detection equipment applied to vehicle | |
CN106875430A (en) | Single movement target method for tracing and device based on solid form under dynamic background | |
CN112149713A (en) | Method and device for detecting insulator image based on insulator image detection model | |
CN115239822A (en) | Real-time visual identification and positioning method and system for multi-module space of split type flying vehicle | |
CN109816738B (en) | Stripe boundary extraction method based on coded structured light | |
CN112434694B (en) | Method and system for identifying damage fault of outer ring of front cover of rolling bearing | |
CN112066914B (en) | 3362 potentiometer mechanical angle resetting system and method based on machine vision | |
CN113393430A (en) | Thermal imaging image enhancement training method and device for fan blade defect detection | |
CN104850869A (en) | Automatic identification system and method for high-speed railway CPIII marker | |
CN113311507A (en) | Typhoon path identification method and device | |
CN116245948A (en) | Monocular vision cooperative target and pose measuring and calculating method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |