CN112066914B - 3362 potentiometer mechanical angle reset system and reset method based on machine vision - Google Patents

3362 potentiometer mechanical angle reset system and reset method based on machine vision Download PDF

Info

Publication number
CN112066914B
CN112066914B CN202010822863.2A CN202010822863A CN112066914B CN 112066914 B CN112066914 B CN 112066914B CN 202010822863 A CN202010822863 A CN 202010822863A CN 112066914 B CN112066914 B CN 112066914B
Authority
CN
China
Prior art keywords
mechanical angle
potentiometer
detection algorithm
reset
result
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.)
Active
Application number
CN202010822863.2A
Other languages
Chinese (zh)
Other versions
CN112066914A (en
Inventor
楼竞
沈琳
顾卫杰
王斌
王云良
任佳红
崔明勇
吴正栋
朱涛
宋桃玉
何文韬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changzhou Vocational Institute of Mechatronic Technology
Original Assignee
Changzhou Vocational Institute of Mechatronic Technology
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Changzhou Vocational Institute of Mechatronic Technology filed Critical Changzhou Vocational Institute of Mechatronic Technology
Priority to CN202010822863.2A priority Critical patent/CN112066914B/en
Publication of CN112066914A publication Critical patent/CN112066914A/en
Application granted granted Critical
Publication of CN112066914B publication Critical patent/CN112066914B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/26Measuring arrangements characterised by the use of optical techniques for measuring angles or tapers; for testing the alignment of axes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity
    • HELECTRICITY
    • H01ELECTRIC ELEMENTS
    • H01CRESISTORS
    • H01C17/00Apparatus or processes specially adapted for manufacturing resistors

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Geometry (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • Manufacturing & Machinery (AREA)
  • Microelectronics & Electronic Packaging (AREA)
  • Image Analysis (AREA)

Abstract

本发明提出了基于机器视觉的3362电位器机械角度复位系统及复位方法,属于3362电位器机械角度复位技术领域。解决了现有3362电位器的机械角度复位操作采用人工方式,导致成本高、效率低、准确性差的问题。复位系统包括机器控制器、总线、机械角度检测装置和机械角度复位装置,所述机器控制器与总线通讯连接,所述机械角度检测装置包括视觉相机和工控机,所述视觉相机安装在待机械角度检测的3362电位器夹具的正上方,所述视觉相机与工控机通讯连接,所述工控机与机器控制器通讯连接,所述机械角度复位装置包括气缸、伺服驱动、伺服电机和十字型批头。它主要用于3362电位器机械角度复位。

Figure 202010822863

The invention provides a 3362 potentiometer mechanical angle reset system and a reset method based on machine vision, and belongs to the technical field of 3362 potentiometer mechanical angle reset. It solves the problems of high cost, low efficiency and poor accuracy caused by the manual method used for the mechanical angle reset operation of the existing 3362 potentiometer. The reset system includes a machine controller, a bus, a mechanical angle detection device and a mechanical angle reset device, the machine controller is connected to the bus in communication, the mechanical angle detection device includes a vision camera and an industrial computer, and the vision camera is installed on the waiting machine. Right above the 3362 potentiometer fixture for angle detection, the visual camera is connected in communication with the industrial computer, and the industrial computer is in communication with the machine controller. The mechanical angle reset device includes a cylinder, a servo drive, a servo motor, and a cross-shaped batch. head. It is mainly used for 3362 potentiometer mechanical angle reset.

Figure 202010822863

Description

3362 potentiometer mechanical angle resetting system and method based on machine vision
Technical Field
The invention belongs to the technical field of 3362 potentiometer mechanical angle resetting, and particularly relates to a 3362 potentiometer mechanical angle resetting system and method based on machine vision.
Background
3362 in the production process of potentiometer, it is required to detect whether the resistance value and the mechanical angle change keep linear relation, the detection steps are: firstly, a cross-shaped groove of a 3362 potentiometer is rotated to an initial mechanical angle to detect zero resistance, then the cross-shaped groove is rotated clockwise from the initial mechanical angle to an end mechanical angle, and whether the resistance value and the change of the mechanical angle keep a linear relation or not is detected. However, the 3362 potentiometer produced on-line is typically at any mechanical angle due to manufacturing process issues. At present, whether manufacturing enterprises detect the resistance and the change of mechanical angle and keep the in-process of linear relation, the mechanical angle reset operation to the 3362 potentiometre mainly adopts manual mode, promptly when the 3362 potentiometre that awaits measuring gets into the anchor clamps that detect the station, the manual work is rotatory to initial mechanical angle with cross type groove and is detected again. 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 3362 potentiometer mechanical angle reset system and a reset method based on machine vision, aiming at solving the problems in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme: a3362 potentiometer mechanical angle resetting system based on machine vision comprises a machine controller, a bus, a mechanical angle detection device and a mechanical angle resetting device, wherein the machine controller is in communication connection with the bus, the mechanical angle detection device comprises a visual camera and an industrial personal computer, the visual camera is installed right above a 3362 potentiometer clamp for detecting mechanical angles, the visual camera is in communication connection with the industrial personal computer, the industrial personal computer is in communication connection with the machine controller, the mechanical angle resetting device comprises an air cylinder, a servo drive, a servo motor and a cross screwdriver head, the air cylinder is in communication connection with the machine controller through an I/O module, the servo drive is in communication connection with the machine controller through the bus, the servo motor is in communication connection with the servo drive, a telescopic rod of the air cylinder is connected with the servo motor, an output shaft of the servo motor is fixedly connected with the cross screwdriver head, the mechanical angle resetting device is located right above a 3362 potentiometer clamp to be reset by a mechanical angle, the area where the mechanical angle detecting device is located is a mechanical angle detecting station, and the area where the mechanical angle resetting device is located is a mechanical angle resetting station.
Further, the bus is an EtherCAT bus.
Furthermore, the vision camera is in communication connection with the industrial personal computer through the GigE.
Furthermore, the industrial personal computer is in communication connection with the machine controller through Ethernet.
The invention also provides a reset method of the 3362 potentiometer mechanical angle reset system based on machine vision, which comprises the following steps:
step 1.1: when the 3362 potentiometer enters the clamp of the mechanical angle detection station, the machine controller sends a mechanical angle detection station ready signal to the industrial personal computer through Ethernet;
step 1.2: after the industrial personal computer obtains a mechanical angle detection station ready signal, a trigger signal is sent to the visual camera through the GigE;
step 1.3: after the visual 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, the current mechanical angle alpha of the potentiometer is calculated 3362 according to a mechanical angle detection algorithm, and then the initial mechanical angle alpha obtained by the initial mechanical angle detection algorithm is utilized0Calculating to obtain a deflection angle beta, and transmitting the beta to the machine controller through Ethernet, wherein the calculation formula of the deflection angle beta is as follows:
β=α-α0
step 1.5: after the machine controller obtains the deflection angle beta, the servo motor is controlled to rotate clockwise from an initial position by the EtherCAT bus and the servo drive, and meanwhile, the transmission mechanism is informed to transmit the 3362 potentiometer to a mechanical angle reset station by the EtherCAT bus;
step 1.6: after the servo motor rotates, sending a servo motor ready signal to a machine controller through an EtherCAT bus;
step 1.7: after the 3362 potentiometer enters the clamp of the mechanical angle reset station, a mechanical angle reset station ready signal is sent to a machine controller through an EtherCAT bus;
step 1.8: after receiving a servo motor ready signal and a mechanical angle reset station ready signal simultaneously, the machine controller controls the air cylinder to move downwards from a high position to a low position through the I/O module, so that the cross-shaped batch head extends into a cross-shaped groove of the 3362 potentiometer, and after the completion, the machine controller sends an air cylinder ready signal to the machine controller through the I/O module;
step 1.9: after receiving the cylinder ready signal, the machine controller controls the servo motor to rotate anticlockwise by beta through the EtherCAT bus and the servo drive, and sends a mechanical angle reset completion signal to the machine controller through the EtherCAT bus after the rotation is completed;
step 1.10: after the mechanical angle reset completion signal is received by the machine controller, the air cylinder is controlled by the I/O module to move upwards from a low position to a high position, the servo motor is controlled to rotate to an initial position through the EtherCAT bus and the servo drive, and meanwhile the transmission mechanism is informed through the EtherCAT bus to transmit the 3362 potentiometer to a detection station whether the resistance value and the mechanical angle change keep a linear relation or not.
Further, the mechanical angle detection algorithm comprises the following steps:
step 2.1: intercepting square image sub-blocks with the size of 500 multiplied by 500 pixels from the center of an image shot by a visual camera of a mechanical angle detection device to serve as an input image of a mechanical angle detection algorithm;
step 2.2: extracting 3362 a circular area in the center of the potentiometer from the input image by using a circular area detection algorithm, and setting the rest part to be white as the input image of the indication point area detection algorithm;
step 2.3: detecting to obtain 2 indication point areas in a circular area at the center of the 3362 potentiometer by using an indication point area detection algorithm;
step 2.4: calculating area descriptors for the 2 indication point areas to respectively obtain the centroid coordinates (x) of the 2 indication point areasc1,yc1) And (x)c2,yc2);
Step 2.5: calculating to obtain the center point coordinate (x) between the centroids of the 2 indication point areas by using the centroid coordinates of the 2 indication point areasc,yc) The calculation formula is as follows:
Figure BDA0002634241920000031
step 2.6: extracting 3362 a circular area in the center of the potentiometer from the input image by using a circular area detection algorithm, and setting the rest part of the circular area to be black as an input image of a non-indication point area detection algorithm;
step 2.7: detecting to obtain 2 non-indication point areas in a circular area at the center of the 3362 potentiometer by using a non-indication point area detection algorithm;
step 2.8: calculating area descriptors for 2 non-indication point areas to respectively obtain the main shaft angles alpha of the 2 non-indication point areas1And alpha2In which α is1∈[-90°,90°]、α2∈[-90°,90°];
Step 2.9: calculating the average angle of the principal axes of the 2 non-point-indicating regions
Figure BDA0002634241920000032
The calculation formula is as follows:
Figure BDA0002634241920000033
wherein
Figure BDA0002634241920000035
Step 2.10: constructing a new coordinate system with the center (x) of the circleo,yo) Is the origin, is vertically downward 0 degree, and clockwise 0 degree and 360 degree];
Step 2.11: under the new coordinate system of the construction, the circle center (x) of the circular area is simultaneously utilizedo,yo) And the midpoint coordinate (x) among the centroids of the 2 indication point areasc,yc) 2 average angle of principal axis of non-indication point region
Figure BDA0002634241920000036
The current mechanical angle alpha of the 3362 potentiometer is obtained by calculation, and the calculation formula is as follows:
Figure BDA0002634241920000041
further, the circular region detection algorithm comprises the following steps:
step 3.1: in a color name space, taking a blue channel for an input image of a mechanical angle detection algorithm;
step 3.2: negating the blue channel and normalizing;
step 3.3: performing binarization operation on the normalization result by using an Otsu method, and filling holes in the binarization result;
step 3.4: calculating a region descriptor for the hole filling result to obtain the area and the centroid coordinate of each region;
step 3.5: in the hole filling result, only the region R with the largest area is reserved, and the centroid coordinate of the region is recorded as (x)o,yo);
Step 3.6: using Sobel operator, edge detection is performed on the region R, and the coordinates (x) of each pixel p on the edge are usedp,yp) Calculating p to coordinate (x)o,yo) Euclidean distance r ofpThe calculation formula is as follows:
Figure BDA0002634241920000042
step 3.7: all edge pixels to coordinate (x) at region Ro,yo) In the Euclidean distance of (1), the maximum Euclidean distance is taken and recorded as ro
Step 3.8: with (x)o,yo) As a center of circle, roThe area with the radius is the circular area obtained by the circular area detection algorithm.
Further, the indicator region detection algorithm comprises the following steps:
step 4.1: in a color name space, taking a black channel for an input image of an indication point region detection algorithm, and normalizing;
step 4.2: performing binarization operation on the normalization result by using an Otsu method, and filling holes in the binarization result;
step 4.3: constructing a disc-shaped structural element with the radius of 20, and carrying out corrosion operation on the hole filling result by using the structural element;
step 4.4: taking the corrosion result as a marked image, taking the hole filling result as a mask image, and executing morphological reconstruction operation;
step 4.5: subtracting the morphological reconstruction result from the hole filling result, and performing binarization operation on the difference image by using an Otsu method;
step 4.6: calculating a region descriptor for the difference image binarization result to obtain the area of each region;
step 4.7: in the difference image binarization result, only 2 regions with the largest area are reserved, namely the indication point regions obtained by the indication point region detection algorithm.
Further, the non-indicator region detection algorithm comprises the following steps:
step 5.1: in an RGB color space, taking a red channel for an input image of a non-indication point region detection algorithm;
step 5.2: constructing a matrix with the size of 5 multiplied by 5 and all element values of 1, and respectively executing maximum value filtering operation and minimum value filtering operation on a red channel;
step 5.3: subtracting the minimum filtering result from the maximum filtering result to obtain a difference image;
step 5.4: calculating a global threshold value by using an Otsu method, performing binarization operation on the difference image, and filling holes in a binarization result;
step 5.5: constructing a disc-shaped structural element with the radius of 5, and carrying out corrosion operation on the hole filling result by using the structural element to obtain a corrosion result 1;
step 5.6: constructing a disc-shaped structural element with the radius of 20, and carrying out corrosion operation on the corrosion result 1 by using the structural element to obtain a corrosion result 2;
step 5.7: performing morphological reconstruction operation by taking the corrosion result 2 as a marked image and the corrosion result 1 as a mask image;
step 5.8: calculating a region descriptor for the morphological reconstruction result to obtain a centroid coordinate of each region;
step 5.9: combining the regions in the morphological reconstruction result pairwise, calculating the midpoint coordinate between the centroids of any two regions, and setting a region RmAnd region RnRespectively, are (x)m,ym) And (x)n,yn) Then region RmAnd RnThe coordinate of the midpoint between the centroids is (x)mn,ymn) The calculation formula is as follows:
Figure BDA0002634241920000051
step 5.10: the midpoint coordinate (x) among the centroids of the 2 indicating point areas obtained by the mechanical angle detection algorithm step 2.5 is utilizedc,yc) Calculating all (x)mn,ymn) To the coordinate (x)c,yc) Euclidean distance of dmnThe calculation formula is as follows:
Figure BDA0002634241920000052
step 5.11: in all OldhamDistance dmnFinding the maximum Euclidean distance;
step 5.12: in the morphological reconstruction result, 2 regions corresponding to the maximum euclidean distance are generated, namely the non-indication point regions obtained by the non-indication point region detection algorithm.
Further, the initial mechanical angle detection algorithm comprises the following steps:
step 6.1: manually rotating a cross-shaped groove in a 3362 potentiometer standard element to an initial position, and placing the cross-shaped groove into a clamp of a mechanical angle detection station;
step 6.2: shooting an image through a visual camera of the mechanical angle detection device;
step 6.3: the current mechanical angle calculated by the mechanical angle detection algorithm from step 2.1 to step 2.11 is the initial mechanical angle alpha0
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 manual mode adopted by the mechanical angle resetting operation of the existing 3362 potentiometer. The method adopts an image triggering and collecting device to collect image information of a 3362 potentiometer to be mechanically reset, detects the current mechanical angle of the 3362 potentiometer through a defined mechanical angle detection algorithm, and then realizes the automatic mechanical angle resetting operation of the 3362 potentiometer by using a mechanical angle resetting device; the device has the advantages of remarkably reducing the manual reset cost, increasing the mechanical angle reset accuracy, improving the detection efficiency of whether the resistance value and the mechanical angle change keep a linear relation or not, having small investment, being convenient for operation and having great market prospect.
Drawings
Fig. 1 is a schematic structural diagram of a mechanical angle resetting system of a 3362 potentiometer based on machine vision according to the present invention;
FIG. 2 is a block diagram of a mechanical angle detection algorithm of a reset method of a 3362 potentiometer mechanical angle reset system based on machine vision according to the present invention;
FIG. 3 is a block diagram of a circular area detection algorithm for a reset method of a mechanical angle reset system of a 3362 potentiometer based on machine vision according to the present invention;
FIG. 4 is a block diagram of a flow of a reset method indication point area detection algorithm of a 3362 potentiometer mechanical angle reset system based on machine vision according to the present invention;
FIG. 5 is a block diagram of a non-indication point area detection algorithm of a reset method of a 3362 potentiometer mechanical angle reset system based on machine vision according to the present invention;
FIG. 6 is a schematic view of the 3362 potentiometer initial mechanical angle collected by the mechanical angle detection algorithm of the present invention;
FIG. 7 is a schematic view of 3362 potentiometer arbitrary mechanical angles collected by the mechanical angle detection algorithm of the present invention;
FIG. 8 is a schematic diagram illustrating the definition of the indicated point region and the non-indicated point region in the mechanical angle detection algorithm according to the present invention;
FIG. 9 is a schematic diagram of the result of the circular region detection algorithm of the present invention inverting and normalizing the blue channel of FIG. 7 in the color name space;
FIG. 10 is a schematic diagram of the result of binarization and hole filling of FIG. 9 by the circular region detection algorithm according to the present invention;
FIG. 11 is a schematic diagram of the calculation of the centroid coordinates of the maximum area region and the Euclidean distance from the region edge pixels to the centroid, which is obtained by the circular region detection algorithm of the present invention for the region descriptor calculated in FIG. 10;
FIG. 12 is a diagram illustrating the results of a circular region obtained by the circular region detection algorithm of the present invention;
FIG. 13 is an input image of an indicated point region detection algorithm in accordance with the present invention;
FIG. 14 is a schematic diagram of the result of the indicator point region detection algorithm of the present invention in color namespace, taking the black channel of FIG. 13 and normalizing;
FIG. 15 is a schematic diagram of the result of binarization and hole filling of FIG. 14 by the indicated point region detection algorithm according to the present invention;
FIG. 16 is a diagram illustrating the result of morphological reconstruction of FIG. 15 using a disc-shaped structural element with a radius of 20 according to the pointing region detection algorithm of the present invention;
FIG. 17 is a schematic diagram of the difference image of FIGS. 15 and 16 calculated by the indicated point region detection algorithm and normalized by the difference image according to the present invention;
fig. 18 is a schematic diagram of the result of the indicator region obtained by retaining only 2 regions with the largest area in fig. 17 by the indicator region detection algorithm according to the present invention;
FIG. 19 is a diagram illustrating the results of the mechanical angle detection algorithm of the present invention on the centroid coordinates of the 2 indicator regions obtained by the area descriptor calculated in FIG. 18 and the midpoint coordinates between the centroids of the 2 indicator regions;
FIG. 20 is an input image of a non-indicative point region detection algorithm in accordance with the present invention;
FIG. 21 is a schematic diagram showing a result of the non-indicator region detection algorithm of the present invention taking the red channel from FIG. 20 in the RGB color space and performing maximum filtering on the red channel by using a 5 × 5 full 1 matrix;
FIG. 22 is a schematic diagram showing the result of the non-indicator region detection algorithm of the present invention taking the red channel from FIG. 20 in the RGB color space and performing minimum filtering on the red channel using a 5 × 5 full 1 matrix;
FIG. 23 is a schematic diagram of the result of the difference image obtained by subtracting the minimum value filter of FIG. 22 from the maximum value filter of FIG. 21 by the non-indicative point region detection algorithm of the present invention;
FIG. 24 is a schematic diagram of the result of binarization and hole filling of FIG. 23 by the non-indicative point region detection algorithm according to the present invention;
FIG. 25 is a schematic diagram of a corrosion result 1 obtained by the non-indicator region detection algorithm of the present invention using a disc-shaped structural element with a radius of 5 to perform a corrosion operation on FIG. 24;
FIG. 26 is a schematic diagram of a corrosion result 2 obtained by the non-indicator region detection algorithm of the present invention using a disc-shaped structural element with a radius of 20 to perform a corrosion operation on FIG. 25;
FIG. 27 is a schematic diagram illustrating the morphological reconstruction of FIGS. 25 and 26 by the non-indicative point region detection algorithm of the present invention;
FIG. 28 is a schematic diagram illustrating symbol definitions of the non-pointing region detection algorithm of FIG. 27 for detecting non-pointing regions in accordance with the present invention;
FIG. 29 is a schematic diagram illustrating the process of detecting the non-indicative point regions of FIG. 27 by the non-indicative point region detection algorithm of the present invention;
FIG. 30 is a schematic diagram of the results of non-pointing regions obtained by the non-pointing region detection algorithm of the present invention;
FIG. 31 is a schematic diagram of the principal axis angle α of 2 non-pointing regions obtained by the mechanical angle detection algorithm according to the present invention from the region descriptor calculated in FIG. 301And alpha2And using alpha1And alpha2Calculating the average angle of the main axes of the 2 non-indication point areas
Figure BDA0002634241920000081
Schematic diagram of the results of (1);
FIG. 32 is a schematic diagram of a new coordinate system constructed by the mechanical angle detection algorithm of the present invention;
FIG. 33 is a diagram illustrating the result of the mechanical angle detection algorithm of the present invention on the current mechanical angle α detected in FIG. 6;
fig. 34 is a schematic diagram of the result of the mechanical angle detection algorithm of the present invention on the current mechanical angle α detected in fig. 7.
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.
Referring to fig. 1-34 to illustrate the embodiment, a 3362 potentiometer mechanical angle resetting system based on machine vision comprises a machine controller, a bus, a mechanical angle detecting device and a mechanical angle resetting device, wherein the machine controller is in communication connection with the bus, the mechanical angle detecting device comprises a visual camera and an industrial personal computer, the visual camera is installed right above a 3362 potentiometer clamp to be detected for a mechanical angle, the visual camera is in communication connection with the industrial personal computer, the industrial personal computer is in communication connection with the machine controller, the mechanical angle resetting device comprises an air cylinder, a servo drive, a servo motor and a cross batch head, the air cylinder is in communication connection with the machine controller through an I/O module, the servo drive is in communication connection with the machine controller through the bus, the servo motor is in communication connection with the servo drive, and a telescopic rod of the air cylinder is connected with the servo motor, the output shaft of the servo motor is fixedly connected with the cross-shaped batch head, the mechanical angle resetting device is located right above a 3362 potentiometer clamp to be reset by a mechanical angle, the area where the mechanical angle detecting device is located is a mechanical angle detecting station, and the area where the mechanical angle resetting device is located is a mechanical angle resetting station.
The bus is an EtherCAT bus, the vision camera is in communication connection with an industrial personal computer through GigE, and the industrial personal computer is in communication connection with a machine controller through Ethernet.
The embodiment is a resetting method of a 3362 potentiometer mechanical angle resetting system based on machine vision, which comprises the following steps:
step 1.1: when the 3362 potentiometer enters the clamp of the mechanical angle detection station, the machine controller sends a mechanical angle detection station ready signal to the industrial personal computer through Ethernet;
step 1.2: after the industrial personal computer obtains a mechanical angle detection station ready signal, a trigger signal is sent to the visual camera through the GigE;
step 1.3: after the visual 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, the current mechanical angle alpha of the potentiometer is calculated 3362 according to a mechanical angle detection algorithm, and then the initial mechanical angle alpha obtained by the initial mechanical angle detection algorithm is utilized0Calculating to obtain a deflection angle beta, and transmitting the beta to the machine controller through Ethernet, wherein the calculation formula of the deflection angle beta is as follows:
β=α-α0
step 1.5: after the machine controller obtains the deflection angle beta, the servo motor is controlled to rotate clockwise from an initial position by the EtherCAT bus and the servo drive, and meanwhile, the transmission mechanism is informed to transmit the 3362 potentiometer to a mechanical angle reset station by the EtherCAT bus;
step 1.6: after the servo motor rotates, sending a servo motor ready signal to a machine controller through an EtherCAT bus;
step 1.7: after the 3362 potentiometer enters the clamp of the mechanical angle reset station, a mechanical angle reset station ready signal is sent to a machine controller through an EtherCAT bus;
step 1.8: after receiving a servo motor ready signal and a mechanical angle reset station ready signal simultaneously, the machine controller controls the air cylinder to move downwards from a high position to a low position through the I/O module, so that the cross-shaped batch head extends into a cross-shaped groove of the 3362 potentiometer, and after the completion, the machine controller sends an air cylinder ready signal to the machine controller through the I/O module;
step 1.9: after receiving the cylinder ready signal, the machine controller controls the servo motor to rotate anticlockwise by beta through the EtherCAT bus and the servo drive, and sends a mechanical angle reset completion signal to the machine controller through the EtherCAT bus after the rotation is completed;
step 1.10: after the mechanical angle reset completion signal is received by the machine controller, the air cylinder is controlled by the I/O module to move upwards from a low position to a high position, the servo motor is controlled to rotate to an initial position through the EtherCAT bus and the servo drive, and meanwhile the transmission mechanism is informed through the EtherCAT bus to transmit the 3362 potentiometer to a detection station whether the resistance value and the mechanical angle change keep a linear relation or not.
The mechanical angle detection algorithm in the embodiment comprises the following steps:
step 2.1: intercepting square image sub-blocks with the size of 500 multiplied by 500 pixels from the center of an image shot by a visual camera of a mechanical angle detection device to serve as an input image of a mechanical angle detection algorithm;
step 2.2: extracting 3362 a circular area in the center of the potentiometer from the input image by using a circular area detection algorithm, and setting the rest part to be white as the input image of the indication point area detection algorithm;
step 2.3: detecting to obtain 2 indication point areas in a circular area at the center of the 3362 potentiometer by using an indication point area detection algorithm;
step 2.4: calculating area descriptors for the 2 indication point areas to respectively obtain the centroid coordinates (x) of the 2 indication point areasc1,yc1) And (x)c2,yc2);
Step 2.5: calculating to obtain the center point coordinate (x) between the centroids of the 2 indication point areas by using the centroid coordinates of the 2 indication point areasc,yc) The calculation formula is as follows:
Figure BDA0002634241920000101
step 2.6: extracting 3362 a circular area in the center of the potentiometer from the input image by using a circular area detection algorithm, and setting the rest part of the circular area to be black as an input image of a non-indication point area detection algorithm;
step 2.7: detecting to obtain 2 non-indication point areas in a circular area at the center of the 3362 potentiometer by using a non-indication point area detection algorithm;
step 2.8: calculating area descriptors for 2 non-indication point areas to respectively obtain the main shaft angles alpha of the 2 non-indication point areas1And alpha2In which α is1∈[-90°,90°]、α2∈[-90°,90°];
Step 2.9: calculating the average angle of the principal axes of the 2 non-point-indicating regions
Figure BDA0002634241920000102
The calculation formula is as follows:
Figure BDA0002634241920000103
wherein
Figure BDA0002634241920000104
Step 2.10: constructing a new coordinate system with the center (x) of the circleo,yo) Is at the origin and vertically downwardIs 0 DEG, clockwise is [0 DEG ], 360 DEG];
Step 2.11: under the new coordinate system of the construction, the circle center (x) of the circular area is simultaneously utilizedo,yo) And the midpoint coordinate (x) among the centroids of the 2 indication point areasc,yc) 2 average angle of principal axis of non-indication point region
Figure BDA0002634241920000105
The current mechanical angle alpha of the 3362 potentiometer is obtained by calculation, and the calculation formula is as follows:
Figure BDA0002634241920000111
the circular region detection algorithm comprises the following steps:
step 3.1: in a color name space, taking a blue channel for an input image of a mechanical angle detection algorithm;
step 3.2: negating the blue channel and normalizing;
step 3.3: performing binarization operation on the normalization result by using an Otsu method, and filling holes in the binarization result;
step 3.4: calculating a region descriptor for the hole filling result to obtain the area and the centroid coordinate of each region;
step 3.5: in the hole filling result, only the region R with the largest area is reserved, and the centroid coordinate of the region is recorded as (x)o,yo);
Step 3.6: using Sobel operator, edge detection is performed on the region R, and the coordinates (x) of each pixel p on the edge are usedp,yp) Calculating p to coordinate (x)o,yo) Euclidean distance r ofpThe calculation formula is as follows:
Figure BDA0002634241920000112
step 3.7: all edge pixels to coordinate (x) at region Ro,yo) In the euclidean distance of (a),the maximum Euclidean distance is taken and recorded as ro
Step 3.8: with (x)o,yo) As a center of circle, roThe area with the radius is the circular area obtained by the circular area detection algorithm.
The indicator region detection algorithm comprises the following steps:
step 4.1: in a color name space, taking a black channel for an input image of an indication point region detection algorithm, and normalizing;
step 4.2: performing binarization operation on the normalization result by using an Otsu method, and filling holes in the binarization result;
step 4.3: constructing a disc-shaped structural element with the radius of 20, and carrying out corrosion operation on the hole filling result by using the structural element;
step 4.4: taking the corrosion result as a marked image, taking the hole filling result as a mask image, and executing morphological reconstruction operation;
step 4.5: subtracting the morphological reconstruction result from the hole filling result, and performing binarization operation on the difference image by using an Otsu method;
step 4.6: calculating a region descriptor for the difference image binarization result to obtain the area of each region;
step 4.7: in the difference image binarization result, only 2 regions with the largest area are reserved, namely the indication point regions obtained by the indication point region detection algorithm.
The non-indicator region detection algorithm comprises the following steps:
step 5.1: in an RGB color space, taking a red channel for an input image of a non-indication point region detection algorithm;
step 5.2: constructing a matrix with the size of 5 multiplied by 5 and all element values of 1, and respectively executing maximum value filtering operation and minimum value filtering operation on a red channel;
step 5.3: subtracting the minimum filtering result from the maximum filtering result to obtain a difference image;
step 5.4: calculating a global threshold value by using an Otsu method, performing binarization operation on the difference image, and filling holes in a binarization result;
step 5.5: constructing a disc-shaped structural element with the radius of 5, and carrying out corrosion operation on the hole filling result by using the structural element to obtain a corrosion result 1;
step 5.6: constructing a disc-shaped structural element with the radius of 20, and carrying out corrosion operation on the corrosion result 1 by using the structural element to obtain a corrosion result 2;
step 5.7: performing morphological reconstruction operation by taking the corrosion result 2 as a marked image and the corrosion result 1 as a mask image;
step 5.8: calculating a region descriptor for the morphological reconstruction result to obtain a centroid coordinate of each region;
step 5.9: combining the regions in the morphological reconstruction result pairwise, calculating the midpoint coordinate between the centroids of any two regions, and setting a region RmAnd region RnRespectively, are (x)m,ym) And (x)n,yn) Then region RmAnd RnThe coordinate of the midpoint between the centroids is (x)mn,ymn) The calculation formula is as follows:
Figure BDA0002634241920000121
step 5.10: the midpoint coordinate (x) among the centroids of the 2 indicating point areas obtained by the mechanical angle detection algorithm step 2.5 is utilizedc,yc) Calculating all (x)mn,ymn) To the coordinate (x)c,yc) Euclidean distance of dmnThe calculation formula is as follows:
Figure BDA0002634241920000122
step 5.11: at all Euclidean distances dmnFinding the maximum Euclidean distance;
step 5.12: in the morphological reconstruction result, 2 regions corresponding to the maximum euclidean distance are generated, namely the non-indication point regions obtained by the non-indication point region detection algorithm.
The initial mechanical angle detection algorithm comprises the following steps:
step 6.1: manually rotating a cross-shaped groove in a 3362 potentiometer standard element to an initial position, and placing the cross-shaped groove into a clamp of a mechanical angle detection station;
step 6.2: shooting an image through a visual camera of the mechanical angle detection device;
step 6.3: the current mechanical angle calculated by the mechanical angle detection algorithm from step 2.1 to step 2.11 is the initial mechanical angle alpha0
As shown in fig. 6, the initial mechanical angle of the 3362 potentiometer acquired by the mechanical angle detection algorithm is as shown in fig. 7, the random mechanical angle of the 3362 potentiometer acquired by the mechanical angle detection algorithm is as shown in fig. 8, the indicated point region and the non-indicated point region are defined by the mechanical angle detection algorithm, as shown in fig. 9, the blue channel is taken by the circular region detection algorithm in the color name space of fig. 7, the blue channel is taken, the inverted channel is taken and normalized, as shown in fig. 10, the fig. 9 is binarized by the circular region detection algorithm and the holes are filled, as shown in fig. 11, the region descriptor is calculated by the circular region detection algorithm with respect to fig. 10, the obtained centroid coordinates of the maximum area region and the euclidean distance from the region edge pixels to the centroid are obtained, as shown in fig. 12, the circular region is obtained by the circular region detection algorithm, as shown in fig. 13, the input image of the indicated point region detection algorithm obtained by the mechanical angle detection algorithm, as shown in fig. 14, fig. 13 is taken black channel and normalized in color namespace by the indicated point region detection algorithm, as shown in fig. 15, fig. 14 is binarized and hole-filled by the indicated point region detection algorithm, as shown in fig. 16, fig. 15 is morphologically reconstructed by the indicated point region detection algorithm using a disc-shaped structuring element with radius 20, as shown in fig. 17, the difference image of fig. 15 and fig. 16 is calculated by the indicated point region detection algorithm, and the difference image is normalized, as shown in fig. 18, only 2 regions with the largest area are retained for fig. 17 by the indicated point region detection algorithm, and the obtained indicated point region is, as shown in fig. 19, the mechanical angle detection algorithm describes the region calculated for fig. 18Sub-derived centroid coordinates (x) of 2 pointer regionsc1,yc1) And (x)c2,yc2) And 2 midpoint coordinates (x) between centroids of the pointing regionc,yc) As shown in fig. 20, the input image of the non-pointing region detection algorithm obtained by the mechanical angle detection algorithm is, as shown in fig. 21, obtained by taking a red color channel in the RGB color space by the non-pointing region detection algorithm and maximum-filtering the red color channel by using a 5 × 5 full 1 matrix, as shown in fig. 22, obtained by taking a red color channel in the RGB color space by the non-pointing region detection algorithm and minimum-filtering the red color channel by using a 5 × 5 full 1 matrix, as shown in fig. 23, obtained by subtracting the red color channel from fig. 22 from fig. 21 by the non-pointing region detection algorithm, as shown in fig. 24, obtained by binarizing and filling holes in fig. 23 by the non-pointing region detection algorithm, as shown in fig. 25, obtained by performing the etching operation on fig. 24 by using a disk-type structural element having a radius of 5 by the non-pointing region detection algorithm, as shown in fig. 1, as shown in fig. 26, the corrosion result 2 obtained by performing the corrosion operation on fig. 25 by using the disc-shaped structural element with the radius of 20 by the non-indicative point region detection algorithm is, as shown in fig. 27, morphologically reconstructed by the non-indicative point region detection algorithm on fig. 25 and 26, as shown in fig. 28, and the symbol definition of the non-indicative point region detected by the non-indicative point region detection algorithm on fig. 27, including R1、R2And R3Three areas with the coordinates of the mass center of the three areas being respectively (x)1,y1)、(x2,y2) And (x)3,y3) The coordinates of the middle points among the centroids of the three regions are respectively (x)12,y12)、(x13,y13) And (x)23,y23) FIG. 29 shows a process of detecting a non-pointing region of FIG. 27 by a non-pointing region detection algorithm, wherein R is1、R2And R3Coordinate of middle point between centroids of three regions to coordinate of middle point between centroids of indicated point region (x)c,yc) Respectively, are d12、d13And d23Due to d therein12Maximum, and thus its corresponding region R1And R2That is, the detected non-pointing point region is obtained by a non-pointing point region detection algorithm as shown in fig. 30, and the main axis angle α of 2 non-pointing point regions obtained by calculating a region descriptor from fig. 30 by a mechanical angle detection algorithm as shown in fig. 311And alpha2And using alpha1And alpha2Calculating the average angle of the main axes of the 2 non-indication point areas
Figure BDA0002634241920000141
As shown in fig. 32, a new coordinate system is constructed by the mechanical angle detection algorithm, and as shown in fig. 33, the current mechanical angle α detected by the mechanical angle detection algorithm from fig. 6 is xc<xoThus, therefore, it is
Figure BDA0002634241920000142
I.e. the initial mechanical angle alpha0As shown in fig. 34, the current mechanical angle α detected by the mechanical angle detection algorithm in fig. 7 is 52.1 °, since x is xc>xoThus, therefore, it is
Figure BDA0002634241920000143
Then the deflection angle beta is obtained from step 1.4 of the mechanical angle resetting method as alpha-alpha0239.6 ° -52.1 ° -187.5 °, i.e. a mechanical angular reset of fig. 7 requires a rotation of 187.5 °.
The 3362 potentiometer mechanical angle resetting system and the resetting method based on machine vision provided by the invention are introduced in detail, and a specific example is applied in the text to explain the principle and the implementation of the invention, and the description of the above 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 (9)

