Detection method of animal husbandry and veterinary waste treatment based on image processing

By calculating the local mutually different eigenvalues ​​and interpolated kernel function values ​​in the animal husbandry and veterinary waste images for image reconstruction, the problems of image clarity and edge blur are solved, and the classification accuracy of animal husbandry and veterinary waste is improved.

CN118762247BActive Publication Date: 2024-12-10DALIAN SHOUYE BIOTECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411253495.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-09
Publication Date
2024-12-10
Estimated Expiration
2044-09-09

AI Technical Summary

Technical Problem

In the prior art, the lower clarity and blurred edges of the animal husbandry and veterinary waste images lead to poor detection effects, and the reconstruction effects of different interpolation kernel functions in different images are different, resulting in low accuracy of the animal husbandry and veterinary waste classification.

Method used

By obtaining the grayscale image of the waste accumulation area for animal husbandry and veterinary medicine, the local mutually different eigenvalue and interpolation kernel function value of each pixel point are calculated, image interpolation processing is performed, super-resolution images are obtained, and each is determined based on the interpolation kernel function value is determined. The grayscale values ​​of each pixel point are reconstructed and classified.

Benefits of technology

It improves the resolution of the image and the obviousness of edge features, and improves the accuracy and effectiveness of waste classification for animal husbandry and veterinary medicine.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118762247B_ABST
    Figure CN118762247B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to a method for detecting animal husbandry and veterinary waste treatment based on image processing. The method comprises: obtaining a grayscale image of an area where animal husbandry and veterinary waste is accumulated; obtaining local mutually different eigenvalues ​​according to the grayscale difference between each pixel in the grayscale image and the pixel in its neighborhood; obtaining the contrast weight of each pixel in each preset direction according to the difference between the local mutually different eigenvalues ​​of adjacent pixels in each preset direction of each pixel, and further obtaining the interpolation kernel function value; interpolating the grayscale image to obtain a super-resolution image, determining the grayscale value of each interpolation pixel according to the relative position of each interpolation pixel in the super-resolution image and the mapped pixel in its neighborhood and the interpolation kernel function value, and then obtaining a reconstructed image; and classifying the waste based on the reconstructed image. The present invention improves the accuracy of animal husbandry and veterinary waste classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to a method for detecting animal husbandry and veterinary waste treatment based on image processing. Background Art

[0002] Livestock and veterinary waste refers to waste generated in animal husbandry and veterinary medical practice, such as discarded drugs and vaccines. There are different treatment methods for different veterinary wastes, including incineration, disinfection, landfill, recycling and other methods.

[0003] Since livestock and veterinary waste is usually placed in a messy manner, and images of medical waste accumulation areas are usually collected through surveillance cameras, the collected images have low clarity and blurred edges. The blurred edges of the collected images will result in relatively poor detection effects when traditional visual detection algorithms, such as edge detection algorithms, are used to detect images of waste accumulation areas. At the same time, since the image clarity is also low, when feature extraction algorithms are used to extract features from images of medical waste accumulation areas, the resulting features will be relatively unclear, making it impossible to accurately detect medical waste.

[0004] In order to solve the problem that the medical waste cannot be accurately detected due to the low clarity and blurred edges of the collected images, the existing technology often reconstructs the image to improve its clarity. The existing image super-resolution reconstruction algorithm, such as the multi-phase image interpolation algorithm, has a good super-resolution reconstruction effect, which can make the image relatively clear and relatively easy to extract features. However, different interpolation kernel functions have different reconstruction effects, and the reconstruction effect of the interpolation kernel function is also different in different images. Therefore, the inappropriate setting of the interpolation kernel function will lead to poor classification of animal husbandry and veterinary waste. Therefore, how to adaptively obtain a suitable interpolation kernel function based on the characteristics of the image of the medical waste accumulation area to improve the accuracy of the classification results of animal husbandry and veterinary waste is an urgent problem to be solved. Summary of the invention

[0005] In order to solve the problem that the existing image super-resolution reconstruction algorithm has poor reconstruction effect on livestock and veterinary waste images, resulting in low classification accuracy of livestock and veterinary waste, the purpose of the present invention is to provide a livestock and veterinary waste treatment detection method based on image processing, and the technical scheme adopted is as follows:

[0006] The present invention provides a method for detecting animal husbandry and veterinary waste treatment based on image processing, the method comprising the following steps:

[0007] Obtaining a grayscale image of an area where livestock and veterinary waste is accumulated;

