Head-removed shrimp posture detection method based on machine vision
Through the machine vision-based shrimp posture detection method, the problems of poor anti-interference ability and high cost in the prior art are solved, and more stable and accurate shrimp posture detection is achieved, reducing detection costs.
Patent Information
- Application Number
- CN202411625983.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-13
AI Technical Summary
In the mechanized processing of shrimps, especially in the detection of postures of head-removing shrimps, the prior art has problems such as poor anti-interference ability, high cost, limited popularity and development.
The machine vision-based attitude detection method for removing the head shrimp is used to accurately detect the posture of removing the head shrimp through image preprocessing, extraction of the center area of the shrimp head, determination of the directional reference line and posture representation.
It improves the stability and anti-interference ability of shrimp extraction, reduces detection costs, and achieves more accurate and stable shrimp posture detection.
Smart Images

Figure CN119580304A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a shrimp posture image processing technology, and in particular to a headless shrimp posture detection method based on machine vision. Background Art
[0002] In recent years, with the continuous expansion of shrimp farming in China and the increase in demand for shrimp processing, mechanized processing has gradually replaced inefficient manual processing and become the mainstream trend. The main process of mechanized shrimp peeling includes cleaning, decapitation, plating, feeding, shrimp thread removal, shelling, etc. In the plating process, a robot is required to grab the decapitated shrimp and adjust it to a uniform posture and place it in the feeding trough, so accurate identification of the posture of the decapitated shrimp is a key step to smoothly carry out subsequent operations.
[0003] The posture of headless shrimp can be constrained mainly based on the direction of the head and the back. At present, machine vision and deep learning methods are usually used to obtain this posture information. Machine vision mainly uses traditional image processing and machine learning methods to detect shrimp by setting shape, posture thresholds and artificial features. The recognition method has certain requirements for the lighting and background of the shrimp, and has poor anti-interference ability. Deep learning mainly trains the model by collecting a large amount of data. Although this end-to-end method solves the problem of the former's poor anti-interference ability to a certain extent, it also brings higher training and deployment costs, which to a certain extent limits the popularization and development of the technology. Summary of the invention
[0004] In view of the technical problems existing in the prior art, the purpose of the present invention is to provide a method for detecting the posture of headless shrimp based on machine vision, which can accurately, stably and at low cost detect the posture of headless shrimp, and provide a basis for the actuator control of shrimp processing machinery.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] A method for detecting the posture of headless shrimp based on machine vision comprises the following steps:
[0007] S1, image preprocessing, the headless shrimp image is separated into three channels in the HSV space, and the optimal channel is selected according to the difference between the foreground and background to obtain the headless shrimp binary image Img0;
[0008] S2, extracting the central area of the shrimp head, obtaining three distance transformation heat maps of the headless shrimp binary image Img0 using three distance representation methods: Manhattan distance, Euclidean distance, and Chebyshev distance, and selecting the optimal heat map according to the extraction matching degree of the central area of the shrimp head to obtain the central area image Img1 of the shrimp head;
[0009] S3, determine the shrimp head and shrimp back direction reference lines, perform corner point detection on the shrimp head center area image Img1, obtain the shrimp head direction reference line by straight line fitting the corner point coordinates, and make a perpendicular midline of the shrimp head direction reference line to obtain the shrimp back direction reference line;
[0010] S4, determining the direction of the shrimp head, comparing the distances between the two wide sides of the minimum circumscribed rectangle of the binary image Img0 of the headless shrimp and the two end points of the shrimp head direction reference line to obtain the shrimp head direction vector;
[0011] S5, determining the shrimp back direction, comparing the distance between the long side close to the shrimp back in the minimum circumscribed rectangle of the headless shrimp binary image Img0 and the two end points of the shrimp back direction reference line to obtain the shrimp back direction vector;
[0012] S6. The posture information of the headless shrimp is represented by the shrimp head direction vector and the shrimp back direction vector.
[0013] Preferably, the image preprocessing in S1 comprises the following steps:
[0014] S11 converts the captured headless shrimp image into HSV space and performs three-channel separation to generate R h , R s , R v Three grayscale images;
[0015] S12 calculates the difference coefficients of the foreground and background of the three grayscale images respectively, and selects the grayscale image with the largest coefficient for the next step;
[0016] S13 performs a sharpening process on the selected grayscale image, and then performs a binarization process, and finally obtains a headless shrimp binary image Img0.
[0017] Preferably, in S12, the method for obtaining the foreground and background difference coefficient is to divide the input grayscale image into a plurality of square areas of fixed size, calculate the sum of the grayscale representative values of all square areas, and divide the obtained sum by the total number of square areas. The calculation expression is as follows:
[0018]
[0019] In the formula, α represents the difference coefficient between the foreground and background, R represents the input grayscale image, M represents the total number of square areas, and N i Represents the grayscale representative value of the i-th square area.
[0020] Preferably, the grayscale representative value N is obtained i The method is to calculate the grayscale step value of each pixel in the square area, and count the number of pixels whose value is greater than the step threshold. If the number is greater than or equal to half of the total number of pixels in the square area, the grayscale representative value of the square area is recorded as 1, otherwise it is recorded as 0, where the grayscale step value The calculation expressions of the step threshold T are as follows:
[0021]
[0022] T=β×std
[0023] In the formula, Represents the grayscale step value of the jth pixel in the i-th square area of the grayscale image. Indicates the grayscale value of the jth pixel in the i-th square area of the grayscale image, std, mode, They represent the standard deviation, mode and mean of the grayscale value of the grayscale image respectively, and β represents the grayscale step multiple.
[0024] Preferably, the method for extracting the central area of the shrimp head in S2 is: obtaining three distance transform heat maps of the headless shrimp binary image Img0 using Manhattan distance, Euclidean distance and Chebyshev distance respectively, and according to the RGB red threshold set in advance, performing a mask operation on the three distance transform heat maps to extract the red area in the image, and then performing a binarization operation to obtain three different shrimp head central area images, for each shrimp head central area image, calculating the extraction matching degree of the shrimp head central area, and selecting the image with the highest extraction matching degree as the final shrimp head central area image Img1.
[0025] Preferably, the method for obtaining the extraction matching degree of the central area of the shrimp head is:
[0026]
[0027] In the formula, Indicates the extraction matching degree, k i Indicates the rectangular degree of the connected domain of the central area of the i-th shrimp head image, length i Indicates the length of the long side of the minimum circumscribed rectangle of the connected domain of the central area of the i-th shrimp head image, length max Indicates the length of the longest side among the three long sides.
[0028] Preferably, the method for determining the shrimp head and shrimp back direction reference line in S3 is: perform corner point detection on the shrimp head central area image Img1, and perform straight line fitting on the obtained corner point pixel coordinates to obtain the fitted line segment l1, which is the shrimp head direction reference line, make a median perpendicular line segment l2 of the same length as the fitted line segment l1, which is the shrimp back direction reference line, and save the pixel coordinates of the center point O of l1, the pixel coordinates of the two end points h1 and h2 of l1, and the pixel coordinates of the two end points b1 and b2 of l2.
[0029] Preferably, the method for determining the direction of the shrimp head in S4 is: first, obtain the minimum bounding rectangle of the binary image Img0 of the headless shrimp, save the equation of the line where the two wide sides W1 and W2 of the minimum bounding rectangle are located and the equation of the line where the two long sides L1 and L2 are located in the pixel coordinate system, and then calculate the Euclidean distance d between the endpoints h1 and h2 and the wide sides W1 and W2 respectively. h , and finally find the endpoint h corresponding to the minimum distance, vector It is the direction vector of the shrimp head.
[0030] Preferably, the method for determining the shrimp back direction in S5 is: first, the long side L1 is translated by P pixel units in the direction close to the long side L2 to cut the headless shrimp binary image Img0, and the cut binary image Img is obtained. 01 Calculate the area of the connected domain in the graph greater than the threshold S min The number num1, similarly obtain the binary image Img after the long edge L2 is cut 02 Calculate the area of the connected domain in the graph greater than the threshold S min The number of num2, and then compare the size of num1 and num2, the longer side corresponding to the smaller value is the longer side L close to the shrimp back b Finally, calculate the endpoints b1, b2 and the long side L respectively b The Euclidean distance d b , find the endpoint b corresponding to the minimum distance, vector This is the shrimp's back direction vector.
[0031] The present invention has the following advantages:
[0032] (1) An image preprocessing method based on the difference between foreground and background was proposed. By calculating the difference coefficient between foreground and background and selecting the appropriate channel for subsequent binarization processing, it can adapt to different lighting and backgrounds to a certain extent. Compared with traditional image processing and machine learning methods, it improves the stability and anti-interference ability of shrimp extraction. Compared with deep learning methods, it reduces the detection cost.
[0033] (2) Based on the morphological characteristics of decapitated shrimps with a thick head and a thin tail, the central area of the shrimp head was extracted using a "distance heat map" method, and the extraction matching degree of the central area of the shrimp head was proposed. When faced with shrimps of different sizes and postures, the extraction and positioning of the central area of the shrimp head gained better adaptability, making the shrimp posture detection more accurate and stable.
[0034] (3) Based on actual needs, a method for representing the posture of headless shrimp is proposed. The posture information of headless shrimp is simplified by using the mutually perpendicular shrimp head and shrimp back orientation vectors. On the premise of meeting work requirements, effective posture recognition features can be obtained efficiently and at low cost, thereby improving recognition efficiency and reducing recognition cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a flow chart of the present invention.
[0036] Figure 2 This is a schematic diagram of the process of selecting the optimal channel through the foreground and background difference coefficients in step S1 and obtaining a binary image of the headless shrimp.
[0037] Figure 3 The images of the central area of the shrimp head extracted under different distance representation methods in step S2.
[0038] Figure 4 It is the shrimp head center area image selected according to the extraction matching degree of the shrimp head center in step S2.
[0039] Figure 5 It is a schematic diagram of the minimum circumscribed rectangle of the shrimp head and shrimp back facing the reference line and the binary image of the headless shrimp in step S3.
[0040] Figure 6 This is a schematic diagram of the method for determining the long side close to the shrimp back in step S5.
[0041] Figure 7 It is a schematic diagram of the direction vectors of the shrimp head and shrimp back in steps S4 and S5. DETAILED DESCRIPTION
[0042] The present invention will be further described in detail below in conjunction with specific implementation methods.
[0043] After the de-heading process, the shrimps lie flat on the conveyor belt in random postures without touching each other. The image acquisition camera is located directly above the conveyor belt, and the camera lens maintains a certain distance from the plane of the conveyor belt and is parallel to each other.
[0044] like Figure 1 , a headless shrimp posture detection method based on machine vision, comprising the following steps:
[0045] S1, image preprocessing, the headless shrimp image is separated into three channels in the HSV space, and the optimal channel is selected according to the difference between the foreground and background to obtain the headless shrimp binary image Img0;
[0046] S2, extracting the central area of the shrimp head, obtaining three distance transformation heat maps of the headless shrimp binary image Img0 using three distance representation methods: Manhattan distance, Euclidean distance, and Chebyshev distance, and selecting the optimal heat map according to the extraction matching degree of the central area of the shrimp head to obtain the central area image Img1 of the shrimp head;
[0047] S3, determine the shrimp head and shrimp back direction reference lines, perform corner point detection on the shrimp head center area image Img1, obtain the shrimp head direction reference line by straight line fitting the corner point coordinates, and make a perpendicular midline of the shrimp head direction reference line to obtain the shrimp back direction reference line;
[0048] S4, determining the direction of the shrimp head, comparing the distances between the two wide sides of the minimum circumscribed rectangle of the binary image Img0 of the headless shrimp and the two end points of the shrimp head direction reference line to obtain the shrimp head direction vector;
[0049] S5, determining the shrimp back direction, comparing the distance between the long side close to the shrimp back in the minimum circumscribed rectangle of the headless shrimp binary image Img0 and the two end points of the shrimp back direction reference line to obtain the shrimp back direction vector;
[0050] S6. The posture information of the headless shrimp is represented by the shrimp head direction vector and the shrimp back direction vector.
[0051] Each step is described in detail below.
[0052] 1)S1.
[0053] Image preprocessing, due to the differences in background and light, directly binarizing the original image cannot have a good effect in every environment, but by selecting the appropriate channel image and then binarizing it, a certain degree of environmental adaptability can be obtained.
[0054] Specifically, the steps include: S11, Figure 2 , the headless shrimp image obtained by shooting is converted into HSV space, and three-channel separation is performed to generate R h , R s , R v Three grayscale images (corresponding to the H channel grayscale image, the S channel grayscale image, and the V channel grayscale image in the figure respectively); S12, respectively calculating the foreground and background difference coefficients of the three grayscale images, and selecting the grayscale image with the largest coefficient (the S channel grayscale image in this embodiment); S13, performing another sharpening process to further highlight the outline of the main body, and finally performing OSTU binarization processing to obtain the headless shrimp binary image Img0.
[0055] In S12, the foreground and background difference coefficient is defined as the ratio of the number of square areas in the grayscale image whose grayscale representative value is 1. If the foreground and background difference coefficient is high, it means that the grayscale value difference between the subject and the background in the grayscale image is large, and it is easier to extract a complete and accurate shrimp outline. The specific calculation steps of the foreground and background difference coefficient are as follows:
[0056] (1) Calculate the standard deviation std, mode, and mean of the grayscale value of the grayscale image
[0057] (2) Divide the grayscale image into a plurality of square regions of equal size, each square region consisting of p×p pixels, where p=25 in this embodiment;
[0058] (3) Calculate the grayscale step value of each pixel in the square area as follows:
[0059]
[0060] in, Represents the grayscale step value of the jth pixel in the i-th square area of the grayscale image. Represents the gray value of the jth pixel in the i-th square area of the gray image;
[0061] (4) Calculate the grayscale representative value and count the number of pixels whose value is greater than the step threshold. If the number is greater than or equal to half of the total number of pixels in the square area, the grayscale representative value of the area is recorded as 1, otherwise it is recorded as 0. The method is as follows:
[0062]
[0063] t=β×std
[0064] Among them, N i represents the grayscale representative value of the i-th square area, Sum represents the number of pixels in the square area whose grayscale representative value is greater than the step threshold, Int represents the rounding function, T represents the step threshold, β represents the grayscale step multiple, and in this embodiment, β=2;
[0065] (5) Traverse each square area and repeat steps (3) and (4);
[0066] (6) Calculate the difference coefficient between the foreground and background as follows:
[0067]
[0068] Among them, α represents the difference coefficient between the foreground and background, R represents the input grayscale image, and M represents the total number of square areas.
[0069] 2)S2.
[0070] Extract the center area of the shrimp head. In this embodiment, the distance transformation function of OpenCV is used to calculate the binary image Img of the headless shrimp. 01 The distance from the non-zero value pixel (i.e. white pixel) to the nearest zero value pixel (i.e. black pixel) is calculated using three distance representation methods: Manhattan distance, Euclidean distance, and Chebyshev distance. Three new grayscale images are obtained, and the three new grayscale images are converted into color images through the pseudo-color function of OpenCV, i.e. three distance transformation heat maps. Figure 3, since the shrimp head is wider than the shrimp tail, the red area will be concentrated in the center of the shrimp head, so it is only necessary to extract the red area separately and perform binarization operation to obtain three shrimp head center area images. According to the RGB red threshold set in advance, the three distance transformation heat maps are masked to extract the red area in the image. In this embodiment, the lower limit of the set RGB red threshold is [0,0,0] and the upper limit is [190,0,0]. Due to the different distance transformation heat maps, the three shrimp head center area images are also different. Among them, the image with better continuity of the connected domain, larger area and slender shape is more conducive to the subsequent shrimp head baseline fitting, so that the obtained shrimp head orientation is more accurate. In order to deal with shrimps of different sizes and postures, the extraction matching degree of the shrimp head center is proposed to select the shrimp head center area image that best meets the above requirements. The extraction matching degree of the shrimp head center is defined as the product of the rectangularity of the connected domain of the shrimp head center area image and the relative long side length of its minimum circumscribed rectangle. The method is as follows:
[0071]
[0072] In the formula, Indicates the extraction matching degree, k i Represents the rectangularity of the connected domain of the i-th shrimp head central area image (rectangularity is the ratio of the area of the connected domain to the area of its smallest circumscribed rectangle), length i The length of the minimum circumscribed rectangle of the connected domain of the central area of the i-th shrimp head image (the long side is the longer side of the rectangle), length max Indicates the length of the longest side among the three long sides.
[0073] Then, if Figure 4 , select and extract the image with the highest matching degree (Euclidean distance in this embodiment) as the final shrimp head central area image Img1.
[0074] 3)S3.
[0075] Determine the reference line for the shrimp head and back. Use OpenCV's corner detection function to perform corner detection on the shrimp head center area image Img1, and perform straight line fitting on the obtained corner pixel coordinates to obtain the fitted line segment l1, which is the shrimp head direction reference line. Combined with actual work needs, it is observed that when the shrimp lies flat, the direction of the head and back can be constrained by two mutually perpendicular direction reference lines, and the posture information is sufficient to complete the shrimp forward operation. In order to make the recognition more efficient and simple, only the median perpendicular line segment l2 of the same length as the fitting line segment l1 is needed as the shrimp back direction reference line, such as Figure 5 The red line segment in the figure is the baseline for the shrimp head to face, and the blue line segment is the baseline for the shrimp back to face. Finally, save the pixel coordinates of the center point O of l1, the pixel coordinates of the two end points h1 and h2 of l1, and the pixel coordinates of the two end points b1 and b2 of l2.
[0076] 4)S4.
[0077] Determine the direction of the shrimp head.
[0078] First, the minimum bounding rectangle of the headless shrimp binary image I,g0 is obtained. The longer side is called the long side, and the shorter side is called the wide side. In the pixel coordinate system, the equations of the lines where the two wide sides W1 and W2 of the minimum bounding rectangle are located and the equations of the lines where the two long sides L1 and L2 are located are saved; Figure 5 , the end points h1, h2 and the wide side L close to the shrimp head h The point closer to the target is the end point of the shrimp head direction vector (the starting point is the center point O of l1), and the Euclidean distance d between the endpoints h1, h2 and the wide sides W1, W2 is calculated respectively. h (dis represents the Euclidean distance solving function):
[0079] d h 11=dis(h1,W1);d h 12=dis(h1,W2);
[0080] d h 21=dis(h2,W1);d h 22=dis(h2,W2);
[0081] Find the minimum distance d hmin The corresponding endpoint h(x h ,y h ):
[0082]
[0083] vector The direction is the direction of the shrimp head. Figure 7 ,vector It is the direction vector of the shrimp head.
[0084] 5)S5.
[0085] Make sure the shrimp's back is facing the right way.
[0086] Since the headless shrimp only presents a crescent shape, with a smooth back and feet on the abdomen, the contour of its back is roughly a smooth arc, while the contour of its abdomen is roughly an uneven curve. Based on this difference, the long side of the minimum circumscribed rectangle is translated inward by an appropriate distance to cut the connected domain of the headless shrimp binary image Img0. If the long side that is translated inward is close to the shrimp back, such as Figure 6 As shown in (a), the original complete connected domain will be divided into two connected domains (corresponding to connected domain 1 and connected domain 2 in the figure). If the long side close to the shrimp abdomen is translated inward, such as Figure 6As shown in (b), it will be segmented into at least three connected domains (corresponding to connected domain 1, connected domain 2, and connected domain 3 in the figure). Based on this rule, the long side of the two long sides L1 and L2 that is closest to the shrimp back can be determined by comparing the number of connected domains after segmentation.
[0087] Specifically, the long side L1 is translated toward the direction close to the long side L2 (ie, translated inward) by P pixel units (P=10 in this embodiment) to cut the headless shrimp binary image Img0 to obtain the cut binary image Img 01 , calculate the binary image Img 01 The area of the connected domain is greater than the threshold S min =3 (the area threshold is set to prevent interference from other small connected domains); the long side L2 is translated by P pixel units in the direction close to the long side L1 to cut the headless shrimp binary image Img0, and the cut binary image Img is obtained 02 , calculate the binary image Img 02 The area of the connected domain is greater than the threshold S min = 3; compare num1 and num2, the longer side corresponding to the smaller value is the longer side L close to the shrimp back b ;like Figure 5 , the point between the endpoints b1 and b2 and the long side L close to the shrimp back b The point closer to the shrimp is the end point of the shrimp back vector (the starting point is the center point O of l1), and the endpoints b1, b2 and the long side L are calculated respectively. b The Euclidean distance d b :
[0088]
[0089] d b 1=dis(b1,L b );d b 2=dis(b2,L b );
[0090] Find the minimum distance d bmin The corresponding endpoint b(x b ,y b ):
[0091]
[0092] vector The direction is the shrimp back direction, such as Figure 7 ,vector This is the shrimp's back direction vector.
[0093] 6)S6.
[0094] The posture information of the headless shrimp is represented by the shrimp head direction vector and the shrimp back direction vector.
[0095] According to the posture information, the shrimps are guided toward a device (such as a robotic arm end effector) to adjust the shrimps to a uniform posture (such as the shrimp heads facing forward and the shrimp backs facing upward) and placed in a feeding trough, thus completing the plating process.
[0096] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A headless shrimp posture detection method based on machine vision, characterized in that: The steps include: S1, image preprocessing, the headless shrimp image is separated into three channels in the HSV space, and the optimal channel is selected according to the difference between the foreground and background to obtain the headless shrimp binary image Img0; S2, extracting the central area of the shrimp head, obtaining three distance transformation heat maps of the headless shrimp binary image Img0 using three distance representation methods: Manhattan distance, Euclidean distance, and Chebyshev distance, and selecting the optimal heat map according to the extraction matching degree of the central area of the shrimp head to obtain the central area image Img1 of the shrimp head; S3, determine the shrimp head and shrimp back direction reference lines, perform corner point detection on the shrimp head center area image Img1, obtain the shrimp head direction reference line by straight line fitting the corner point coordinates, and make a perpendicular midline of the shrimp head direction reference line to obtain the shrimp back direction reference line; S4, determining the direction of the shrimp head, comparing the distances between the two wide sides of the minimum circumscribed rectangle of the binary image Img0 of the headless shrimp and the two end points of the shrimp head direction reference line to obtain the shrimp head direction vector; S5, determining the shrimp back direction, comparing the distance between the long side close to the shrimp back in the minimum circumscribed rectangle of the headless shrimp binary image Img0 and the two end points of the shrimp back direction reference line to obtain the shrimp back direction vector; S6. The posture information of the headless shrimp is represented by the shrimp head direction vector and the shrimp back direction vector.
2. A method for detecting the posture of headless shrimp based on machine vision according to claim 1, characterized in that: Image preprocessing in S1 includes the following steps: S11 converts the captured headless shrimp image into HSV space and performs three-channel separation to generate R h , R s , R v Three grayscale images; S12 calculates the difference coefficients of the foreground and background of the three grayscale images respectively, and selects the grayscale image with the largest coefficient for the next step; S13 performs a sharpening process on the selected grayscale image, and then performs a binarization process, and finally obtains a headless shrimp binary image Img0.
3. A method for detecting the posture of headless shrimp based on machine vision according to claim 2, characterized in that: In S12, the method for obtaining the foreground and background difference coefficient is to divide the input grayscale image into multiple square areas of fixed size, calculate the sum of the grayscale representative values of all square areas, and divide the obtained sum by the total number of square areas. The calculation expression is as follows: Where α represents the difference coefficient between foreground and background, R represents the input grayscale image, M represents the total number of square areas, and Ni represents the grayscale representative value of the i-th square area.
4. A method for detecting the posture of headless shrimp based on machine vision according to claim 3, characterized in that: The method for obtaining the grayscale representative value Ni is to calculate the grayscale step value of each pixel in the square area, and count the number of pixels whose value is greater than the step threshold. If the number is greater than or equal to half of the total number of pixels in the square area, the grayscale representative value of the square area is recorded as 1, otherwise it is recorded as 0, where the grayscale step value The calculation expressions of the step threshold T are as follows: T=β×std In the formula, Represents the grayscale step value of the jth pixel in the i-th square area of the grayscale image. Indicates the grayscale value of the jth pixel in the i-th square area of the grayscale image, std, mode, They represent the standard deviation, mode and mean of the grayscale value of the grayscale image respectively, and β represents the grayscale step multiple.
5. The method for detecting the posture of headless shrimp based on machine vision according to claim 1, characterized in that: The method for extracting the central area of the shrimp head in S2 is: Three distance transform heat maps of the headless shrimp binary image Img0 are obtained using Manhattan distance, Euclidean distance and Chebyshev distance respectively, and according to the pre-set RGB red threshold, the three distance transform heat maps are masked to extract the red area in the image, and then binarized to obtain three different shrimp head center area images. For each shrimp head center area image, the extraction matching degree of the shrimp head center area is calculated, and the image with the highest extraction matching degree is selected as the final shrimp head center area image Img1.
6. A method for detecting the posture of headless shrimp based on machine vision according to claim 5, characterized in that: The method for obtaining the extraction matching degree of the central area of the shrimp head is: In the formula, Indicates the extraction matching degree, k i Indicates the rectangular degree of the connected domain of the central area of the i-th shrimp head image, length i Indicates the length of the long side of the minimum circumscribed rectangle of the connected domain of the central area of the i-th shrimp head image, length max Indicates the length of the longest side among the three long sides.
7. The method for detecting the posture of headless shrimp based on machine vision according to claim 1, characterized in that: The method for determining the reference line of the shrimp head and shrimp back in S3 is: Perform corner detection on the image Img1 of the central area of the shrimp head, and perform straight line fitting on the obtained pixel coordinates of the corner points to obtain the fitting line segment l1, which is the reference line for the shrimp head. Make a perpendicular bisector segment l2 of the same length as the fitting line segment l1, which is the reference line for the shrimp back. Save the pixel coordinates of the center point O of l1, the pixel coordinates of the two end points h1 and h2 of l1, and the pixel coordinates of the two end points b1 and b2 of l2.
8. A method for detecting the posture of headless shrimp based on machine vision according to claim 7, characterized in that: The method for determining the shrimp head orientation in S4 is: First, the minimum bounding rectangle of the headless shrimp binary image Img0 is obtained. In the pixel coordinate system, the equations of the lines where the two wide sides W1 and W2 of the minimum bounding rectangle and the equations of the lines where the two long sides L1 and L2 are located are saved. Then, the Euclidean distances d between the endpoints h1 and h2 and the wide sides W1 and W2 are calculated respectively. h , and finally find the endpoint h corresponding to the minimum distance, vector It is the direction vector of the shrimp head.
9. A method for detecting the posture of headless shrimp based on machine vision according to claim 8, characterized in that: The method for determining the shrimp back direction in S5 is: First, the long side L1 is translated by P pixel units toward the direction close to the long side L2 to cut the headless shrimp binary image Img0, and the cut binary image Img is obtained 01 Calculate the area of the connected domain in the graph greater than the threshold S min The number num1, similarly obtain the binary image Img after the long edge L2 is cut 02 Calculate the area of the connected domain in the graph greater than the threshold S min The number of num2, and then compare the size of num1 and num2, the longer side corresponding to the smaller value is the longer side L close to the shrimp back b Finally, calculate the endpoints b1, b2 and the long side L b The Euclidean distance d b , find the endpoint b corresponding to the minimum distance, vector This is the shrimp's back direction vector.
Citation Information
Patent Citations
Online visual detection method and system for crayfish pose recognition
CN111832532A
Robust palm region-of-interest positioning method in natural scene
CN115661872A
Vehicle detection method based on thermal imaging
US20170169299A1
Methods and apparatus for orientation keypoints for complete 3D human pose computerized estimation
US20210097718A1
Cited By
Tissue fragment automatic uniform planking method based on image recognition
CN120726627A