Metal surface defect online detection device and method based on image processing

文档序号:6096 发布日期:2021-09-17 浏览:61次 中文

1. The utility model provides a metal surface defect on-line measuring device based on image processing, includes conveyer belt (1) and detection device, detection device is connected with computer (6), its characterized in that, detection device sets up the top and the lateral part at the conveyer belt, be provided with several piece (2) that await measuring on conveyer belt (1), wherein detection device detects respectively whether the surface defect and the incision of piece (2) that await measuring are just.

2. The on-line metal surface defect detection device based on image processing as claimed in claim 1, characterized in that the detection device comprises a first camera (5) and a second camera (7), a coaxial light source (3) is fixedly arranged at the bottom of the first camera (5), and parallel light (4) is absorbed at one side of the coaxial light source.

3. The on-line metal surface defect detection device based on image processing as claimed in claim 1, characterized in that, the computer (6) is configured with an image processing system and a data analysis system.

4. A method for applying the device for detecting the metal surface defect on line based on the image processing as claimed in any one of claims 1 to 3, which is characterized by comprising the following steps:

step A: starting a first camera and a second camera, and filtering an image;

and B: detecting the surface defects of the metal to be detected through a first camera, and displaying the characteristics and real-time pictures on a QT interface;

and C: and detecting the notch defect of the metal to be detected through the second camera, and displaying the characteristics and the real-time picture on a QT interface.

5. The image processing-based metal surface defect online detection method according to claim 4, wherein the step B specifically comprises:

b1: a first camera calls an OpenCV interface adaptive method, an image after adaptive threshold binarization is obtained through self-defining Block Size Block Size and a constant item C, and an OpenCV interface findContours is used for detecting the object contour after thresholding;

b2: coordinating the detected object contour;

b3: defining a width range, screening the object outline according to the width range, and adding the outline in the width range into a collection list to obtain an outline collection of the piece to be detected;

b4: screening a plurality of contours in each contour of the piece to be detected in the set to eliminate contours except for defects in the piece to be detected;

b5: and respectively screening the black line characteristic and the gap characteristic in the outline of the piece to be detected.

6. The image processing-based metal surface defect online detection method according to claim 5, wherein the specific steps of step B4 are as follows:

b41: acquiring four-point coordinates on the outline of the coordinate to be measured, determining a straight line according to the two points, and calculating to obtain straight line equations on two sides;

b42: traversing a plurality of contours in each contour of the piece to be measured through for circulation, calculating the distance from each contour in the contour of the piece to be measured to two sides of the piece to be measured, wherein the distance is d1 and d2, and taking the minimum min length of the distance

B43: setting a range [ rate min, rate max ] through a preset distance from the defect to the shortest side of the piece to be detected and the ratio of the whole piece to be detected, and if the rate min < rate fix < rate max, determining that the shape is a defect contour, and excluding other contours on the surface of the steel pipe.

7. The image processing-based metal surface defect online detection method according to claim 5, wherein the specific steps of step B5 are as follows:

b51: setting two ranges [ detect _ width _ min, detect _ width _ max ], [ detect _ height _ min, detect _ height _ max ] and a constant min numm;

b52, finding the width rect _ detect [1] [1] and the length rect _ detect [1] [0] of the defect contour, if detect _ width _ min < rect _ detect [1] [1] < detect _ width _ max and detect _ height _ min < rect _ detect [1] [0] < detect _ height _ max, then we determine that the contour is a black line;

b52: if rect _ detect [1] [1] > detect _ width _ max, the contour is determined to be a notch.

8. The method for detecting the metal surface defects based on the image processing as claimed in claim 4, wherein the specific steps of the step C are as follows:

c1: extracting the edge contour by calling an OpenCV interface Canny operator;

c2: carrying out expansion processing and noise reduction processing on the edge profile;

c3: calculating the perimeter of the expanded edge contour through an OpenCV interface arcLength, acquiring the side length of the expanded polygon through a structure aproxPolyDP, and calculating the number of side lengths, count length, through a len function;

c4: the number of side lengths is determined, and if the number of side lengths is 4, the cut is squared, and if the number of side lengths is 5 or otherwise, the cut is not squared.