[0008] According to the grayscale difference between each pixel point in the grayscale image and the pixels in its neighborhood, a local mutually different eigenvalue of each pixel point is obtained; according to the difference between the local mutually different eigenvalues ​​of adjacent pixels in each preset direction of each pixel point, a contrast weight value of each pixel point is calculated in each preset direction, and an interpolation kernel function value in each preset direction is obtained according to the contrast weight value;

[0009] Performing interpolation processing on the grayscale image to obtain a super-resolution image and a mapping pixel point corresponding to each pixel point in the grayscale image in the super-resolution image, recording other pixel points in the super-resolution image except the mapping pixel point as interpolation pixel points; determining the grayscale value corresponding to each interpolation pixel point according to the relative position of each interpolation pixel point in the super-resolution image and the mapping pixel point in its neighborhood and the interpolation kernel function value corresponding to the mapping pixel point in the neighborhood in each preset direction; and obtaining a reconstructed image based on the grayscale value of the interpolation pixel point;

[0010] The reconstructed image is processed and waste in the livestock and veterinary waste accumulation area is classified using the processed image.

[0011] Preferably, the step of obtaining a grayscale image of an area where livestock and veterinary waste is accumulated includes:

[0012] The image obtained by the monitoring camera is recorded as the surface image of the livestock and veterinary waste accumulation area, the surface image of the livestock and veterinary waste accumulation area is grayscale processed and denoised, and the processed image is recorded as the grayscale image of the livestock and veterinary waste accumulation area.

[0013] Preferably, obtaining the local mutually different characteristic value of each pixel point according to the grayscale difference between each pixel point in the grayscale image and the pixels in its neighborhood includes:

[0014] For the i-th pixel in the grayscale image:

[0015] Constructing a neighborhood grayscale difference matrix corresponding to the i-th pixel based on the grayscale difference between the i-th pixel and each pixel in its neighborhood, and obtaining the roughness corresponding to the i-th pixel based on the neighborhood grayscale difference matrix;

[0016] The local mutually different eigenvalue of the i-th pixel is obtained according to the maximum grayscale difference between the i-th pixel and the pixels in its neighborhood, the minimum grayscale difference between the i-th pixel and the pixels in its neighborhood, and the roughness.

[0017] Preferably, the following formula is used to calculate the local mutually different eigenvalue of the i-th pixel:

[0018]

[0019] in, is the local distinct eigenvalue of the i-th pixel, is the roughness corresponding to the i-th pixel, is the maximum grayscale difference between the i-th pixel and its neighboring pixels, is the minimum grayscale difference between the ith pixel and its neighboring pixels, e is a natural constant, and ln( ) is a logarithmic function with the natural constant as the base.

[0020] Preferably, obtaining the interpolation kernel function value corresponding to each pixel point in each preset direction according to the difference between the local mutually different feature values ​​of adjacent pixel points in each preset direction of each pixel point includes:

[0021] For the i-th pixel in the grayscale image:

[0022] For the qth preset direction, a preset first number of pixel points that are closest to the ith pixel point in the qth preset direction are obtained as characteristic pixel points of the ith pixel point in the qth preset direction;

[0023] According to the difference between the local mutually different feature values ​​of the adjacent feature pixels of the ith pixel in the qth preset direction, the interpolation kernel function value corresponding to the ith pixel in the qth preset direction is obtained.

[0024] Preferably, the following formula is used to calculate the contrast weight of the i-th pixel in the q-th preset direction:

[0025]

[0026] in, is the contrast weight of the i-th pixel in the q-th preset direction, is the local mutually different eigenvalue of the mth feature pixel of the ith pixel in the qth preset direction, is the local mutually different eigenvalue of the m-1th feature pixel of the ith pixel in the qth preset direction.

[0027] Preferably, the interpolation kernel function value corresponding to the i-th pixel point in the q-th preset direction is calculated using the following formula:

[0028]

[0029] in, is the interpolation kernel function value corresponding to the ith pixel in the qth preset direction, M is the number of feature pixels of the ith pixel in the qth preset direction, ln( ) is a logarithmic function with a natural constant as the base, and e is a natural constant.

[0030] Preferably, determining the grayscale value corresponding to each interpolated pixel point according to the relative position of each interpolated pixel point in the super-resolution image and the mapped pixel point in its neighborhood and the interpolation kernel function value corresponding to the mapped pixel point in the neighborhood in each preset direction includes:

[0031] For the j-th interpolation pixel in the super-resolution image:

[0032] According to the relative position of the j-th interpolation pixel point and each mapping pixel point in its neighborhood, the target direction corresponding to each mapping pixel point in the neighborhood of the j-th interpolation pixel point is obtained; the target direction is the direction from the j-th interpolation pixel point to the corresponding mapping pixel point in its neighborhood;

