CN108176608A - Nut defect inspection method and device based on machine vision - Google Patents

Nut defect inspection method and device based on machine vision Download PDF

Info

Publication number
CN108176608A
CN108176608A CN201711423743.XA CN201711423743A CN108176608A CN 108176608 A CN108176608 A CN 108176608A CN 201711423743 A CN201711423743 A CN 201711423743A CN 108176608 A CN108176608 A CN 108176608A
Authority
CN
China
Prior art keywords
nut
image
preset
detected
binaryzation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711423743.XA
Other languages
Chinese (zh)
Other versions
CN108176608B (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.)
Institute of Automation of Chinese Academy of Science
Original Assignee
Institute of Automation of Chinese Academy of Science
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 Institute of Automation of Chinese Academy of Science filed Critical Institute of Automation of Chinese Academy of Science
Priority to CN201711423743.XA priority Critical patent/CN108176608B/en
Publication of CN108176608A publication Critical patent/CN108176608A/en
Application granted granted Critical
Publication of CN108176608B publication Critical patent/CN108176608B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B07SEPARATING SOLIDS FROM SOLIDS; SORTING
    • B07CPOSTAL SORTING; SORTING INDIVIDUAL ARTICLES, OR BULK MATERIAL FIT TO BE SORTED PIECE-MEAL, e.g. BY PICKING
    • B07C5/00Sorting according to a characteristic or feature of the articles or material being sorted, e.g. by control effected by devices which detect or measure such characteristic or feature; Sorting by manually actuated devices, e.g. switches
    • B07C5/34Sorting according to other particular properties
    • B07C5/342Sorting according to other particular properties according to optical properties, e.g. colour
    • B07C5/3422Sorting according to other particular properties according to optical properties, e.g. colour using video scanning devices, e.g. TV-cameras
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/89Investigating the presence of flaws or contamination in moving material, e.g. running paper or textiles
    • G01N21/892Investigating the presence of flaws or contamination in moving material, e.g. running paper or textiles characterised by the flaw, defect or object feature examined

Abstract

The present invention relates to part defect detection fields, and in particular to a kind of nut defect inspection method and device based on machine vision, in order to improve the efficiency of nut defects detection.The present invention obtains overhead view image, side elevation image and the oblique-view image of nut first, and carries out binary conversion treatment to this 3 kinds of images;Then the characteristic parameter of nut to be detected is extracted on the image after binary conversion treatment, it is compared with prior preset characteristic parameter, so that it is determined that nut to be detected with the presence or absence of internal diameter is excessive or too small, upper groove cutting excessively, do not open slot, upper slot open it is anti-, outer groove discrepancy of quantity, turned upside down, do not open internal thread, and the problems such as whether being overlapped with other nuts, and then classify to nut to be detected, to distinguish waste product, substandard products, abnormal article and certified products.Compared with traditional artificial detection, the present invention can efficiently detect all nuts one by one, greatly improve production efficiency, and significantly improve the qualification rate of manufacture nut.

Description

