CN1749740A - Method for detecting foreign body in food - Google Patents

Method for detecting foreign body in food Download PDF

Info

Publication number
CN1749740A
CN1749740A CN 200410077816 CN200410077816A CN1749740A CN 1749740 A CN1749740 A CN 1749740A CN 200410077816 CN200410077816 CN 200410077816 CN 200410077816 A CN200410077816 A CN 200410077816A CN 1749740 A CN1749740 A CN 1749740A
Authority
CN
China
Prior art keywords
image
food
peak
foreign matter
pixel
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
CN 200410077816
Other languages
Chinese (zh)
Other versions
CN100472206C (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.)
China Agricultural University
Original Assignee
China Agricultural University
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 China Agricultural University filed Critical China Agricultural University
Priority to CNB2004100778160A priority Critical patent/CN100472206C/en
Publication of CN1749740A publication Critical patent/CN1749740A/en
Application granted granted Critical
Publication of CN100472206C publication Critical patent/CN100472206C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The method of detecting foreign matter in food includes: acquiring the X-ray image of the detected food, performing contrast enhancing treatment, calculating the number of peaks in line distribution curve, obtaining the structure width, obtaining the X-ray image of simulating no-foreign matter food, and image subtraction calculation to obtain the foreign matter target image. The present invention simulates normal food image by means of mathematic morphologic operation and subsequent image subtraction partition to distinguish the foreign matter target in food X-ray image fast, and is simple and suitable for on-line detection.

Description