[0033] The products of the interpolation kernel function values ​​and the corresponding grayscale values ​​of each mapped pixel point in the neighborhood of the j-th interpolation pixel point in the corresponding target direction are respectively determined as the first eigenvalues ​​corresponding to each mapped pixel point in the neighborhood of the j-th interpolation pixel point; the sum of the first eigenvalues ​​corresponding to all mapped pixel points in the neighborhood of the j-th interpolation pixel point is recorded as the first sum value;

[0034] The interpolation kernel function value corresponding to the target direction of all mapped pixels in the neighborhood of the j-th interpolation pixel is recorded as the second sum value;

[0035] The ratio of the first sum value to the second sum value is determined as the grayscale value of the j-th interpolation pixel point.

[0036] Preferably, the processing of the reconstructed image comprises:

[0037] Performing histogram equalization and contrast enhancement processing on the reconstructed image to obtain a processed image;

[0038] A threshold segmentation method is used to obtain the medical waste regions in the processed image, and feature data of each medical waste region is extracted.

[0039] Preferably, the method of using the processed image to classify the waste in the livestock and veterinary waste accumulation area includes:

[0040] The characteristic data is used as the input of a support vector machine, and the output is used to obtain the classification category of animal husbandry and veterinary waste.

[0041] The present invention has at least the following beneficial effects:

[0042] The present invention first obtains the local mutual difference eigenvalue of each pixel point according to the grayscale difference between each pixel point and the pixel points in its neighborhood in the grayscale image of the livestock and veterinary waste accumulation area. The local mutual difference eigenvalue is used to reflect the strength of the edge feature of the corresponding pixel point. The larger the difference of the local mutual difference eigenvalue is, the greater the concentration degree of the pixel point difference in the preset direction is, that is, the corresponding pixel point is more likely to belong to the edge in the preset direction. When reconstructing the image, in order to make the edge clearer, it is necessary to give a larger weight in the corresponding preset direction, that is, the larger the corresponding interpolation kernel function value is. Therefore, the present invention combines the difference between the local mutual difference eigenvalues ​​of adjacent pixels in each preset direction of each pixel point, obtains the interpolation kernel function value corresponding to each pixel point in each preset direction, and determines the grayscale value of each interpolation pixel point based on the interpolation kernel function value, and obtains the reconstructed image. The reconstructed image has higher resolution and more obvious edge features. The classification effect of classifying the waste in the livestock and veterinary waste accumulation area based on the reconstructed image is better, and the accuracy of the classification of livestock and veterinary waste is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 The present invention provides a flowchart of a livestock and veterinary waste treatment detection method based on image processing. DETAILED DESCRIPTION

[0045] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose of the invention, the livestock and veterinary waste treatment detection method based on image processing proposed by the present invention is described in detail as follows in combination with the accompanying drawings and preferred embodiments.

[0046] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0047] The specific scheme of the livestock and veterinary waste treatment detection method based on image processing provided by the present invention is described in detail below with reference to the accompanying drawings.

[0048] Example of animal husbandry and veterinary waste treatment detection method based on image processing:

[0049] The specific scenario targeted by this embodiment is: when determining the category of waste in the livestock and veterinary waste accumulation area, first collect images of the livestock and veterinary waste accumulation area, and then perform feature extraction on the collected images of the livestock and veterinary waste accumulation area. However, during the image acquisition process, the image is easily disturbed by the image acquisition device and the environment, resulting in a low resolution of the collected image, which in turn affects the accuracy of subsequent vital sign extraction. In this embodiment, first collect images of the livestock and veterinary waste accumulation area, and then analyze the grayscale difference of each pixel point in the collected image and the pixel points in its neighborhood to determine the local mutually different eigenvalues ​​of each pixel point, and obtain the interpolation kernel function value corresponding to each pixel point in each preset direction based on the local mutually different eigenvalues, and then use a multi-phase image interpolation algorithm (i.e., Lanczos algorithm) to perform super-resolution reconstruction on the collected image to obtain a reconstructed image, and classify the waste in the livestock and veterinary waste accumulation area based on the reconstructed image.

[0050] This embodiment proposes a method for detecting animal husbandry and veterinary waste treatment based on image processing, such as Figure 1 As shown, the animal husbandry and veterinary waste treatment detection method based on image processing of this embodiment includes the following steps:

[0051] Step S001, obtaining a grayscale image of an area where livestock and veterinary waste is accumulated.