Nut defect inspection method and device based on machine vision
Technical field
The present invention relates to part defect detection fields, and in particular to a kind of nut defect inspection method based on machine vision And device.
Background technology
Nut is a kind of fundamental parts for closely connecting mechanical equipment, have been widely used at present automobile making, The multiple fields such as building, machinery, rail traffic, public utility, foundry industry.Due to material, specification, technology requirement etc. difference, The type of market top nut product is various.Complicated and changeable by production procedure, equipment operation maintenance situation differs and artificial setting The influence of misoperation, there are a certain proportion of defect wares for the nut of automatic assembly line production.Typical defect has:
1) nut internal diameter is excessive or too small, after causing nut that can not be threaded together or be threaded together with bolt or screw rod Respective standard is not achieved in snap-in force.Since defect is difficult to through solution of simply doing over again, this kind of nut is generally taken as waste disposal;
2) technique lacks, and exemplary, which has, not to be opened internal thread, does not open slot etc., and this kind of defect is mainly due to production and processing When miss out particular process step and cause.After defect is clear and definite, nut can be allowed to become by supplementing the leaked through procedure of processing of execution Certified products solve, therefore this kind of nut is generally regarded as substandard products processing;
3) slot is opened instead on, nut non-correct placement in production line, such as bottom-up, causes to manage during following process It should be implemented in the grooving processes that nut one side is implemented by mistake in other faces, entire nut is also therefore as waste product.
Although nut manufacturing enterprise is by the means such as technique and process optimization, fine-grained management, by above-mentioned defect ware The ratio of nut is controlled in a relatively low value, but from the perspective of product quality is ensured, nut quality testing is still must Indispensable link.Nut quality testing is intended to that existing defects nut is found and rejected by quality inspection step, it is made not flow into end Hold market.Traditional nut quality inspection is mainly by being accomplished manually, the modes such as worker measures internal diameter by professional gage, visually observes, Determine that nut whether there is defect.However, nut production has the characteristics of single product value is low, and quantity radix is big, by artificial real Now comprehensive nut quality inspection is unpractical.Nut manufacturing enterprise generally use is all the quality inspection form manually inspected by random samples at present, This form can be found that the continuous nut quality problems of high-volume, and apparent work is not had then for sporadic quality problems With, and the latter is much in practice produces.Nut industry is badly in need of that nut can be carried out the side of comprehensive exact mass detection Method and sorting equipment.
Invention content
In order to solve the above problem of the prior art, the present invention proposes a kind of nut defect inspection based on machine vision Method and device is surveyed, greatly improves the efficiency of detection nut defect, while ensure that accuracy in detection.
An aspect of of the present present invention proposes a kind of nut defect inspection method based on machine vision, includes the following steps:
Overhead view image, side elevation image and the oblique-view image of nut to be detected are obtained respectively;
Binary conversion treatment is carried out to the overhead view image;The characteristic parameter of the overhead view image after binaryzation is extracted, and The characteristic parameter of the overhead view image extracted and preset overhead view image characteristic parameter are compared, judge spiral shell to be detected Mother whether there is defect;
Binary conversion treatment is carried out to the side elevation image;The characteristic parameter of the side elevation image after binaryzation is extracted, and The characteristic parameter for the side elevation image extracted and preset side elevation image characteristic parameter are compared, judge spiral shell to be detected Mother whether there is defect;
Binary conversion treatment is carried out to the oblique-view image;The characteristic parameter of the oblique-view image after binaryzation is extracted, and The characteristic parameter for the oblique-view image extracted and preset oblique-view image characteristic parameter are compared, judge spiral shell to be detected Mother whether there is defect;
The overhead view image, the side elevation image and the oblique-view image, for when nut is horizontal positioned, respectively from nut Surface, side and the image captured by oblique upper.
Preferably, " binary conversion treatment is carried out to the overhead view image ", including:
The overhead view image is converted into gray level image, the noise after gray processing is eliminated by gaussian filtering;
It is operated by self-adaption binaryzation and the overhead view image after noise reduction is converted into bianry image;
Closed operation is carried out to bianry image, the noise in rejection image.
Preferably, " binary conversion treatment is carried out to the side elevation image ", including:
Gray processing and histogram equalization are carried out to the side elevation image, enhance the contrast of the side elevation image;Pass through Gaussian filtering eliminates the noise after gray processing;
By OTSU Adaptive Thresholdings, (OTSU algorithms are in a kind of to image of proposition in 1979 by Japanese scholars OTSU Carry out the highly effective algorithm of binaryzation) binaryzation is carried out to image, prospect is the low gray value region in image;
Closed operation is carried out to bianry image, the noise in rejection image.
Preferably, " binary conversion treatment is carried out to the oblique-view image ", including:
Gray processing and histogram equalization are carried out to the oblique-view image, enhance the contrast of the oblique-view image;Pass through Gaussian filtering eliminates the noise after gray processing;
Binaryzation carries out image by OTSU Adaptive Thresholdings, prospect is the high gray value region in image;
Closed operation is carried out to bianry image, the noise in rejection image.
Preferably, the preset overhead view image characteristic parameter, including:Preset nut inner circle maximum radius value and default Nut inner circle least radius value;
" characteristic parameter of the overhead view image after extraction binaryzation, and the feature of the overhead view image that will be extracted Parameter is compared with preset overhead view image characteristic parameter, judges that nut to be detected whether there is defect ", including:
According to the overhead view image after binaryzation, the radius value of nut inner circle in the image is extracted;
The radius value of nut inner circle described in the image by extraction, respectively with preset nut inner circle maximum radius value and Preset nut inner circle least radius value is compared, and judges that nut to be detected whether there is the defects of internal diameter is excessive or too small.
Preferably, it " according to the overhead view image after binaryzation, extracts the radius value of nut inner circle in the image ", wraps It includes:
According to the overhead view image after binaryzation, the point being located in nut inner circle of predetermined number is found;
Perpendicular bisector based on the upper any two points of circle crosses the property in the center of circle, and the intersection point of two perpendicular bisectors is obtained, makees For center of circle candidate point;It repeats, obtains the center of circle candidate point of preset quantity;
The center of circle candidate point to peel off is abandoned, the position mean of the remaining center of circle candidate point is obtained, as inspection The central coordinate of circle measured;
According to the point being located in nut inner circle of the central coordinate of circle detected and the predetermined number found, The distance between each point on the central coordinate of circle detected described in calculating respectively and the nut inner circle found, and the distance is obtained Average value, as the radius value of the nut inner circle extracted.
Preferably, the preset side elevation image characteristic parameter, including:Preset image left edge region, preset figure As the ratio between right hand edge region, preset right boundary distance and picture traverse;
" characteristic parameter of the side elevation image after extraction binaryzation, and the feature of the side elevation image that will be extracted Parameter is compared with preset side elevation image characteristic parameter, judges that nut to be detected whether there is defect ", including:
According to the side elevation image after binaryzation, the position of nut in the picture is determined;
Judge that nut to be detected whether there is situation about being overlapped with other nuts;
Wherein, it is described to judge that nut to be detected whether there is situation about being overlapped with other nuts, specially:
The position of left and right boundary in the picture is extracted respectively, and according to preset image left edge region and preset figure As right hand edge region, judge whether left margin is located at the preset image left edge region respectively, whether right margin is located at institute State preset image right hand edge region;
If left margin is located at the preset image left edge region or right margin is located at the preset image right hand edge Region, then calculate the ratio of the distance between right boundary and picture traverse, and judges whether the ratio is more than a preset left side The ratio between right margin distance and picture traverse;If so, think that nut to be detected there is a situation where to overlap with other nuts.
Preferably, " according to the side elevation image after binaryzation, the position of nut in the picture is determined ", including:
The foreground pixel point number per a line in the side elevation image after binaryzation is counted, obtains row projection vector;
The foreground pixel point number of each row in the side elevation image after binaryzation is counted, obtains row projection vector;
Pixel value transition position in the row projection vector, pixel value transition position in the row projection vector are searched respectively It puts, and then determines the specific location of nut to be detected in the picture.
Preferably, the preset oblique-view image characteristic parameter, including:Preset white pixel accounting third threshold value;
" characteristic parameter of the oblique-view image after extraction binaryzation, and the feature of the oblique-view image that will be extracted Parameter is compared with preset oblique-view image characteristic parameter, judges that nut to be detected whether there is defect ", including:
According to the oblique-view image after binaryzation, calculate internal thread white pixel in the image area accounting;
If the internal thread the accounting of white pixel in the image area be less than the preset white pixel accounting the Three threshold values, then it is assumed that nut to be detected does not open internal thread.
Preferably, " according to the oblique-view image after binaryzation, the internal thread institute white picture in the image area is calculated The accounting of element ", including:
According to the oblique-view image after binaryzation, the position of nut in the picture is determined;
According to the relative position of position and preset internal thread in nut of nut in the picture, internal thread is intercepted Place image-region;
Closed operation is carried out to image-region where the internal thread of interception, eliminates noise spot;
Calculate respectively the internal thread the number of pixel total number and white pixel in the image area, and then calculate institute The ratio between the number of white pixel and the pixel total number is stated, obtains the internal thread institute white picture in the image area The accounting of element.
Preferably, " according to the oblique-view image after binaryzation, the position of nut in the picture is determined ", including:Statistics Foreground pixel point number in the oblique-view image after binaryzation per a line, obtains row projection vector;After counting binaryzation The foreground pixel point number of each row, obtains row projection vector in the oblique-view image;
Pixel value transition position in the row projection vector, pixel value transition position in the row projection vector are searched respectively It puts, and then determines the specific location of nut to be detected in the picture.
Preferably, if the internal diameter of qualified nut bottom end is more than the internal diameter on top, and top is provided with multiple upper slots, then described pre- If overhead view image characteristic parameter, further include:Preset semidiameter threshold value and preset radius increment l1、l2, and l2<l1
After " judging the defects of nut to be detected is excessive or too small with the presence or absence of internal diameter ", further include:If spiral shell to be detected Mother there are internal diameter it is excessive the defects of, then further judge nut to be detected whether turned upside down;The turned upside down is to be detected The downward bottom end in nut top is upward, horizontal positioned;
Wherein, it is described judge nut to be detected whether turned upside down, specially:
Calculate the difference between the radius value r for the nut inner circle extracted and the preset nut inner circle radius value Value;
If the difference being calculated is more than the preset semidiameter threshold value, on the overhead view image after binarization A radius value is taken in [r, r+l1] in the range of annular region, the annular region is enabled to include the pixel of entire nut;
Connected domain analysis is carried out to the annular region, if at least there are a prospect connected domain, and the prospect connected domain Meet following two conditions simultaneously:
Pixel in the prospect connected domain is occurred in four quadrants of nut;
Distance in the prospect connected domain between all foreground pixel points and the center of circle is both greater than r+l2
Then think the nut turned upside down to be detected, it is otherwise excessive for internal diameter;
Four quadrants of the nut refer to and carry out upper left, upper right, the left side that horizontal and vertical cutting obtains to image from the center of circle Lower and four pieces of bottom right image-region.
Preferably, if the circumferential direction of qualified nut is provided with outer groove, the preset side elevation image characteristic parameter further includes: Preset third sectional drawing height, default sectional drawing width, preset white pixel point quantity, preset outer groove quantity;
After " judging that nut to be detected whether there is situation about being overlapped with other nuts ", further include:
If situation about being overlapped with other nuts is not present in nut to be detected, judge that nut to be detected whether there is outer slot number Measure incongruent defect;
Wherein, it is described to judge the defects of nut to be detected is closed with the presence or absence of outer groove discrepancy of quantity, specially:
According to the side elevation image after binaryzation, the position of left and right boundary and lower boundary in the picture is extracted;
According to the position of the left and right boundary of extraction and lower boundary in the picture, in the side elevation image before binaryzation, Using lower boundary the bottom of as, using preset third sectional drawing height as height, intercepted to the right from left margin respectively default sectional drawing width region, It intercepts the region of default sectional drawing width to the left from right margin, obtains the image in left margin region and the image of right border area;
Binaryzation and closed operation are carried out to the two images of interception respectively;
It calculates respectively in the two images, the quantity of white pixel point in each white pixel connected region;Judge respectively Whether the quantity of white pixel point is more than preset white pixel point quantity in each white pixel connected region, if so, recognizing It is an outer groove for the white pixel connected region;
If in the two images, the outer groove at least detected on piece image is in varying numbers in preset outer groove quantity When, then it is assumed that there are the defects of the conjunction of outer groove discrepancy of quantity for nut to be detected.
Preferably, if the top of qualified nut is provided with multiple upper slots, the preset side elevation image characteristic parameter also wraps It includes:Preset first sectional drawing height, preset white pixel accounting first threshold, preset white pixel accounting second threshold;
After " judging the defects of nut to be detected is closed with the presence or absence of outer groove discrepancy of quantity ", further include:
If the defects of nut to be detected is closed there is no outer groove discrepancy of quantity, judges that nut to be detected is cut with the presence or absence of upper slot Cut the defects of excessive;
Wherein,
It is described to judge that nut to be detected whether there is the defects of upper groove cutting is excessive, specially:
According to the side elevation image after binaryzation, the position of the left and right boundary and coboundary of nut in the picture is extracted;
Using the left and right boundary of the nut of extraction as two sides, using coboundary as top margin, preset first is intercepted from top to bottom Sectional drawing height obtains truncated picture region;
In truncated picture region, the quantity of white pixel point in each white pixel connected region is calculated respectively;Point Do not judge whether the quantity of white pixel point in each white pixel connected region is more than preset white pixel point quantity, if It is, then it is assumed that the white pixel connected region is a upper slot;And then calculate the quantity N of upper slot in truncated picture region;
In truncated picture region, total of the total number of all pixels and white pixel in the region is calculated respectively Number, and then calculate the ratio between the total number of white pixel and the total number of all pixels, is accounted for as white pixel in the region Compare P;
If the upper slot number amount N and the accounting P of white pixel that calculate meet following conditions:
Then think nut to be detected there are upper groove cutting it is excessive the defects of;
Wherein, P1、P2Respectively described preset white pixel accounting first threshold, the preset white pixel accounting Second threshold, and P1>P2
Preferably, if being provided with multiple upper slots on qualified nut, the preset overhead view image characteristic parameter, including:In advance If nut inner circle maximum radius value, preset nut inner circle least radius value and preset radius increment l3、l4, and l4< l3;The preset side elevation image characteristic parameter, including:Preset second sectional drawing height and preset white pixel accounting 4th threshold value;
" binary conversion treatment is being carried out to the side elevation image;The characteristic parameter of the side elevation image after binaryzation is extracted, And be compared the characteristic parameter for the side elevation image extracted and preset side elevation image characteristic parameter, judge to be detected Nut whether there is defect " after, it further includes:
According to the overhead view image after binaryzation, judge nut to be detected with the presence or absence of do not open slot or upper slot open it is anti- Defect;
According to the side elevation image after binaryzation, it is to exist not open slot or upper slot is opened to further discriminate between nut to be checked The defects of anti-;
Wherein, " according to the overhead view image after binaryzation, judge that nut to be detected whether there is and do not open slot or upper slot Open the defects of anti-", specially:
According to the overhead view image after binaryzation, the radius value r of nut inner circle in the image is extracted;
Judge whether the radius value of the nut inner circle extracted is more than the preset nut inner circle least radius value, And less than preset nut inner circle maximum radius value;If so, take a radius value on the overhead view image after binarization In [r, r+l3] in the range of annular region, the annular region is enabled to include the pixel of entire nut;
Connected domain analysis is carried out to the annular region, if at least there are a prospect connected domain, and the prospect connected domain Meet following two conditions simultaneously:
Pixel in the prospect connected domain is occurred in four quadrants of nut;
Distance in the prospect connected domain between all foreground pixel points and the center of circle is both greater than r+l4
Then think that slot is not opened in nut presence to be detected or upper slot opens the defects of anti-;
Four quadrants of the nut refer to and carry out upper left, upper right, the left side that horizontal and vertical cutting obtains to image from the center of circle Lower and four pieces of bottom right image-region;
" according to the side elevation image after binaryzation, it is to exist not open slot or upper slot to further discriminate between nut to be checked Open the defects of anti-", specially:
According to the side elevation image after binaryzation, respectively extract nut left and right boundary and lower boundary in the picture Position;
In the side elevation image after binarization, using the left and right boundary of the nut of extraction as two sides, using lower boundary as Base intercepts preset second sectional drawing height, obtains truncated picture region from the bottom up;
Calculate pixel total number and white pixel number in institute's truncated picture region, so calculate white pixel number and The ratio of pixel total number obtains the accounting of white pixel in institute's truncated picture region;
When the accounting of gained white pixel is more than preset four threshold value of white pixel accounting, it is believed that spiral shell to be detected Slot is opened instead on mother, otherwise it is assumed that nut to be detected does not open slot.
Another aspect of the present invention proposes a kind of nut defect detecting device based on machine vision, including:Transmission is set Standby, vision collecting unit, image detecting element, nut taxon;
Wherein, the transmission equipment, for placing and conveying nut to be detected;Each nut independence to be detected and level is put It puts on the transmission equipment;The vision collecting unit, including optoelectronic switch and be respectively arranged at transmission equipment just on Side, side and the camera of oblique upper three;
The optoelectronic switch, for when detecting that nut to be detected enters target area, it is same to trigger three cameras Shi Jinhang takes pictures;Three cameras are respectively used to shoot overhead view image, side elevation image and the oblique-view image of nut to be detected; Described image detection unit, for receiving overhead view image, side elevation image and oblique-view image captured by three cameras, and base In the nut defect inspection method recited above based on machine vision, defects detection is carried out to nut to be detected;The nut Taxon for the testing result according to the defects of described image detection unit, classifies to nut to be detected.
Preferably, nut is divided by the nut taxon:Substandard products, waste product, abnormal article and certified products;
The substandard products, including:Slot is not opened and does not open the nut of internal thread;The waste product, including:Internal diameter is excessive or mistake Small, upper slot opens the excessive nut of anti-and upper groove cutting;The abnormal article, including:Turned upside down, outer groove discrepancy of quantity and There are problems that the nut of overlap joint;The certified products are the satisfactory nut of testing result.
Preferably, the nut defect detecting device further includes:White light source;The white light source, for by nut to be detected It illuminates.
Preferably, the nut taxon includes:(Programmable Logic Controller may be programmed PLC Logic controller), motor, three mechanical pushing hands, three nut storing apparatus;
The PLC for receiving the testing result that described image detection unit is sent, and is controlled according to the testing result Motor action;The motor, three mechanical pushing hands according to the order-driven of the PLC;Three nut storing apparatus, It is respectively used to accommodate waste product, substandard products and abnormal article;Described three mechanical pushing hands, it is a pair of with three nut storing apparatus one Should, waste product, substandard products or abnormal article are pushed into corresponding nut storing apparatus under the driving of the motor.
Beneficial effects of the present invention:
The present invention carries out binary conversion treatment by the image from three different angle shots nuts to be detected, from two The characteristic parameter of nut to be detected is extracted in value treated image, is compared with preset characteristic parameter, so as to screen Go out the nut of various defects.Compared with traditional artificial detection, the present invention can quickly and efficiently examine all nuts one by one It surveys, and classifying quality is good, can greatly improve production efficiency, while significantly improves the qualification rate of manufacture nut.
Description of the drawings
Fig. 1 is that the vertical view of nut, strabismus and side elevation image and typical defect and abnormal article are shown in the embodiment of the present invention Illustration picture;
Fig. 2 is the schematic diagram of the nut defect inspection method embodiment based on machine vision of the present invention;
Fig. 3 is the composition schematic diagram of the nut defect detecting device embodiment based on machine vision of the present invention;
Fig. 4 is camera and to be checked when taking pictures in the nut defect detecting device embodiment based on machine vision of the present invention Survey the relative position schematic diagram of nut.
Specific embodiment
The preferred embodiment of the present invention described with reference to the accompanying drawings.It will be apparent to a skilled person that this A little embodiments are used only for explaining the technical principle of the present invention, it is not intended that limit the scope of the invention.
Except the nut internal diameter mentioned in background technology is excessive or too small, technique missing and upper slot open the general defects such as anti- Outside, also there are a small amount of other model nuts and model nut to be detected is mixed in together is transported to quality inspection links.In addition, For the automatic quality inspection device of the nut built based on machine vision technique, there is also nut mistakes to put what is overlapped with nut Situation, the former is referred to nut and is entered quality inspection equipment in the form of bottom-up on assembly line, and the latter is that multiple nuts are superimposed upon one Rise be not distinguished, both of which be by the nut of the aforementioned link of assembly line break up housekeeping operation it is unsuccessful caused by.Due to Corresponding mass problem, the present invention do not unite these three situations to these three situations (being mixed into other models, mistake is put and is overlapped) Referred to as abnormal article and be not added with distinguishing sort, subsequently can by break up again arrange after be transported to quality inspection device again and examined It surveys and solves.
Fig. 1 is that the vertical view of nut, strabismus and side elevation image and typical defect and wrong product show in the embodiment of the present invention Illustration picture;Wherein, (a) overhead view image;(b) oblique-view image;(c) side elevation image;(d) side elevation image after turned upside down;(e) on Overhead view image after lower inversion;(f) overhead view image of slot is not opened;(g) side elevation image of slot is not opened;(h) slot is opened anti-on Side elevation image;(i) oblique-view image of internal thread is not opened;(j) side elevation image of outer groove discrepancy of quantity;(k) groove cutting is excessive on Side elevation image;(l) side elevation image of overlap joint problem occurs.
It is worth noting that although different size, the nut towards different application scene can also have oneself it is respective lack Fall into type and criterion, but their principles for being mostly analogous to the present invention for being followed in Image Acquisition:It is as complete as possible The information on ground acquisition nut surface.In addition, different type nut on defect collection there are part intersection, even different lacks It falls into, also more or less there is certain general character on detection algorithm.Therefore the present invention even if for other nuts have it is stronger use for reference meaning Justice.
Fig. 2 is the nut defect inspection method schematic diagram based on machine vision of the present invention.As shown in Fig. 2, we pass through The overhead view image of nut is analyzed, the defects of to detect excessive internal diameter or size and turned upside down;By the side view for analyzing nut Image is come the problem of detecting excessive upper groove cutting, outer groove discrepancy of quantity and overlap joint;In detecting and do not open by analyzing oblique-view image The defects of screw thread;First find that nut does not open upper slot or upper slot is opened instead by analyzing overhead view image, then by analyze side elevation image come It is specific to distinguish both of these case.
The nut defect inspection method of the present embodiment includes the following steps:
Step S1 obtains overhead view image, side elevation image and the oblique-view image of nut to be detected respectively;
Step S2 carries out binary conversion treatment to overhead view image;The characteristic parameter of the overhead view image after binaryzation is extracted, and will The characteristic parameter of the overhead view image extracted is compared with preset overhead view image characteristic parameter, whether judges nut to be detected Existing defects;
Step S3 carries out binary conversion treatment to side elevation image;The characteristic parameter of the side elevation image after binaryzation is extracted, and will The characteristic parameter for the side elevation image extracted is compared with preset side elevation image characteristic parameter, whether judges nut to be detected Existing defects;
Step S4 carries out binary conversion treatment to oblique-view image;The characteristic parameter of the oblique-view image after binaryzation is extracted, and will The characteristic parameter for the oblique-view image extracted is compared with preset oblique-view image characteristic parameter, whether judges nut to be detected Existing defects;
Overhead view image mentioned herein, side elevation image and oblique-view image, refer to when nut is horizontal positioned, respectively from nut Surface, horizontal side and the image captured by oblique upper, the present embodiment intermediate-resolution can be respectively preferably 2048*2048, 1280*850 and 800*850.
In the present embodiment, preset overhead view image characteristic parameter, including:Preset nut inner circle maximum radius value and default Nut inner circle least radius value.
Correspondingly, step S2 is specifically included:
In step S211-S213, binary conversion treatment is carried out to overhead view image.
Overhead view image is converted into gray level image by step S211, and the noise after gray processing is eliminated by gaussian filtering;
Step S212 is operated by self-adaption binaryzation the overhead view image after noise reduction being converted into bianry image;Generation In bianry image, the edge in the main correspondence image of foreground pixel point;
Step S213 carries out closed operation to bianry image, and the noises such as small-sized black hole in rejection image are obtained at binaryzation Overhead view image after reason.
In step S221-224, according to the overhead view image after binaryzation, the radius value of nut inner circle in the image is extracted.
Step S221 according to the overhead view image after binaryzation, finds the point being located in nut inner circle of predetermined number;
Step S222, the perpendicular bisector based on the upper any two points of circle cross the property in the center of circle, it is known that upper two point coordinates of circle can The slope k of 2 perpendicular bisectors and y intercept b are acquired, as shown in formula (1), (2):
K=(y1-y2) ÷ (x1-x2) (1)
B=(y2 × x1-y1 × x2) ÷ (x1-x2) (2)
The intersection point of two perpendicular bisectors can be acquired by slope k and b, as center of circle candidate point, such as formula (3), (4) institute Show:
Y=k1 × x+b1 (3)
Y=k2 × x+b2 (4)
According to the point being located in nut inner circle for finding predetermined number found, formula (1)-(4) are repeated, are obtained To the center of circle candidate point of preset quantity;
Step S223 abandons the center of circle candidate point to peel off, the position mean of remaining center of circle candidate point is obtained, as inspection The central coordinate of circle measured;
Step S224, according to the point being located in nut inner circle of the central coordinate of circle detected and the predetermined number found, The distance between each point in the central coordinate of circle detected and the nut inner circle that finds is calculated respectively, and being averaged for these distances is obtained Value, as the radius value of nut inner circle extracted.
In step S230, by the radius value of nut inner circle in the image of extraction, respectively with preset nut inner circle most Large radius value and preset nut inner circle least radius value are compared, and judge nut to be detected with the presence or absence of internal diameter is excessive or mistake The defects of small.
For example, for the nut that normal inner diameter is 26.5, preset nut inner circle maximum radius value is 13.386, is preset Nut inner circle least radius value be 13.106;If it is maximum to be more than preset nut inner circle for nut inner circle radius value in present image Radius value, then it is assumed that there are internal diameter it is excessive the defects of, if less than preset nut inner circle least radius value, then it is assumed that there are internal diameters The defects of too small.
In the present embodiment, preset side elevation image characteristic parameter, including:Preset image left edge region, preset figure As the ratio between right hand edge region, preset right boundary distance and picture traverse (being preferably 0.75 in the present embodiment).
Correspondingly, step S3 is specifically included:
In step S311-313, binary conversion treatment is carried out to side elevation image.
Step S311 carries out gray processing and histogram equalization to side elevation image, enhances the contrast of side elevation image;Pass through Gaussian filtering eliminates the noise after gray processing;
Step S312 carries out binaryzation by OTSU Adaptive Thresholdings to image;It is raw since nut region is more black than background Into in bianry image, the low gray value region in the main correspondence image of foreground pixel point;
Step S313, closed operation is carried out to bianry image, and the noise in rejection image obtains the side view after binary conversion treatment Image.
In step S321-S323, according to the side elevation image after binaryzation, the position of nut in the picture is determined.
Step S321 counts the foreground pixel point number per a line in the side elevation image after binaryzation, obtains a record Per a line foreground pixel numerical value, dimension is equal to the row projection vector of picture altitude;
Step S322 counts the foreground pixel point number of each row in the side elevation image after binaryzation, obtains a record Each row foreground pixel numerical value, dimension are equal to the row projection vector of picture traverse;
Step S323, since prospect is mainly nut region, by searching pixel value transition position in row projection vector respectively It puts, pixel value transition position in row projection vector, and then can determine the specific location of nut to be detected in the picture.
In step S331-S332, judge that nut to be detected whether there is situation about being overlapped with other nuts.
Step S331, extracts the position of left and right boundary in the picture respectively, and according to preset image left edge region and Preset image right hand edge region, judges whether left margin is located at the preset image left edge region respectively, and right margin is It is no to be located at the preset image right hand edge region;
Step S332, if left margin is located at the preset image left edge region or right margin is located at the preset figure As right hand edge region, then the ratio of the distance between right boundary and picture traverse is calculated, and judge whether the ratio is more than The ratio between preset right boundary distance and picture traverse;If so, think that nut to be detected has the feelings overlapped with other nuts Condition.
In the present embodiment, preset oblique-view image characteristic parameter, including:Preset white pixel accounting third threshold value (this In embodiment preferably 0.1).
Correspondingly, step S4 is specifically included:
In step S411-S413, binary conversion treatment is carried out to oblique-view image.
Step S411 carries out gray processing and histogram equalization to oblique-view image, enhances the contrast of oblique-view image;Pass through Gaussian filtering eliminates the noise after gray processing;
Step S412 carries out binaryzation by OTSU Adaptive Thresholdings to image;The prospect that we want to obtain is strabismus Internal thread in image, in bianry image is generated, the high gray value region in the main correspondence image of foreground pixel point;
Step S413, closed operation is carried out to bianry image, and the noise in rejection image obtains the strabismus after binary conversion treatment Image.
In step S421-S423, according to the oblique-view image after binaryzation, the position of nut in the picture is determined.Specifically Process can determine the position of nut in the picture referring in step S321-S323 according to the side elevation image after binaryzation.
In step S431-S433, according to the oblique-view image after binaryzation, it is white in the image area to calculate internal thread institute The accounting of pixel.
Step S431 according to the relative position of position and preset internal thread in nut of nut in the picture, is cut Image-region where taking internal thread;
Step S432 carries out closed operation to image-region where the internal thread of interception, eliminates noise spot;
Step S433, calculate respectively internal thread the number of pixel total number and white pixel in the image area, and then Calculate the ratio between the number of white pixel and pixel total number, obtain internal thread in the image area white pixel account for Than.
In step S440, white pixel accounting and preset white pixel accounting third threshold that step S433 is calculated Value is compared, if internal thread in the image area white pixel accounting be less than preset white pixel accounting third threshold Value, then it is assumed that nut to be detected does not open internal thread.
In the present embodiment, if the internal diameter of qualified nut bottom end is more than the internal diameter on top, and top is provided with multiple upper slots, then in advance If overhead view image characteristic parameter, further include:Preset semidiameter threshold value and preset radius increment l1、l2, and l2<l1
Correspondingly, after step S230, step S240 is further included:
In step S240, if nut to be detected there are internal diameter it is excessive the defects of, further judge that nut to be detected is No turned upside down;The turned upside down is that the downward bottom end in nut top to be detected is upward, horizontal positioned.
Wherein, it is described judge nut to be detected whether turned upside down, specially:
Step S241 calculates the difference between the radius value r for the nut inner circle extracted and preset nut inner circle radius value Value;
Step S242, if the difference being calculated is more than preset semidiameter threshold value, overhead view image after binarization On take a radius value in [r, r+l1] in the range of annular region, the annular region is enabled to include the pixel of entire nut;
Step S243 carries out connected domain analysis to the annular region, can obtain one or more prospect connected domains;If at least exist One prospect connected domain, and the prospect connected domain meets following two conditions simultaneously:(1) pixel in the prospect connected domain exists Four quadrants of nut occur;(2) distance in the prospect connected domain between all foreground pixel points and the center of circle is both greater than r+ l2;Then think the nut turned upside down to be detected, it is otherwise excessive for internal diameter.Four quadrants of nut, refer to from the center of circle to image Carry out upper left, upper right, lower-left and four pieces of bottom right image-region that horizontal and vertical cutting obtains.
In the present embodiment, if the circumferential direction of qualified nut is provided with outer groove, preset side elevation image characteristic parameter further includes: Preset third sectional drawing height (being the 9/10 of qualified height of nut in the present embodiment), default sectional drawing width (are in the present embodiment The 1/10 of qualified nut width), preset white pixel point quantity (in the present embodiment be preferably 50), preset outer groove quantity (being 5 in the present embodiment).
Correspondingly, after step S332, step S340 is further included:
In step S340, if situation about being overlapped with other nuts is not present in nut to be detected, nut to be detected is judged The defects of being closed with the presence or absence of outer groove discrepancy of quantity;
Wherein, judge the defects of nut to be detected is closed with the presence or absence of outer groove discrepancy of quantity, specially:
Step S341 according to the side elevation image after binaryzation, extracts the position of left and right boundary and lower boundary in the picture;
Step S342, according to the position of the left and right boundary of extraction and lower boundary in the picture, the side view before binaryzation As upper, using lower boundary the bottom of as, using preset third sectional drawing height as height, default sectional drawing width is intercepted to the right from left margin respectively Region, the region for intercepting default sectional drawing width to the left from right margin, obtain the image in left margin region and the figure of right border area Picture;
Step S343 carries out binaryzation and closed operation to the two images of interception respectively;
Step S344 is calculated respectively in the two images, the quantity of white pixel point in each white pixel connected region; Judge whether the quantity of white pixel point in each white pixel connected region is more than preset white pixel point quantity respectively, if It is, then it is assumed that the white pixel connected region is an outer groove;
Step S345, if in the two images, the outer groove at least detected on piece image is in varying numbers in preset During outer groove quantity, then it is assumed that there are the defects of the conjunction of outer groove discrepancy of quantity for nut to be detected.
In the present embodiment, if the top of qualified nut is provided with multiple upper slots, preset side elevation image characteristic parameter also wraps It includes:Preset first sectional drawing height (being the 1/4 of qualified height of nut in the present embodiment), preset white pixel point quantity (this In embodiment preferably 200), preset white pixel accounting first threshold P1(being 0.3 in the present embodiment), preset white picture Plain accounting second threshold P2(being 0.2 in the present embodiment).
Correspondingly, after step S345, step S350 is further included:
In step S350, if the defects of nut to be detected is closed there is no outer groove discrepancy of quantity, judges nut to be detected With the presence or absence of upper groove cutting it is excessive the defects of;
Wherein, step S351 judges that nut to be detected whether there is the defects of upper groove cutting is excessive, specially:
Step S352, according to the side elevation image after binaryzation, extract nut left and right boundary and coboundary in the picture Position;
Step S353 using the left and right boundary of the nut of extraction as two sides, using coboundary as top margin, is intercepted from top to bottom Preset first sectional drawing height, obtains truncated picture region;
Step S354 in truncated picture region, calculates white pixel point in each white pixel connected region respectively Quantity;Judge whether the quantity of white pixel point in each white pixel connected region is more than preset white pixel point respectively Quantity, if so, thinking the white pixel connected region for a upper slot;And then calculate upper slot in truncated picture region Quantity N;
Step S355 in truncated picture region, calculates the total number of all pixels and white picture in the region respectively The total number of element, and then the ratio between the total number of white pixel and the total number of all pixels are calculated, as white in the region The accounting P of pixel;
Step S356, if the upper slot number amount N and the accounting P of white pixel that calculate meet formula (5):
Then think nut to be detected there are upper groove cutting it is excessive the defects of;
Wherein, P1、P2Respectively described preset white pixel accounting first threshold, the preset white pixel accounting Second threshold, and P1>P2
In the present invention, the image that can be combined with two or three different directions carries out defects detection, such as:If qualified spiral shell Multiple upper slots are provided on mother, it is necessary to which combination top view picture and side elevation image do not open upper slot or upper slot opens the defects of anti-to detect.
In the present embodiment, if being provided with multiple upper slots on qualified nut, preset overhead view image characteristic parameter further includes: Preset nut inner circle maximum radius value, preset nut inner circle least radius value and preset radius increment l3、l4, and l4 <l3;Preset side elevation image characteristic parameter, further includes:Preset second sectional drawing height (is qualified height of nut in the present embodiment 1/6) and preset the 4th threshold value of white pixel accounting (in the present embodiment be preferably 0.05);
Correspondingly, after step S356, step S360 is further included:
In step 360, first according to the overhead view image after binaryzation, judge nut to be detected with the presence or absence of do not open slot or Upper slot opens the defects of anti-;Further according to the side elevation image after binaryzation, further discriminate between nut to be checked be exist do not open slot or Upper slot opens the defects of anti-.
The step is specially:
Step S361 according to the overhead view image after binaryzation, extracts the radius value r of nut inner circle in the image;
Step S362, judges whether the radius value of nut inner circle extracted is more than preset nut inner circle least radius Value, and less than preset nut inner circle maximum radius value;If so, take a radius on the overhead view image after binarization Value is in [r, r+l3] in the range of annular region, the annular region is enabled to include the pixel of entire nut;
Step S363 carries out connected domain analysis to the annular region, can obtain one or more prospect connected domains;If at least There are a prospect connected domain, and the prospect connected domain meets following two conditions simultaneously:(1) pixel in the prospect connected domain Point is occurred in four quadrants of nut;(2) distance in the prospect connected domain between all foreground pixel points and the center of circle is all big In r+l4, then it is assumed that slot is not opened in nut presence to be detected or upper slot opens the defects of anti-;Four quadrants of nut, refer to from circle The heart carries out image upper left, upper right, lower-left and four pieces of the bottom right image-region that horizontal and vertical cutting obtains;
Step S364, according to the side elevation image after binaryzation, the left and right boundary of extraction nut and lower boundary are in image respectively In position;
Step S365, in side elevation image after binarization, using the left and right boundary of the nut of extraction as two sides, below Boundary is base, intercepts preset second sectional drawing height from the bottom up, obtains truncated picture region;
Step S366 calculates pixel total number and white pixel number in institute's truncated picture region, and then calculates white The ratio of number of pixels and pixel total number obtains the accounting of white pixel in institute's truncated picture region;
Step S367, when the accounting of gained white pixel is more than preset four threshold value of white pixel accounting, it is believed that treat Slot is opened instead on detection nut, otherwise it is assumed that nut to be detected does not open slot.
Fig. 3 is the composition schematic diagram of the nut defect detecting device embodiment based on machine vision of the present invention, and Fig. 4 is this In the nut defect detecting device embodiment based on machine vision of invention, the relative position of camera and nut to be detected when taking pictures Schematic diagram.The defects of the present embodiment, nut to be detected was divided by detection device:Waste product, substandard products, abnormal article, certified products.Wherein, it gives up Product include:It is excessive that internal diameter is excessive or too small, upper slot opens anti-, upper groove cutting;Substandard products include:Slot is not opened, does not open internal thread;It is abnormal Product include:Outer groove discrepancy of quantity, turned upside down, overlap joint.
As shown in figure 3, the nut defect detecting device 10 of the present embodiment, including:Transmission equipment 110, vision collecting unit 120 (including optoelectronic switch 121 and are respectively arranged at the surface, side and the camera of oblique upper three of transmission equipment 110 122-124), image detecting element 130, nut taxon 140 (PLC controller 141, the mechanical pushing hands of 142, three, motor 143-145, three nut storing apparatus 146-148).As shown in figure 4, when taking pictures, three cameras 122,123 and 124 are distinguished Positioned at surface, side and the oblique upper of nut 20 to be detected.
Wherein, transmission equipment 110 is used to place and convey nut 20 to be detected;Each nut 20 to be detected is independent and horizontal It is placed on transmission equipment 120;Optoelectronic switch 121, for when detecting that nut 20 to be detected enters target area, in triggering It states three cameras and is carried out at the same time and take pictures;Three cameras be respectively used to shoot the overhead view image of nut 20 to be detected, side elevation image and Oblique-view image;Overhead view image, side elevation image and oblique-view image of the image detecting element 130 captured by for three cameras of reception, And based on the nut defect inspection method recited above based on machine vision, defects detection is carried out to nut 20 to be detected;Spiral shell Female taxon 140 is used for the testing result according to the defects of image detecting element 130, classifies to nut to be detected;PLC is controlled Device 141 processed, for receiving the testing result that image detecting element 130 is sent, and control motor 142 acts according to testing result; Motor 142 drives any one in three mechanical pushing hands 143-145 every time according to the instruction of PLC controller 141;Three spiral shells Female storing apparatus 146-148 is respectively used to accommodate waste product, substandard products and abnormal article;Three mechanical pushing hands 143-145 respectively with three Nut storing apparatus 146-148 is corresponded, waste product, substandard products or the exception for terminating current detection under the driving of motor 142 Product are pushed into corresponding nut storing apparatus, and normal nut, which then continues to stay on transmission equipment, is transported to next link.
In the present embodiment, nut is divided by nut taxon 140:Substandard products, waste product, abnormal article and certified products;
Wherein, substandard products include:Slot is not opened and does not open the nut of internal thread;Waste product includes:Internal diameter is excessive or too small, upper slot Open the excessive nut of anti-and upper groove cutting;Abnormal article includes:Turned upside down, outer groove discrepancy of quantity and there are problems that overlap joint Nut;Certified products are the satisfactory nut of testing result (namely there is no the nuts of the above problem or defect).
The nut defect detecting device 10 of the present embodiment, further includes:White light source 150 (is not drawn into) in Fig. 3;White light source 150, For nut to be detected to be illuminated, so as to take clearly image.
Those skilled in the art should be able to recognize that, each exemplary side described with reference to the embodiments described herein Method step can realize with the combination of electronic hardware, computer software or the two, in order to clearly demonstrate electronic hardware and The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These Function is performed actually with electronic hardware or software mode, specific application and design constraint depending on technical solution. Those skilled in the art can realize described function to each specific application using distinct methods, but this reality Now it is not considered that beyond the scope of this invention.
So far, it has been combined preferred embodiment shown in the drawings and describes technical scheme of the present invention, still, this field Technical staff is it is easily understood that protection scope of the present invention is expressly not limited to these specific embodiments.Without departing from this Under the premise of the principle of invention, those skilled in the art can make the relevant technologies feature equivalent change or replacement, these Technical solution after changing or replacing it is fallen within protection scope of the present invention.