1.一种基于机器视觉的3362电位器机械角度复位系统的复位方法,其特征在于:它包括以下步骤:1. a reset method based on the 3362 potentiometer mechanical angle reset system of machine vision, is characterized in that: it comprises the following steps: 步骤1.1:当3362电位器进入机械角度检测工位的夹具后,机器控制器通过Ethernet向工控机发出机械角度检测工位就绪信号;Step 1.1: When the 3362 potentiometer enters the fixture of the mechanical angle detection station, the machine controller sends the mechanical angle detection station ready signal to the industrial computer through Ethernet; 步骤1.2:工控机获得机械角度检测工位就绪信号后,通过GigE向视觉相机发出一个触发信号;Step 1.2: After the industrial computer obtains the ready signal of the mechanical angle detection station, it sends a trigger signal to the vision camera through GigE; 步骤1.3:视觉相机获得触发信号后,拍摄一幅图像,并通过GigE向工控机传送拍摄的图像;Step 1.3: After the vision camera obtains the trigger signal, it captures an image and transmits the captured image to the industrial computer through GigE; 步骤1.4:工控机获得图像后,根据机械角度检测算法计算3362电位器的当前机械角度α,再利用初始机械角度检测算法得到的初始机械角度α0,计算得到偏转角度β,并将β通过Ethernet输送给机器控制器,偏转角度β的计算公式为:Step 1.4: After the industrial computer obtains the image, calculate the current mechanical angle α of the 3362 potentiometer according to the mechanical angle detection algorithm, and then use the initial mechanical angle α 0 obtained by the initial mechanical angle detection algorithm to calculate the deflection angle β, and pass β through Ethernet It is sent to the machine controller, and the calculation formula of the deflection angle β is: β=α-α0β=α-α 0 ; 步骤1.5:机器控制器获得偏转角度β后,通过EtherCAT总线和伺服驱动控制伺服电机从初始位顺时针旋转β,同时通过EtherCAT总线通知传送机构将3362电位器传送到机械角度复位工位;Step 1.5: After the machine controller obtains the deflection angle β, it controls the servo motor to rotate β clockwise from the initial position through the EtherCAT bus and the servo drive, and at the same time notifies the transmission mechanism through the EtherCAT bus to transmit the 3362 potentiometer to the mechanical angle reset station; 步骤1.6:伺服电机旋转完毕后,通过EtherCAT总线向机器控制器发出一个伺服电机就绪信号;Step 1.6: After the servo motor rotates, send a servo motor ready signal to the machine controller through the EtherCAT bus; 步骤1.7:当3362电位器进入机械角度复位工位的夹具后,通过EtherCAT总线向机器控制器发出一个机械角度复位工位就绪信号;Step 1.7: When the 3362 potentiometer enters the fixture of the mechanical angle reset station, it sends a mechanical angle reset station ready signal to the machine controller through the EtherCAT bus; 步骤1.8:机器控制器同时接收到伺服电机就绪信号和机械角度复位工位就绪信号后,通过I/O模块控制气缸从高位向下运动至低位,使十字型批头伸入3362电位器的十字型槽中,完毕后通过I/O模块向机器控制器发出气缸就绪信号;Step 1.8: After the machine controller receives the ready signal of the servo motor and the ready signal of the mechanical angle reset station at the same time, it controls the cylinder to move downward from the high position to the low position through the I/O module, so that the cross-shaped batch head extends into the cross of the 3362 potentiometer After completion, the cylinder ready signal is sent to the machine controller through the I/O module; 步骤1.9:机器控制器接收到气缸就绪信号后,通过EtherCAT总线和伺服驱动控制伺服电机逆时针旋转β,旋转完毕后通过EtherCAT总线向机器控制器发出机械角度复位完毕信号;Step 1.9: After the machine controller receives the cylinder ready signal, it controls the servo motor to rotate β counterclockwise through the EtherCAT bus and the servo drive. After the rotation is completed, it sends a mechanical angle reset completion signal to the machine controller through the EtherCAT bus; 步骤1.10:机器控制器接收到机械角度复位完毕信号后,通过I/O模块控制气缸从低位向上运动至高位,并通过EtherCAT总线和伺服驱动控制伺服电机旋转至初始位,同时通过EtherCAT总线通知传送机构将3362电位器传送到阻值与机械角度变化是否保持线性关系的检测工位;Step 1.10: After the machine controller receives the mechanical angle reset signal, it controls the cylinder to move upward from the low position to the high position through the I/O module, and controls the servo motor to rotate to the initial position through the EtherCAT bus and the servo drive. At the same time, the transmission is notified through the EtherCAT bus. The mechanism transmits the 3362 potentiometer to the detection station where the resistance value and the mechanical angle change maintain a linear relationship; 所述机械角度检测算法包括以下步骤:The mechanical angle detection algorithm includes the following steps: 步骤2.1:从机械角度检测装置视觉相机拍摄的图像中心,截取500×500像素大小的正方形图像子块,作为机械角度检测算法的输入图像;Step 2.1: From the center of the image captured by the visual camera of the mechanical angle detection device, intercept a square image sub-block with a size of 500×500 pixels as the input image of the mechanical angle detection algorithm; 步骤2.2:使用圆形区域检测算法,从输入图像中提取3362电位器中心的圆形区域,其余部分设置为白色,作为指示点区域检测算法的输入图像;Step 2.2: Use the circular area detection algorithm to extract the circular area in the center of the 3362 potentiometer from the input image, and set the rest to white as the input image of the point area detection algorithm; 步骤2.3:使用指示点区域检测算法,在3362电位器中心的圆形区域中检测得到2个指示点区域;Step 2.3: Use the indicator point area detection algorithm to detect 2 indicator point areas in the circular area in the center of the 3362 potentiometer; 步骤2.4:对2个指示点区域计算区域描述子,分别得到2个指示点区域的质心坐标(xc1,yc1)和(xc2,yc2);Step 2.4: Calculate the area descriptor for the two indicated point areas, and obtain the centroid coordinates (x c1 , y c1 ) and (x c2 , y c2 ) of the two indicated point areas respectively; 步骤2.5:利用2个指示点区域的质心坐标,计算得到2个指示点区域质心间的中点坐标(xc,yc),计算公式为:Step 2.5: Using the centroid coordinates of the two indicated point areas, calculate the midpoint coordinates (x c , y c ) between the centroids of the two indicated point areas. The calculation formula is:
Figure FDA0003256266630000021
Figure FDA0003256266630000021
步骤2.6:使用圆形区域检测算法,从输入图像中提取3362电位器中心的圆形区域,其余部分设置为黑色,作为非指示点区域检测算法的输入图像;Step 2.6: Use the circular area detection algorithm to extract the circular area in the center of the 3362 potentiometer from the input image, and set the rest to black as the input image of the non-indicating point area detection algorithm; 步骤2.7:使用非指示点区域检测算法,在3362电位器中心的圆形区域中检测得到2个非指示点区域;Step 2.7: Use the non-indicating point area detection algorithm to detect 2 non-indicating point areas in the circular area in the center of the 3362 potentiometer; 步骤2.8:对2个非指示点区域计算区域描述子,分别得到2个非指示点区域的主轴角度α1和α2,其中α1∈[-90°,90°]、α2∈[-90°,90°];Step 2.8: Calculate the region descriptor for the two non-indicating point regions, and obtain the principal axis angles α 1 and α 2 of the two non-indicating point regions, where α 1 ∈[-90°, 90°], α 2 ∈[- 90°,90°]; 步骤2.9:计算2个非指示点区域主轴的平均角度
Figure FDA0003256266630000022
计算公式为:
Step 2.9: Calculate the average angle of the major axes of the 2 non-indicating point areas
Figure FDA0003256266630000022
The calculation formula is:
Figure FDA0003256266630000023
Figure FDA0003256266630000023
其中
Figure FDA0003256266630000024
in
Figure FDA0003256266630000024
步骤2.10:构造一个新的坐标系,该坐标系以圆形区域的圆心(xo,yo)为原点,垂直向下为0°,顺时针方向为[0°,360°];Step 2.10: Construct a new coordinate system, which takes the center (x o , y o ) of the circular area as the origin, 0° vertically downward, and [0°, 360°] clockwise; 步骤2.11:在构造的新坐标系下,同时利用圆形区域的圆心(xo,yo)、2个指示点区域质心间的中点坐标(xc,yc)、2个非指示点区域主轴的平均角度
Figure FDA0003256266630000025
计算得到3362电位器的当前机械角度α,计算公式为:
Step 2.11: Under the constructed new coordinate system, use the center of the circle area (x o , y o ), the midpoint coordinates (x c , y c ) between the centroids of the two indicated point areas, and the two non-indicative points Average angle of the principal axis of the area
Figure FDA0003256266630000025
Calculate the current mechanical angle α of the 3362 potentiometer, and the calculation formula is:
Figure FDA0003256266630000031
Figure FDA0003256266630000031
2.根据权利要求1所述的一种基于机器视觉的3362电位器机械角度复位系统的复位方法,其特征在于:所述圆形区域检测算法包括以下步骤:2. a kind of reset method based on machine vision 3362 potentiometer mechanical angle reset system according to claim 1, is characterized in that: described circular area detection algorithm comprises the following steps: 步骤3.1:在颜色名空间中,对机械角度检测算法的输入图像取蓝色通道;Step 3.1: In the color namespace, take the blue channel for the input image of the mechanical angle detection algorithm; 步骤3.2:对蓝色通道取反,并归一化;Step 3.2: Invert the blue channel and normalize it; 步骤3.3:使用Otsu方法对归一化结果执行二值化操作,并对二值化结果进行孔洞填充;Step 3.3: Use the Otsu method to perform a binarization operation on the normalized result, and fill holes in the binarized result; 步骤3.4:对孔洞填充结果计算区域描述子,得到每个区域的面积和质心坐标;Step 3.4: Calculate the area descriptor for the hole filling result, and obtain the area and centroid coordinates of each area; 步骤3.5:在孔洞填充结果中,仅保留面积最大的区域R,该区域的质心坐标记为(xo,yo);Step 3.5: In the hole filling result, only the region R with the largest area is retained, and the centroid coordinates of this region are marked as (x o , y o ); 步骤3.6:使用Sobel算子,对区域R进行边缘检测,并利用边缘上每个像素p的坐标(xp,yp),计算p到坐标(xo,yo)的欧氏距离rp,计算公式为:Step 3.6: Use the Sobel operator to perform edge detection on the region R, and use the coordinates (x p , y p ) of each pixel p on the edge to calculate the Euclidean distance r p from p to the coordinates (x o , y o ) , the calculation formula is:
Figure FDA0003256266630000032
Figure FDA0003256266630000032
步骤3.7:在区域R的所有边缘像素到坐标(xo,yo)的欧氏距离中,取最大欧氏距离并记为roStep 3.7: In the Euclidean distance from all edge pixels of the region R to the coordinates (x o , y o ), take the largest Euclidean distance and denote it as r o ; 步骤3.8:以(xo,yo)为圆心、ro为半径的区域,即为圆形区域检测算法得到的圆形区域。Step 3.8: The area with (x o , y o ) as the center and ro as the radius is the circular area obtained by the circular area detection algorithm.
3.根据权利要求1所述的一种基于机器视觉的3362电位器机械角度复位系统的复位方法,其特征在于:所述指示点区域检测算法包括以下步骤:3. a kind of reset method based on machine vision 3362 potentiometer mechanical angle reset system according to claim 1, is characterized in that: described indication point area detection algorithm comprises the following steps: 步骤4.1:在颜色名空间中,对指示点区域检测算法的输入图像取黑色通道,并归一化;Step 4.1: In the color namespace, take the black channel for the input image of the indicator point region detection algorithm, and normalize it; 步骤4.2:使用Otsu方法对归一化结果执行二值化操作,并对二值化结果进行孔洞填充;Step 4.2: Use the Otsu method to perform a binarization operation on the normalized result, and fill holes in the binarized result; 步骤4.3:构造一个半径为20的圆盘型结构元素,并利用该结构元素对孔洞填充结果进行腐蚀操作;Step 4.3: Construct a disc-shaped structural element with a radius of 20, and use this structural element to perform corrosion operation on the hole filling result; 步骤4.4:将腐蚀结果作为标记图像,将孔洞填充结果作为掩模图像,执行形态学重构操作;Step 4.4: Use the corrosion result as the marked image and the hole filling result as the mask image, and perform the morphological reconstruction operation; 步骤4.5:将孔洞填充结果减去形态学重构结果,并使用Otsu方法对差图像执行二值化操作;Step 4.5: Subtract the morphological reconstruction result from the hole filling result, and use the Otsu method to perform a binarization operation on the difference image; 步骤4.6:对差图像二值化结果计算区域描述子,得到每个区域的面积;Step 4.6: Calculate the region descriptor for the binarization result of the difference image, and obtain the area of each region; 步骤4.7:在差图像二值化结果中,仅保留面积最大的2个区域,即为指示点区域检测算法得到的指示点区域。Step 4.7: In the difference image binarization result, only the two regions with the largest area are reserved, which are the indicator point regions obtained by the indicator point region detection algorithm. 4.根据权利要求1所述的一种基于机器视觉的3362电位器机械角度复位系统的复位方法,其特征在于:所述非指示点区域检测算法包括以下步骤:4. a kind of reset method of 3362 potentiometer mechanical angle reset system based on machine vision according to claim 1, is characterized in that: described non-indicating point area detection algorithm comprises the following steps: 步骤5.1:在RGB颜色空间中,对非指示点区域检测算法的输入图像取红色通道;Step 5.1: In the RGB color space, take the red channel for the input image of the non-indicating point area detection algorithm; 步骤5.2:构造一个大小为5×5、元素值全为1的矩阵,对红色通道分别执行最大值滤波和最小值滤波操作;Step 5.2: Construct a matrix with a size of 5 × 5 and element values of all 1, and perform maximum and minimum filtering operations on the red channel respectively; 步骤5.3:将最大值滤波结果减去最小值滤波结果,得到差图像;Step 5.3: subtract the minimum filter result from the maximum filter result to obtain a difference image; 步骤5.4:使用Otsu方法计算全局阈值,对差图像执行二值化操作,并对二值化结果进行孔洞填充;Step 5.4: Use the Otsu method to calculate the global threshold, perform the binarization operation on the difference image, and fill the holes on the binarized result; 步骤5.5:构造一个半径为5的圆盘型结构元素,并利用该结构元素对孔洞填充结果进行腐蚀操作,得到腐蚀结果1;Step 5.5: Construct a disc-shaped structural element with a radius of 5, and use this structural element to perform corrosion operation on the hole filling result, and obtain corrosion result 1; 步骤5.6:构造一个半径为20的圆盘型结构元素,并利用该结构元素对腐蚀结果1进行腐蚀操作,得到腐蚀结果2;Step 5.6: Construct a disk-shaped structural element with a radius of 20, and use the structural element to perform the corrosion operation on the corrosion result 1 to obtain the corrosion result 2; 步骤5.7:将腐蚀结果2作为标记图像,将腐蚀结果1作为掩模图像,执行形态学重构操作;Step 5.7: Use the corrosion result 2 as the marked image and the corrosion result 1 as the mask image, and perform the morphological reconstruction operation; 步骤5.8:对形态学重构结果计算区域描述子,得到每个区域的质心坐标;Step 5.8: Calculate the region descriptor for the morphological reconstruction result, and obtain the centroid coordinates of each region; 步骤5.9:将形态学重构结果中的区域两两组合,计算任意两个区域质心间的中点坐标,设区域Rm和区域Rn的质心坐标分别为(xm,ym)和(xn,yn),则区域Rm和Rn质心间的中点坐标为(xmn,ymn),其计算公式为:Step 5.9: Combine the regions in the morphological reconstruction result in pairs, calculate the coordinates of the midpoint between the centroids of any two regions, and set the centroid coordinates of the region R m and the region R n to be (x m , y m ) and ( x n , y n ), then the coordinates of the midpoint between the area R m and the centroid of R n are (x mn , y mn ), and the calculation formula is:
Figure FDA0003256266630000041
Figure FDA0003256266630000041
步骤5.10:利用机械角度检测算法步骤2.5得到的2个指示点区域质心间的中点坐标(xc,yc),计算出所有(xmn,ymn)到坐标(xc,yc)的欧氏距离dmn,计算公式为:Step 5.10: Use the coordinates (x c , y c ) of the midpoint between the centroids of the two indicated point regions obtained in step 2.5 of the mechanical angle detection algorithm, and calculate all (x mn , y mn ) to the coordinates (x c , y c ) The Euclidean distance d mn , the calculation formula is:
Figure FDA0003256266630000042
Figure FDA0003256266630000042
步骤5.11:在所有的欧氏距离dmn中,找到最大欧氏距离;Step 5.11: Among all the Euclidean distances dmn , find the largest Euclidean distance; 步骤5.12:在形态学重构结果中,产生最大欧氏距离所对应的2个区域,即为非指示点区域检测算法得到的非指示点区域。Step 5.12: In the morphological reconstruction result, two regions corresponding to the maximum Euclidean distance are generated, which are the non-indicative point regions obtained by the non-indicative point region detection algorithm.
5.根据权利要求1所述的一种基于机器视觉的3362电位器机械角度复位系统的复位方法,其特征在于:所述初始机械角度检测算法包括以下步骤:5. a kind of reset method of 3362 potentiometer mechanical angle reset system based on machine vision according to claim 1, is characterized in that: described initial mechanical angle detection algorithm comprises the following steps: 步骤6.1:将3362电位器标准元件中的十字型槽人工旋转至初始位,放入机械角度检测工位的夹具中;Step 6.1: Manually rotate the cross-shaped groove in the 3362 potentiometer standard component to the initial position, and put it into the fixture of the mechanical angle detection station; 步骤6.2:通过机械角度检测装置的视觉相机拍摄一幅图像;Step 6.2: Take an image through the visual camera of the mechanical angle detection device; 步骤6.3:采用机械角度检测算法的步骤2.1至步骤2.11计算得到的当前机械角度,即为初始机械角度α0Step 6.3: The current mechanical angle calculated from steps 2.1 to 2.11 of the mechanical angle detection algorithm is the initial mechanical angle α 0 . 6.根据权利要求1所述的一种基于机器视觉的3362电位器机械角度复位系统的复位方法,其特征在于:所述复位系统包括机器控制器、总线、机械角度检测装置和机械角度复位装置,所述机器控制器与总线通讯连接,所述机械角度检测装置包括视觉相机和工控机,所述视觉相机安装在待机械角度检测的3362电位器夹具的正上方,所述视觉相机与工控机通讯连接,所述工控机与机器控制器通讯连接,所述机械角度复位装置包括气缸、伺服驱动、伺服电机和十字型批头,所述气缸通过I/O模块与机器控制器通讯连接,所述伺服驱动通过总线与机器控制器通讯连接,所述伺服电机与伺服驱动通讯连接,所述气缸的伸缩杆与伺服电机相连,所述伺服电机的输出轴与十字型批头固定相连,所述机械角度复位装置位于待机械角度复位的3362电位器夹具的正上方,所述机械角度检测装置所在的区域为机械角度检测工位,所述机械角度复位装置所在的区域为机械角度复位工位。6. a kind of reset method based on machine vision 3362 potentiometer mechanical angle reset system according to claim 1, is characterized in that: described reset system comprises machine controller, bus, mechanical angle detection device and mechanical angle reset device , the machine controller is connected to the bus in communication, the mechanical angle detection device includes a visual camera and an industrial computer, the visual camera is installed just above the 3362 potentiometer fixture to be detected by the mechanical angle, and the visual camera is connected to the industrial computer. Communication connection, the industrial computer is communicatively connected with the machine controller, the mechanical angle reset device includes a cylinder, a servo drive, a servo motor and a cross-shaped bit, and the cylinder is communicated with the machine controller through the I/O module, so The servo drive is communicatively connected to the machine controller through the bus, the servo motor is communicatively connected to the servo drive, the telescopic rod of the cylinder is connected to the servo motor, the output shaft of the servo motor is fixedly connected to the cross-shaped bit, and the The mechanical angle reset device is located just above the 3362 potentiometer fixture to be reset by the mechanical angle, the area where the mechanical angle detection device is located is the mechanical angle detection station, and the area where the mechanical angle reset device is located is the mechanical angle reset station. 7.根据权利要求6所述的一种基于机器视觉的3362电位器机械角度复位系统的复位方法,其特征在于:所述总线为EtherCAT总线。7 . The method for resetting a machine vision-based 3362 potentiometer mechanical angle resetting system according to claim 6 , wherein the bus is an EtherCAT bus. 8 . 8.根据权利要求6所述的一种基于机器视觉的3362电位器机械角度复位系统的复位方法,其特征在于:所述视觉相机通过GigE与工控机通讯连接。8 . The method for resetting a 3362 potentiometer mechanical angle resetting system based on machine vision according to claim 6 , wherein the vision camera is communicated with an industrial computer through GigE. 9 . 9.根据权利要求6所述的一种基于机器视觉的3362电位器机械角度复位系统的复位方法,其特征在于:所述工控机通过Ethernet与机器控制器通讯连接。9 . The method for resetting a machine vision-based 3362 potentiometer mechanical angle resetting system according to claim 6 , wherein the industrial computer is connected to the machine controller through Ethernet for communication. 10 .
CN202010822863.2A 2020-08-14 2020-08-14 3362 potentiometer mechanical angle reset system and reset method based on machine vision Active CN112066914B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010822863.2A CN112066914B (en) 2020-08-14 2020-08-14 3362 potentiometer mechanical angle reset system and reset method based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010822863.2A CN112066914B (en) 2020-08-14 2020-08-14 3362 potentiometer mechanical angle reset system and reset method based on machine vision