[0052] In this embodiment, the surface image of the livestock and veterinary waste accumulation area is first collected by the monitoring camera of the livestock and veterinary waste collection center. The collected surface image of the livestock and veterinary waste accumulation area is an RGB image. The surface image of the livestock and veterinary waste accumulation area is grayed to obtain a corresponding gray image. Since the monitoring camera may be affected by environmental factors when collecting images, the quality of the collected image is low, which may affect the subsequent analysis and recognition results. The gray image after graying is denoised. In this embodiment, the gray image is denoised using a bilateral filtering algorithm, and the denoised gray image is recorded as the gray image of the livestock and veterinary waste accumulation area. The graying of the image and the bilateral filtering algorithm are both existing technologies and will not be described in detail here.

[0053] At this point, a grayscale image of the livestock and veterinary waste accumulation area is obtained.

[0054] Step S002, obtaining the local mutually different eigenvalues ​​of each pixel point according to the grayscale difference between each pixel point in the grayscale image and the pixels in its neighborhood; obtaining the interpolation kernel function value corresponding to each pixel point in each preset direction according to the difference between the local mutually different eigenvalues ​​of adjacent pixels in each preset direction of each pixel point.

[0055] Since the surveillance camera is designed to meet the requirements of stability and reliability, ensuring long-term operation without failure, but its pixel number is low, that is, the clarity of the captured image is relatively low. When the grayscale image of the livestock and veterinary waste accumulation area is directly used for medical waste identification, there will be a problem of low accuracy of the identification result. In this embodiment, the grayscale image of the livestock and veterinary waste accumulation area is reconstructed with image super-resolution through an improved Lanczos algorithm to obtain a clearer image, which is convenient for the subsequent accurate identification of medical waste.

[0056] Since the resolution of the grayscale image of the livestock and veterinary waste accumulation area is low, the medical waste features are relatively fuzzy, such as edge features with higher grayscale values ​​and obvious edges may be diluted into edge features with lower grayscale values ​​and thicker edge lines. Based on this, this embodiment first analyzes the grayscale distribution of each pixel point and its surrounding pixels in the grayscale image of the livestock and veterinary waste accumulation area, determines the roughness corresponding to each pixel point and each pixel point in its neighborhood, and then determines the local mutually different feature value of each pixel point.

[0057] Specifically, for the i-th pixel in the grayscale image of the livestock and veterinary waste accumulation area:

[0058] Based on the grayscale difference between the i-th pixel and each pixel in its neighborhood, a neighborhood grayscale difference matrix corresponding to the i-th pixel is constructed, and the roughness corresponding to the i-th pixel is obtained based on the neighborhood grayscale difference matrix. The method for obtaining the neighborhood grayscale difference matrix and the calculation process of the roughness are both well-known technologies and will not be described in detail here. The neighborhood in this embodiment is eight neighborhoods, and in specific applications, the implementer can set it according to specific circumstances.

[0059] The greater the roughness corresponding to the pixel point, the greater the grayscale difference between the corresponding pixel point and the surrounding pixels, that is, the more likely the corresponding pixel point is an edge pixel point. This embodiment will first combine the grayscale difference between each pixel point and the pixels in its neighborhood in the grayscale image of the livestock and veterinary waste accumulation area to obtain the local mutual difference eigenvalue of each pixel point, and then assign corresponding grayscale allocation weights to the interpolated pixels in combination with the local mutual difference eigenvalues.

[0060] Specifically, this embodiment first obtains the maximum grayscale difference between the i-th pixel point in the grayscale image of the livestock and veterinary waste accumulation area and the pixels in its neighborhood and the minimum grayscale difference between the i-th pixel point in the grayscale image of the livestock and veterinary waste accumulation area and the pixels in its neighborhood, and then calculates the local mutual difference eigenvalue of the i-th pixel point according to the maximum grayscale difference between the i-th pixel point in the grayscale image of the livestock and veterinary waste accumulation area and the pixels in its neighborhood, the minimum grayscale difference between the i-th pixel point and the pixels in its neighborhood and the roughness. The specific calculation formula of the local mutual difference eigenvalue of the i-th pixel point is:

[0061]

[0062] in, is the local distinct eigenvalue of the i-th pixel, is the roughness corresponding to the i-th pixel, is the maximum grayscale difference between the i-th pixel and its neighboring pixels, is the minimum grayscale difference between the ith pixel and its neighboring pixels, e is a natural constant, and ln( ) is a logarithmic function with the natural constant as the base.

[0063] The local mutual difference eigenvalue of the i-th pixel reflects the concentration degree of the difference between the i-th pixel and the surrounding pixels. The more concentrated the difference between the i-th pixel and the surrounding pixels, that is, the difference between the i-th pixel and the surrounding pixels is mainly concentrated on several pixels around the i-th pixel. At this time, the more obvious the edge feature in the image is, the larger the local mutual difference eigenvalue of the i-th pixel is; the more dispersed the difference between the i-th pixel and the surrounding pixels, that is, the i-th pixel and the surrounding pixels have certain differences, and there is no significant difference between the differences, the edge feature in the image is relatively weak, and the local mutual difference eigenvalue of the i-th pixel is smaller.