Background

Areas of the metal surface that are locally non-uniform in physical or chemical properties. Including non-metallic inclusions and other second phase particles, dislocations or grain boundary outcrops, adsorbed impurity atoms, surface vacancies or steps, and the like. Surface defects are sites of higher atomic activity and often serve as origins of metal corrosion.

The vulcanized rubber product sometimes has defects of scars, blisters, cracks, sponginess, inconsistent color, heavy leather and the like on the surface, the defects are mostly caused by the reasons of insufficient vulcanization pressure, stained surface before vulcanization, over-high vulcanization speed of rubber material, under-sulfur and over-sulfur and the like, and in order to avoid the defects, strict operation requirements are required and process conditions are well controlled.

In the prior art, the efficiency of detecting the defects on the metal surface is not high, the instrument cost is high, and the detection precision and efficiency of the quality of the metal product are influenced.

Disclosure of Invention

The invention provides a high-reflectivity metal surface defect online detection device and method based on image processing, aiming at the problems that the defect detection efficiency of the metal surface is low, the instrument cost is high and the detection precision and efficiency of the quality of a metal product are influenced in the prior art, and the aim is that: the metal defect detection cost is reduced, and the workpiece defect detection efficiency and speed are improved.

The technical scheme adopted by the invention is as follows:

the utility model provides a metal surface defect on-line measuring device based on image processing, includes conveyer belt and detection device, detection device is connected with the computer, its characterized in that, detection device sets up the top and the lateral part at the drive belt, be provided with the several piece that awaits measuring on the conveyer belt, wherein detection device detects respectively whether the surface defect and the incision of piece that awaits measuring are squarely.

By adopting the scheme, the defects of the surface and the cut of the to-be-detected piece on the conveying belt can be detected by the detecting device arranged at the top and the side of the conveying belt, so that the detection efficiency of the metal surface defects is greatly improved.

The detection device comprises a first camera and a second camera, a coaxial light source is fixedly arranged at the bottom of the first camera, and parallel light is shot into one side of the coaxial light source.

By adopting the scheme, the camera is positioned above the coaxial light source by a plurality of distances, reflection noise is effectively inhibited through uniform reflection of the coaxial light source on the surface of the high-reflection metal, a foundation is laid for effective defect extraction of an algorithm, the coaxial light source can highlight unevenness of the surface of an object and overcome interference caused by surface reflection, the coaxial light source is mainly used for detecting bruises, scratches, cracks and foreign bodies on the flat and smooth surface of the object, the coaxial light source is suitable for truly reflecting surface information of the high-reflection metal, high-reflection noise can be well inhibited during algorithm processing, and the coaxial light source is also a light source which is found to have the best effect after various light sources are tried.

The computer is configured with an image processing system and a data analysis system.

A method of a metal surface defect online detection device based on image processing is characterized by comprising the following steps:

step A: starting a first camera and a second camera, and filtering an image;

and B: detecting the surface defects of the metal to be detected through a first camera, and displaying the characteristics and real-time pictures on a QT interface;

and C: and detecting the notch defect of the metal to be detected through the second camera, and displaying the characteristics and the real-time picture on a QT interface.

By adopting the scheme, the efficiency and the speed of workpiece defect detection can be effectively improved, the overall structure is simple, the cost is reduced, the detection cost can be effectively reduced, and the enterprise competitiveness is improved.

The step B specifically comprises the following steps:

b1: a first camera calls an OpenCV interface adaptive method, an image after adaptive threshold binarization is obtained through self-defining Block Size Block Size and a constant item C, and an OpenCV interface findContours is used for detecting the object contour after thresholding;

b2: coordinating the detected object contour;

b3: defining a width range, screening the object outline according to the width range, and adding the outline in the width range into a collection list to obtain an outline collection of the piece to be detected;

b4: screening a plurality of contours in each contour of the piece to be detected in the set to eliminate contours except for defects in the piece to be detected;

b5: and respectively screening the black line characteristic and the gap characteristic in the outline of the piece to be detected.

The specific steps of the step B4 are as follows:

b41: and (4) acquiring coordinates of four points on the outline of the coordinate to-be-measured piece, determining a straight line according to the two points, and calculating to obtain equations of straight lines on two sides.