Publications (2)

Publication Number Publication Date
CN112066914A CN112066914A (en) 2020-12-11
CN112066914B true CN112066914B (en) 2021-12-21

Family

ID=73661790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010822863.2A Active CN112066914B (en) 2020-08-14 2020-08-14 3362 potentiometer mechanical angle reset system and reset method based on machine vision

Country Status (1)

Country Link
CN (1) CN112066914B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113628184A (en) * 2021-08-06 2021-11-09 信利光电股份有限公司 Method and device for detecting defects of display screen based on Fourier transform and readable storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3953133A (en) * 1973-07-11 1976-04-27 Ernst Leitz G.M.B.H. Method of determining the angular position of a workpiece and apparatus therefor
CN101673116A (en) * 2009-09-30 2010-03-17 上海交通大学 Precise resetting system of humanoid robot initial position
JP2013092519A (en) * 2011-10-04 2013-05-16 Meidensha Corp Rotation angle measurement device and method
KR20160132650A (en) * 2015-05-11 2016-11-21 (주)네스트아이앤씨 A Magnetic Field Detecting Type of Potentiometer and a Method for Setting Zero Point by the Same
CN109459970A (en) * 2018-10-26 2019-03-12 常州机电职业技术学院 Elliptical hole potentiometer angle reset system and reset method based on vision
CN110456254A (en) * 2019-08-20 2019-11-15 南京优倍自动化系统有限公司 A kind of automatic checkout equipment and method for pcb board
CN110672040A (en) * 2019-09-24 2020-01-10 中国计量科学研究院 High-precision rotation angle measuring method based on vision
CN111103533A (en) * 2019-12-12 2020-05-05 常州机电职业技术学院 A vision-based ten-digit rotary dial switch reset system and reset method
CN111457914A (en) * 2020-01-22 2020-07-28 南京航空航天大学 A Multi-rudder-Wing Dynamic Swing Angle Measurement Method Based on Codable Visual Cooperative Targets

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104820439B (en) * 2015-04-16 2017-10-20 华南理工大学 A kind of visual apparatus as sensor parallel connection platform follow-up control apparatus and method
CN110811827B (en) * 2019-09-25 2021-04-06 中奕智创医疗科技有限公司 Surgical robot motor resetting calibration device, calibration method and robot

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3953133A (en) * 1973-07-11 1976-04-27 Ernst Leitz G.M.B.H. Method of determining the angular position of a workpiece and apparatus therefor
CN101673116A (en) * 2009-09-30 2010-03-17 上海交通大学 Precise resetting system of humanoid robot initial position
JP2013092519A (en) * 2011-10-04 2013-05-16 Meidensha Corp Rotation angle measurement device and method
KR20160132650A (en) * 2015-05-11 2016-11-21 (주)네스트아이앤씨 A Magnetic Field Detecting Type of Potentiometer and a Method for Setting Zero Point by the Same
CN109459970A (en) * 2018-10-26 2019-03-12 常州机电职业技术学院 Elliptical hole potentiometer angle reset system and reset method based on vision
CN110456254A (en) * 2019-08-20 2019-11-15 南京优倍自动化系统有限公司 A kind of automatic checkout equipment and method for pcb board
CN110672040A (en) * 2019-09-24 2020-01-10 中国计量科学研究院 High-precision rotation angle measuring method based on vision
CN111103533A (en) * 2019-12-12 2020-05-05 常州机电职业技术学院 A vision-based ten-digit rotary dial switch reset system and reset method
CN111457914A (en) * 2020-01-22 2020-07-28 南京航空航天大学 A Multi-rudder-Wing Dynamic Swing Angle Measurement Method Based on Codable Visual Cooperative Targets

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
用数字电位器实现自动调零的一种方法;柏方艳等;《仪表技术与传感器》;20040331;41-42 *