[0064] By adopting the above method, the local mutual difference eigenvalue of the i-th pixel point is obtained, which is used to reflect the concentration degree of the difference between the i-th pixel point and the surrounding pixels. The resolution of the grayscale image of the livestock and veterinary waste accumulation area is low, and the edge is relatively blurred. In addition, due to the disordered stacking of medical waste such as syringes and medicine bottles, the grayscale values ​​of the edge pixels have a certain gradient, and the gradient direction is the edge direction. Based on this, this embodiment constructs an interpolation kernel function according to the local mutual difference eigenvalue of each pixel point, and determines the grayscale value corresponding to each interpolation pixel point in the super-resolution image based on the interpolation kernel function value corresponding to each pixel point in each preset direction.

[0065] Specifically, this embodiment will obtain the interpolation kernel function value corresponding to each pixel in each preset direction according to the difference between the local mutually different characteristic values ​​of adjacent pixels in each preset direction of each pixel. For the i-th pixel in the grayscale image of the livestock and veterinary waste accumulation area: for the q-th preset direction, obtain the preset first number of pixels closest to the i-th pixel in the q-th preset direction as the characteristic pixel of the i-th pixel in the q-th preset direction; in this embodiment, the preset first number is 20, and in specific applications, the implementer can set it according to specific circumstances.

[0066] According to the difference between the local mutually different feature values ​​of the adjacent feature pixels of the ith pixel in the qth preset direction, the contrast weight of the ith pixel in the qth preset direction is obtained.

[0067]

[0068] in, is the contrast weight of the i-th pixel in the q-th preset direction, is the local mutually different eigenvalue of the mth feature pixel of the ith pixel in the qth preset direction, is the local mutually different eigenvalue of the m-1th feature pixel of the ith pixel in the qth preset direction.

[0069] According to the contrast weight of the ith pixel in the qth preset direction, the interpolation kernel function value corresponding to the ith pixel in the qth preset direction is obtained. The specific calculation formula of the interpolation kernel function value corresponding to the ith pixel in the qth preset direction is:

[0070]

[0071] in, is the interpolation kernel function value corresponding to the ith pixel in the qth preset direction, M is the number of feature pixels of the ith pixel in the qth preset direction, ln( ) is a logarithmic function with a natural constant as the base, and e is a natural constant.

[0072] In this embodiment, four preset directions are set, namely 0° direction, 45° direction, 90° direction and 135° direction. In specific applications, the implementer can set them according to specific circumstances. When q is 1, it indicates 0° direction, when q is 2, it indicates 45° direction, when q is 3, it indicates 90° direction, and when q is 4, it indicates 135° direction.

[0073] The greater the difference in local mutually different eigenvalues ​​between the adjacent pixels of the i-th pixel in the q-th preset direction, that is, The larger the value is, the greater the concentration of pixel differences in the qth preset direction is, that is, the more likely the i-th pixel is to belong to the edge in the qth preset direction.

[0074] When reconstructing an image, in order to make the edge clearer, it is necessary to assign a larger weight in the qth preset direction, that is, the corresponding interpolation kernel function value is larger; the smaller the difference in the local different eigenvalues ​​of adjacent pixels in the qth preset direction, that is, The smaller it is, the smaller the concentration of pixel differences in the qth preset direction is, that is, the i-th pixel is less likely to belong to the edge in the qth preset direction. When reconstructing the image, in order to make the edge clearer, it is necessary to assign a smaller weight in the qth preset direction, that is, the corresponding interpolation kernel function value is smaller.

[0075] By adopting the above method, the interpolation kernel function value corresponding to each pixel point in each preset direction in the grayscale image of the livestock and veterinary waste accumulation area can be obtained.

[0076] Step S003, interpolating the grayscale image to obtain a super-resolution image and a mapping pixel point corresponding to each pixel point in the grayscale image in the super-resolution image, and recording the other pixel points in the super-resolution image except the mapping pixel points as interpolated pixel points; determining the grayscale value corresponding to each interpolated pixel point according to the relative position of each interpolated pixel point in the super-resolution image and the mapping pixel points in its neighborhood and the interpolation kernel function value corresponding to the mapping pixel points in the neighborhood in each preset direction; and obtaining a reconstructed image based on the grayscale value of the interpolated pixel point.