The detection method of foreign matter in the food
Technical field
The present invention relates to the detection method of foreign matter in a kind of food, especially a kind ofly carry out calculation process, extract the detection method of sneaking into foreign matter image in the food by radioscopic image to food.
Background technology
At present, normally utilize X ray to gather the radioscopic image of this food, and then, adopt direct threshold value or adaptive threshold split plot design, extract foreign matter target image in the food radioscopic image by human intervention for the detection method of sneaking into foreign matter in the packaged food.
Because food variety is more, and the kind of the foreign matter that may sneak into, position form in food has uncertainty, this has bigger difficulty with regard to the dividing method that has caused traditional extraction foreign matter target image, especially threshold value preestablish with testing process in image extract and all to need to add too much human factor, need the testing staff to have practical experience than horn of plenty, the phenomenon that mistake is cut apart target appears easily, therefore, traditional pass through to extract the foreign matter image detection method of foreign matter in the food is not only lacked accuracy, and be not suitable for continuous on-line detection, can't satisfy the job requirements of modernized food production enterprise.
Summary of the invention
Technical matters to be solved by this invention is to provide at the existing deficiency of extracting method of foreign matter target image in the above-mentioned packaged food detection method of foreign matter in a kind of food, this method utilization mathematical morphology carries out calculation process to the radioscopic image of food, can extract the foreign matter target image easily.
Solving the problems of the technologies described above the technical scheme that is adopted is the detection method of foreign matter in a kind of food, and it is made up of following steps:
Step 1: the radioscopic image of gathering tested food;
Step 2:, obtain to strengthen image to radioscopic image degree of the comparing enhancement process of being gathered;
Step 3: the quantity of calculating the peak in the intensity profile curve that strengthens each row of image automatically; Described automatic calculating is carried out according to following method: choose any pixel one by one, and calculating two gray values of pixel points adjacent with this pixel, when described adjacent two gray values of pixel points simultaneously less than or during greater than the above-mentioned gray values of pixel points of choosing arbitrarily, this pixel of choosing is counted a peak;
Step 4: utilize the quantity at resulting peak to obtain structure width automatically; The automatic acquisition methods of described structure width is: when the quantity at peak less than 3 the time, automatically described structure width is made as 3; When the quantity at peak greater than 3 the time, at first calculate the element width of all place, peak pixels; Then with the element width of maximum as described structure width;
Step 5: utilize described structure width to carry out morphology operations, obtain the no foreign matter radioscopic image of the tested food of simulation;
Step 6: the image after handling in the analog image that step 5 is obtained and the step 2 carries out the image subtraction computing, obtains foreign matter target image in the food, finishes foreign matter detection in the food.
As can be seen from the above technical solutions, the present invention simulates normal food by the computing of adopting mathematical morphology--and promptly there is not the image of the food of foreign matter in inside, and then cuts apart by the Photographic Subtraction mode, thereby obtains interested foreign matter target image.The present invention has overcome the Flame Image Process, extraction difficulty and the mistake that exist in traditional food foreign matter detecting method and has cut apart the deficiency of target, and will obtain good effect.
Beneficial effect of the present invention is, can discern the foreign matter target in the food radioscopic image apace, and disposal route is simple, can be applicable to online detection, also can be applicable to the interesting target identification and the extraction of other image processing field.
Below, also the present invention is described in further detail in conjunction with the accompanying drawings by embodiment.
Description of drawings
Fig. 1 is a schematic flow sheet of the present invention;
Fig. 2 is the grey scale curve of an image line in the specific embodiment involved in the present invention.
Embodiment
When utilizing method provided by the present invention that the food that may be mixed with metallic foreign body is detected, its process flow process as shown in Figure 1, its process is as follows:
Step 1: the radioscopic image of gathering tested food.
With packaged food to be detected with certain uniform motion by detecting device, settings detector resolution is 0.5mm * 0.5mm, when packaged food to be detected be in detecting device directly in the 0.5mm width range, it is by partly being scanned into picture.At this moment, be T the integral time of X-ray scanning Int, the detector pixel resolution width is S Pixel, scanning times position N s, conveyer belt velocity potential V s, the relational expression that exists between each parameter is:
T int = S pixel × N s / V s
In this gatherer process, adopt line by line the method for averaging after the repeatedly scanning to obtain the noise reduction sound radioscopic image of tested food.
Step 2:, obtain to strengthen image to radioscopic image degree of the comparing enhancement process of gathering.
The contrast of radioscopic image strengthens and can carry out than the degree enhancement process according to following formula:
g ( x , y ) = Gb - Ga ln Fb - ln Fa [ ln f ( x , y ) ] + Ga
Wherein: (x y) is the gray scale after the conversion to g; (x y) is the gray-scale value before the conversion to f, and Gb, Ga are respectively gray scale maximal value and the minimum value after the conversion, and Fb, Fa are gray scale maximal value and minimum value before the conversion.
Step 3: the quantity of calculating the peak in the intensity profile curve that strengthens each row of image automatically.Because metallic foreign body is bigger to stopping of X ray, it is inhomogeneous to cause the intensity profile of image line to present, the curved shape of its intensity profile.In curve, there are a plurality of peaks.The account form at peak is: choose any pixel one by one, and calculating two gray values of pixel points adjacent with this pixel, when adjacent two gray values of pixel points simultaneously less than or during greater than the above-mentioned gray values of pixel points of choosing arbitrarily, this pixel of choosing is counted a peak.
Figure 2 shows that the intensity profile curve of certain delegation in the radioscopic image, as can be seen from the figure have 4 peaks, all simultaneously less than this gray values of pixel points, therefore, the quantity at this image line peak is 4 to adjacent two gray values of pixel points of each place, peak pixel.
Step 4: the quantity according to the peak that obtains is obtained structure width automatically.
The automatic acquisition methods of structure width is: when the quantity at peak less than 3 the time, automatically described structure width is made as 3; When the quantity at peak greater than 3 the time, at first calculate the element width of all place, peak pixels according to following formula:
Width(i,k)=|m-k|,if|Peak(i,m)-f(i,k)|<ε
Wherein, (i is that (i m) locates nearest pixel apart from the pixel Peak of place, peak k) to f;
ε is one and levels off to 0 numeral;
(i k) is the element width of this peak pixel to Width.
After finishing calculating, with the element width of maximum as described structure width.
Step 5: utilize described structure width to carry out morphology operations, obtain the no foreign matter radioscopic image of the tested food of simulation.
Step 6: the image in the analog image that step 4 is obtained and the step 2 after the processing carries out the image subtraction computing, and cut apart and obtain foreign matter target image in the accurate food according to the image that prior preset threshold obtains after to additive operation, finish that foreign matter detects in the food.
Because X ray is to the penetration capacity difference of different foreign matters, therefore, the peak in the capable intensity profile curve of image can present crest or trough.In figure line, show as the recessed of the epirelief of curve or curve.When utilizing morphology operations to handle, the structure opening operation can be removed the part of grey scale curve epirelief and keep recessed part, and closed operation is just in time opposite with opening operation.
Comprise structure closed operation or structure opening operation for eliminating the morphology operations that crest or trough adopt.
The structure closed operation is obtained by the expansion post-etching computing of mathematical morphology elder generation, and its arithmetic expression is:
Dilation operation is according to formula [f g s] (x)=max (f (i-v) ... f (i) ... f (f+v)) carry out;
Erosion operation is according to formula [f Θ g s] (x)=min (f (i-v) ... f (i) ... f (i+v)) carries out;
The structure opening operation is: [f Θ g s g] (x).
In above-mentioned each arithmetic expression, v is a structure width, and i is computing central pixel point position.
The metal of sneaking in the food shows as concave portion usually in grey scale curve, so thereby the utilization structure opening operation keeps epirelief partly to be removed concave portion and simulate normal picture.
If sneak into the foreign matter of plastics and so on density much smaller than food density in the food, then the food image that does not contain foreign matter is simulated in the utilization structure closed operation.
The calculating process of above-mentioned Flame Image Process is to carry out automatic calculation process by computing machine fully, when beginning to detect, only need the artificial foreign matter project that detects as required to preestablish calculating parameter and threshold value, just can realize whole robotizations of whole testing process.
It should be noted last that: above embodiment is the unrestricted technical scheme of the present invention in order to explanation only, although the present invention is had been described in detail with reference to the foregoing description, those of ordinary skill in the art is to be understood that: still can make amendment or be equal to replacement the present invention, and not breaking away from any modification or partial replacement of the spirit and scope of the present invention, it all should be encompassed in the middle of the claim scope of the present invention.

