CN110689491B - Method for correcting side image of cheese under machine vision - Google Patents
Method for correcting side image of cheese under machine vision Download PDFInfo
- Publication number
- CN110689491B CN110689491B CN201910850919.2A CN201910850919A CN110689491B CN 110689491 B CN110689491 B CN 110689491B CN 201910850919 A CN201910850919 A CN 201910850919A CN 110689491 B CN110689491 B CN 110689491B
- Authority
- CN
- China
- Prior art keywords
- cheese
- coordinate system
- image
- point
- camera
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 235000013351 cheese Nutrition 0.000 title claims abstract description 77
- 238000000034 method Methods 0.000 title claims abstract description 21
- 239000011159 matrix material Substances 0.000 claims abstract description 37
- 230000009466 transformation Effects 0.000 claims abstract description 13
- 238000003384 imaging method Methods 0.000 claims abstract description 12
- 230000003287 optical effect Effects 0.000 claims description 9
- 238000013507 mapping Methods 0.000 claims description 7
- 230000000694 effects Effects 0.000 abstract description 3
- 238000012937 correction Methods 0.000 description 5
- 238000001514 detection method Methods 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 2
- PCTMTFRHKVHKIS-BMFZQQSSSA-N (1s,3r,4e,6e,8e,10e,12e,14e,16e,18s,19r,20r,21s,25r,27r,30r,31r,33s,35r,37s,38r)-3-[(2r,3s,4s,5s,6r)-4-amino-3,5-dihydroxy-6-methyloxan-2-yl]oxy-19,25,27,30,31,33,35,37-octahydroxy-18,20,21-trimethyl-23-oxo-22,39-dioxabicyclo[33.3.1]nonatriaconta-4,6,8,10 Chemical compound C1C=C2C[C@@H](OS(O)(=O)=O)CC[C@]2(C)[C@@H]2[C@@H]1[C@@H]1CC[C@H]([C@H](C)CCCC(C)C)[C@@]1(C)CC2.O[C@H]1[C@@H](N)[C@H](O)[C@@H](C)O[C@H]1O[C@H]1/C=C/C=C/C=C/C=C/C=C/C=C/C=C/[C@H](C)[C@@H](O)[C@@H](C)[C@H](C)OC(=O)C[C@H](O)C[C@H](O)CC[C@@H](O)[C@H](O)C[C@H](O)C[C@](O)(C[C@H](O)[C@H]2C(O)=O)O[C@H]2C1 PCTMTFRHKVHKIS-BMFZQQSSSA-N 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000003702 image correction Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000002994 raw material Substances 0.000 description 1
- 238000009987 spinning Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000004753 textile Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/80—Geometric correction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30124—Fabrics; Textile; Paper
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
The invention relates to a method for correcting a side image of a cheese under machine vision, which is characterized in that a cheese side image imaging model is established on the basis of perspective projection to obtain a cheese side image; converting point coordinates corresponding to an image coordinate system in a world coordinate system into homogeneous coordinates to obtain an internal parameter matrix and an external parameter matrix of the camera, and solving the external parameter matrix in combination with the internal parameter matrix to obtain a transformation matrix; and expressing the relation between the point on the surface of the cheese and the projection point of the image by using a homogeneous equation, solving the point coordinates in the corrected side image of the cheese according to the homogeneous equation, and resetting the gray value of each point to obtain the corrected side image of the cheese. The method for correcting the side image of the cheese under the machine vision can better correct distorted cheese images with various diameters, and has better reduction effect on the linear characteristics of the upper boundary and the lower boundary of the side image of the cheese.
Description
The technical field is as follows:
the invention belongs to the field of digital image processing, and particularly relates to a method for correcting a side image of a cheese under machine vision.
Background art:
cheese is the output of the spooling process in a spinning mill, and the quality of cheese directly affects the production of the subsequent process and finally affects the quality of textiles. Due to the limitations of production process settings, inadequate equipment cleaning and maintenance, raw material quality and other factors, the cheese may have defects and needs to be detected, and one detection method is machine vision-based detection.
When the machine vision is used for detecting the external shape of the cheese, the shot image is required to be consistent with the shape of a cheese real object, a camera model under the common condition is an ideal pinhole imaging model, and the image acquired by the camera always has certain nonlinear distortion during actual imaging, wherein the nonlinear distortion is called geometric distortion and is not beneficial to subsequent image processing. To correct for this geometric distortion, the camera needs to be calibrated, i.e. the intrinsic and extrinsic parameters of the camera are calculated. With the progress of modern technology, distortion caused by imaging system hardware is smaller and smaller, but cannot be eliminated fundamentally, in machine vision, an accurate image can improve the accuracy of a detection system, and in a generally acquired cheese side image, linear characteristic distortion of upper and lower boundaries of a cheese outline is serious, so that the cheese image needs to be corrected in the vertical direction. In view of the production requirements, the inventor proposes a correction method based on the combination of camera calibration and image information according to the perspective projection theory, and the invention is generated accordingly.
The invention content is as follows:
the invention provides a cheese side image correction method with small calculated amount and good adaptability to cheese with various diameters, aiming at the problem of distortion of cheese side images when an area-array camera shoots, and specifically adopting the following technical scheme to realize the method:
a method for correcting a side image of a cheese under machine vision comprises the following steps: establishing a cheese side image imaging model based on perspective projection to obtain a cheese side image; converting point coordinates corresponding to an image coordinate system in a world coordinate system into homogeneous coordinates to obtain an internal parameter matrix and an external parameter matrix of the camera, and solving the external parameter matrix in combination with the internal parameter matrix to obtain a transformation matrix; and expressing the relation between the point on the surface of the cheese and the projection point of the image by using a homogeneous equation, solving the point coordinates in the corrected side image of the cheese according to the homogeneous equation, and resetting the gray value of each point to obtain the corrected side image of the cheese.
Establishing a camera coordinate system, a world coordinate system and an image in the cheese side image imaging modelThe coordinate system of the camera represents the optical center of the camera by an o point, and a rectangular coordinate system is formed by an x axis, a y axis and a z axis of the optical axis of the camera; XO1Y constitutes the image coordinate system, OWIs an origin, XWYWZWForming a world coordinate system, the image coordinate system being between the camera coordinate system and the world coordinate system, Z of the world coordinate systemWThe axis is aligned with the camera optical axis z of the camera coordinate system, the cheese is located in the world coordinate system, and the X of the world coordinate systemWThe axis is parallel to the x-axis of the cheese and camera coordinate system.
The points on the surface of the cheese satisfy the following relation:
in the above formula, r is the cheese radius; the point coordinate of the Q point on the surface of the cheese in the world coordinate system is Q (X)W,YW,ZW) The homogeneous coordinate of the point Q is Q ═ X (X)W,YW,ZW)TThe mapping point Q coordinate of the point Q in the image coordinate system is Q (u, v), and the homogeneous coordinate of the mapping point Q in the image coordinate system is Q ═ u, vT,O1(u0,v0) The scale factors of the camera on the x-axis and the y-axis are f respectively as the origin of the image coordinate systemx=f/dx、fyF/dy, a point Q in the world coordinate system is projected onto the image coordinate system according to projective transformation, and is represented by equation (2):
in the above formula, M is an internal parameter matrix of the camera, H is an external parameter matrix of the camera, and T is a transformation matrix.
The internal parameter matrix is represented as: f is the focal length of the camera and,
extrinsic parameter matrices H and OOWRelated to, OOWIs determined by the following formula, d is the object distance, and d is oO1:
OOW=d+2r (4)
The transformation matrix T is:
the relationship between the points on the surface of the cheese and the projection points of the image is expressed by a homogeneous equation:
the method comprises the steps of firstly obtaining relevant fixed parameters according to an image acquisition device and calibration, then analyzing the principle of bobbin yarn image boundary straight line characteristic loss, establishing a correction model, expressing the corresponding relation of points on a bobbin yarn side image in a world coordinate system and an image coordinate system by using a homogeneous equation, and then correcting all the points in the acquired bobbin yarn side image one by one according to the homogeneous equation to obtain a corrected image. The method for correcting the side image of the cheese under the machine vision can better correct distorted cheese images with various diameters, and has better reduction effect on the linear characteristics of the upper boundary and the lower boundary of the side image of the cheese.
The invention is further illustrated by the accompanying drawings and detailed description.
Description of the drawings:
FIG. 1 is a schematic view of a side image imaging model of a cheese according to the present invention;
FIG. 2 is a schematic view of a calibration model of a yarn package surface, using point Q as an example;
FIG. 3 is a schematic side view of a yarn package before correction in an embodiment;
FIG. 4 is a schematic side view of the corrected cheese in the example.
The specific implementation mode is as follows:
the embodiment discloses a method for correcting a side image of a cheese under machine vision, which comprises the steps of establishing a side image imaging model of the cheese on the basis of perspective projection to obtain a side image of the cheese; converting point coordinates corresponding to an image coordinate system in a world coordinate system into homogeneous coordinates to obtain an internal parameter matrix and an external parameter matrix of the camera, and solving the external parameter matrix in combination with the internal parameter matrix to obtain a transformation matrix; and expressing the relation between the point on the surface of the cheese and the projection point of the image by using a homogeneous equation, solving the point coordinates in the corrected side image of the cheese according to the homogeneous equation, and resetting the gray value of each point to obtain the corrected side image of the cheese. The following detailed description is given in conjunction with the accompanying drawings:
the invention relates to a method for establishing a cheese side image imaging model by taking a perspective projection theory as a basis, wherein an imaging coordinate system of a cheese side image is established as shown in figure 1, and the coordinate system consists of a camera coordinate system, a world coordinate system and an image coordinate system. The camera coordinate system uses an o point to represent a camera optical center, and uses an x axis, a y axis and a camera optical axis z axis to form a rectangular coordinate system; XO1Y constitutes an image coordinate system; o isWIs an origin, XWYWZWA world coordinate system is formed, and the image coordinate system is between the camera coordinate system and the world coordinate system. Z of world coordinate systemWThe axis is aligned with the camera optical axis z of the camera coordinate system, f is the focal length of the camera, the cheese is located in the world coordinate system, and X of the world coordinate systemWThe axis is parallel to the x-axis of the cheese and camera coordinate system. The rectangle ABCD in fig. 1 is the effective field of view and is located in the world coordinate system where all units are pixels in the image coordinate system.
For convenience of analysis, an arc of the upper boundary of the cheese is takenAs analytical models, e.g.Shown in FIG. 2, arcAnd arcPhase mapping, in which the object distance d ═ oO1The cheese radius is r. Since the cheese is a rotating body, the points on the surface of the cheese satisfy the following relationship:
the point coordinate of the Q point on the surface of the cheese in the world coordinate system is Q (X)W,YW,ZW) The homogeneous coordinate of the point Q is Q ═ X (X)W,YW,ZW)TThe mapping point Q coordinate of the point Q in the image coordinate system is Q (u, v), and the homogeneous coordinate of the mapping point Q in the image coordinate system is Q ═ u, vT,O1(u0,v0) Being the origin of the image coordinate system, in general, a pixel in a digital camera is d in length and widthxAnd dyRectangular, the scale factors of the camera on the x-axis and the y-axis are fx=f/dx、fyF/dy, a point Q in the world coordinate system is projected onto the image coordinate system according to projective transformation, and is represented by equation (2):
in the above formula, M is an internal parameter matrix of the camera, H is an external parameter matrix of the camera, and T is a transformation matrix.
Wherein the internal parameter matrix M is represented as:
extrinsic parameter matrix H is defined by the relative positions of the camera and the world coordinate systemPosition relation determination, in this embodiment, only with OOWIn this case, the value of the radius r associated with the point q in the image coordinate system is the number of pixels having a line gray scale value of 0 at the point q. OOWIs determined by the following formula1:
OOW=d+2r (4)
The extrinsic parameter matrix H can be obtained as:
from equations (3) and (5), the transformation matrix T can be obtained as:
in summary, the relationship between the point Q on the surface of the cheese and the image projection point Q can be expressed by the following homogeneous equation:
according to the formula (7), the coordinates of all points in the corrected cheese image can be obtained, and the corrected undistorted cheese image can be obtained by resetting the gray value of each point. FIG. 3 shows the side image of the previous bobbin without correction, and it can be seen from FIG. 3 that the upper and lower boundaries of the bobbin are arcs and distortion occurs. After the correction method provided by the invention is utilized, the corrected side image of the cheese shown in the figure 4 can be obtained, and the comparison between the figure 4 and the figure 3 clearly shows that the upper and lower boundaries of the cheese in the figure 4 are straight lines, so that the invention is verified to have better straight line characteristic reduction effect.
The above embodiments are only for illustrating the technical solutions of the present invention and are not limited, and other modifications or equivalent substitutions made by the technical solutions of the present invention by the ordinary skilled person in the art are included in the scope of the claims of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims (5)
1. A method for correcting side images of cheese under machine vision is characterized by comprising the following steps: establishing a cheese side image imaging model based on perspective projection to obtain a cheese side image; converting point coordinates corresponding to an image coordinate system in a world coordinate system into homogeneous coordinates to obtain an internal parameter matrix and an external parameter matrix of the camera, and solving the external parameter matrix in combination with the internal parameter matrix to obtain a transformation matrix; and expressing the relation between the point on the surface of the cheese and the projection point of the image by using a homogeneous equation, solving the point coordinates in the corrected side image of the cheese according to the homogeneous equation, and resetting the gray value of each point to obtain the corrected side image of the cheese.
2. The method for correcting the side image of the cheese under machine vision according to claim 1, wherein: establishing a camera coordinate system, a world coordinate system and an image coordinate system in the cheese side image imaging model, wherein the camera coordinate system expresses a camera optical center by an o point, and a rectangular coordinate system is formed by an x axis, a y axis and a camera optical axis z axis; XO1Y constitutes the image coordinate system, OWIs an origin, XWYWZWForming a world coordinate system, the image coordinate system being between the camera coordinate system and the world coordinate system, Z of the world coordinate systemWThe axis is aligned with the camera optical axis z of the camera coordinate system, the cheese is located in the world coordinate system, and the X of the world coordinate systemWThe axis is parallel to the x-axis of the cheese and camera coordinate system.
3. The method for correcting the side image of the cheese under machine vision according to claim 2, wherein: the points on the surface of the cheese satisfy the following relation:
in the above formula, r is the cheese radius; bobbinThe point coordinate of the Q point on the yarn surface in the world coordinate system is Q (X)W,YW,ZW) The homogeneous coordinate of the point Q is Q ═ X (X)W,YW,ZW)TThe mapping point Q coordinate of the point Q in the image coordinate system is Q (u, v), and the homogeneous coordinate of the mapping point Q in the image coordinate system is Q ═ u, vT,O1(u0,v0) The scale factors of the camera on the x-axis and the y-axis are f respectively as the origin of the image coordinate systemx=fdx、fyF/dy, the length and width of a pixel in a digital camera are dxAnd dy rectangle, f is camera focal length, and projects a point Q in the world coordinate system onto a point Q on the image coordinate system according to projective transformation, represented by equation (2):
in the above formula, M is an internal parameter matrix of the camera, H is an external parameter matrix of the camera, and T is a transformation matrix.
4. The method for correcting the side image of the cheese under machine vision according to claim 3, wherein: the internal parameter matrix is represented as: f is the focal length of the camera and,
extrinsic parameter matrices H and OOWRelated to, OOWD is the object distance, d ═ oO1, determined by the following formula:
OOW=d+2r (4)
the transformation matrix T is:
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910794143 | 2019-08-27 | ||
CN2019107941437 | 2019-08-27 |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110689491A CN110689491A (en) | 2020-01-14 |
CN110689491B true CN110689491B (en) | 2022-03-29 |
Family
ID=69108913
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910850919.2A Active CN110689491B (en) | 2019-08-27 | 2019-09-10 | Method for correcting side image of cheese under machine vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110689491B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106120071A (en) * | 2016-08-22 | 2016-11-16 | 广东溢达纺织有限公司 | Warping dress yarn system |
CN205990491U (en) * | 2016-08-22 | 2017-03-01 | 广东溢达纺织有限公司 | Cheese grabbing device |
CN106856003A (en) * | 2016-12-31 | 2017-06-16 | 南京理工大学 | The expansion bearing calibration of shaft-like workpiece side surface defects detection image |
CN109520888A (en) * | 2018-12-29 | 2019-03-26 | 浙江理工大学 | A kind of cheese denseness on-line detection device |
-
2019
- 2019-09-10 CN CN201910850919.2A patent/CN110689491B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106120071A (en) * | 2016-08-22 | 2016-11-16 | 广东溢达纺织有限公司 | Warping dress yarn system |
CN205990491U (en) * | 2016-08-22 | 2017-03-01 | 广东溢达纺织有限公司 | Cheese grabbing device |
CN106856003A (en) * | 2016-12-31 | 2017-06-16 | 南京理工大学 | The expansion bearing calibration of shaft-like workpiece side surface defects detection image |
CN109520888A (en) * | 2018-12-29 | 2019-03-26 | 浙江理工大学 | A kind of cheese denseness on-line detection device |
Non-Patent Citations (1)
Title |
---|
"基于机器视觉的筒子纱缺陷在线检测***";牟新刚 等;《纺织学报》;20180131;第39卷(第1期);第139-145页 * |
Also Published As
Publication number | Publication date |
---|---|
CN110689491A (en) | 2020-01-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106504290B (en) | A kind of high-precision video camera dynamic calibrating method | |
CN112223285B (en) | Robot hand-eye calibration method based on combined measurement | |
US20100225666A1 (en) | Digital optical comparator | |
CN112837257B (en) | Curved surface label splicing detection method based on machine vision | |
CN106815823B (en) | Lens distortion calibration and correction method and device | |
CN106815866B (en) | Calibration method of fisheye camera, calibration system and target thereof | |
CN111243033A (en) | Method for optimizing external parameters of binocular camera | |
US20120093363A1 (en) | Image processing apparatus and image processing method | |
JP2011180084A (en) | Picked-up image processor of component mounting machine | |
CN111047633A (en) | Monocular distance measuring device | |
CN106204480A (en) | Pattern distortion antidote based on conic section and in real time apparatus for correcting | |
US20070013803A1 (en) | Pickup image processing device of electronic part mounting device and pickup image processing method | |
CN111131801B (en) | Projector correction system and method and projector | |
CN109887038B (en) | Machine vision image correction method for online detection | |
CN110689491B (en) | Method for correcting side image of cheese under machine vision | |
CN111080716A (en) | Camera calibration target based on color coding phase shift stripes and calibration point extraction method | |
CN108230400B (en) | Self-adaptive coordinate reconstruction method suitable for laser cutting machine | |
CN111179180B (en) | Image correction method and device | |
US20220182519A1 (en) | Adjustment method and measurement method | |
JP2006010613A (en) | Correcting method of image distortion | |
CN113888558A (en) | Ladle slag surface image correction method | |
CN106709885B (en) | A kind of sub-pixel distortion correction method and device | |
WO2020031980A1 (en) | Method for correcting lens marker image, correcting device, program, and recording medium | |
CN115471562A (en) | TOF module calibration method and device and electronic equipment | |
CN111047637A (en) | Monocular distance measuring device |
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 |