Claims (19)

1. a kind of nut defect inspection method based on machine vision, which is characterized in that include the following steps:
Overhead view image, side elevation image and the oblique-view image of nut to be detected are obtained respectively;
Binary conversion treatment is carried out to the overhead view image;The characteristic parameter of the overhead view image after binaryzation is extracted, and will be carried The characteristic parameter for the overhead view image got is compared with preset overhead view image characteristic parameter, judges that nut to be detected is No existing defects;
Binary conversion treatment is carried out to the side elevation image;The characteristic parameter of the side elevation image after binaryzation is extracted, and will be carried The characteristic parameter for the side elevation image got is compared with preset side elevation image characteristic parameter, judges that nut to be detected is No existing defects;
Binary conversion treatment is carried out to the oblique-view image;The characteristic parameter of the oblique-view image after binaryzation is extracted, and will be carried The characteristic parameter for the oblique-view image got is compared with preset oblique-view image characteristic parameter, judges that nut to be detected is No existing defects;
The overhead view image, the side elevation image and the oblique-view image, for when nut is horizontal positioned, respectively from nut just Image captured by top, side and oblique upper.
2. nut defect inspection method according to claim 1, which is characterized in that " two-value is carried out to the overhead view image Change is handled ", including:
The overhead view image is converted into gray level image, the noise after gray processing is eliminated by gaussian filtering;
It is operated by self-adaption binaryzation and the overhead view image after noise reduction is converted into bianry image;
Closed operation is carried out to bianry image, the noise in rejection image.
3. nut defect inspection method according to claim 1, which is characterized in that " two-value is carried out to the side elevation image Change is handled ", including:
Gray processing and histogram equalization are carried out to the side elevation image, enhance the contrast of the side elevation image;Pass through Gauss The noise after gray processing is eliminated in filtering;
Binaryzation carries out image by OTSU Adaptive Thresholdings, prospect is the low gray value region in image;
Closed operation is carried out to bianry image, the noise in rejection image.
4. nut defect inspection method according to claim 1, which is characterized in that " two-value is carried out to the oblique-view image Change is handled ", including:
Gray processing and histogram equalization are carried out to the oblique-view image, enhance the contrast of the oblique-view image;Pass through Gauss The noise after gray processing is eliminated in filtering;
Binaryzation carries out image by OTSU Adaptive Thresholdings, prospect is the high gray value region in image;
Closed operation is carried out to bianry image, the noise in rejection image.
5. nut defect inspection method according to claim 2, which is characterized in that
The preset overhead view image characteristic parameter, including:Preset nut inner circle maximum radius value and preset nut inner circle Least radius value;
" characteristic parameter of the overhead view image after extraction binaryzation, and the characteristic parameter of the overhead view image that will be extracted It is compared with preset overhead view image characteristic parameter, judges that nut to be detected whether there is defect ", including:
According to the overhead view image after binaryzation, the radius value of nut inner circle in the image is extracted;
The radius value of nut inner circle described in the image by extraction, respectively with preset nut inner circle maximum radius value and default Nut inner circle least radius value be compared, judge nut to be detected with the presence or absence of internal diameter it is excessive or too small the defects of.
6. nut defect inspection method according to claim 5, which is characterized in that " according to the vertical view after binaryzation Image extracts the radius value of nut inner circle in the image ", including:
According to the overhead view image after binaryzation, the point being located in nut inner circle of predetermined number is found;
Perpendicular bisector based on the upper any two points of circle crosses the property in the center of circle, the intersection point of two perpendicular bisectors is obtained, as circle Heart candidate point;It repeats, obtains the center of circle candidate point of preset quantity;
The center of circle candidate point that peels off is abandoned, the position mean of the remaining center of circle candidate point is obtained, as detecting Central coordinate of circle;
According to the central coordinate of circle detected and the point being located in nut inner circle of the predetermined number found, difference The distance between each point on the central coordinate of circle detected described in calculating and the nut inner circle found, and being averaged for the distance is obtained Value, as the radius value of the nut inner circle extracted.
7. nut defect inspection method according to claim 3, which is characterized in that
The preset side elevation image characteristic parameter, including:Preset image left edge region, preset image right hand edge area The ratio between domain, preset right boundary distance and picture traverse;
" characteristic parameter of the side elevation image after extraction binaryzation, and the characteristic parameter of the side elevation image that will be extracted It is compared with preset side elevation image characteristic parameter, judges that nut to be detected whether there is defect ", including:
According to the side elevation image after binaryzation, the position of nut in the picture is determined;
Judge that nut to be detected whether there is situation about being overlapped with other nuts;
Wherein,
It is described to judge that nut to be detected whether there is situation about being overlapped with other nuts, specially:
The position of left and right boundary in the picture is extracted respectively, and right according to preset image left edge region and preset image Fringe region, judges whether left margin is located at the preset image left edge region respectively, and it is described pre- whether right margin is located at If image right hand edge region;
If left margin is located at the preset image left edge region or right margin is located at the preset image right hand edge region, The ratio of the distance between right boundary and picture traverse is then calculated, and judges whether the ratio is more than preset right boundary The ratio between distance and picture traverse;If so, think that nut to be detected there is a situation where to overlap with other nuts.
8. nut defect inspection method according to claim 7, which is characterized in that " according to the side view after binaryzation Image determines the position of nut in the picture ", including:
The foreground pixel point number per a line in the side elevation image after binaryzation is counted, obtains row projection vector;
The foreground pixel point number of each row in the side elevation image after binaryzation is counted, obtains row projection vector;
Pixel value transition position in the row projection vector, pixel value transition position in the row projection vector are searched respectively, into And determine the specific location of nut to be detected in the picture.
9. nut defect inspection method according to claim 4, which is characterized in that
The preset oblique-view image characteristic parameter, including:Preset white pixel accounting third threshold value;
" characteristic parameter of the oblique-view image after extraction binaryzation, and the characteristic parameter of the oblique-view image that will be extracted It is compared with preset oblique-view image characteristic parameter, judges that nut to be detected whether there is defect ", including:
According to the oblique-view image after binaryzation, calculate internal thread white pixel in the image area accounting;
If the internal thread in the image area white pixel accounting be less than the preset white pixel accounting third threshold Value, then it is assumed that nut to be detected does not open internal thread.
10. nut defect inspection method according to claim 9, which is characterized in that " according to the strabismus after binaryzation Image, calculate the internal thread white pixel in the image area accounting ", including:
According to the oblique-view image after binaryzation, the position of nut in the picture is determined;
According to the relative position of position and preset internal thread in nut of nut in the picture, interception internal thread place Image-region;
Closed operation is carried out to image-region where the internal thread of interception, eliminates noise spot;
Calculate respectively the internal thread the number of pixel total number and white pixel in the image area, and then calculate described white Ratio between the number of color pixel and the pixel total number, obtain the internal thread white pixel in the image area Accounting.
11. nut defect inspection method according to claim 10, which is characterized in that " according to described oblique after binaryzation Visible image determines the position of nut in the picture ", including:
The foreground pixel point number per a line in the oblique-view image after binaryzation is counted, obtains row projection vector;
The foreground pixel point number of each row in the oblique-view image after binaryzation is counted, obtains row projection vector;
Pixel value transition position in the row projection vector, pixel value transition position in the row projection vector are searched respectively, into And determine the specific location of nut to be detected in the picture.
12. nut defect inspection method according to claim 5, which is characterized in that
If the internal diameter of qualified nut bottom end is more than the internal diameter on top, and top is provided with multiple upper slots, then the preset vertical view As characteristic parameter, further include:Preset semidiameter threshold value and preset radius increment l1、l2, and l2<l1
After " judging the defects of nut to be detected is excessive or too small with the presence or absence of internal diameter ", further include:
If nut to be detected there are internal diameter it is excessive the defects of, further judge nut to be detected whether turned upside down;On described Lower inversion is that the downward bottom end in nut top to be detected is upward, horizontal positioned;
Wherein,
It is described judge nut to be detected whether turned upside down, specially:
Calculate the difference between the radius value r for the nut inner circle extracted and the preset nut inner circle radius value;
If the difference being calculated is more than the preset semidiameter threshold value, one is taken on the overhead view image after binarization A radius value is in [r, r+l1] in the range of annular region, the annular region is enabled to include the pixel of entire nut;
Connected domain analysis is carried out to the annular region, if at least there are a prospect connected domain, and the prospect connected domain is simultaneously Meet following two conditions:
Pixel in the prospect connected domain is occurred in four quadrants of nut;
Distance in the prospect connected domain between all foreground pixel points and the center of circle is both greater than r+l2
Then think the nut turned upside down to be detected, it is otherwise excessive for internal diameter;
Four quadrants of the nut, refer to the upper left for carrying out horizontal and vertical cutting to image from the center of circle and obtaining, upper right, lower-left and Four pieces of bottom right image-region.
13. nut defect inspection method according to claim 7, which is characterized in that if the circumferential direction of qualified nut is provided with outside Slot, then the preset side elevation image characteristic parameter, further includes:Preset third sectional drawing height presets sectional drawing width, is preset White pixel point quantity, preset outer groove quantity;
After " judging that nut to be detected whether there is situation about being overlapped with other nuts ", further include:
If situation about being overlapped with other nuts is not present in nut to be detected, judge nut to be detected with the presence or absence of outer groove quantity not The defects of meeting;
Wherein,
It is described to judge the defects of nut to be detected is closed with the presence or absence of outer groove discrepancy of quantity, specially:
According to the side elevation image after binaryzation, the position of left and right boundary and lower boundary in the picture is extracted;
According to the position of the left and right boundary of extraction and lower boundary in the picture, in the side elevation image before binaryzation, below Boundary is bottom, using preset third sectional drawing height as height, intercepts the region of default sectional drawing width to the right from left margin respectively, from the right side Boundary intercepts the region of default sectional drawing width to the left, obtains the image in left margin region and the image of right border area;
Binaryzation and closed operation are carried out to the two images of interception respectively;
It calculates respectively in the two images, the quantity of white pixel point in each white pixel connected region;Judge respectively each Whether the quantity of white pixel point is more than preset white pixel point quantity in white pixel connected region, if so, thinking this White pixel connected region is an outer groove;
If in the two images, the outer groove at least detected on piece image is in varying numbers when preset outer groove quantity, then Thinking nut to be detected, there are the defects of the conjunction of outer groove discrepancy of quantity.
14. nut defect inspection method according to claim 13, which is characterized in that
If the top of qualified nut is provided with multiple upper slots, the preset side elevation image characteristic parameter further includes:Preset One sectional drawing height, preset white pixel accounting first threshold, preset white pixel accounting second threshold;
After " judging the defects of nut to be detected is closed with the presence or absence of outer groove discrepancy of quantity ", further include:
If the defects of nut to be detected is closed there is no outer groove discrepancy of quantity, judge that nut to be detected whether there is upper groove cutting mistake The defects of spending;
Wherein,
It is described to judge that nut to be detected whether there is the defects of upper groove cutting is excessive, specially:
According to the side elevation image after binaryzation, the position of the left and right boundary and coboundary of nut in the picture is extracted;
Using the left and right boundary of the nut of extraction as two sides, using coboundary as top margin, preset first sectional drawing is intercepted from top to bottom Highly, truncated picture region is obtained;
In truncated picture region, the quantity of white pixel point in each white pixel connected region is calculated respectively;Sentence respectively Whether the quantity of white pixel point is more than preset white pixel point quantity in each white pixel connected region of breaking, if so, Think the white pixel connected region for a upper slot;And then calculate the quantity N of upper slot in truncated picture region;
In truncated picture region, the total number of the total number of all pixels and white pixel in the region is calculated respectively, into And the ratio between the total number of white pixel and the total number of all pixels are calculated, the accounting P as white pixel in the region;
If the upper slot number amount N and the accounting P of white pixel that calculate meet following conditions:
Then think nut to be detected there are upper groove cutting it is excessive the defects of;
Wherein, P1、P2Respectively described preset white pixel accounting first threshold, the preset white pixel accounting second Threshold value, and P1>P2
15. nut defect inspection method according to claim 1, which is characterized in that
If being provided with multiple upper slots on qualified nut, the preset overhead view image characteristic parameter, including:Preset nut inner circle Maximum radius value, preset nut inner circle least radius value and preset radius increment l3、l4, and l4<l3;It is described preset Side elevation image characteristic parameter, including:Preset second sectional drawing height and preset the 4th threshold value of white pixel accounting;
" binary conversion treatment is being carried out to the side elevation image;The characteristic parameter of the side elevation image after binaryzation is extracted, and will The characteristic parameter for the side elevation image extracted is compared with preset side elevation image characteristic parameter, judges nut to be detected With the presence or absence of defect " after, it further includes:
According to the overhead view image after binaryzation, judge that nut to be detected whether there is and do not open slot or upper slot opens anti-lack It falls into;
According to the side elevation image after binaryzation, further discriminate between nut to be checked in the presence of do not open upper slot or upper slot open it is anti- Defect;
Wherein,
" according to the overhead view image after binaryzation, judge that nut to be detected whether there is and do not open slot or upper slot opens anti-lack Fall into ", specially:
According to the overhead view image after binaryzation, the radius value r of nut inner circle in the image is extracted;
Judge whether the radius value of the nut inner circle extracted is more than the preset nut inner circle least radius value, and small In preset nut inner circle maximum radius value;If so, taken on the overhead view image after binarization a radius value [r, r+l3] in the range of annular region, the annular region is enabled to include the pixel of entire nut;
Connected domain analysis is carried out to the annular region, if at least there are a prospect connected domain, and the prospect connected domain is simultaneously Meet following two conditions:
Pixel in the prospect connected domain is occurred in four quadrants of nut;
Distance in the prospect connected domain between all foreground pixel points and the center of circle is both greater than r+l4
Then think that slot is not opened in nut presence to be detected or upper slot opens the defects of anti-;
Four quadrants of the nut, refer to the upper left for carrying out horizontal and vertical cutting to image from the center of circle and obtaining, upper right, lower-left and Four pieces of bottom right image-region;
" according to the side elevation image after binaryzation, it is to exist not open slot or upper slot is opened instead to further discriminate between nut to be checked The defects of ", specially:
According to the side elevation image after binaryzation, the position of the left and right boundary and lower boundary of nut in the picture is extracted respectively;
In the side elevation image after binarization, using the left and right boundary of the nut of extraction as two sides, using lower boundary the bottom of as Side intercepts preset second sectional drawing height, obtains truncated picture region from the bottom up;
Pixel total number and white pixel number in institute's truncated picture region are calculated, and then calculates white pixel number and pixel The ratio of total number obtains the accounting of white pixel in institute's truncated picture region;
When the accounting of gained white pixel is more than preset four threshold value of white pixel accounting, it is believed that on nut to be detected Slot is opened instead, otherwise it is assumed that nut to be detected does not open slot.
16. a kind of nut defect detecting device based on machine vision, which is characterized in that including:Transmission equipment, vision collecting list Member, image detecting element, nut taxon;
Wherein,
The transmission equipment, for placing and conveying nut to be detected;It each nut independence to be detected and lies in a horizontal plane in described On transmission equipment;
The vision collecting unit including optoelectronic switch and is respectively arranged at the surface, side and oblique upper of transmission equipment Three cameras;
The optoelectronic switch, for when detecting that nut to be detected enters target area, trigger three cameras simultaneously into Row is taken pictures;
Three cameras are respectively used to shoot overhead view image, side elevation image and the oblique-view image of nut to be detected;
Described image detection unit, for receiving overhead view image, side elevation image and oblique-view image captured by three cameras, And based on the nut defect inspection method based on machine vision described in any one of claim 1-15, to nut to be detected into Row defects detection;
The nut taxon for the testing result according to the defects of described image detection unit, carries out nut to be detected Classification.
17. nut defect detecting device according to claim 16, which is characterized in that the nut taxon is by nut It is divided into:Substandard products, waste product, abnormal article and certified products;
The substandard products, including:Slot is not opened and does not open the nut of internal thread;
The waste product, including:Internal diameter is excessive or too small, upper slot opens the excessive nut of anti-and upper groove cutting;
The abnormal article, including:Turned upside down, outer groove discrepancy of quantity and there are problems that the nut of overlap joint;
The certified products are the satisfactory nut of testing result.
18. nut defect detecting device according to claim 16, which is characterized in that further include:White light source;
The white light source, for nut to be detected to be illuminated.
19. nut defect detecting device according to claim 17, which is characterized in that the nut taxon includes: PLC, motor, three mechanical pushing hands, three nut storing apparatus;
The PLC for receiving the testing result that described image detection unit is sent, and controls motor according to the testing result Action;
The motor, three mechanical pushing hands according to the order-driven of the PLC;
Three nut storing apparatus are respectively used to accommodate waste product, substandard products and abnormal article;
Three mechanical pushing hands, correspond with three nut storing apparatus, under the driving of the motor by waste product, Substandard products or abnormal article are pushed into corresponding nut storing apparatus.
CN201711423743.XA 2017-12-25 2017-12-25 Nut defect inspection method and device based on machine vision Active CN108176608B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711423743.XA CN108176608B (en) 2017-12-25 2017-12-25 Nut defect inspection method and device based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711423743.XA CN108176608B (en) 2017-12-25 2017-12-25 Nut defect inspection method and device based on machine vision

