CN116499377A - Nondestructive detection method for backfat thickness of pig carcass - Google Patents
Nondestructive detection method for backfat thickness of pig carcass Download PDFInfo
- Publication number
- CN116499377A CN116499377A CN202310390800.8A CN202310390800A CN116499377A CN 116499377 A CN116499377 A CN 116499377A CN 202310390800 A CN202310390800 A CN 202310390800A CN 116499377 A CN116499377 A CN 116499377A
- Authority
- CN
- China
- Prior art keywords
- edge
- backfat
- image
- point
- points
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Investigating Or Analyzing Materials By The Use Of Magnetic Means (AREA)
Abstract
The invention discloses a pig carcass backfat thickness nondestructive testing method, which belongs to the technical field of pig carcass grading detection, and is based on binocular machine vision and three-dimensional reconstruction technology, through camera calibration, binocular acquisition, feature extraction, feature point matching and European reconstruction, extraction and reconstruction of two side edges of backfat are realized, the diversity problem of a backfat thickness detection area caused by different pork varieties, growth periods, segmentation forms and the like is fully considered, and the imaging characteristic and the boundary characteristic distribution characteristic of the pig carcass backfat area are fully analyzed. The nondestructive detection method for the thickness of the pig carcass backfat solves various problems in an automatic detection process, realizes nondestructive detection of the thickness of the pig carcass backfat, finally provides important technical support for automatic grading detection of the pig carcass, and has important significance for promoting development of slaughtering enterprises, stabilizing market order and promoting development of pork industry in China.
Description
Technical Field
The invention relates to the technical field of pig carcass grading detection, in particular to a pig carcass backfat thickness nondestructive detection method.
Background
With the development of economy and the increase of income, consumers are pursuing higher and higher food quality. In China, when the pig carcass is evaluated according to the national standard NY/T3380, two indexes of carcass quality and backfat thickness are mainly used as main evaluation indexes, and the carcass grade is divided into six grades from high to low through the two indexes. Pig carcass classification is mostly carried out by slaughtering and processing enterprises in China by adopting two objective indexes of carcass quality and backfat thickness, but backfat thickness measurement is limited by the problem that the position to be measured is not fixed and connective tissues are attached, so that intelligent classification is difficult. At present, most production lines of pork slaughtering and processing enterprises in China are still in the state of mixed production of semi-automatic production lines and workers, related sorting special mechanical instruments are generally required to be imported from abroad, once the special mechanical instruments are applied, a large amount of capital introduction equipment is required, and meanwhile, the existing production lines are required to be modified in a large scale and related professional talents are specially introduced for using and maintaining the equipment, so that the investment is huge, and the reliability of the created benefits is prohibitive for a plurality of enterprises. In such an industry-wide environment, most pork businesses have still selected methods of grading by manual visual and rough measurement. The manual ruler measuring method is high in subjectivity and difficult to guarantee precision, pork is directly contacted in the operation process, problems of pork pollution, measurement errors caused by squeezing of pork and the like exist, and stable and accurate backfat thickness detection is difficult to achieve. The technology related to measuring the backfat of the pig carcass in China is mostly test research carried out under a specific test environment, is difficult to meet the requirement of on-line real-time measurement, has no wide applicability and is difficult to apply to an actual pig slaughtering line, so that the nondestructive detection method for the thickness of the backfat of the pig carcass is provided.
Disclosure of Invention
The invention aims to provide a nondestructive testing method for the backfat thickness of a pig carcass, which solves the problems of accurate positioning and extraction of characteristic points of a region to be tested of the backfat of the pig carcass and intelligent accurate measurement of the backfat thickness of a specific position, and realizes high-precision rapid nondestructive testing of the backfat thickness required by grading of the pig carcass.
In order to achieve the above purpose, the invention provides a nondestructive testing method for the backfat thickness of a pig carcass, which comprises the following steps:
step one: performing spectral imaging characteristic analysis on pork skin, lean meat, bones, fascia and fat meat near the backfat position to be detected by using a hyperspectral instrument;
step two: image acquisition is carried out on the binary cross section of the pig carcass, pretreatment is carried out on the acquired left image and right image, and self-adaptive threshold segmentation, morphological treatment, image binarization and contour feature edge extraction are carried out on the images;
identifying the images, positioning seventh rib points on the left image and the right image through the terminal of the sternum, which are respectively L a 、R a The method comprises the steps of (1) obtaining coordinates of corresponding points, providing a left-right image differential feature extraction scheme for extracting backfat edge point line features from a left image L and backfat edge two-line features from a right image R, and carrying out region extraction and storage on feature information on backfat edges;
step three: on the basis of extracting the edge characteristic points of the left image and the right image, the edge characteristic points of the right side edge on the left image and the right image are distributed in a two-dimensional curve, the upper boundary and the lower boundary of the ROI area are rapidly determined by judging the curvature of the right side edge curve of the image, namely, the numerical value of the number n of the upper and lower search characteristic points along the edge line is determined by judging the curvature of the right side edge curve of the image, and the ROI area is positioned;
step four: on the basis of completing extraction of the backfat edges of the left and right images and determining the range of the ROI region, for each point on the extracted edge line, obtaining the change of gray values at two sides of each point on the edge line through calculation, obtaining a gray value change curve of the measuring line domain in the horizontal direction through measuring the gray value change of the line domain in the horizontal direction, and using a first order derivative formula on the gray value change curve:
when the maximum change rate of the curve is found out and the difference between the maximum value and the minimum value in the monotonic interval is larger than 60, on the gray value change curve, the maximum derivative is the boundary of different components near backfat to be measured in the horizontal direction, so that the accurate transverse coordinates of the left edge key characteristic point and the right edge key characteristic point on the image are obtained, the single-point search result of the positioning completion result on the left edge of the carcass backfat of the left image is taken as a reconstruction positioning standard, a plurality of discrete points of the left edge are searched on the right image in order to ensure the matching precision of the single point of the left edge in the subsequent stereo matching process, and the three-dimensional coordinate information of the left edge characteristic point of the carcass is determined by comparing the cost value between the single characteristic point of the left edge of the left image and the plurality of characteristic points of the left edge of the right image and reserving the point with the highest matching precision in the left edge characteristic point of the right image and discarding the rest points;
step five: on the basis of accurately positioning the edge characteristics of the left image and the right image backfat, carrying out three-dimensional matching and three-dimensional reconstruction on the edges of the image backfat, and carrying out corresponding characteristic point matching by adopting limit constraint matching because key characteristic points are longitudinally distributed, reconstructing the dot line characteristics of the backfat of the pig carcass by adopting an European reconstruction method, and finally realizing three-dimensional information reconstruction of characteristic points and lines on the two edges of the backfat;
step six: on the basis of completing three-dimensional information reconstruction of backfat edge discrete feature points, determining that the left edge key feature point coordinate is L k (X, Y, Z), since the space positions of a plurality of edge points of the right edge are in three-dimensional discrete distribution, performing straight line fitting on the right edge point to obtain a three-dimensional straight line equation:
ax+by+cz+d=0
wherein a, b, c, d are constants describing the slope, direction and distance from the origin of the fitted line, defining the right edge line as line m, if line m fits goodness R 2 ≥0.5(R 2 Is a dimensionless coefficient, has a definite value range (0-1), and has the following formula:
in the above, R 2 The closer to 1, the better the effect of the model fit, R 2 The closer to 0, the worse the model fitting effect, the smaller the fluctuation of the straight line fitting of the edge points is, the spatial position of the characteristic point of the right edge is close to the straight line distribution, and any point P (X) on the fitting straight line m is taken 1 ,Y 1 ,Z 1 ) The backfat thickness result is calculated as follows:
S 0 is a unit vector in the same direction as the fitting straight line m; if the straight line m fits goodness R 2 If the value is less than 0.5, the fact that the straight line fitting fluctuation of the edge points is large is indicated, the spatial positions of the characteristic points of the right edge are irregularly distributed, and the coordinates of any characteristic point on the right edge line are defined as (X) t ,Y t ,Z t ) T epsilon (k-n, k+n), the backfat thickness result is calculated as follows:
in the above formula, the backfat thickness is d.
Preferably, in the first step, spectral imaging characteristic analysis is performed on different component parts near the backfat position to be measured by using a hyperspectral instrument, a hyperspectral reflection characteristic curve of a corresponding region is obtained, and an illumination model with a proper wavelength is selected by analyzing a reflection characteristic difference band interval of the hyperspectral reflection characteristic curve.
Preferably, the image acquisition in the second step is specifically to acquire images by binocular synchronization.
Preferably, the feature searching method in the second step specifically includes the following steps:
based on the edge extraction result of the left image after the image preprocessing, the backfat thickness is used for measuring the position L a Locating coordinates as an origin, searching horizontally to the right, and selecting a first point with a value of 1 as a left edge key feature L of a left image K And extracting the coordinates thereof;
the second point with the value of 1 is a point Lr of the key feature of the right edge of the left image k And searching n points along the edge line of the point by using the searched point as the origin, and storing to obtain the right and left edge key features (Lr) k-n --Lr k+n ) Extracting and storing;
based on the edge extraction result after the image preprocessing of the right image, the position R to be measured of backfat thickness is used a The positioning coordinate is the origin point and is searched horizontally to the right, and the first point with the value of 1 is the key feature Rl of the left edge of the right image K Searching n points along the upper and lower edge line of the point, and storing to obtain the key feature (Rl) of the left edge of the right image K-n --Rl K+n ) Extracting and storing;
the right edge feature extraction method is the same as that of the left edge, the coordinates of the position to be detected are used as the origin to search horizontally to the right, and the second point with the value of 1 is a point Rr of the right edge key feature of the right image K Edge of the flangeN points are searched for and stored on and off the edge line where the point is located, and the right edge key feature (Rr) of the right image is obtained k-n --Rr K+n ) And extracting and storing.
Preferably, in the third step, the step of determining the ROI area is specifically as follows:
the left and right images are respectively arranged at the position L to be measured a 、R a Establishing a plane rectangular coordinate system for an origin;
by performing two-dimensional curve fitting on a plurality of edge feature points of the right edge of the left image, a curve equation y=f (x) is obtained, and a formula for calculating the curvature of the right edge fitting curve is as follows:
the ROI area is rapidly determined through the calculated curve curvature:
when the right edge curve curvature calculation result K<When the threshold T is smaller, it indicates that the bending degree of the edge curve is not large, and the position L to be measured can be taken a The right edge point of the horizontal search searches up and down along the edge line where the point is locatedThe region where the points are located is taken as an ROI region, and the positioning of the longitudinal ROI region is reduced;
when the right edge curve curvature calculation result K>When the threshold T is larger, the edge curve bending degree is larger, and the position L to be measured is taken a And the right edge point of the horizontal search is used as an ROI area for searching the area where n points are located along the edge line where the right edge point is located, and the positioning of the longitudinal ROI area is determined.
Preferably, the limit constraint matching in the fifth step is implemented to constrain the search range of the matching points from the two-dimensional plane of the whole image to a transverse one-dimensional straight line obtained by a calibration matrix
Therefore, the nondestructive detection method for the backfat thickness of the pig carcass with the structure has the following beneficial effects:
(1) And the hyperspectral instrument is used for carrying out spectral characteristic imaging analysis on the region near the backfat of the pig carcass, and the backfat region to be detected is distinguished from the nearby skin, lean meat, bone and connective tissue by designing a proper illumination model, so that the interference of other components on backfat measurement results is reduced, and the accuracy of the measurement results is improved.
(2) In order to effectively avoid the problem that the accuracy of the detection result of the backfat thickness of the final pig carcass is low due to inaccurate three-dimensional reconstruction information caused by slight shaking of the carcass, the binocular synchronous acquisition image is adopted, and the binocular stereoscopic vision detection technology has the advantages of synchronous binocular acquisition information, high three-dimensional information reconstruction and detection accuracy and the like. In order to solve the problem of inaccurate matching of subsequent left and right images caused by too few edge extraction points of the left and right images, ensure the matching precision of the edge features extracted on the left and right images, and solve the problem of reduced measurement precision caused by hanging and tilting of pig carcasses, a left and right image differential feature extraction scheme is provided, wherein the left image L extracts backfat edge dotted line features and the right image R extracts backfat edge two-line features.
(3) And the longitudinal search width of the backfat ROI to be detected is rapidly determined through calculation and judgment of the edge curvature of the preliminary extraction, so that the detection efficiency is greatly improved.
(4) In the determined ROI area, the edges on two sides of the backfat are extracted, and the characteristics of gray value change curves in the horizontal direction of the characteristic points on the edges are combined to accurately finish the positioning of the edge characteristic points, so that the subsequent matching reconstruction work is more accurate, and the error is reduced.
(5) On the basis of accurately positioning the edge characteristics of the backfat of the left image and the backfat of the right image, because key characteristic points are longitudinally distributed, limit constraint matching is adopted, the search range of the matching points is constrained from the two-dimensional plane of the whole image to a transverse one-dimensional straight line obtained by a calibration matrix, the number of points to be matched is reduced, the matching efficiency is greatly improved, after the characteristic point matching is finished, the dot line characteristics of the backfat of the pig carcass are reconstructed by adopting an European reconstruction method, and the three-dimensional information reconstruction of the characteristic points and the lines of the two edges of the backfat is accurately realized.
(6) On the basis of matching and reconstructing three-dimensional information of characteristic discrete points, a three-dimensional curve equation is obtained by curve fitting the right edge points of three-dimensional distribution, and the measurement result of backfat thickness is obtained in a classified mode according to the distribution condition of a fitted curve, so that errors are reduced.
The technical scheme of the invention is further described in detail through the drawings and the embodiments.
Drawings
FIG. 1 is a graph of hyperspectral reflectance characteristics of a backfat area of a pig carcass in an embodiment of a method for non-destructive testing of backfat thickness of a pig carcass in accordance with the present invention;
fig. 2 is a schematic diagram of preliminary extraction of key feature points of the edge of the left image in an embodiment of a pig carcass backfat thickness nondestructive testing method of the present invention;
FIG. 3 is a schematic diagram of preliminary extraction of key feature points of the edge of the right image in an embodiment of a method for non-destructive detection of pig carcass backfat thickness according to the present invention;
FIG. 4 is a schematic view of a region of a left image ROI in an embodiment of a method for non-destructive inspection of pig carcass backfat thickness according to the present invention;
FIG. 5 is a schematic view of a region of a right image ROI in an embodiment of a method for non-destructive inspection of pig carcass backfat thickness according to the present invention;
FIG. 6 is a schematic diagram of the ab position of the measuring line domain in an embodiment of a method for non-destructive detection of pig carcass backfat thickness according to the present invention;
fig. 7 is a schematic diagram of a gray value variation curve of a line domain ab in a horizontal direction in an embodiment of a pig carcass backfat thickness nondestructive testing method of the present invention;
FIG. 8 is a schematic diagram showing the position of gray value change measured in the horizontal direction of each edge feature point in an embodiment of a pig carcass backfat thickness nondestructive testing method according to the present invention;
fig. 9 is a schematic diagram of three-dimensional reconstruction effect of an edge feature point and line reconstruction scheme in an embodiment of a pig carcass backfat thickness nondestructive testing method.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Examples
Step one: the suspended pig carcass split section images acquired on the production line have the problem that backfat fat is connected with various tissues such as muscle, connective tissue, pigskin, bone and the like and cannot be separated, so that the carcass acquisition result characteristics under natural light are not obvious, and the subsequent characteristic extraction and reconstruction measurement links are seriously hindered. Therefore, spectral imaging characteristic analysis is performed on pork skin, lean meat, bone, fascia and fat meat near the backfat position to be detected by using a hyperspectral instrument, as shown in fig. 1, hyperspectral reflection characteristic curves of corresponding areas are obtained, and the band interval with the maximum difference of reflection characteristics of the hyperspectral reflection characteristic curves, such as band d, is analyzed 1 —d 2 Further, a lighting model with proper wavelength is selected, interference of other components on backfat measurement results is reduced, and accuracy of the measurement results is improved;
step two: the method comprises the steps of carrying out binocular image acquisition on a binary cross section of a pig carcass, preprocessing left and right images acquired by binocular images, and carrying out self-adaptive threshold segmentation, morphological processing, image binarization and contour feature edge extraction on the images;
aiming at the problem of positioning the middle of the sixth rib and the seventh rib to be parallel to the thoracic vertebrae in the thickness detection process of pig carcass backfat, a scheme for indirectly positioning the rib position through positioning the characteristic point at the tail end of the sternum is provided, and the seventh rib of the pig is connected with the chest through costal cartilageThe bone tail end can be used for positioning the characteristic points of the tail end of the sternum to position the seventh rib, a semantic segmentation neural network is built through a Pytorch deep learning framework, pixel-level identification and segmentation of pig chest parts are realized, the contour of the segmented chest parts is extracted by combining digital image processing, and the characteristic points L are realized a 、R a Is used for accurate positioning of the device.
Determining a position L to be measured on the left and right images a 、R a Positioning points and acquiring coordinates, and providing a left-right image differential feature extraction scheme for extracting backfat edge dotted line features from a left image L and backfat edge two-line features from a right image R in order to avoid the problem of inaccurate matching of subsequent left-right images caused by too few edge extraction points of the left image and the right image, ensure the matching precision of the extracted edge features on the left image and the right image, and solve the problem of reduced measurement precision caused by suspension and inclination of a pig carcass; in order to accurately position the ROI region by determining, the backfat thickness result of the subsequent step is rapidly and accurately measured, and the characteristic information on the backfat edge is subjected to region extraction and preservation:
as shown in FIG. 2, based on the edge extraction result after the left image is subjected to image preprocessing, the position L to be measured is measured by backfat thickness a The positioning coordinate is the origin point and is searched horizontally to the right, and the first point with the value of 1 is the left edge key feature Ll of the left image K And extracting the coordinates thereof; the second point with the value of 1 is a point Lr of the key feature of the right edge of the left image k And searching n points along the edge line of the point by using the searched point as the origin, and storing to obtain the right and left edge key features (Lr) k-n --Lr k+n ) And extracting and storing.
As shown in FIG. 3, the backfat thickness is used for measuring the position R based on the edge extraction result after the right image is subjected to image preprocessing a The positioning coordinate is the origin point and is searched horizontally to the right, and the first point with the value of 1 is the key feature Rl of the left edge of the right image K Searching n points along the upper and lower edge line of the point, and storing to obtain the key feature (Rl) of the left edge of the right image K-n --Rl K+n ) And extracting and storing. Right edge feature extraction method and left edge phaseMeanwhile, the coordinate of the position to be detected is used as the origin to search horizontally to the right, and the point with the second value of 1 is used as a point Rr of the key feature of the right edge of the right image K N points are searched and stored along the upper and lower edge lines of the point to obtain right edge key feature (Rr) k-n --Rr K+n ) And extracting and storing.
In summary, the second step completes the extraction of the edge features of the image.
Step three:
on the basis of extracting the edge characteristic points of the left image and the right image, as the edge characteristic points of the right edge on the left image and the right image are distributed in a two-dimensional curve, the upper boundary and the lower boundary of the ROI area are rapidly determined by judging the curvature of the right edge curve of the image, namely, the numerical value of the number n of the feature points searched up and down along the edge line is determined by judging the curvature of the right edge curve of the image, so that the ROI area is rapidly and accurately positioned, and the rapid and accurate measurement of the backfat thickness result in the subsequent step is realized:
the left and right images are respectively arranged at the position L to be measured a 、R a And establishing a plane rectangular coordinate system for the origin.
Taking the left image as an example, by performing two-dimensional curve fitting on a plurality of edge feature points of the right edge of the left image, a curve equation y=f (x) is obtained, and a curvature formula of the right edge fitting curve is calculated as follows:
the ROI area is rapidly determined by judging the curvature of the right edge curve of the left image:
when the right edge curve curvature calculation result K<When the threshold T is smaller, it indicates that the bending degree of the edge curve is not large, and the position L to be measured can be taken a The right edge point of the horizontal search searches up and down along the edge line where the point is locatedThe region where the points are located is used as the ROI region, the positioning of the longitudinal ROI region is reduced, and the detection is improvedEfficiency is improved;
when the right edge curve curvature calculation result K>When the threshold T is larger, the edge curve bending degree is larger, and the position L to be measured is taken a The right edge point of the horizontal search is used as the ROI area along the edge line of the point, and the area of n points is searched up and down to determine the positioning of the longitudinal ROI area, thereby improving the detection accuracy;
as in fig. 4, the right edge (Lr k-n —Lr k+n ) The partial points in the region are key feature searching widths, and the longitudinal region in the region is a preliminary and rapidly determined ROI region.
The right edge feature of the right image is subjected to the same operation as above, as in fig. 5, the right edge (Rr k-n —Rr k+n ) The partial points in the region are key feature searching widths, and the longitudinal region in the region is a preliminary and rapidly determined ROI region.
In summary, step three, based on extracting backfat edge characteristics, the search width of the longitudinal ROI area is rapidly determined through edge curve curvature comparison.
Step four: and on the basis of finishing the extraction of the backfat edges of the left image and the right image and determining the range of the ROI area, calculating each point on the extracted edge line to obtain the change of gray values at two sides of each point on the edge line. As in fig. 6, the gray value variation of the line field ab in the horizontal direction is measured by an algorithm. As shown in fig. 7, a gray value change curve of the measurement line field ab in the horizontal direction is obtained, and the gray value of the backfat to-be-measured area is greatly different from the gray values of other component areas, so that the gray value change curve has obvious characteristics. The first order derivative formula is passed on the change curve, the formula is as follows
When the maximum change rate of the curve is found and the difference between the maximum value and the minimum value in the monotonic interval is more than 60, the maximum derivative is the boundary of different components near backfat to be measured in the horizontal direction on the gray value change curve, so that the accurate transverse coordinates of the left edge key characteristic point and the right edge key characteristic point are obtained. The method is different from the prior step of backfat edge extraction, namely the contour feature initial position is obtained through image preprocessing, the step of obtaining the accurate transverse coordinates of key feature points through gray value change provides data support for the backfat thickness result calculated in the subsequent step, and the accuracy is high.
As shown in fig. 8, by comparing the gray value calculation of each feature point on the extracted edge line, that is, the accurate lateral positioning of each key feature point on the left and right edges of the searched backfat is achieved, the accurate coordinates of the left and right edge key feature points on the image are accurately determined. And searching a plurality of discrete points of the left edge on the right image in order to ensure the matching precision of single points of the left edge characteristics in the subsequent stereo matching process by taking a single point search result of a positioning completion result on the left edge of the left image carcass backfat as a reconstruction positioning standard, and reserving the point with the highest matching precision in the left edge characteristic points of the right image and discarding the rest points by comparing cost values between the single characteristic point of the left edge of the left image backfat and the plurality of characteristic points of the left edge of the right image so as to determine the three-dimensional coordinate information of the left edge characteristic points of the carcass.
In summary, step four, on the basis of completing extraction of backfat edges of left and right images and determining the range of the ROI, the lateral positioning of the edge feature points is accurately achieved by calculating the change of gray values in the horizontal direction of the edge feature points, and the coordinates of the edge feature points are obtained.
Step five: and on the basis of accurately positioning the edge characteristics of the left and right image backfat, carrying out three-dimensional matching and three-dimensional reconstruction on the edge of the image backfat. Because the key feature points are all longitudinally distributed, limit constraint matching is adopted, the search range of the matching points is constrained from the two-dimensional plane of the whole image to a transverse one-dimensional straight line obtained by a calibration matrix, the number of points to be matched is reduced, the matching efficiency is greatly improved, after feature point matching is finished, the dot line features of the backfat of the pig carcass are reconstructed by adopting an European reconstruction method, as shown in fig. 9, and the three-dimensional information reconstruction of the feature points and the lines at two edges of the backfat is realized;
in summary, on the basis of accurately positioning the edge characteristics of the left and right image backfat, the limit constraint is adopted, the matching efficiency is improved, the dot line characteristics of the backfat of the pig carcass are reconstructed by adopting the European reconstruction method, and the three-dimensional information reconstruction of the characteristic points and the line at two edges of the backfat is realized.
Step six: on the basis of completing three-dimensional information reconstruction of backfat edge discrete feature points, determining that the left edge key feature point coordinate is L k (X, Y, Z) due to the spatial positions of the plurality of edge points of the right edge
At present, three-dimensional discrete distribution is carried out, straight line fitting is carried out on the edge points on the right side, and a three-dimensional straight line equation is obtained:
ax+by+cz+d=0
where a, b, c, d are constants describing the slope, direction, and distance from the origin of the fitted line. Defining the right edge line as a straight line m, if the straight line m fits the goodness R 2 ≥0.5(R 2 Is a dimensionless coefficient, has a definite value range (0-1), and has the following formula:
R 2 the closer to 1, the better the effect of the model fit, R 2 The closer to 0, the worse the model fitting effect, the smaller the fluctuation of the straight line fitting of the edge points is, the spatial position of the characteristic point of the right edge is close to the straight line distribution, and any point P (X) on the fitting straight line m is taken 1 ,Y 1 ,Z 1 ) The calculation formula of backfat thickness result is as follows
S 0 Is a unit vector in the same direction as the fitting straight line m; if the straight line m fits goodness R 2 If the value is less than 0.5, the fact that the straight line fitting fluctuation of the edge points is large is indicated, the spatial positions of the characteristic points of the right edge are irregularly distributed, and the coordinates of any characteristic point on the right edge line are defined as (X) t ,Y t ,Z t ) T is E (k-n, k+n), the backfat thickness results in
In the above formula, the backfat has a thickness d.
In summary, the hyperspectral instrument is utilized to carry out spectral characteristic imaging analysis on the area near the backfat of the pig carcass, and a proper illumination model is designed to realize the distinction between the backfat area to be detected and the connective tissues and the spines near the backfat area; aiming at the problem of measurement errors caused by rotation and movement due to carcass suspension, corresponding characteristic design is reasonably carried out. After image preprocessing, rapidly acquiring an ROI (region of interest) detected by backfat of an image to be detected through edge extraction and edge curvature calculation; the horizontal positioning of the feature points is accurately achieved by calculating the gray value change of the edge feature points in the horizontal direction, and the edge feature coordinate information is obtained; reconstructing the edges of two sides of the backfat based on binocular machine vision and a three-dimensional reconstruction technology to obtain a three-dimensional model of the backfat area; and determining the backfat edge space distribution condition through algorithm design, and finally calculating and measuring the backfat thickness result. Therefore, the nondestructive detection method for the thickness of the pig carcass backfat provided by the invention can realize high-precision rapid nondestructive detection of the thickness of the pig carcass backfat.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention and not for limiting it, and although the present invention has been described in detail with reference to the preferred embodiments, it will be understood by those skilled in the art that: the technical scheme of the invention can be modified or replaced by the same, and the modified technical scheme cannot deviate from the spirit and scope of the technical scheme of the invention.
Claims (6)
1. A nondestructive detection method for the backfat thickness of a pig carcass is characterized by comprising the following steps: the method comprises the following steps:
step one: performing spectral imaging characteristic analysis on pork skin, lean meat, bones, fascia and fat meat near the backfat position to be detected by using a hyperspectral instrument;
step two: image acquisition is carried out on the binary cross section of the pig carcass, pretreatment is carried out on the acquired left image and right image, and self-adaptive threshold segmentation, morphological treatment, image binarization and contour feature edge extraction are carried out on the images;
identifying the images, positioning seventh rib points on the left image and the right image through the terminal of the sternum, which are respectively L a 、R a The method comprises the steps of (1) obtaining coordinates of corresponding points, providing a left-right image differential feature extraction scheme for extracting backfat edge point line features from a left image L and backfat edge two-line features from a right image R, and carrying out region extraction and storage on feature information on backfat edges;
step three: on the basis of extracting the edge characteristic points of the left image and the right image, the edge characteristic points of the right side edge on the left image and the right image are distributed in a two-dimensional curve, the upper boundary and the lower boundary of the ROI area are rapidly determined by judging the curvature of the right side edge curve of the image, namely, the numerical value of the number n of the upper and lower search characteristic points along the edge line is determined by judging the curvature of the right side edge curve of the image, and the ROI area is positioned;
step four: on the basis of completing extraction of the backfat edges of the left and right images and determining the range of the ROI region, for each point on the extracted edge line, obtaining the change of gray values at two sides of each point on the edge line through calculation, obtaining a gray value change curve of the measuring line domain in the horizontal direction through measuring the gray value change of the line domain in the horizontal direction, and using a first order derivative formula on the gray value change curve:
when the maximum change rate of the curve is found out and the difference between the maximum value and the minimum value in the monotonic interval is larger than 60, on the gray value change curve, the maximum derivative is the boundary of different components near backfat to be measured in the horizontal direction, so that the accurate transverse coordinates of the left edge key characteristic point and the right edge key characteristic point on the image are obtained, the single-point search result of the positioning completion result on the left edge of the carcass backfat of the left image is taken as a reconstruction positioning standard, a plurality of discrete points of the left edge are searched on the right image in order to ensure the matching precision of the single point of the left edge in the subsequent stereo matching process, and the three-dimensional coordinate information of the left edge characteristic point of the carcass is determined by comparing the cost value between the single characteristic point of the left edge of the left image and the plurality of characteristic points of the left edge of the right image and reserving the point with the highest matching precision in the left edge characteristic point of the right image and discarding the rest points;
step five: on the basis of accurately positioning the edge characteristics of the left image and the right image backfat, carrying out three-dimensional matching and three-dimensional reconstruction on the edges of the image backfat, and carrying out corresponding characteristic point matching by adopting limit constraint matching because key characteristic points are longitudinally distributed, reconstructing the dot line characteristics of the backfat of the pig carcass by adopting an European reconstruction method, and finally realizing three-dimensional information reconstruction of characteristic points and lines on the two edges of the backfat;
step six: on the basis of completing three-dimensional information reconstruction of backfat edge discrete feature points, determining that the left edge key feature point coordinate is L k (X, Y, Z), since the space positions of a plurality of edge points of the right edge are in three-dimensional discrete distribution, performing straight line fitting on the right edge point to obtain a three-dimensional straight line equation:
ax+by+cz+d=0
wherein a, b, c, d are constants describing the slope, direction and distance from the origin of the fitted line, defining the right edge line as line m, if line m fits goodness R 2 ≥0.5(R 2 Is a dimensionless coefficient, has a definite value range (0-1), and has the following formula:
in the above, R 2 The closer to 1, the better the effect of the model fit, R 2 The closer to 0, the worse the model fitting effect, the smaller the fluctuation of the edge point straight line fitting, and the spatial position of the right edge characteristic pointIs close to the straight line distribution, and any point P (X 1 ,Y 1 ,Z 1 ) The backfat thickness result is calculated as follows:
S 0 is a unit vector in the same direction as the fitting straight line m; if the straight line m fits goodness R 2 If the value is less than 0.5, the fact that the straight line fitting fluctuation of the edge points is large is indicated, the spatial positions of the characteristic points of the right edge are irregularly distributed, and the coordinates of any characteristic point on the right edge line are defined as (X) t ,Y t ,Z t ) T epsilon (k-n, k+n), the backfat thickness result is calculated as follows:
in the above formula, the backfat thickness is d.
2. The method for nondestructive testing of pig carcass backfat thickness according to claim 1, wherein the method comprises the steps of: and in the first step, spectral imaging characteristic analysis is carried out on different component parts near the backfat position to be detected by using a hyperspectral instrument, a hyperspectral reflection characteristic curve of a corresponding region is obtained, and an illumination model with proper wavelength is selected by analyzing a reflection characteristic difference wave band interval of the hyperspectral reflection characteristic curve.
3. The method for nondestructive testing of pig carcass backfat thickness according to claim 1, wherein the method comprises the steps of: the image acquisition in the second step is specifically to adopt binocular synchronous acquisition images.
4. The method for nondestructive testing of pig carcass backfat thickness according to claim 1, wherein the method comprises the steps of: the feature searching method in the second step specifically comprises the following steps:
completing image pre-processing at left imageBased on the edge extraction result after the treatment, the position L to be measured is measured by the backfat thickness a Locating coordinates as an origin, searching horizontally to the right, and selecting a first point with a value of 1 as a left edge key feature L of a left image K And extracting the coordinates thereof;
the second point with the value of 1 is a point Lr of the key feature of the right edge of the left image k And searching n points along the edge line of the point by using the searched point as the origin, and storing to obtain the right and left edge key features (Lr) k-n --Lr k+n ) Extracting and storing;
based on the edge extraction result after the image preprocessing of the right image, the position R to be measured of backfat thickness is used a The positioning coordinate is the origin point and is searched horizontally to the right, and the first point with the value of 1 is the key feature Rl of the left edge of the right image K Searching n points along the upper and lower edge line of the point, and storing to obtain the key feature (Rl) of the left edge of the right image K-n --Rl K+n ) Extracting and storing;
the right edge feature extraction method is the same as that of the left edge, the coordinates of the position to be detected are used as the origin to search horizontally to the right, and the second point with the value of 1 is a point Rr of the right edge key feature of the right image K N points are searched and stored along the upper and lower edge lines of the point to obtain right edge key feature (Rr) k-n --Rr K+n ) And extracting and storing.
5. The method for nondestructive testing of pig carcass backfat thickness according to claim 1, wherein the method comprises the steps of: in the third step, the step of determining the ROI area is specifically as follows:
the left and right images are respectively arranged at the position L to be measured a 、R a Establishing a plane rectangular coordinate system for an origin;
by performing two-dimensional curve fitting on a plurality of edge feature points of the right edge of the left image, a curve equation y=f (x) is obtained, and a formula for calculating the curvature of the right edge fitting curve is as follows:
the ROI area is rapidly determined through the calculated curve curvature:
when the right edge curve curvature calculation result K<When the threshold T is smaller, it indicates that the bending degree of the edge curve is not large, and the position L to be measured can be taken a The right edge point of the horizontal search searches up and down along the edge line where the point is locatedThe region where the points are located is taken as an ROI region, and the positioning of the longitudinal ROI region is reduced;
when the right edge curve curvature calculation result K>When the threshold T is larger, the edge curve bending degree is larger, and the position L to be measured is taken a And the right edge point of the horizontal search is used as an ROI area for searching the area where n points are located along the edge line where the right edge point is located, and the positioning of the longitudinal ROI area is determined.
6. The method for nondestructive testing of pig carcass backfat thickness according to claim 1, wherein the method comprises the steps of: and step five, limit constraint matching is carried out, and the search range of the matching points is constrained from the two-dimensional plane of the whole image to a transverse one-dimensional straight line obtained by a calibration matrix.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310390800.8A CN116499377A (en) | 2023-04-13 | 2023-04-13 | Nondestructive detection method for backfat thickness of pig carcass |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310390800.8A CN116499377A (en) | 2023-04-13 | 2023-04-13 | Nondestructive detection method for backfat thickness of pig carcass |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116499377A true CN116499377A (en) | 2023-07-28 |
Family
ID=87315929
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310390800.8A Pending CN116499377A (en) | 2023-04-13 | 2023-04-13 | Nondestructive detection method for backfat thickness of pig carcass |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116499377A (en) |
-
2023
- 2023-04-13 CN CN202310390800.8A patent/CN116499377A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU665683B2 (en) | Image analysis for meat | |
CN115294113B (en) | Quality detection method for wood veneer | |
KR100948406B1 (en) | Chicken carcass quality grade automatic decision and weight measuring system | |
CN110335238A (en) | A kind of Automotive Paint Film Properties defect recognition system constituting method of deep learning | |
Gazo et al. | A fast pith detection for computed tomography scanned hardwood logs | |
HK1109302A1 (en) | Data acquisition for classifying slaughtered animal bodies and for their qualitative and quantitative determination | |
CN102435316B (en) | Image detail energy-based printing color uniformity measurement method | |
Yeh et al. | Establishing a demerit count reference standard for the classification and grading of leather hides | |
CN116499377A (en) | Nondestructive detection method for backfat thickness of pig carcass | |
CN115239666A (en) | Method for positioning and segmenting defect target area image of rolling contact fatigue defect | |
CN109300150B (en) | Hand bone X-ray image texture feature extraction method for bone age assessment | |
CN115984232B (en) | Method for detecting maximum thickness of fat of section of split pork based on binocular vision system | |
CN116977331A (en) | 3D model surface detection method based on machine vision | |
CN116735610A (en) | Steel pipe surface defect detection method based on machine vision | |
Handayani et al. | Determination of beef marbling based on fat percentage for meat quality | |
Yeh et al. | A reference standard of defect compensation for leather transactions | |
CN116012528A (en) | Three-dimensional reconstruction method for quantifying curling character of Chinese cabbage | |
Felfoldi et al. | Image processing based method for characterization of the fat/meat ratio and fat distribution of pork and beef samples | |
Atencio et al. | Automatic visual model for classification and measurement of quality of fruit: case Mangifera Indica L | |
Peppmeier et al. | Estimating backfat depth, loin depth, and intramuscular fat percentage from ultrasound images in swine | |
CN113866122A (en) | Method for rapidly identifying chicken varieties and application thereof | |
CN115908285A (en) | Nondestructive quality detection method, nondestructive quality detection device, electronic equipment and storage medium | |
Furtado et al. | Influence of noise, light and shadows on image segmentation algorithms | |
CN115201142A (en) | Heterogeneous chicken breast quality detection method based on multi-information fusion | |
CN118334411A (en) | Snowflake beef quality detection method, system, equipment and medium |
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 |