[0077] In this embodiment, the Lanczos radius in the Lanczos algorithm is set to 3. In specific applications, the implementer can set it according to specific circumstances. For each pixel point in the grayscale image of the livestock and veterinary waste accumulation area, the grayscale image of the livestock and veterinary waste accumulation area is interpolated by bilinear interpolation to obtain a super-resolution image. The position of each pixel point in the grayscale image of the livestock and veterinary waste accumulation area corresponding to the super-resolution image is calculated by bilinear interpolation, that is, the pixel points in the grayscale image of the livestock and veterinary waste accumulation area are mapped to the super-resolution image.

[0078] The corresponding mapping pixel point in the super-resolution image for each pixel point in the grayscale image of the livestock and veterinary waste accumulation area is obtained. It should be noted that the bilinear interpolation method is used here only to obtain the position of each pixel point in the grayscale image of the livestock and veterinary waste accumulation area in the interpolated image, that is, the position in the super-resolution image; the size of the super-resolution image is larger than the size of the grayscale image of the livestock and veterinary waste accumulation area.

[0079] The bilinear interpolation method is used to obtain the position correspondence between the super-resolution image and the original image, which is a well-known technique, and the specific process will not be described in detail in this embodiment.

[0080] The present embodiment obtains the interpolation kernel function value corresponding to each pixel in the grayscale image of the livestock and veterinary waste accumulation area and the specific position of each mapped pixel in the super-resolution image, and records the other pixels in the super-resolution image except the mapped pixels as interpolation pixels, that is, there are multiple interpolation pixels in the super-resolution image; when reconstructing the super-resolution image, the edge features of the reconstructed image should be more obvious, so the grayscale allocation weight corresponding to the edge pixel should be larger, and the interpolation kernel function value is used to represent the grayscale allocation weight of the interpolation pixel. Therefore, the present embodiment will combine the interpolation kernel function value corresponding to the mapped pixel in each preset direction in the neighborhood of each interpolation pixel in the super-resolution image to determine the interpolation kernel function value corresponding to each interpolation pixel.

[0081] For the j-th interpolation pixel point in the super-resolution image: according to the relative position of the j-th interpolation pixel point and each mapping pixel point in its neighborhood, obtain the target direction corresponding to each mapping pixel point in the neighborhood of the j-th interpolation pixel point; the target direction is the direction from the j-th interpolation pixel point to the corresponding mapping pixel point in its neighborhood.

[0082] For example: for the first mapped pixel in the neighborhood of the jth interpolation pixel, if the direction from the jth interpolation pixel to the first mapped pixel in its neighborhood is 45°, then the 45° direction is used as the target direction corresponding to the first mapped pixel in the neighborhood of the jth interpolation pixel. The product of the interpolation kernel function value and the corresponding gray value corresponding to each mapped pixel in the neighborhood of the jth interpolation pixel in the corresponding target direction is determined as the first eigenvalue corresponding to each mapped pixel in the neighborhood of the jth interpolation pixel; the sum of the first eigenvalues ​​corresponding to all mapped pixels in the neighborhood of the jth interpolation pixel is recorded as the first sum; the interpolation kernel function value corresponding to the target direction corresponding to all mapped pixels in the neighborhood of the jth interpolation pixel is recorded as the second sum; the ratio of the first sum to the second sum is determined as the gray value of the jth interpolation pixel.

[0083] It should be noted that the grayscale value corresponding to each pixel mapping pixel is the same as the grayscale value of the corresponding pixel in the grayscale image of the livestock and veterinary waste accumulation area, that is, the grayscale value of each pixel in the grayscale image of the livestock and veterinary waste accumulation area is the same as the grayscale value of the corresponding mapping pixel in the super-resolution image. The specific calculation formula for the grayscale value of the j-th interpolation pixel is:

[0084]

[0085] in, is the gray value of the j-th interpolated pixel in the super-resolution image, R is the number of mapped pixels in the neighborhood of the j-th interpolated pixel in the super-resolution image, is the interpolation kernel function value corresponding to the rth mapped pixel point in the neighborhood of the jth interpolation pixel point in the super-resolution image in the corresponding target direction, is the gray value of the rth mapped pixel in the neighborhood of the jth interpolated pixel in the super-resolution image.

[0086] represents the first eigenvalue corresponding to the rth mapped pixel in the neighborhood of the jth interpolated pixel, is the first sum value, is the second sum value.

[0087] The interpolation kernel function value is used to represent the grayscale distribution weight of the interpolated pixel point. The more obvious the edge feature of the pixel point in the target direction, the larger the corresponding interpolation kernel function value, that is, the larger the weight in the target direction, and the more obvious the edge feature of the reconstructed image; the weaker the edge feature of the pixel point in the target direction, the smaller the corresponding interpolation kernel function value, that is, the smaller the weight in the target direction, and the weaker the edge feature of the reconstructed image.