Claims (6)

1, the detection method of foreign matter in a kind of food is characterized in that may further comprise the steps:
Step 1: the radioscopic image of gathering tested food;
Step 2:, obtain to strengthen image to radioscopic image degree of the comparing enhancement process of being gathered;
Step 3: the quantity of calculating the peak in the intensity profile curve that strengthens each row of image automatically; Described automatic calculating is carried out according to following method: choose any pixel one by one, and calculating two gray values of pixel points adjacent with this pixel, when described adjacent two gray values of pixel points simultaneously less than or during greater than the above-mentioned gray values of pixel points of choosing arbitrarily, this pixel of choosing is counted a peak;
Step 4: utilize the quantity at the described peak that calculates automatically to obtain structure width automatically; The automatic acquisition methods of described structure width is: when the quantity at peak less than 3 the time, automatically described structure width is made as 3; When the quantity at peak greater than 3 the time, at first calculate the element width of all place, peak pixels according to following formula:
Width(i,k)=|m-k|,if|Peak(i,m)-f(i,k)|<ε
Wherein, (i is that (i m) locates nearest pixel, and ε is one and levels off to 0 numeral, and (i k) is the element width of this peak pixel to Width apart from the pixel Peak of place, peak k) to f; Then with the element width of maximum as described structure width;
Step 5: utilize described structure width to carry out morphology operations, obtain the no foreign matter radioscopic image of the tested food of simulation;
Step 6: the image after handling in the analog image that step 5 is obtained and the step 2 carries out the image subtraction computing, obtains foreign matter target image in the food, finishes foreign matter detection in the food.
2, method according to claim 1 is characterized in that: described step 1 is to adopt line by line the method for averaging after the repeatedly scanning to obtain the noise reduction sound radioscopic image of tested food.
3, method according to claim 1 is characterized in that: described step 2 is carried out than the degree enhancement process according to following formula:
g ( x , y ) = Gb - Ga ln Fb - ln Fa [ ln f ( x , y ) ] + Ga
Wherein: (x y) is the gray scale after the conversion to g; (x y) is the gray-scale value before the conversion to f, and Gb, Ga are respectively gray scale maximal value and the minimum value after the conversion, and Fb, Fa are gray scale maximal value and minimum value before the conversion.
4, according to claim 1 or 2 or 3 described methods, it is characterized in that: the peak in the described step 4 is crest or the trough that is presented in the intensity profile curve.
5, method according to claim 1 is characterized in that: the morphology operations of described step 5 is structure closed operation or structure opening operation; Described structure closed operation is obtained by the expansion post-etching computing of mathematical morphology elder generation,
Dilation operation is according to formula [f g s] (x)=max (f (i-v) ... f (i) ... f (i+v)) carry out;
Erosion operation is according to formula [f Θ g s] (x)=min (f (i-v) ... f (i) ... f (i+v)) carry out;
Described structure opening operation is: [f Θ g s g] (x)
In above-mentioned each arithmetic expression, v is a structure width, and i is the position of computing central pixel point.
6, according to claim 1 or 2 or 3 or 5 described methods, it is characterized in that: have additional also in the described step 6 that the image that obtains after to additive operation according to prior preset threshold is cut apart and the step that obtains foreign matter target image in the accurate food.
CNB2004100778160A 2004-09-15 2004-09-15 Method for detecting foreign body in food Expired - Fee Related CN100472206C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2004100778160A CN100472206C (en) 2004-09-15 2004-09-15 Method for detecting foreign body in food

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2004100778160A CN100472206C (en) 2004-09-15 2004-09-15 Method for detecting foreign body in food

