A head-on-shrimp posture detection method based on machine vision
By using machine vision-based image preprocessing and methods that determine the orientation of the shrimp's head and back towards a baseline, the problem of anti-interference in shrimp posture detection under changes in lighting and background was solved, achieving low-cost and efficient shrimp posture recognition.
Patent Information
- Application Number
- CN202411625983.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-11-13
AI Technical Summary
Existing shrimp posture detection methods have poor anti-interference capabilities under changes in lighting and background, and are also costly, which limits the popularization and development of mechanized shrimp processing.
A machine vision-based method for headless shrimp pose detection is adopted. By preprocessing the image, an appropriate channel is selected for binarization. The central region of the shrimp head is extracted by combining Manhattan distance, Euclidean distance and Chebyshev distance. The pose information of the shrimp is determined by using the shrimp head and back facing the baseline, which is simplified into a mutually perpendicular orientation vector representation.
This improved the stability and anti-interference ability of shrimp posture detection, reduced detection costs, and achieved efficient and low-cost shrimp posture recognition.
Smart Images

Figure CN119580304B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to shrimp posture image processing technology, and in particular to a headless shrimp posture detection method based on machine vision. BACKGROUND
[0002] In recent years, with the continuous expansion of shrimp farming scale in China and the increase of shrimp processing demand, mechanized processing gradually replaces low-efficiency manual processing as the mainstream trend. The main process of shrimp mechanical peeling includes cleaning, head removal, tray arrangement, feeding, shrimp line removal, and shell removal. In the tray arrangement process, a mechanical hand is used to grab the headless shrimp and adjust it to a uniform posture and place it in the feeding tank, so accurate identification of the headless shrimp posture is the key step to smoothly perform the subsequent operation.
[0003] The posture of the headless shrimp can be mainly constrained according to the head orientation and the back orientation. Currently, these posture information is usually obtained by using machine vision and deep learning methods. Machine vision mainly uses traditional image processing and machine learning methods to achieve shrimp detection by setting shape, posture threshold and artificial features. The identification method has certain requirements for shrimp illumination and background, 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 poor anti-interference ability of the former to some extent, it also brings high training and deployment costs, which to some extent limits the popularization and development of the technology. SUMMARY
[0004] In view of the technical problems existing in the prior art, the purpose of the present application is to provide a headless shrimp posture detection method based on machine vision, which can accurately, stably and low-cost detect the posture of headless shrimp and provide a basis for the control of the execution mechanism of shrimp processing machinery.
[0005] In order to achieve the above purpose, the present application adopts the following technical solutions:
[0006] A headless shrimp posture detection method based on machine vision comprises the following steps:
[0007] S1, image preprocessing, separating the headless shrimp image in HSV space into three channels, selecting the optimal channel according to the foreground and background difference to obtain a headless shrimp binary image Img0;
[0008] S2, extracting the shrimp head center region, obtaining three distance transform heat maps of the headless shrimp binary image Img0 by using Manhattan distance, Euclidean distance and Chebyshev distance three distance representation methods, and selecting the optimal heat map according to the extraction matching degree of the shrimp head center region to obtain a shrimp head center region image Img1;
[0009] S3, determining the shrimp head and back direction to the reference line, performing corner point detection on the shrimp head center area image Img1, obtaining the shrimp head direction reference line by straight line fitting the corner point coordinates, and making the middle vertical line of the shrimp head direction reference line to obtain the shrimp back direction reference line;
[0010] S4, determining the shrimp head direction, comparing the distance between the two wide sides of the minimum circumscribed rectangle of the headless shrimp binary image Img0 and the two endpoints 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 endpoints of the shrimp back direction reference line to obtain the shrimp back direction vector;
[0012] S6, representing the posture information of the headless shrimp by the shrimp head direction vector and the shrimp back direction vector.
[0013] Preferably, the image preprocessing in S1 includes the following steps:
[0014] S11 converts the headless shrimp image obtained by shooting into HSV space, and performs three-channel separation to generate R h , R s , and R v three gray scale images;
[0015] S12 calculates the foreground and background difference coefficients of the three gray scale images respectively, selects the gray scale image with the largest coefficient for the next operation;
[0016] S13 performs sharpening processing on the selected gray scale image, and then performs binaryzation processing, finally obtaining the headless shrimp binary image Img0.
[0017] Preferably, in S12, the method for obtaining the foreground and background difference coefficient is to divide the input gray scale image into a plurality of fixed-size square regions, calculate the sum of the gray scale representative values of all square regions, and divide the obtained sum by the total number of square regions. The calculation expression is as follows:
[0018]
[0019] In the formula, α represents the foreground and background difference coefficient, R represents the input gray scale image, M represents the total number of square regions, N i represents the gray scale representative value of the i-th square region.
[0020] Preferably, the method for obtaining the gray scale representative value N i is to calculate the gray scale step value of each pixel in the square region, count the number of pixels whose value is greater than the step threshold value, and if the number is greater than or equal to half of the total number of pixels in the square region, the gray scale representative value of the square region is recorded as 1, otherwise as 0, wherein the gray scale step value The calculation expression of the step threshold value T is as follows:
[0021]
[0022] T = β × std
[0023] In the formula, represents the gray step value of the jth pixel point in the ith square region of the gray scale image, represents the gray value of the jth pixel point in the ith square region of the gray scale image, std, mode, respectively represent the gray value standard deviation, mode, and mean of the gray scale image, and β represents the gray step multiple.
[0024] Preferably, the method for extracting the head center region of the shrimp in S2 is as follows: Manhattan distance, Euclidean distance, and Chebyshev distance are respectively used to obtain three distance conversion heat maps of the headless shrimp binary image Img0, a mask operation is performed on the three distance conversion heat maps according to a pre-set RGB red threshold value to extract the red region in the image, and then a binarization operation is performed to obtain three different shrimp head center region images. For each shrimp head center region image, the extraction matching degree of the shrimp head center region is calculated, and the image with the highest extraction matching degree is selected as the final shrimp head center region image Img1.
[0025] Preferably, the method for obtaining the extraction matching degree of the shrimp head center region is as follows:
[0026]
[0027] In the formula, represents the extraction matching degree, k i represents the rectangularity of the connected domain of the ith shrimp head center region image, length i represents the length of the long side of the minimum circumscribed rectangle of the connected domain of the ith shrimp head center region image, length max represents the length of the longest side of the three long sides.
[0028] Preferably, the method for determining the head and back orientation reference lines of the shrimp in S3 is as follows: corner point detection is performed on the shrimp head center region image Img1, and the obtained corner point pixel coordinates are subjected to straight line fitting to obtain a fitting line segment l1, which is the head orientation reference line. A midline segment l2 equal in length to the fitting line segment l1 is drawn, which is the back orientation reference line. The pixel coordinates of the center point O of the fitting line segment l1, the pixel coordinates of the two end points h1 and h2 of the fitting line segment l1, and the pixel coordinates of the two end points b1 and b2 of the midline segment l2 are saved.
[0029] Preferably, the method for determining the head direction of the shrimp in S4 is: first, obtaining the minimum circumscribed rectangle of the headless shrimp binary image Img0, saving the straight line equations of the two wide sides W1 and W2 and the two long sides L1 and L2 in the pixel coordinate system, then calculating the Euclidean distance d of the endpoints h1 and h2 and the wide side W1 h , and finally finding the endpoint h corresponding to the minimum distance, and the vector is the head direction vector of the shrimp.
[0030] Preferably, the method for determining the back direction of the shrimp in S5 is: first, cutting the headless shrimp binary image Img0 by translating the long side L1 by P pixel units towards the long side L2 to obtain the cut binary image Img 01 , calculating the number num1 of connected domains with an area greater than a threshold S min in the image, similarly obtaining the binary image Img 02 cut by the long side L2, calculating the number num2 of connected domains with an area greater than a threshold S min in the image, then comparing the sizes of num1 and num2, wherein the smaller value corresponds to the long side L b close to the back of the shrimp, and finally calculating the Euclidean distance d b of the endpoints b1 and b2 and the long side L b , finding the endpoint b corresponding to the minimum distance, and the vector is the back direction vector of the shrimp.
[0031] The present application has the following advantages:
[0032] (1) An image preprocessing method for foreground and background difference is proposed, by calculating the foreground and background difference coefficient, selecting a suitable channel for subsequent binary processing, which can adapt to different light and background to a certain extent, compared with traditional image processing and machine learning methods, the stability and anti-interference ability of shrimp extraction are improved, and compared with deep learning methods, the detection cost is reduced.
[0033] (2) Based on the morphological characteristics of the thick head and thin tail of the headless shrimp, the "distance heat map" method is used to extract the head center region of the shrimp, and the extraction matching degree of the head center region of the shrimp is proposed, which can adapt to shrimp of different sizes and different postures, and the extraction and positioning of the head center region of the shrimp are more accurate and stable.
[0034] (3) Based on the actual demand, a representation method of headless shrimp posture is proposed, which uses the mutually perpendicular head and back direction vectors to simplify the posture information of the headless shrimp, and under the premise of meeting the work demand, the effective posture recognition features can be obtained efficiently and at low cost, which improves the recognition efficiency and reduces the recognition cost. BRIEF DESCRIPTION OF DRAWINGS
[0035] Figure 1 Flow chart of the present application.
[0036] Figure 2 Process diagram for selecting optimal channel and obtaining headless shrimp binary image by foreground and background difference coefficient in step S1.
[0037] Figure 3 Shrimp head center region image extracted in step S2 under different distance representation methods.
[0038] Figure 4 Shrimp head center region image selected according to shrimp head center extraction matching degree in step S2.
[0039] Figure 5 Diagram for shrimp head, shrimp back orientation reference line and minimum circumscribed rectangle of headless shrimp binary image in step S3.
[0040] Figure 6 Diagram for judging the long side close to the shrimp back in step S5.
[0041] Figure 7 Diagram for shrimp head and shrimp back orientation vector in steps S4 and S5. DETAILED DESCRIPTION
[0042] The present application will be further described in detail below with specific embodiments.
[0043] The shrimp after the head removal process lies flat on the conveying belt in a random posture without contacting each other, and the image acquisition camera is located directly above the conveying belt, the camera lens and the plane of the conveying belt maintain a certain distance and are parallel to each other.
[0044] As Figure 1 A headless shrimp posture detection method based on machine vision, comprising the following steps:
[0045] S1, image preprocessing, separating the headless shrimp image in HSV space into three channels, selecting the optimal channel according to the foreground and background difference to obtain a headless shrimp binary image Img0;
[0046] S2, extract the shrimp head center region, obtain three distance transform heat maps of the headless shrimp binary image Img0 by Manhattan distance, Euclidean distance and Chebyshev distance three distance representation methods, and select the optimal heat map according to the extraction matching degree of the shrimp head center region to obtain the shrimp head center region image Img1;
[0047] S3, determine the shrimp head, shrimp back to the reference line, the shrimp head center area image Img1 is executed corner point detection, through the straight line fitting corner point coordinate obtains the shrimp head to the reference line, and makes the vertical line of the shrimp head to the reference line and obtains the shrimp back to the reference line;
[0048] S4, determine the shrimp head direction, compare the two wide edges of the minimum circumscribed rectangle of the headless shrimp binary image Img0 with the distance between the two end points of the shrimp head direction reference line to obtain the shrimp head direction vector;
[0049] S5, determine the shrimp back direction, compare the long side of the minimum circumscribed rectangle of the headless shrimp binary image Img0 close to the shrimp back with the distance between 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] The steps will be described in detail below.
[0052] 1) S1.
[0053] Image preprocessing, due to the difference of background and light, direct binaryzation of the original image cannot have good effect in every environment, but by selecting appropriate channel image and then binaryzation can obtain certain environmental adaptability.
[0054] Specifically includes the following steps: S11, as Figure 2 Convert the headless shrimp image obtained by shooting to HSV space, and separate three channels to generate R h , R s , R v Three gray scale images (corresponding to H channel gray scale image, S channel gray scale image and V channel gray scale image in the figure respectively); S12, calculate the foreground and background difference coefficients of the three gray scale images respectively, and select the gray scale image with the largest coefficient (in this embodiment, it is S channel gray scale image); S13, perform sharpening processing again, so that the outline of the main body is further highlighted, and finally perform OSTU binaryzation processing to obtain the headless shrimp binary image Img0.
[0055] In S12, the foreground and background difference coefficient is defined as the proportion of the number of square regions with gray value of 1 in the gray scale image. If the foreground and background difference coefficient value is high, it indicates that the gray value difference between the main body and the background in the gray scale image is large, and it is easier to extract the complete and accurate shrimp outline. The specific calculation steps of the foreground and background difference coefficient are as follows:
[0056] (1) Calculate the gray value standard deviation std, mode, and mean
[0057] (2) The gray-scale image is divided into multiple equal square regions, each square region consisting of p x p pixel points, and in this embodiment, p = 25;
[0058] (3) The gray-scale step value of each pixel point in the square region is calculated, and the method is as follows:
[0059]
[0060] wherein, represents the gray-scale step value of the jth pixel point in the ith square region of the gray-scale image, represents the gray value of the jth pixel point in the ith square region of the gray-scale image.
[0061] (4) The gray-scale representative value is calculated, the number of pixels with a value greater than the step threshold is counted, and if the number is greater than or equal to half of the total number of pixels in the square region, the gray-scale representative value of the region is recorded as 1, otherwise as 0, and the method is as follows:
[0062]
[0063] t = β x std
[0064] wherein, N i represents the gray-scale representative value of the ith square region, Sum represents the number of pixels with a value greater than the step threshold in the square region, Int represents the upward rounding function, T represents the step threshold, and β represents the gray-scale step multiple, and in this embodiment, β = 2;
[0065] (5) Each square region is traversed, and steps (3) and (4) are repeated.
[0066] (6) The foreground and background difference coefficient is calculated, and the method is as follows:
[0067]
[0068] wherein, α represents the foreground and background difference coefficient, R represents the input gray-scale image, and M represents the total number of square regions.
[0069] 2) S2.
[0070] The head center region of the shrimp is extracted, and in this embodiment, the distance transform function of OpenCV is used to calculate the distance of the headless shrimp binary image Img 01 non-zero pixel points (i.e., white pixels) to the nearest zero pixel point (i.e., black pixel) in the Manhattan distance, Euclidean distance, and Chebyshev distance, and three new gray-scale images are obtained, and the pseudo-color function of OpenCV is used to convert the three new gray-scale images into color images, i.e., three distance transform heat maps. As Figure 3Since the head of the shrimp is wider than the tail, the red area will be concentrated in the center of the shrimp head, so only the red area needs to be extracted and binarized to obtain three shrimp head center area images. According to the pre-set RGB red threshold, the red area in the three distance transform heat maps is extracted by mask operation. In this embodiment, the lower limit of the RGB red threshold is [0, 0, 0] and the upper limit is [190, 0, 0]. Due to the difference in distance transform heat maps, the three shrimp head center area images also have some differences. The image with better connectivity, larger area and slender shape is more conducive to subsequent fitting of the shrimp head reference line, so that the obtained shrimp head direction is more accurate. In order to deal with shrimp 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 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 length of the longer side of its minimum bounding rectangle. The method is as follows:
[0071]
[0072] In the formula, indicates the extraction matching degree, k i indicates the rectangularity of the connected domain of the i-th shrimp head center area image (the rectangularity is the ratio of the area of the connected domain to the area of its minimum bounding rectangle), length i indicates the length of the longer side of the minimum bounding rectangle of the connected domain of the i-th shrimp head center area image (the longer side is the longer side in the rectangle), length max indicates the length of the longest side of the three longer sides.
[0073] Then, as Figure 4 , select the image with the highest extraction matching degree (Euclidean distance in this embodiment) as the final shrimp head center area image Img1.
[0074] 3) S3.
[0075] Determine the shrimp head and back direction reference line. The corner detection function of OpenCV is used to perform corner detection on the shrimp head center area image Img1, and the obtained corner pixel coordinates are subjected to straight line fitting to obtain the fitting line segment l1, which is the shrimp head direction reference line. According to the actual work requirements, it is observed that when the shrimp is flat, the direction of the head and the back can be constrained by two direction reference lines perpendicular to each other, and this posture information is sufficient to complete the forward operation of the shrimp. In order to make the identification more efficient and simple, only the midline segment l2 equal in length to the fitting line segment l1 is needed as the shrimp back direction reference line, as Figure 5 , the red line segment in the figure is the shrimp head direction reference line, and the blue line segment is the shrimp back direction reference line. Finally, 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 are saved.
[0076] 4) S4.
[0077] Determine the shrimp head orientation.
[0078] First, get the minimum bounding rectangle of the headless shrimp binary image I, g0, call the longer side of the rectangle as the long side, and the shorter side as the wide side, save the equations of the straight lines on which the two wide sides W1, W2 and the two long sides L1, L2 of the minimum bounding rectangle lie in the pixel coordinate system; as shown in Figure 5 , the point closer to the wide side L h of the shrimp head is the end point of the shrimp head orientation vector (the starting point is the center point O of the long side L 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 corresponding to the end point h(x h , y h ):
[0082]
[0083] The direction of the vector is the shrimp head orientation, and the vector Figure 7 is the shrimp head orientation vector.
[0084] 5) S5.
[0085] Determine the shrimp back orientation.
[0086] Since the headless shrimp only presents a crescent shape, and the back is smooth and the abdomen has feet, the back profile is roughly a smooth circular arc, and the abdomen profile is roughly a concave-convex curve, which is different, so the long side of the minimum bounding rectangle is translated inward by a suitable distance to cut the connected domain of the headless shrimp binary image Img0, if the long side close to the back of the shrimp is translated inward, as shown in Figure 6 (a), then the original complete connected domain will be divided into two connected domains (corresponding to the connected domain 1 and the connected domain 2 in the figure), if the long side close to the shrimp abdomen is translated inward, as shown in Figure 6 As shown in (b), it will be divided into at least three connected components (corresponding to connected component 1, connected component 2, and connected component 3 in the figure). Based on this pattern, the longer side of the two long sides L1 and L2 that is close to the shrimp's back can be determined by comparing the number of connected components after the division.
[0087] Specifically, the longer side L1 is translated (i.e., translated inward) by P pixels (P = 10 in this embodiment) towards the longer side L2 to cut the headless shrimp binarized image Img0, thus obtaining the cut binarized image Img. 01 Calculate the binarized image Img 01 The area of the connected region in the middle is greater than the threshold S min =Number of 3s num1 (setting the area threshold is to prevent interference from other small connected components); shift the longer side L2 P pixels closer to the longer side L1 to cut the headless shrimp binarized image Img0, obtaining the cut binarized image Img. 02 Calculate the binarized image Img 02 The area of the connected region in the middle is greater than the threshold S min =The number of 3s, num2; compare the size of num1 and num2, the longer side corresponding to the smaller value is the longer side L that is close to the shrimp's back. b ;like Figure 5 The endpoints b1 and b2 are adjacent to the long side L that is close to the shrimp's back. b The point closer to the target is the endpoint of the vector pointing towards the shrimp's back (the starting point is the center point O of l1). Calculate the endpoints b1, b2, and the long side L respectively. b 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 direction the shrimp's back faces, such as... Figure 7 ,vector This refers to the vector representing the direction the shrimp's back faces.
[0093] 6)S6.
[0094] The posture information of the headless shrimp is represented by a head direction vector and a back direction vector.
[0095] According to the posture information, the shrimp is guided to adjust to a uniform posture (e.g., the head of the shrimp faces forward and the back of the shrimp faces upward) by a device (e.g., an end effector of a robot arm) and is placed into a feeding slot, i.e., a plating process is completed.
[0096] The above embodiments are the preferred embodiments of the present application, but the embodiments of the present application are not limited to the above embodiments, and any changes, modifications, substitutions, combinations, simplifications, etc. made without departing from the spirit and principles of the present application should be equivalent replacement manners and should be included in the protection scope of the present application.
Claims
1. A machine vision-based headless shrimp posture detection method, characterized in that, The method comprises the following steps: S1, image preprocessing, three-channel separation of the headless shrimp image in HSV space, selection of the optimal channel according to the foreground and background difference to obtain a headless shrimp binary image Img0; S2, extraction of the head center region, three distance transform heat maps of the headless shrimp binary image Img0 are obtained by using Manhattan distance, Euclidean distance and Chebyshev distance, and the optimal heat map is selected according to the extraction matching degree of the head center region to obtain a head center region image Img1; S3, determination of the head and back orientation reference lines, corner point detection is performed on the head center region image Img1, the corner point coordinates are fitted by a straight line to obtain the head orientation reference line, and the midline of the head orientation reference line is drawn to obtain the back orientation reference line; S4, determination of the head orientation, comparison of the distances between the two wide sides of the minimum circumscribed rectangle of the headless shrimp binary image Img0 and the two end points of the head orientation reference line to obtain a head orientation vector; S5, determination of the back orientation, comparison of the distances between the long side close to the back of the headless shrimp in the minimum circumscribed rectangle of the headless shrimp binary image Img0 and the two end points of the back orientation reference line to obtain a back orientation vector; S6, representation of the posture information of the headless shrimp by the head orientation vector and the back orientation vector.
2. The machine vision-based head-on-shrimp posture detection method according to claim 1, wherein, The image preprocessing in S1 comprises the following steps: S11 converts the headless shrimp image obtained by shooting into HSV space, and performs three-channel separation to generate R h , G s , and B v gray scale images; S12, calculation of the foreground and background difference coefficients of the three gray images respectively, selection of the gray image with the largest coefficient for the next step; S13, sharpening processing of the selected gray image, and then binaryzation processing, finally obtaining a headless shrimp binary image Img0.
3. The machine vision-based deheading shrimp posture detection method according to claim 2, wherein, In S12, the foreground and background difference coefficient is obtained by dividing the input gray image into multiple square regions of fixed size, calculating the sum of the gray representative values of all square regions, and dividing the obtained sum by the total number of square regions, and the calculation expression is as follows: In the formula, a represents a foreground and background difference coefficient, R represents an input gray scale image, M represents the total number of square regions, N i represents the gray scale representative value of the i-th square region.
4. The machine vision-based deheading shrimp posture detection method according to claim 3, wherein, The method for obtaining the gray scale representative value Ni is to calculate the gray scale jump value of each pixel in the square region, count the number of pixels whose value is greater than the jump threshold value, and if the number is greater than or equal to half of the total number of pixels in the square region, the gray scale representative value of the square region is recorded as 1, otherwise as 0, wherein the gray scale jump value and the calculation expression of the jump threshold value T is as follows: T = β × std In the formula, represents the gray level of the jth pixel in the ith square region of the gray scale image, represents the gray value of the jth pixel in the ith square region of the gray scale image, std, mode, respectively represent the standard deviation, mode, and mean of the gray values of the gray scale image, and β represents the gray level step multiple.
5. The machine vision-based deheading shrimp posture detection method according to claim 1, wherein, In S2, the method for extracting the head center region is as follows: Three distance transform heat maps of the headless shrimp binary image Img0 are obtained by using Manhattan distance, Euclidean distance and Chebyshev distance respectively, and the red region in the image is extracted by performing mask operation on the three distance transform heat maps according to the pre-set RGB red threshold, and then binaryzation operation is performed to obtain three different head center region images, for each head center region image, the extraction matching degree of the head center region is calculated, and the image with the highest extraction matching degree is selected as the final head center region image Img1.
6. The machine vision-based deheading shrimp posture detection method according to claim 5, wherein, The method for obtaining the extraction matching degree of the head center region is as follows: In the formula, represents the extraction matching degree, k i represents the rectangularity of the connected domain of the i-th shrimp head center area image, length i represents the length of the long side of the minimum circumscribed rectangle of the connected domain of the i-th shrimp head center area image, length max represents the length of the longest side of the three long sides.
7. The machine vision-based head-on-shrimp posture detection method according to claim 1, wherein: In S3, the method for determining the head and back orientation reference lines is as follows: Corner point detection is performed on the head center region image Img1, and the obtained corner point pixel coordinates are fitted by a straight line to obtain a fitting line segment l1, which is the head orientation reference line, a midline segment l2 equal in length to the fitting line segment l1 is drawn, which is the back orientation reference line, and 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 are saved.
8. The machine vision-based deheading shrimp posture detection method according to claim 7, wherein, In S4, the method for determining the head orientation is as follows: Firstly, the minimum circumscribed rectangle of the headless shrimp binary image Img0 is obtained, and the equations of the straight lines on which the two wide sides W1 and W2 of the minimum circumscribed rectangle are located and the equations of the straight lines on which the two long sides L1 and L2 of the minimum circumscribed rectangle are located are saved in the pixel coordinate system, and then the Euclidean distances d of the endpoints h1 and h2 and the wide sides W1 and W2 are calculated respectively h , and finally the endpoint h corresponding to the minimum distance is found, and the vector is the head direction vector of the shrimp.
9. The machine vision-based deheading shrimp posture detection method according to claim 8, wherein: In S5, the method for determining the back orientation is as follows: Firstly, the long side L1 is translated P pixel units towards the direction of the long side L2 to cut the head of the shrimp binaryzation image Img0, and the cut binaryzation image Img 01 is obtained The number num1 of connected domains with an area greater than a threshold S min in the image is calculated, and the binaryzation image Img 02 cut by the long side L2 is obtained in the same way The number num2 of connected domains with an area greater than a threshold S min in the image is calculated, and then the size of num1 and num2 is compared The long side L b with the smaller value is the long side close to the back of the shrimp The Euclidean distance d b between the end points b1 and b2 and the long side L b is calculated respectively The end point b corresponding to the smallest distance is found The vector is the back of the shrimp 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