[0088] By using the above method, the grayscale value corresponding to each interpolated pixel in the super-resolution image can be obtained, the calculated grayscale value is assigned to the corresponding interpolated pixel, and the image after the assignment is completed is recorded as a reconstructed image.

[0089] Step S004, processing the reconstructed image, and using the processed image to classify the waste in the livestock and veterinary waste accumulation area.

[0090] This embodiment takes into account that the edge of the medical waste image after super-resolution reconstruction may not be smooth enough, so this embodiment uses the dilation operation in morphological image processing to smooth the reconstructed image. At the same time, in order to improve the contrast in the reconstructed image and make the characteristics of the medical waste more obvious, this embodiment uses the histogram equalization algorithm (i.e., CLAHE algorithm) to enhance the contrast of the reconstructed image, and the image after smoothing and contrast enhancement is recorded as the processed image. The dilation operation and histogram equalization algorithm in morphological image processing are both existing technologies and will not be described in detail here.

[0091] The processed image obtained by the above steps is relatively clear, and the characteristics of medical waste in the processed image are relatively more obvious. This embodiment uses the threshold segmentation method to segment and extract the medical waste in the processed image; extract the characteristic data of each medical waste area, wherein the characteristic data includes perimeter, area, curvature, aspect ratio, gray value, etc., use RBF kernel function as the kernel function of SVM, transform the low-dimensional inseparable characteristic data into high-dimensional space, and use support vector machine to achieve the optimal classification of medical waste, and mark the classification results, and take corresponding processing methods according to the different classification results of animal husbandry and veterinary waste. The threshold segmentation method used in this embodiment is the Otsu threshold segmentation algorithm; wherein the Otsu threshold segmentation method and the support vector machine are both known technologies for classifying characteristic data, and the specific process of this embodiment will not be repeated in detail.

[0092] This embodiment first obtains the local mutual difference eigenvalue of each pixel point based on the grayscale difference between each pixel point and the pixel points in its neighborhood in the grayscale image of the livestock and veterinary waste accumulation area. The local mutual difference eigenvalue is used to reflect the strength of the edge feature of the corresponding pixel point. The larger the difference in the local mutual difference eigenvalue, the greater the concentration of the pixel point difference in the preset direction, that is, the more likely the corresponding pixel point belongs to the edge in the preset direction. When reconstructing the super-resolution image, in order to make the edge clearer, it is necessary to give a larger weight in the corresponding preset direction, that is, the larger the corresponding interpolation kernel function value. Therefore, this embodiment combines the difference between the local mutual difference eigenvalues ​​of adjacent pixels in each preset direction of each pixel point, obtains the interpolation kernel function value corresponding to each pixel point in each preset direction, and determines the grayscale value of each interpolation pixel point based on the interpolation kernel function value, and obtains a reconstructed image. The reconstructed image has a higher resolution and more obvious edge features. The classification effect of classifying waste in the livestock and veterinary waste accumulation area based on the reconstructed image is better, and the accuracy of the classification of livestock and veterinary waste is improved.