Publications (2)

Publication Number Publication Date
CN108176608A true CN108176608A (en) 2018-06-19
CN108176608B CN108176608B (en) 2019-08-23

Family

ID=62547395

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711423743.XA Active CN108176608B (en) 2017-12-25 2017-12-25 Nut defect inspection method and device based on machine vision

Country Status (1)

Country Link
CN (1) CN108176608B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108827982A (en) * 2018-06-27 2018-11-16 重庆大学 Straddle type monorail rail tracks finger-type board defect detection method and system based on deep learning
CN109387524A (en) * 2018-12-12 2019-02-26 长安大学 Thread defect detection method and device based on linearly polarized photon
CN110335263A (en) * 2019-06-28 2019-10-15 珠海博明软件有限公司 It is a kind of to identify the measurement scheme for improving 3D difference in height computational accuracy by brightness
CN112893182A (en) * 2021-01-29 2021-06-04 珠海迪沃航空工程有限公司 Intelligent correction detection classification device and method for aircraft engine nut
CN112964736A (en) * 2021-02-04 2021-06-15 杭州富庆纸制品有限公司 Printing quality control system and method for printing machine, intelligent terminal and storage medium
CN113052809A (en) * 2021-03-18 2021-06-29 中科海拓(无锡)科技有限公司 EfficientNet-based nut surface defect classification method
CN113588654A (en) * 2021-06-24 2021-11-02 宁波大学 Three-dimensional visual detection method for engine heat exchanger interface
CN113867246A (en) * 2020-06-30 2021-12-31 北京福田康明斯发动机有限公司 Processing line mistake proofing system, processing line mistake proofing method, storage medium, electronic device and production line
CN114882028A (en) * 2022-07-08 2022-08-09 深圳市瑞祥鑫五金制品有限公司 Multi-camera-based welding terminal detection method, device and system
CN115330793A (en) * 2022-10-13 2022-11-11 济宁市兖州区恒升机械有限公司 Image processing-based quality detection method for hydraulic hard tube connecting pipe joint
CN115445953A (en) * 2022-06-28 2022-12-09 中机智能装备创新研究院(宁波)有限公司 Oil pipe good product detection method and detection device
CN115995062A (en) * 2023-03-22 2023-04-21 成都唐源电气股份有限公司 Abnormal recognition method and system for connecting net electric connection wire clamp nut
CN116645364A (en) * 2023-07-18 2023-08-25 金乡县金沪合金钢有限公司 Alloy steel casting air hole defect detection method based on image data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050011815A1 (en) * 2003-04-30 2005-01-20 Chi Cheng Jeh Apparatus for automatic nut inspection
CN101424645A (en) * 2008-11-20 2009-05-06 上海交通大学 Soldered ball surface defect detection device and method based on machine vision
CN101526484A (en) * 2009-04-13 2009-09-09 江南大学 Bearing defect detecting technique based on embedded-type machine vision
JP2013188691A (en) * 2012-03-14 2013-09-26 Shinya Fukuno Sorting apparatus for agricultural product
CN104624520A (en) * 2015-01-21 2015-05-20 秦皇岛视听机械研究所 Bare crystalline grain defect detecting equipment
CN105334228A (en) * 2015-10-15 2016-02-17 哈尔滨工程大学 Bottled liquid impurity and liquid level detection method based on image processing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050011815A1 (en) * 2003-04-30 2005-01-20 Chi Cheng Jeh Apparatus for automatic nut inspection
CN101424645A (en) * 2008-11-20 2009-05-06 上海交通大学 Soldered ball surface defect detection device and method based on machine vision
CN101526484A (en) * 2009-04-13 2009-09-09 江南大学 Bearing defect detecting technique based on embedded-type machine vision
JP2013188691A (en) * 2012-03-14 2013-09-26 Shinya Fukuno Sorting apparatus for agricultural product
CN104624520A (en) * 2015-01-21 2015-05-20 秦皇岛视听机械研究所 Bare crystalline grain defect detecting equipment
CN105334228A (en) * 2015-10-15 2016-02-17 哈尔滨工程大学 Bottled liquid impurity and liquid level detection method based on image processing

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108827982A (en) * 2018-06-27 2018-11-16 重庆大学 Straddle type monorail rail tracks finger-type board defect detection method and system based on deep learning
CN108827982B (en) * 2018-06-27 2020-12-25 重庆大学 Straddle type monorail track beam finger-shaped plate defect detection method and system based on deep learning
CN109387524A (en) * 2018-12-12 2019-02-26 长安大学 Thread defect detection method and device based on linearly polarized photon
CN110335263A (en) * 2019-06-28 2019-10-15 珠海博明软件有限公司 It is a kind of to identify the measurement scheme for improving 3D difference in height computational accuracy by brightness
CN113867246A (en) * 2020-06-30 2021-12-31 北京福田康明斯发动机有限公司 Processing line mistake proofing system, processing line mistake proofing method, storage medium, electronic device and production line
CN112893182A (en) * 2021-01-29 2021-06-04 珠海迪沃航空工程有限公司 Intelligent correction detection classification device and method for aircraft engine nut
CN112964736A (en) * 2021-02-04 2021-06-15 杭州富庆纸制品有限公司 Printing quality control system and method for printing machine, intelligent terminal and storage medium
CN113052809A (en) * 2021-03-18 2021-06-29 中科海拓(无锡)科技有限公司 EfficientNet-based nut surface defect classification method
CN113052809B (en) * 2021-03-18 2021-12-10 中科海拓(无锡)科技有限公司 EfficientNet-based nut surface defect classification method
CN113588654A (en) * 2021-06-24 2021-11-02 宁波大学 Three-dimensional visual detection method for engine heat exchanger interface
CN113588654B (en) * 2021-06-24 2024-02-02 宁波大学 Three-dimensional visual detection method for engine heat exchanger interface
CN115445953B (en) * 2022-06-28 2024-04-05 中国机械总院集团宁波智能机床研究院有限公司 Good product detection method and detection device for oil pipe
CN115445953A (en) * 2022-06-28 2022-12-09 中机智能装备创新研究院(宁波)有限公司 Oil pipe good product detection method and detection device
CN114882028A (en) * 2022-07-08 2022-08-09 深圳市瑞祥鑫五金制品有限公司 Multi-camera-based welding terminal detection method, device and system
CN115330793B (en) * 2022-10-13 2023-01-31 济宁市兖州区恒升机械有限公司 Image processing-based quality detection method for hydraulic hard tube connecting pipe joint
CN115330793A (en) * 2022-10-13 2022-11-11 济宁市兖州区恒升机械有限公司 Image processing-based quality detection method for hydraulic hard tube connecting pipe joint
CN115995062A (en) * 2023-03-22 2023-04-21 成都唐源电气股份有限公司 Abnormal recognition method and system for connecting net electric connection wire clamp nut
CN115995062B (en) * 2023-03-22 2023-08-04 西南交通大学 Abnormal recognition method and system for connecting net electric connection wire clamp nut
CN116645364A (en) * 2023-07-18 2023-08-25 金乡县金沪合金钢有限公司 Alloy steel casting air hole defect detection method based on image data
CN116645364B (en) * 2023-07-18 2023-10-27 金乡县金沪合金钢有限公司 Alloy steel casting air hole defect detection method based on image data