Publications (2)

Publication Number Publication Date
CN1749740A true CN1749740A (en) 2006-03-22
CN100472206C CN100472206C (en) 2009-03-25

Family

ID=36605305

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2004100778160A Expired - Fee Related CN100472206C (en) 2004-09-15 2004-09-15 Method for detecting foreign body in food

Country Status (1)

Country Link
CN (1) CN100472206C (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101435783B (en) * 2007-11-15 2011-01-26 同方威视技术股份有限公司 Method and apparatus for recognizing substance
CN101655466B (en) * 2009-09-22 2011-10-26 江苏联众肠衣有限公司 Foreign-matter on-line detecting instrument
CN101675457B (en) * 2007-05-14 2012-05-30 伊利诺斯工具制品有限公司 X-ray imaging
CN104568956A (en) * 2013-10-12 2015-04-29 上海掌迪自动化科技有限公司 Machine vision based detection method for strip steel surface defects
CN105403675A (en) * 2014-09-15 2016-03-16 南京农业大学 Food foreign matter detection apparatus
CN107292888B (en) * 2016-03-31 2019-11-05 合肥美亚光电技术股份有限公司 The acquisition methods of shielding area, device and detection system in determinand

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101675457B (en) * 2007-05-14 2012-05-30 伊利诺斯工具制品有限公司 X-ray imaging
US8712107B2 (en) 2007-05-14 2014-04-29 Illinois Tool Works Inc. X-ray imaging
CN101435783B (en) * 2007-11-15 2011-01-26 同方威视技术股份有限公司 Method and apparatus for recognizing substance
CN101655466B (en) * 2009-09-22 2011-10-26 江苏联众肠衣有限公司 Foreign-matter on-line detecting instrument
CN104568956A (en) * 2013-10-12 2015-04-29 上海掌迪自动化科技有限公司 Machine vision based detection method for strip steel surface defects
CN104568956B (en) * 2013-10-12 2017-06-30 上海掌迪自动化科技有限公司 The detection method of the steel strip surface defect based on machine vision
CN105403675A (en) * 2014-09-15 2016-03-16 南京农业大学 Food foreign matter detection apparatus
CN107292888B (en) * 2016-03-31 2019-11-05 合肥美亚光电技术股份有限公司 The acquisition methods of shielding area, device and detection system in determinand

Also Published As

Publication number Publication date
CN100472206C (en) 2009-03-25

Similar Documents

Publication Publication Date Title
CN115239704B (en) Accurate detection and repair method for wood surface defects
CN104867130B (en) A kind of self-adapting division method based on crack image sub-district gray average
CN110717888A (en) Automatic identification method for intravascular Optical Coherence Tomography (OCT) vessel wall inner contour
CN106683099A (en) Product surface defect detection method
CN103456021B (en) A kind of Fabric Defect detection method based on morphological analysis
CN104252709B (en) Multiple-target foreground detection method for look-down group-housed pigs in look-down state under complicated background
CN1702684A (en) Strong noise image characteristic points automatic extraction method
CN110889807B (en) Image processing method for channel type X-ray security inspection equipment
CN1749740A (en) Method for detecting foreign body in food
CN111192251A (en) Follicle ultrasonic processing method and system based on level set image segmentation
CN113989257A (en) Electric power comprehensive pipe gallery settlement crack identification method based on artificial intelligence technology
CN109410205A (en) A kind of crack extract method under complex road surface background
CN114549441A (en) Sucker defect detection method based on image processing
CN110874825B (en) Method for extracting binary image of water trace on surface of composite insulator
CN117058147A (en) Environment-friendly plastic product defect detection method based on computer vision
CN110455923B (en) Rapid evaluation method for anchor rod anchoring quality grade
CN1595957A (en) Method for determining automatic detection threshold of bad pixel of medical image
CN103942792B (en) Impurity detecting method in medicine detection robot based on time domain features of sequence images
CN113487563A (en) Photovoltaic module subfissure self-adaptive detection method based on EL image
CN112233111A (en) Tunnel gap detection method based on digital image processing
CN107578414A (en) A kind of processing method of pavement crack image
CN115270894B (en) Abnormal vibration signal extraction method for methanol generator
CN111311668A (en) Clear water concrete surface pore analysis method based on convolutional neural network
CN1719238A (en) Non destruction detection method of apple internal quality
CN110111319B (en) Pigsty ground cleanliness evaluation method based on video images

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090325

Termination date: 20110915