CN115526820A - Workpiece detection method and equipment - Google Patents
Workpiece detection method and equipment Download PDFInfo
- Publication number
- CN115526820A CN115526820A CN202110708028.0A CN202110708028A CN115526820A CN 115526820 A CN115526820 A CN 115526820A CN 202110708028 A CN202110708028 A CN 202110708028A CN 115526820 A CN115526820 A CN 115526820A
- Authority
- CN
- China
- Prior art keywords
- workpiece
- image
- tubular workpiece
- detected
- camera
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- 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/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10141—Special mode during image acquisition
- G06T2207/10148—Varying focus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30164—Workpiece; Machine component
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30168—Image quality inspection
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Geometry (AREA)
- Quality & Reliability (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
Abstract
The invention provides a workpiece detection method and equipment, wherein the method comprises the following steps: acquiring an image to be processed corresponding to a tubular workpiece to be detected, wherein the image to be processed is acquired by a camera and comprises an image of the surface of the tubular workpiece to be detected; adopting a quality inspection network model to carry out defect detection processing on the image to be processed so as to obtain a workpiece defect detection result corresponding to the tubular workpiece to be detected; and if the workpiece defect detection result indicates that the surface of the workpiece has defects, controlling an alarm to give an alarm, and not manually checking the surface of the tubular workpiece to be detected to determine whether the surface of the tubular workpiece to be detected has defects or not, so that the defect determination efficiency is improved.
Description
Technical Field
The embodiment of the invention relates to the technical field of image processing, in particular to a workpiece detection method and device.
Background
In the quality inspection of tubular workpieces, it is necessary to determine whether defects (e.g., cracks, scratches, etc.) exist on the surface of the tubular workpiece.
At present, when determining whether a surface of a tubular workpiece has a defect, the determination is generally performed manually, that is, relevant personnel check whether the surface of the tubular workpiece has a defect, and when the surface of the tubular workpiece has a defect, recording is performed so as to repair the tubular workpiece having the defect subsequently.
However, the determination of defects is inefficient due to the need to manually determine whether defects exist on the surface of the tubular workpiece.
Disclosure of Invention
The embodiment of the invention provides a workpiece detection method and device, and aims to solve the technical problem that in the prior art, the accuracy of workpiece defect determination is low.
In a first aspect, an embodiment of the present invention provides an image processing method, where the method includes:
acquiring an image to be processed corresponding to a tubular workpiece to be detected, wherein the image to be processed is acquired by a camera and comprises an image of the surface of the tubular workpiece to be detected;
adopting a quality inspection network model to carry out defect detection processing on the image to be processed so as to obtain a workpiece defect detection result corresponding to the tubular workpiece to be detected;
and if the workpiece defect detection result indicates that the surface of the workpiece has defects, controlling an alarm to give an alarm.
In a possible design, before the acquiring a to-be-processed image corresponding to the tubular workpiece to be measured, the method further includes:
acquiring the diameter of the tubular workpiece to be detected;
and acquiring a target focal length corresponding to the diameter of the workpiece, and adjusting the focal length of the camera to the target focal length, or outputting focal length adjustment prompt information including the target focal length.
In a possible design, before the obtaining of the corresponding workpiece diameter of the tubular workpiece to be measured, the method further includes:
based on an image processing technology, performing image processing on the image to be processed to determine the number of pixels occupied by the diameter corresponding to the tubular workpiece to be detected;
acquiring a standard diameter pixel ratio;
and calculating the product of the number of pixels occupied by the diameter corresponding to the tubular workpiece to be measured and the standard diameter pixel ratio to obtain the diameter of the workpiece corresponding to the tubular workpiece to be measured.
In one possible design, after the adjusting the focal length of the camera to the target focal length, the method further includes:
acquiring a test image acquired by a camera;
determining the definition corresponding to the test image based on a preset image definition evaluation algorithm;
and if the definition is smaller than the preset definition, continuously adjusting the focal length of the camera, or outputting prompt information for fine-tuning the focal length.
In one possible design, if the workpiece surface detection result indicates that the workpiece surface has a defect, the method further includes:
and controlling a code sprayer to spray the tubular workpiece to be detected.
In a possible design, before the acquiring a to-be-processed image corresponding to the tubular workpiece to be measured, the method further includes:
acquiring the diameter of the tubular workpiece to be detected;
determining the actual distance between the auxiliary shooting light source device and the tubular workpiece to be detected according to the diameter of the workpiece;
and if the actual distance is not the standard distance, adjusting the height of the auxiliary shooting light source device so as to adjust the actual distance between the auxiliary shooting light source device and the tubular workpiece to be measured to be the standard distance.
In one possible design, the camera comprises a ring camera, wherein the ring camera is composed of at least three cameras.
In a second aspect, an embodiment of the present invention provides a workpiece detection apparatus, including:
the device comprises an image acquisition module, a processing module and a processing module, wherein the image acquisition module is used for acquiring an image to be processed corresponding to a tubular workpiece to be detected, which is acquired by a camera, and the image to be processed comprises an image of the surface of the tubular workpiece to be detected;
the processing module is used for carrying out defect detection processing on the image to be processed by adopting a quality inspection network model so as to obtain a workpiece defect detection result corresponding to the tubular workpiece to be detected;
the processing module is also used for controlling an alarm to give an alarm when the workpiece defect detection result is determined to be that the workpiece surface has defects.
In one possible design, the processing module is further to:
before acquiring an image to be processed corresponding to a tubular workpiece to be detected, which is acquired by a camera, the diameter of the workpiece corresponding to the tubular workpiece to be detected is acquired;
and acquiring a target focal length corresponding to the diameter of the workpiece, and adjusting the focal length of the camera to the target focal length, or outputting focal length adjustment prompt information including the target focal length.
In one possible design, the processing module is further to:
before the diameter of the workpiece corresponding to the tubular workpiece to be detected is obtained, image processing is carried out on the image to be processed based on an image processing technology so as to determine the number of pixels occupied by the diameter corresponding to the tubular workpiece to be detected;
acquiring a standard diameter pixel ratio;
and calculating the product of the number of pixels occupied by the diameter corresponding to the tubular workpiece to be measured and the standard diameter pixel ratio to obtain the diameter of the workpiece corresponding to the tubular workpiece to be measured.
In one possible design, the processing module is further to:
after the focal length of the camera is adjusted to the target focal length, acquiring a test image acquired by the camera;
determining the definition corresponding to the test image based on a preset image definition evaluation algorithm;
and if the definition is smaller than the preset definition, continuously adjusting the focal length of the camera, or outputting prompt information for fine-tuning the focal length.
In one possible design, the processing module is further to:
and if the detection result of the surface of the workpiece indicates that the surface of the workpiece has defects, controlling the code spraying device to spray the tubular workpiece to be detected.
In one possible design, the processing module is further to:
before acquiring an image to be processed corresponding to a tubular workpiece to be detected, which is acquired by a camera, the diameter of the workpiece corresponding to the tubular workpiece to be detected is acquired;
determining the actual distance between the auxiliary shooting light source device and the tubular workpiece to be detected according to the diameter of the workpiece;
and if the actual distance is not the standard distance, adjusting the height of the auxiliary shooting light source device so as to adjust the actual distance between the auxiliary shooting light source device and the tubular workpiece to be measured to be the standard distance.
In one possible design, the camera comprises a ring camera, wherein the ring camera is composed of at least three cameras.
In a third aspect, an embodiment of the present invention provides an electronic device, including: at least one processor and memory;
the memory stores computer-executable instructions;
execution of the computer-executable instructions stored by the memory by the at least one processor causes the at least one processor to perform the workpiece inspection method as set forth above in the first aspect and in various possible designs of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where computer-executable instructions are stored, and when a processor executes the computer-executable instructions, the workpiece detection method according to the first aspect and various possible designs of the first aspect is implemented.
In a fifth aspect, an embodiment of the present invention provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the computer program implements the workpiece detection method according to the first aspect and various possible designs of the first aspect.
The invention provides a workpiece detection method and device, which are used for acquiring an image to be processed, which is acquired by a camera and corresponds to a tubular workpiece to be detected, namely an image comprising the surface of the tubular workpiece to be detected, when the tubular workpiece to be detected, namely the surface of the tubular workpiece to be detected, is required to be determined to have defects. The quality inspection network model is used for detecting the defects of the image to be processed, namely, whether the surface of the tubular workpiece to be detected has defects or not is determined, corresponding workpiece defect detection results are generated, automatic and accurate detection of the defects on the surface of the tubular workpiece is achieved, when the workpiece defect detection results corresponding to the tubular workpiece to be detected are determined to be that the surface of the workpiece has defects, the surface of the tubular workpiece to be detected has defects, the alarm is controlled to give an alarm, relevant personnel can know that the surface of the tubular workpiece to be detected has defects, the surface of the tubular workpiece to be detected does not need to be manually inspected to determine whether the surface of the tubular workpiece to be detected has defects or not, the defect determination efficiency is improved, and the labor cost can be effectively reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic diagram of a workpiece inspection system according to an embodiment of the present invention;
FIG. 2 is a first flowchart illustrating a workpiece inspection method according to an embodiment of the present invention;
FIG. 3 is a second flowchart illustrating a workpiece inspection method according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a workpiece inspection apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, during industrial quality inspection, when determining whether the surface of a tubular workpiece has a defect, a camera is arranged right above the tubular workpiece, and the camera is controlled to acquire an image containing the surface of the tubular workpiece, so that whether the surface of the tubular workpiece has the defect is judged by using the acquired image. However, a single camera cannot completely capture the entire surface of the tubular workpiece, i.e., only can capture an image including a part of the surface (e.g., the upper surface or the lower surface) of the tubular workpiece, and therefore, when the image including one surface of the tubular workpiece is captured, the workpiece needs to be rotated to capture images including other surfaces of the tubular workpiece, which results in a tedious defect detection procedure, low defect detection efficiency, and low defect determination accuracy due to the fact that defects are easily missed.
Therefore, in view of the above problems, the technical idea of the present invention is to provide an adaptive adjustment system for defect detection of tubular workpieces. The camera is placed by adopting a 360-degree annular optical scheme, so that the camera placed in an annular shape can acquire images of all areas comprising the surface of the tubular workpiece, the images acquired by the camera can be used for detecting whether defects exist in all the areas on the surface of the tubular workpiece, the workpiece does not need to be rotated, the defect detection flow is simplified, the defect detection efficiency is improved, the problem of missing defects is avoided, and the accuracy of defect determination is improved. When the diameter of the tubular workpiece changes, the focal length of the camera and the length of the telescopic pipe can be adjusted in a self-adaptive mode so as to guarantee the definition of the collected image containing the surface of the tubular workpiece, meanwhile, the light source device is fixed on the telescopic pipe with the adjustable height according to a low-angle polishing mode, and the distance between the light source device and the surface of the tubular workpiece is fixed by adjusting the length of the telescopic pipe, so that the image collected by the camera can clearly show the defects of the tubular workpiece, and the accuracy of defect determination is further guaranteed.
The following describes the technical solutions of the present disclosure and how to solve the above technical problems in detail by specific examples. Several of these specific examples may be combined with each other below, and some of the same or similar concepts or processes may not be repeated in some examples. Examples of the present disclosure will now be described with reference to the accompanying drawings.
Fig. 1 is a schematic structural diagram of a workpiece detection system according to an embodiment of the present invention, and as shown in fig. 1, the workpiece detection system includes a camera, a tubular workpiece, a light source device, a telescopic tube, a processor, an alarm, and an inkjet printer. The telescopic pipe is respectively connected with the light source device and the processor, and the camera, the alarm and the code spraying machine are respectively connected with the processor.
The number of the cameras is at least three, the cameras are arranged in a ring shape, as shown in fig. 1, when the number of the cameras is 3, one camera is arranged on the upper surface of the tubular workpiece, and the other two cameras are arranged on the lower surface of the tubular workpiece.
As shown in fig. 1, when the number of the light source devices is 2, one light source device is disposed on the upper surface of the tubular workpiece, and the other light source device is disposed on the lower surface of the tubular workpiece.
Optionally, the light source device is a light emitting device such as a lamp.
Fig. 2 is a first flowchart illustrating a workpiece detection method according to an embodiment of the present invention, where an execution main body of the embodiment may be an electronic device, and specifically, a processor (as shown in fig. 1) in the electronic device. As shown in fig. 2, the method includes:
s201, acquiring an image to be processed corresponding to the tubular workpiece to be processed, wherein the image to be processed is acquired by a camera and comprises an image of the surface of the tubular workpiece to be processed.
In this embodiment, in the process of quality inspection of the tubular workpiece, the tubular workpiece is used as the tubular workpiece to be inspected. And controlling the camera to collect an image containing the surface of the tubular workpiece to be detected so as to obtain a to-be-processed image corresponding to the tubular workpiece to be detected.
When the tubular workpiece is short, namely, the tubular workpiece is shorter than the acquisition length corresponding to the camera, the camera can acquire images of all surfaces of the tubular workpiece to be detected; when the workpiece is long, that is, greater than or equal to the acquisition length corresponding to the camera, the camera may only acquire an image including a part of the surface of the tubular workpiece to be detected (for example, the camera in fig. 1 may only acquire an image including a part of the surface of the tubular workpiece), and accordingly, in order to detect whether there is a defect on the entire surface of the tubular workpiece to be detected, the tubular workpiece to be detected may be placed on a conveyor belt that operates at a certain speed, so that the camera continuously acquires the image, that is, the image including a part of the surface of the tubular workpiece to be detected is acquired, and thus, whether there is a defect on each part of the surface of the tubular workpiece to be detected may be determined based on the image, and further, whether there is a defect on the entire surface of the tubular workpiece to be detected may be determined.
Optionally, the cameras comprise a ring camera, wherein the ring camera is composed of at least three cameras, and the ring camera can acquire images of the whole area containing the surface of the tubular workpiece to be measured. The position of each of the ring cameras may be determined by the relevant person through testing.
S202, a quality inspection network model is adopted to carry out defect detection processing on the image to be processed so as to obtain a workpiece defect detection result corresponding to the tubular workpiece to be detected.
In this embodiment, the to-be-processed image corresponding to the tubular workpiece to be detected is input into the quality inspection network model, so that the quality inspection network model performs defect detection processing on the to-be-processed image, that is, determines whether a defect exists on the surface of the tubular workpiece to be detected, and generates a workpiece defect detection result corresponding to the tubular workpiece to be detected.
Optionally, the workpiece defect detection result includes that the workpiece surface has defects and the workpiece surface does not have defects.
The quality inspection network model is a trained network model, namely, a basic network model is trained by utilizing a sample image, and the trained basic network model is used as the quality inspection network model, so that whether defects exist on the surface of a workpiece or not can be accurately identified by the quality inspection network model.
Wherein the sample image comprises an image of the surface of the workpiece marked with the defect. Correspondingly, the process of training the basic network model is similar to the existing model training process, and is not repeated here.
Optionally, the network model includes a neural network model, a segmentation network model, and the like.
Further, optionally, the neural network model comprises a convolutional neural network model, for example, a yolo network model.
In addition, optionally, if the workpiece defect detection result indicates that there is no defect on the surface of the workpiece, it indicates that there is no defect on the surface of the tubular workpiece to be detected corresponding to the image to be processed, and it is not necessary to perform an alarm, and it may continue to detect whether there is a defect on the surface of another part of the tubular workpiece to be detected, or directly detect the next tubular workpiece to be detected.
And S203, if the workpiece surface has defects according to the workpiece defect detection result, controlling an alarm to give an alarm.
In this embodiment, when the workpiece defect detection result indicates that there is a defect on the surface of the workpiece, which indicates that there is a defect on the surface of the tubular workpiece to be detected corresponding to the image to be processed, the alarm is controlled to give an alarm, so that the relevant personnel can timely know that there is a defect on the surface of the tubular workpiece to be detected, and thus the relevant personnel can timely perform corresponding processing on the tubular workpiece to be detected (for example, repair the defect on the surface of the tubular workpiece to be detected).
In this embodiment, the trained quality inspection network model is used to process the to-be-processed image including the surface of the to-be-detected tubular workpiece, so as to determine whether the surface of the to-be-detected tubular workpiece has a defect, thereby realizing rapid and accurate detection of the defect.
As can be seen from the above description, when it is required to determine whether a tubular workpiece, that is, the surface of the tubular workpiece to be measured has a defect, the to-be-processed image corresponding to the tubular workpiece to be measured, that is, the image including the surface of the tubular workpiece to be measured, acquired by the camera is obtained. And when the workpiece defect detection result corresponding to the tubular workpiece to be detected is determined to be that the workpiece surface has the defects, the surface of the tubular workpiece to be detected has the defects, the alarm is controlled to give an alarm, so that related personnel can know that the surface of the tubular workpiece to be detected has the defects, the surface of the tubular workpiece to be detected does not need to be manually inspected to determine whether the surface of the tubular workpiece to be detected has the defects, the detection efficiency of the defects is improved, and the labor cost is reduced.
Fig. 3 is a schematic flow chart of a workpiece detection method according to an embodiment of the present invention, and on the basis of the embodiment of fig. 2 in this embodiment, in order to improve the definition of an image captured by a camera, a focal length of the camera may be adjusted according to an actual diameter of a tubular workpiece to be detected, which will be described below with reference to an embodiment. As shown in fig. 3, the method includes:
s301, acquiring the diameter of the tubular workpiece to be measured.
In this embodiment, when the diameters of the tubular workpieces are different, the distances between the cameras and the tubular workpieces are also different, that is, the shooting distances are different, and since the focal lengths of the cameras are related to the shooting distances, the focal lengths of the cameras need to be adjusted when the tubular workpieces with different diameters are shot. Correspondingly, before the to-be-processed image corresponding to the tubular workpiece to be detected is shot, the diameter of the tubular workpiece to be detected, namely the diameter of the workpiece corresponding to the tubular workpiece to be detected, is obtained, so that the focal length of the camera can be adjusted by utilizing the diameter of the workpiece, and the camera can acquire a clear to-be-processed image.
In this embodiment, optionally, before obtaining the workpiece diameter corresponding to the tubular workpiece to be measured, the workpiece diameter needs to be determined. When determining the diameter of the tubular workpiece to be measured, the diameter can be determined in the following two ways.
One way is to obtain the diameter of the tubular workpiece to be measured input by the user and determine the diameter of the tubular workpiece to be measured.
The other mode is that based on the image processing technology, the image to be processed is processed to determine the number of pixels occupied by the diameter corresponding to the tubular workpiece to be measured. A standard diameter pixel ratio is obtained. And calculating the product of the pixel number occupied by the diameter corresponding to the tubular workpiece to be measured and the standard diameter pixel ratio to obtain the diameter of the workpiece corresponding to the tubular workpiece to be measured.
Specifically, an image processing technology is utilized to perform image processing on an image to be processed corresponding to the tubular workpiece to be detected so as to determine the number of pixels occupied by the diameter of the tubular workpiece to be detected, and thus the number of pixels occupied by the diameter corresponding to the tubular workpiece to be detected is obtained. And acquiring a standard diameter pixel ratio which represents the actual distance corresponding to a single pixel, namely the diameter length. And calculating the product of the number of the pixels occupied by the diameter and the pixel ratio of the standard diameter to obtain the actual distance corresponding to the number of the pixels occupied by the diameter, namely obtaining the diameter of the workpiece corresponding to the tubular workpiece to be measured.
Optionally, the image processing technology includes edge detection, contour extraction, and the like. The process of determining the number of pixels occupied by the diameter of the tubular workpiece to be detected in the image to be processed is similar to the process of determining the number of pixels occupied by a certain object on the image in the prior art, and is not described herein again.
Further, optionally, the standard diameter pixel ratio is determined by calibrating a camera, that is, by calibrating the number of pixels occupied by the real world unit length on the plane where the axis of the tubular workpiece is located, and the specific process is as follows: adjusting the focal length of the camera to a preset focal length, measuring the diameter of the tubular workpiece on the axis plane by related personnel, and determining the number of pixels occupied by the diameter of the tubular workpiece in the image corresponding to the tubular workpiece, wherein the distance pixel ratio is r = L/P (cm/pix), and r is the distance pixel ratio, specifically, the distance pixel ratio represents the actual distance corresponding to each pixel of the axis plane of the tubular workpiece in the image under the condition that the focal length is the preset focal length; l is the diameter of the tubular workpiece, and P is the number of pixels occupied by the diameter of the tubular workpiece.
In addition, since the distance pixel ratio is determined when the focal length of the camera is the preset focal length, in order to ensure the accuracy of the diameter of the workpiece corresponding to the tubular workpiece to be measured, the focal length of the camera can be adjusted to the preset focal length when the diameter of the workpiece corresponding to the tubular workpiece to be measured is determined.
In addition, when the diameter of the workpiece corresponding to the tubular workpiece to be detected is determined, an image can be acquired independently, and the acquired image is only used for determining the diameter of the workpiece corresponding to the tubular workpiece to be detected and is not used for detecting defects. Namely, an image which is acquired by a camera and contains the tubular workpiece to be measured is acquired, and the diameter of the tubular workpiece to be measured is determined based on the image.
S302, acquiring a target focal length corresponding to the diameter of the workpiece, and adjusting the focal length of the camera to the target focal length, or outputting focal length adjustment prompt information including the target focal length.
In this embodiment, after determining the diameter of the tubular workpiece to be measured, the focal length corresponding to the diameter of the tubular workpiece is searched and determined as the target focal length, so as to obtain the focal length matching the diameter of the tubular workpiece to be measured, that is, determine the focal length suitable for the current shooting distance. After the target focal length is determined, automatically adjusting the focal length of the camera to the target focal length, or outputting focal length adjustment prompt information including the target focal length to enable relevant personnel to adjust the focal length of the camera to the target focal length, so that the camera acquires an image to be processed corresponding to the tubular workpiece to be detected under the condition that the focal length is the target focal length.
In this embodiment, optionally, after adjusting the focal length of the camera to the target focal length, it may be further determined whether the sharpness of the image meets the requirement when the image is acquired based on the target focal length, and the distance process is as follows: and acquiring a test image acquired by the camera. And determining the definition corresponding to the test image based on a preset image definition evaluation algorithm. If the definition is smaller than the preset definition, the focal length of the camera is continuously adjusted, namely the focal length of the camera is automatically finely adjusted, or prompt information for finely adjusting the focal length is output, so that related personnel finely adjust the focal length of the camera.
Specifically, a test image including a tubular workpiece to be tested, which is acquired by a camera, is acquired, and the definition of the test image is evaluated by using a preset image definition evaluation algorithm, that is, the definition of the test image is measured, so that the definition corresponding to the test image is obtained. When the definition corresponding to the test image is greater than or equal to the preset definition, the acquired definition of the test image is high, the current focal length of the camera meets the requirement, and the image can be directly acquired according to the current focal length (namely, the target focal length) of the camera so as to determine whether the surface of the tubular workpiece to be detected has defects.
And when the definition corresponding to the test image is smaller than the preset definition, the acquired definition of the test image is low, the current focal length of the camera does not meet the requirement, the focal length of the camera is continuously adjusted, namely the focal length of the camera is finely adjusted until the focal length of the camera meets the requirement, namely the definition of the image acquired by the camera is high.
Optionally, when the focal length of the camera is automatically fine-tuned, the focal length of the camera may be adjusted according to the unit focal length value, that is, the focal length of the camera is adjusted to be higher or lower by the unit focal length value each time the camera is fine-tuned.
Optionally, the preset image sharpness evaluation algorithm includes a gradient algorithm (e.g., brenner gradient algorithm, energy gradient algorithm, tenengrad gradient algorithm, etc.), and a variance algorithm. For example, when the image definition is evaluated by using a gradient algorithm, the definition corresponding to the test image can be represented by a gradient value corresponding to the test image, and when the gradient value is smaller than a preset gradient value, the definition corresponding to the test image is smaller than the preset definition; for another example, when the variance algorithm is used to evaluate the definition of the image, the definition corresponding to the test image may be represented by a variance value corresponding to the test image, and when the variance value is smaller than a preset variance value, it indicates that the definition corresponding to the test image is smaller than the preset definition.
In any embodiment, optionally, in order to enable the camera to clearly photograph the tubular workpiece to be measured, the tubular workpiece to be measured is also polished by using a light source device, i.e., an auxiliary photographing light source device. When the diameter of tubular work piece is different, supplementary distance between shooting light source device and the surface of tubular work piece is different also, and the distance of polishing is different promptly, because the distance of polishing can influence the shooting effect of camera, consequently, when shooing the different tubular work piece of diameter, need adjust the distance between the surface of shooting light source device and tubular work piece to make this distance be standard distance, its concrete regulation mode is: and acquiring the diameter of the tubular workpiece to be detected. And determining the actual distance between the auxiliary shooting light source device and the tubular workpiece to be measured according to the diameter of the workpiece. And if the actual distance is not the standard distance, adjusting the height of the auxiliary shooting light source device so as to adjust the actual distance between the auxiliary shooting light source device and the tubular workpiece to be measured to be the standard distance.
Specifically, the current height of the auxiliary shooting light source device is obtained, and the actual distance between the shooting light source device and the tubular workpiece to be detected is determined by using the current height and the workpiece diameter corresponding to the tubular workpiece to be detected, that is, the distance from the auxiliary shooting light source device to the surface of the tubular workpiece to be detected is determined, so as to obtain the actual polishing distance. When the actual distance, namely the polishing distance, is not the standard distance, the height of the auxiliary shooting light source device is adjusted by adjusting the length of the telescopic pipe connected with the auxiliary shooting light source device until the actual distance between the auxiliary shooting light source device and the tubular workpiece to be measured is adjusted to be the standard distance, namely the standard polishing distance, namely the distance from the light source device to the surface of the tubular workpiece to be measured is ensured to be unchanged, namely the standard polishing distance.
Optionally, the number of the auxiliary photographing light source devices may be two, as shown in fig. 1, two auxiliary photographing light source devices, that is, light source devices, are respectively disposed on the upper side and the lower side of the tubular workpiece to be measured, and the distance between each light device and the nearest surface of the tubular workpiece to be measured is the same, that is, the distance between the light source device above the tubular workpiece to be measured and the upper surface of the tubular workpiece to be measured is the same as the distance between the light source device below the tubular workpiece to be measured and the lower surface of the tubular workpiece to be measured. Therefore, after the heights of the two light source devices and the diameter of the tubular workpiece to be measured are determined, the distance between the light source devices and the surface of the tubular workpiece to be measured can be determined, namely, the difference between the heights of the two light source devices is calculated to obtain a distance value between the two light source devices, and half of the difference between the distance value and the diameter of the tubular workpiece to be measured is taken as the distance between the light source devices and the surface of the tubular workpiece to be measured, namely, the actual distance.
Wherein, the height of the light source device can be input by a user or can be determined by the height of the telescopic pipe connected with the light source device.
The standard distance is smaller, namely, the light source device adopts a low-light-emitting mode, namely a low-angle light-emitting mode.
In addition, optionally, when the height of the light source device, that is, the length of the telescopic tube is adjusted, the adjustment can be performed manually, that is, the same prompt information is output, so that the relevant person can perform the adjustment.
And S303, acquiring an image to be processed corresponding to the tubular workpiece to be processed, wherein the image to be processed is acquired by the camera and comprises an image of the surface of the tubular workpiece to be processed.
S304, a quality inspection network model is adopted to carry out defect detection processing on the image to be processed so as to obtain a workpiece defect detection result corresponding to the tubular workpiece to be detected.
S305, if the workpiece surface is defective according to the workpiece defect detection result, controlling an alarm to give an alarm.
In this embodiment, when it is determined that the workpiece surface detection result corresponding to the tubular workpiece to be detected is that the workpiece surface has a defect, the code sprayer may be further controlled to spray the tubular workpiece to be detected, so as to mark the tubular workpiece to be detected having the defect, and further ensure that the relevant personnel can know that the tubular workpiece to be detected has the defect.
In this embodiment, when the diameter of tubular workpiece changes, can be through adjusting distance of polishing and camera focus for the light source can shine the work piece with fixed angle, and the definition of the pending image that the camera was gathered and is obtained can satisfy the requirement, thereby makes the pending image that the camera was gathered receive external influence less, for follow-up defect detection, the quality control of tubular workpiece that awaits measuring promptly has improved the data assurance, guarantees the rate of accuracy of work piece defect detection result.
In this embodiment, when it is determined that the auxiliary photographing light source device is not a standard distance, that is, the distance between the light source device and the surface of the tubular workpiece to be measured is not a standard distance, the height of the light source device is adjusted to adjust the distance between the light source device and the surface of the tubular workpiece to be measured to be the standard distance, so that the light source device can be polished in a low-angle polishing manner. When the tubular workpiece is polished in a high-angle polishing or direct-projection mode, when the surface of the tubular workpiece has an uneven defect, the defect and a normal area cannot be distinguished when the defect is detected by using an image acquired by a camera, so that the accuracy of defect detection is reduced. However, when the light is emitted in a low-angle light emitting manner, the image shot by the camera can effectively show the convex or concave defects on the surface of the tubular workpiece, so that when the image collected by the camera is used for defect detection, the defects and the normal area can be effectively distinguished, and the accuracy of the defect detection is improved.
Fig. 4 is a schematic structural diagram of a workpiece inspection apparatus according to an embodiment of the present invention, and as shown in fig. 4, the workpiece inspection apparatus 400 includes: an image acquisition module 401 and a processing module 402.
The image acquiring module 401 is configured to acquire an image to be processed corresponding to the tubular workpiece to be detected, where the image to be processed is acquired by a camera, and the image to be processed includes an image of a surface of the tubular workpiece to be detected.
And the processing module 402 is configured to perform defect detection processing on the image to be processed by using a quality inspection network model to obtain a workpiece defect detection result corresponding to the tubular workpiece to be detected.
The processing module 402 is further configured to control the alarm to alarm when it is determined that the workpiece surface has a defect as the workpiece defect detection result.
In one possible design, the processing module 402 is further configured to:
before acquiring the to-be-processed image corresponding to the tubular workpiece to be detected, which is acquired by the camera, the diameter of the workpiece corresponding to the tubular workpiece to be detected is acquired.
And acquiring a target focal length corresponding to the diameter of the workpiece, and adjusting the focal length of the camera to the target focal length, or outputting focal length adjustment prompt information including the target focal length.
In one possible design, the processing module 402 is further configured to:
before the diameter of the tubular workpiece to be detected is obtained, image processing is carried out on the image to be processed based on an image processing technology so as to determine the number of pixels occupied by the diameter corresponding to the tubular workpiece to be detected.
A standard diameter pixel ratio is obtained.
And calculating the product of the number of pixels occupied by the diameter corresponding to the tubular workpiece to be measured and the standard diameter pixel ratio to obtain the diameter of the workpiece corresponding to the tubular workpiece to be measured.
In one possible design, the processing module 402 is further configured to:
after the focal length of the camera is adjusted to the target focal length, a test image acquired by the camera is acquired.
And determining the definition corresponding to the test image based on a preset image definition evaluation algorithm.
And if the definition is smaller than the preset definition, continuously adjusting the focal length of the camera, or outputting prompt information for fine-tuning the focal length.
In one possible design, the processing module 402 is further configured to:
and if the detection result of the surface of the workpiece indicates that the surface of the workpiece has defects, controlling the code spraying device to spray the tubular workpiece to be detected.
In one possible design, processing module 402 is further configured to:
before acquiring the to-be-processed image corresponding to the tubular workpiece to be detected, which is acquired by the camera, the diameter of the workpiece corresponding to the tubular workpiece to be detected is acquired.
And determining the actual distance between the auxiliary shooting light source device and the tubular workpiece to be measured according to the diameter of the workpiece.
And if the actual distance is not the standard distance, adjusting the height of the auxiliary shooting light source device so as to adjust the actual distance between the auxiliary shooting light source device and the tubular workpiece to be measured to be the standard distance.
In one possible design, the cameras include a ring camera, wherein the ring camera is comprised of at least three cameras.
The workpiece detection equipment provided by the embodiment of the invention can realize the workpiece detection method of the embodiment, the realization principle and the technical effect are similar, and the details are not repeated here.
Fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. 5, the electronic device 500 of the present embodiment includes: a processor 501 and a memory 502;
the processor 501 is configured to execute computer-executable instructions stored in the memory to implement the steps performed by the receiving device in the above embodiments. Reference may be made in particular to the description relating to the method embodiments described above.
Alternatively, the memory 502 may be separate or integrated with the processor 501.
When the memory 502 is provided separately, the electronic device further comprises a bus 503 for connecting said memory 502 and the processor 501.
The embodiment of the invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer execution instructions, and when a processor executes the computer execution instructions, the workpiece detection method is implemented.
An embodiment of the present invention further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the workpiece detection method as described above is implemented.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice, for example, a plurality of modules may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one unit. The unit formed by the modules can be realized in a hardware form, and can also be realized in a form of hardware and a software functional unit.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) or a processor (in english: processor) to execute some steps of the methods described in the embodiments of the present application.
It should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose processors, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile storage NVM, such as at least one disk memory, and may also be a usb disk, a removable hard disk, a read-only memory, a magnetic or optical disk, etc.
The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
The storage medium may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the storage medium may reside as discrete components in an electronic device or host device.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (11)
1. A method of inspecting a workpiece, comprising:
acquiring an image to be processed corresponding to a tubular workpiece to be detected, wherein the image to be processed is acquired by a camera and comprises an image of the surface of the tubular workpiece to be detected;
adopting a quality inspection network model to carry out defect detection processing on the image to be processed so as to obtain a workpiece defect detection result corresponding to the tubular workpiece to be detected;
and if the workpiece defect detection result indicates that the surface of the workpiece has defects, controlling an alarm to give an alarm.
2. The method according to claim 1, further comprising, before the acquiring the corresponding to-be-processed image of the tubular workpiece to be measured acquired by the camera:
acquiring the diameter of the tubular workpiece to be detected;
and acquiring a target focal length corresponding to the diameter of the workpiece, and adjusting the focal length of the camera to the target focal length, or outputting focal length adjustment prompt information including the target focal length.
3. The method of claim 2, wherein prior to said obtaining a corresponding workpiece diameter of said tubular workpiece to be measured, further comprising:
based on an image processing technology, performing image processing on the image to be processed to determine the number of pixels occupied by the diameter corresponding to the tubular workpiece to be detected;
acquiring a standard diameter pixel ratio;
and calculating the product of the number of pixels occupied by the diameter corresponding to the tubular workpiece to be measured and the standard diameter pixel ratio to obtain the diameter of the workpiece corresponding to the tubular workpiece to be measured.
4. The method of claim 2, further comprising, after the adjusting the focal length of the camera to the target focal length:
acquiring a test image acquired by a camera;
determining the definition corresponding to the test image based on a preset image definition evaluation algorithm;
and if the definition is smaller than the preset definition, continuously adjusting the focal length of the camera, or outputting prompt information for fine-tuning the focal length.
5. The method of claim 1, wherein if the workpiece surface inspection result is that the workpiece surface has a defect, the method further comprises:
and controlling a code sprayer to spray the tubular workpiece to be detected.
6. The method according to claim 1, further comprising, before the acquiring the corresponding to-be-processed image of the tubular workpiece to be measured acquired by the camera:
acquiring the diameter of the tubular workpiece to be detected;
determining the actual distance between the auxiliary shooting light source device and the tubular workpiece to be detected according to the diameter of the workpiece;
and if the actual distance is not the standard distance, adjusting the height of the auxiliary shooting light source device so as to adjust the actual distance between the auxiliary shooting light source device and the tubular workpiece to be measured to be the standard distance.
7. The method of any one of claims 1 to 5, wherein the camera comprises a ring camera, wherein the ring camera is comprised of at least three cameras.
8. A workpiece inspection apparatus, comprising:
the device comprises an image acquisition module, a processing module and a processing module, wherein the image acquisition module is used for acquiring an image to be processed corresponding to a tubular workpiece to be detected, which is acquired by a camera, and the image to be processed comprises an image of the surface of the tubular workpiece to be detected;
the processing module is used for carrying out defect detection processing on the image to be processed by adopting a quality inspection network model so as to obtain a workpiece defect detection result corresponding to the tubular workpiece to be detected;
and the processing module is also used for controlling an alarm to give an alarm when the workpiece defect detection result is determined to be that the workpiece surface has defects.
9. An electronic device, comprising: at least one processor and a memory;
the memory stores computer execution instructions;
execution of computer-executable instructions stored by the memory by the at least one processor causes the at least one processor to perform the workpiece inspection method of any of claims 1 to 7.
10. A computer-readable storage medium having computer-executable instructions stored thereon which, when executed by a processor, implement the workpiece inspection method of any one of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the workpiece detection method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110708028.0A CN115526820A (en) | 2021-06-24 | 2021-06-24 | Workpiece detection method and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110708028.0A CN115526820A (en) | 2021-06-24 | 2021-06-24 | Workpiece detection method and equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115526820A true CN115526820A (en) | 2022-12-27 |
Family
ID=84694892
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110708028.0A Pending CN115526820A (en) | 2021-06-24 | 2021-06-24 | Workpiece detection method and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115526820A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116386028A (en) * | 2023-04-06 | 2023-07-04 | 扬州市管件厂有限公司 | Image layering identification method and device for processing tee pipe fitting |
CN116559183A (en) * | 2023-07-11 | 2023-08-08 | 钛玛科(北京)工业科技有限公司 | Method and system for improving defect judging efficiency |
-
2021
- 2021-06-24 CN CN202110708028.0A patent/CN115526820A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116386028A (en) * | 2023-04-06 | 2023-07-04 | 扬州市管件厂有限公司 | Image layering identification method and device for processing tee pipe fitting |
CN116386028B (en) * | 2023-04-06 | 2023-10-03 | 扬州市管件厂有限公司 | Image layering identification method and device for processing tee pipe fitting |
CN116559183A (en) * | 2023-07-11 | 2023-08-08 | 钛玛科(北京)工业科技有限公司 | Method and system for improving defect judging efficiency |
CN116559183B (en) * | 2023-07-11 | 2023-11-03 | 钛玛科(北京)工业科技有限公司 | Method and system for improving defect judging efficiency |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10489900B2 (en) | Inspection apparatus, inspection method, and program | |
US9773304B2 (en) | Inspection apparatus, inspection method, and program | |
JP6608682B2 (en) | Positioning method, appearance inspection apparatus, program, computer-readable recording medium, and appearance inspection method | |
JP3560694B2 (en) | Lens inspection system and method | |
CN106645197B (en) | Online detection system for detecting particles on surface of precision optical element and application method | |
JP2870142B2 (en) | Coplanarity measuring method and apparatus | |
CN108645867B (en) | Rapid locating and batch detection method for micro defects on surface of large-caliber optical crystal | |
CN115526820A (en) | Workpiece detection method and equipment | |
US20080175466A1 (en) | Inspection apparatus and inspection method | |
TW201337839A (en) | Segmentation for wafer inspection | |
JP2008309603A (en) | Fluorescent flaw detection method and its device | |
JP7514259B2 (en) | System and method for determining whether a camera component is damaged - Patents.com | |
JP2017040600A (en) | Inspection method, inspection device, image processor, program and record medium | |
CN106303509A (en) | Camera sub-assemblies dust and defect detecting system and method | |
US7139421B1 (en) | Methods and apparatuses for detecting similar features within an image | |
CN112565615B (en) | Method and device for determining trigger point of flying shooting | |
CN116908185A (en) | Method and device for detecting appearance defects of article, electronic equipment and storage medium | |
CN117092113A (en) | Camera mould welding quality detection device and system thereof | |
CN108106610B (en) | Object stage perpendicularity detection method and system and control device thereof | |
CN114286078A (en) | Camera module lens appearance inspection method and equipment | |
CN112782176A (en) | Product appearance detection method and device | |
CN206944930U (en) | A kind of pcb board hole location detecting device | |
JP2008292398A (en) | Method of inspecting floating defect of component electrode and substrate inspecting device | |
JP2016217913A (en) | X-ray inspection device | |
JP2006294684A (en) | Surface inspection apparatus |
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 |