[0093] It should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for detecting animal husbandry and veterinary waste treatment based on image processing, characterized in that: The method comprises the following steps: Obtaining a grayscale image of an area where livestock and veterinary waste is accumulated; According to the grayscale difference between each pixel point in the grayscale image and the pixels in its neighborhood, a local mutually different eigenvalue of each pixel point is obtained; according to the difference between the local mutually different eigenvalues ​​of adjacent pixels in each preset direction of each pixel point, a contrast weight of each pixel point in each preset direction is obtained, and an interpolation kernel function value in each preset direction is obtained according to the contrast weight; Performing interpolation processing on the grayscale image to obtain a super-resolution image and a mapping pixel point corresponding to each pixel point in the grayscale image in the super-resolution image, recording other pixel points in the super-resolution image except the mapping pixel point as interpolation pixel points; determining the grayscale value corresponding to each interpolation pixel point according to the relative position of each interpolation pixel point in the super-resolution image and the mapping pixel point in its neighborhood and the interpolation kernel function value corresponding to the mapping pixel point in the neighborhood in each preset direction; and obtaining a reconstructed image based on the grayscale value of the interpolation pixel point; processing the reconstructed image, and using the processed image to classify waste in a livestock and veterinary waste accumulation area; The method of obtaining the local mutually different characteristic values ​​of each pixel point according to the grayscale difference between each pixel point in the grayscale image and the pixel points in its neighborhood includes: For the i-th pixel in the grayscale image: Constructing a neighborhood grayscale difference matrix corresponding to the i-th pixel based on the grayscale difference between the i-th pixel and each pixel in its neighborhood, and obtaining the roughness corresponding to the i-th pixel based on the neighborhood grayscale difference matrix; Obtaining a local mutually different eigenvalue of the i-th pixel according to the maximum grayscale difference between the i-th pixel and the pixels in its neighborhood, the minimum grayscale difference between the i-th pixel and the pixels in its neighborhood, and the roughness; The following formula is used to calculate the local mutual difference eigenvalue of the i-th pixel: in, is the local distinct eigenvalue of the i-th pixel, is the roughness corresponding to the i-th pixel, is the maximum grayscale difference between the i-th pixel and its neighboring pixels, is the minimum grayscale difference between the i-th pixel and its neighboring pixels, e is a natural constant, and ln() is a logarithmic function with the natural constant as the base; The interpolation kernel function value corresponding to each pixel point in each preset direction is obtained according to the difference between the local mutually different feature values ​​of adjacent pixel points in each preset direction of each pixel point, including: For the i-th pixel in the grayscale image: For the qth preset direction, a preset first number of pixel points that are closest to the ith pixel point in the qth preset direction are obtained as characteristic pixel points of the ith pixel point in the qth preset direction; According to the difference between the local mutually different characteristic values ​​of the adjacent characteristic pixel points of the i-th pixel point in the q-th preset direction, the interpolation kernel function value corresponding to the i-th pixel point in the q-th preset direction is obtained; The following formula is used to calculate the contrast weight of the i-th pixel in the q-th preset direction: in, is the contrast weight of the i-th pixel in the q-th preset direction, is the local mutually different eigenvalue of the mth feature pixel of the ith pixel in the qth preset direction, is the local mutually different eigenvalue of the m-1th feature pixel of the ith pixel in the qth preset direction; The interpolation kernel function value corresponding to the i-th pixel point in the q-th preset direction is calculated using the following formula: in, is the interpolation kernel function value corresponding to the ith pixel in the qth preset direction, M is the number of feature pixels of the ith pixel in the qth preset direction, ln() is a logarithmic function with a natural constant as the base, and e is a natural constant; The processing of the reconstructed image comprises: Performing histogram equalization and contrast enhancement processing on the reconstructed image to obtain a processed image; A threshold segmentation method is used to obtain the medical waste regions in the processed image, and feature data of each medical waste region is extracted.

2. The method for detecting animal husbandry and veterinary waste treatment based on image processing according to claim 1, characterized in that: The step of obtaining a grayscale image of an area where livestock and veterinary waste is accumulated includes: The image obtained by the monitoring camera is recorded as the surface image of the livestock and veterinary waste accumulation area, the surface image of the livestock and veterinary waste accumulation area is grayscale processed and denoised, and the processed image is recorded as the grayscale image of the livestock and veterinary waste accumulation area.

3. The method for detecting animal husbandry and veterinary waste treatment based on image processing according to claim 1, characterized in that: The step of determining the grayscale value corresponding to each interpolated pixel point according to the relative position of each interpolated pixel point in the super-resolution image and the mapped pixel point in its neighborhood and the interpolation kernel function value corresponding to the mapped pixel point in the neighborhood in each preset direction comprises: For the j-th interpolation pixel in the super-resolution image: According to the relative position of the j-th interpolation pixel point and each mapping pixel point in its neighborhood, the target direction corresponding to each mapping pixel point in the neighborhood of the j-th interpolation pixel point is obtained; the target direction is the direction from the j-th interpolation pixel point to the corresponding mapping pixel point in its neighborhood; The products of the interpolation kernel function values ​​and the corresponding grayscale values ​​of each mapped pixel point in the neighborhood of the j-th interpolation pixel point in the corresponding target direction are respectively determined as the first eigenvalues ​​corresponding to each mapped pixel point in the neighborhood of the j-th interpolation pixel point; the sum of the first eigenvalues ​​corresponding to all mapped pixel points in the neighborhood of the j-th interpolation pixel point is recorded as the first sum value; The interpolation kernel function value corresponding to the target direction of all mapped pixels in the neighborhood of the j-th interpolation pixel is recorded as the second sum value; The ratio of the first sum value to the second sum value is determined as the grayscale value of the j-th interpolation pixel point.

4. The method for detecting animal husbandry and veterinary waste treatment based on image processing according to claim 1, characterized in that: The method of using the processed images to classify the waste in the livestock and veterinary waste accumulation area includes: The characteristic data is used as the input of a support vector machine, and the output is used to obtain the classification category of animal husbandry and veterinary waste.