Also Published As

Publication number Publication date
CN112066914A (en) 2020-12-11

Similar Documents

Publication Publication Date Title
CN107203990B (en) Label breakage detection method based on template matching and image quality evaluation
CN106683137B (en) Monocular multi-target recognition and localization method based on artificial markers
CN106824806B (en) The detection method of low module plastic gear based on machine vision
CN111862037A (en) Method and system for geometric feature detection of precision hole parts based on machine vision
CN107504896B (en) A Location Algorithm for Ball Pin Components Based on Point Matching
CN105865329B (en) The acquisition system and method for the bundled round steel end face center coordinate of view-based access control model
CN110119680A (en) A kind of electrical cabinet wiring automatic errordetecting system based on image recognition
CN111251336A (en) A dual-arm collaborative intelligent assembly system based on visual positioning
CN110335271B (en) Infrared detection method and device for electrical component failure
CN107133983A (en) Bundled round steel end face binocular vision system and space orientation and method of counting
CN112066914B (en) 3362 potentiometer mechanical angle reset system and reset method based on machine vision
CN109459970B (en) A vision-based elliptical hole potentiometer angle reset system and reset method
CN108507484B (en) Bundled round steel multi-vision visual identifying system and method for counting
CN108007345A (en) Measuring method of excavator working device based on monocular camera
CN109034170A (en) A kind of round readings of pointer type meters method of switch cubicle detection device
CN117237336A (en) Metallized ceramic ring defect detection method, system and readable storage medium
WO2023216643A1 (en) Wafer cleaning and drying module state detection method and apparatus and planarization device
WO2021114521A1 (en) Vision-based ten-bit rotary dial switch reset system and reset method
CN114898198A (en) An image processing method for automatic reading of pointer pressure gauge
CN110136248A (en) A device and method for three-dimensional reconstruction of transmission housing based on binocular stereo vision
CN111091121B (en) Ellipse dial plate detection and correction method based on image processing
WO2022032648A1 (en) Machine vision-based resetting system and resetting method for resetting mechanical angle of 3362 potentiometer
CN106778723A (en) A kind of pneumatic equipment bladess surface image extracting method in complex background environment
CN113074672B (en) Method for calculating eccentric position of grating disc in encoder eccentric adjustment system
CN116563165A (en) Neutral beam infrared image distortion correction and data processing 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