B42: traversing a plurality of contours in each contour of the piece to be measured through for circulation, calculating the distance from each contour in the contour of the piece to be measured to two sides of the piece to be measured, wherein the distance is d1 and d2, and taking the minimum min length of the distance

B43: setting a range [ rate min, rate max ] through a preset distance from the defect to the shortest side of the piece to be detected and the ratio of the whole piece to be detected, and if the rate min < rate fix < rate max, determining that the shape is a defect contour, and excluding other contours on the surface of the steel pipe.

The specific steps of the step B5 are as follows:

b51: setting two ranges [ detect _ width _ min, detect _ width _ max ], [ detect _ height _ min, detect _ height _ max ] and a constant min numm;

b52, finding the width rect _ detect [1] [1] and the length rect _ detect [1] [0] of the defect contour, if detect _ width _ min < rect _ detect [1] [1] < detect _ width _ max and detect _ height _ min < rect _ detect [1] [0] < detect _ height _ max, then we determine that the contour is a black line;

b52: if rect _ detect [1] [1] > detect _ width _ max, the contour is determined to be a notch.

The concrete steps of the step C are as follows:

c1: extracting the edge contour by calling an OpenCV interface Canny operator;

c2: carrying out expansion processing and noise reduction processing on the edge profile;

c3: calculating the perimeter of the expanded edge contour through an OpenCV interface arcLength, acquiring the side length of the expanded polygon through a structure aproxPolyDP, and calculating the number of side lengths, count length, through a len function;

c4: the number of side lengths is determined, and if the number of side lengths is 4, the cut is squared, and if the number of side lengths is 5 or otherwise, the cut is not squared.

In summary, due to the adoption of the technical scheme, the invention has the beneficial effects that:

1. the accessible sets up and carries out surface and notched defect detection at the detection device of conveyer belt top and lateral part simultaneously to the piece that awaits measuring on the conveyer belt, has improved the detection efficiency of metal surface defect greatly.

2. The camera is located above the coaxial light source for a plurality of distances, reflection noise is effectively inhibited through uniform reflection of the coaxial light source on the surface of the high-reflection metal, a foundation is laid for effective defect extraction of an algorithm, the coaxial light source can highlight unevenness of the surface of an object, interference caused by surface reflection is overcome, the coaxial light source is mainly used for detecting bruise, scratch, crack and foreign matter of the flat and smooth surface of the object, the coaxial light source is suitable for really reflecting surface information of the high-reflection metal, high-reflection noise can be well inhibited during algorithm processing, and the coaxial light source is also a light source which is found to have the best effect after various light sources are tried.

3. The efficiency and the speed of workpiece defect detection can be effectively improved, the overall structure is simple, the cost is reduced, the detection cost can be effectively reduced, and the enterprise competitiveness is improved.

Drawings

The invention will now be described, by way of example, with reference to the accompanying drawings, in which:

FIG. 1 is an algorithmic flow diagram of one embodiment of the present invention;

fig. 2 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.

Fig. 3 is an effect diagram of an embodiment of the present invention.

Reference numerals: 1-a conveyor belt; 2-a piece to be detected; 3-a coaxial light source; 4-parallel light; 5-a first camera; 6-a computer; 7-second camera.

Detailed Description

All of the features disclosed in this specification, or all of the steps in any method or process so disclosed, may be combined in any combination, except combinations of features and/or steps that are mutually exclusive.

The present invention will be described in detail with reference to fig. 1 and 2.

The first embodiment is as follows:

the utility model provides a metal surface defect on-line measuring device based on image processing, includes conveyer belt and detection device, detection device is connected with the computer, its characterized in that, detection device sets up the top and the lateral part at the conveyer belt, be provided with the several piece 2 that awaits measuring on the conveyer belt, wherein detection device detects respectively whether the surface defect and the incision of piece 2 that awaits measuring are squarely.

The detection device comprises a first camera 5 and a second camera 7, wherein a coaxial light source is fixedly arranged at the bottom of the first camera 5, and parallel light 4 is shot into one side of the coaxial light source 3.

The computer 6 is provided with an image processing system and a data analysis system.