Also Published As

Publication number Publication date
CN108176608B (en) 2019-08-23

Similar Documents

Publication Publication Date Title
CN108176608B (en) Nut defect inspection method and device based on machine vision
CN110163853B (en) Edge defect detection method
CN104441526B (en) Mould in-service monitoring protection system and method based on appearance profile coupling
CN106251352B (en) A kind of cover defect inspection method based on image procossing
CN101696945B (en) On-line detection method of machine vision system to photovoltaic glass flaws
CN101751744B (en) Detection and early warning method of smoke
CN107705283A (en) Particle and bubble hit detection method based on Otsu image segmentation
CN104794491A (en) Fuzzy clustering steel plate surface defect detection method based on pre classification
CN101509766B (en) On-line detecting method for spring end plane angle by machine vision system
CN105469105A (en) Cigarette smoke detection method based on video monitoring
CN107966454A (en) A kind of end plug defect detecting device and detection method based on FPGA
CN109615609A (en) A kind of solder joint flaw detection method based on deep learning
CN102221559A (en) Online automatic detection method of fabric defects based on machine vision and device thereof
JP2014157119A (en) Optical granular material classifier
CN101696943B (en) On-line detection method of machine vision system to medical surgical knife flaws
CN104315977B (en) Rubber stopper quality detection device and detection method
CN110403232A (en) A kind of cigarette quality detection method based on second level algorithm
CN109389105B (en) Multitask-based iris detection and visual angle classification method
CN106780473A (en) A kind of magnet ring defect multi-vision visual detection method and system
CN102529019A (en) Method for mould detection and protection as well as part detection and picking
CN106706656A (en) Machine vision-based zipper detection device and method
CN101696877A (en) On-line detection method of machine vision system to spring verticality
CN110310275A (en) A kind of chain conveyor defect inspection method based on image procossing
CN101726265A (en) Online detection method of parallelism of spring by machine vision system
CN106872473A (en) A kind of potato defects detection identifying system design based on machine vision

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