A method of a metal surface defect online detection device based on image processing is characterized by comprising the following steps:

step A: starting a first camera and a second camera, and filtering an image;

and B: detecting the surface defects of the metal to be detected through a first camera, and displaying the characteristics and real-time pictures on a QT interface;

and C: and detecting the notch defect of the metal to be detected through the second camera, and displaying the characteristics and the real-time picture on a QT interface.

The step B specifically comprises the following steps:

b1: a first camera calls an OpenCV interface adaptive method, an image after adaptive threshold binarization is obtained through self-defining Block Size Block Size and a constant item C, and an OpenCV interface findContours is used for detecting the object contour after thresholding;

b2: coordinating the detected object contour;

b3: defining a width range, screening the object outline according to the width range, and adding the outline in the width range into a collection list to obtain an outline collection of the piece to be detected;

b4: screening a plurality of contours in each contour of the piece to be detected in the set to eliminate contours except for defects in the piece to be detected;

b5: and respectively screening the black line characteristic and the gap characteristic in the outline of the piece to be detected.

The specific steps of the step B4 are as follows:

b41: and (4) acquiring coordinates of four points on the outline of the coordinate to-be-measured piece, determining a straight line according to the two points, and calculating to obtain equations of straight lines on two sides.

B42: traversing a plurality of contours in each contour of the piece to be measured through for circulation, calculating the distance from each contour in the contour of the piece to be measured to two sides of the piece to be measured, wherein the distance is d1 and d2, and taking the minimum min length of the distance

B43: setting a range [ rate min, rate max ] through a preset distance from the defect to the shortest side of the piece to be detected and the ratio of the whole piece to be detected, and if the rate min < rate fix < rate max, determining that the shape is a defect contour, and excluding other contours on the surface of the steel pipe.

The specific steps of the step B5 are as follows:

b51: setting two ranges [ detect _ width _ min, detect _ width _ max ], [ detect _ height _ min, detect _ height _ max ] and a constant min numm;

b52, finding the width rect _ detect [1] [1] and the length rect _ detect [1] [0] of the defect contour, if detect _ width _ min < rect _ detect [1] [1] < detect _ width _ max and detect _ height _ min < rect _ detect [1] [0] < detect _ height _ max, then we determine that the contour is a black line;

b52: if rect _ detect [1] [1] > detect _ width _ max, the contour is determined to be a notch.

The concrete steps of the step C are as follows:

c1: extracting the edge contour by calling an OpenCV interface Canny operator;

c2: carrying out expansion processing and noise reduction processing on the edge profile;

c3: calculating the perimeter of the expanded edge contour through an OpenCV interface arcLength, acquiring the side length of the expanded polygon through a structure aproxPolyDP, and calculating the number of side lengths, count length, through a len function;

c4: the number of side lengths is determined, and if the number of side lengths is 4, the cut is squared, and if the number of side lengths is 5 or otherwise, the cut is not squared.

1. In the first embodiment, the coaxial light source arranged at the bottom of the first camera 5 is limited in light emitting angle by the black frame around, so that the light source can be placed outside the to-be-measured piece for a certain distance without being affected by external illumination, and the device has a very light capability of resisting ambient light noise. Wherein the first camera 5 is used for detecting a plurality of defects on the surface of a piece to be detected, the second camera is used for detecting whether the cut of the piece to be detected is square, the resolutions of the first camera 5 and the second camera are both 244+ px 1944px, the maximum frame rate is 6 frames/second under the condition of the maximum resolution, the focal length of a lens of the first camera 5 is 8mm, the teaching aid of the lens of the second camera is 12mm, the first camera 5 is placed 2-5cm away from the upper surface of the coaxial light and is assisted with a certain shielding measure for eliminating the interference caused by the top light source penetrating through the upper surface of the coaxial light source, the second camera is placed 20-30cm away from the placing position of the steel pipe at the top end of the conveyor belt or is clamped 2-3cm away from the upper surface of the steel pipe by an object stage, and the light and shade of the camera can be adjusted according to the environment, according to our experiments, on the premise that the brightness of the power adapter is increased as much as possible, a higher contrast image quality can be obtained using a smaller aperture. The image processing system is connected with a PC terminal through a USB2.0 data line of a camera, defects are recognized and classified based on Python as a development language, and meanwhile, a pyqt5 toolkit is used as a front-end development tool to show real-time pictures and processing pictures in a graphical mode. The data analysis system writes the collected defect types into a database in a socket communication mode, and the back-end system analyzes and processes the data after reading the data.

Wherein the conveyer belt chooses 1m width conveyer belt for use, and the piece that awaits measuring is about 25cm generally, and coaxial light source apparent dimension is about 200cm, so in order to make full use of conveyer belt resource, can set up 4 collection systems simultaneously, and each other noninterference, improved efficiency effectively.

The image processing system is developed based on a Python language and pyqt5 as a development kit, the Python integrates an OpenCV computer vision open source library, and a plurality of excellent traditional image processing algorithm interfaces are provided in the computer vision open source library, so that the selection of developers is well widened, the pyqt5 is programmed in a graphical method, and based on a signal and slot working mode, communication can be realized only by processing a logical relationship by using the Python language, so that the complexity of front-end layout is simplified.

The data analysis system is used for transmitting and writing the data into the database in a socket communication mode according to the defect types identified by the image processing system, then the server reads the data in the database, performs data analysis according to the defect characteristics, designs judgment indexes according to the defect types, the number and other information of each surface of the steel pipes with different numbers and according to the requirements of customers, and feeds back whether the steel pipes are qualified or not.

The step B2 is to set reasonable Gaussian kernel function, self-defined Block Size Block Size and constant item C, so that noise contour can be effectively reduced, and program processing time is reduced. Each outline is framed out by a minimum rectangular frame by calling an OpenCV interface minAreACT, the returned rectangular frame rect contains information such as coordinates, side lengths and angles of specific four points, subscripts of different four points corresponding to different angle ranges can be specifically divided into a steel pipe which is deviated to the left, namely-45.0 < angle <0.0, the coordinates at the moment: lower left (box [0] [0], box [0] [1]), upper left (box [1] [0], box [1] [1]), upper right (box [2] [0], box [2] [1]), lower right (box [3] [0], box [3] [1 ]); right-biased, i.e., -90.0< angle < -45.0, when the coordinates: lower left (box [1] [0], box [1] [1]), upper left (box [2] [0], box [2] [1]), upper right (box [3] [0], box [3] [1]), lower right (box [0] [0], box [0] [1 ]); when the angle is equal to-90.0 or 0.0, the right side is deviated at the same time, so the situation needs to be discussed; then, the profile is screened according to the specific information;

wherein the step B41 specifically comprises the following steps: and B2, calculating the slope k and the intercept B of the left and right linear equations respectively according to a method of determining a straight line from two points by using the four-point coordinates of the object contour obtained in the step B2, wherein (x _ detect, y _ detect) can be any point coordinate, and for convenience, the coordinates are specified as the central coordinates (rect [0] [0], [0] [1]) of the contour rectangular frame, so that the left straight line:

k1=(y_left_upper-y_left_lower)/(x_left_upper-x_left_lower)

b1=y_left_lower-k*x_left_lower

y=k1*x_detect-y_detect+b1

straight line on the right:

k2=(y_right_upper-y_right_lower)/(x_right_upper-x_right_lower)

b2=y_right_lower-k*x_right_lower

y=k2*x_detect-y_detect+b2

the reason why Canny operator is selected in step C1 is that Canny operator is more effective. The Canny operator-based method only needs to consider setting two thresholds thresh1 and thresh2, wherein the larger threshold thresh2 is used for detecting obvious edges in an image, but the detection is intermittent, and the smaller threshold thresh1 is used for connecting the intermittent edges, but the segmentation effect is still not continuous, and then a morphological dilation method is used for connecting the discontinuous edges but the very close edges to form a whole as much as possible, so that the number of the contours is reduced, the time for traversing the contours is shortened, and the complete shape is conveniently identified later;

the above-mentioned embodiments only express the specific embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for those skilled in the art, without departing from the technical idea of the present application, several changes and modifications can be made, which are all within the protection scope of the present application.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种具有缓震功能的电缆包层缺陷自主检测设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!