WO2019014810A1 - Image processing method and device, and intelligent terminal - Google Patents

Image processing method and device, and intelligent terminal Download PDF

Info

Publication number
WO2019014810A1
WO2019014810A1 PCT/CN2017/093170 CN2017093170W WO2019014810A1 WO 2019014810 A1 WO2019014810 A1 WO 2019014810A1 CN 2017093170 W CN2017093170 W CN 2017093170W WO 2019014810 A1 WO2019014810 A1 WO 2019014810A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
target
area
spray
polygon
Prior art date
Application number
PCT/CN2017/093170
Other languages
French (fr)
Chinese (zh)
Inventor
周游
刘洁
唐克坦
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to CN201780004777.7A priority Critical patent/CN108496203B/en
Priority to PCT/CN2017/093170 priority patent/WO2019014810A1/en
Publication of WO2019014810A1 publication Critical patent/WO2019014810A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20172Image enhancement details
    • G06T2207/20182Noise reduction or smoothing in the temporal domain; Spatio-temporal filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20172Image enhancement details
    • G06T2207/20192Edge enhancement; Edge preservation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30181Earth observation
    • G06T2207/30188Vegetation; Agriculture

Definitions

  • the present invention relates to the field of image processing technologies, and in particular, to a method and device for processing an image, and an intelligent terminal.
  • the embodiment of the invention provides a method and a device for processing an image, and an intelligent terminal, which can completely determine the distribution of the spray by means of image analysis.
  • an embodiment of the present invention provides a method for processing an image, where the image is obtained by capturing an object for collecting a spray in a target environment, and the method includes:
  • a spray image object is determined based on the fitted polygon, and a distribution parameter of the spray in the target environment is determined based on the determined spray image object.
  • the embodiment of the present invention further provides an image processing device, wherein the image is obtained by capturing an object for collecting a spray in a target environment, and the device includes:
  • An extraction module configured to determine a sample image from the image
  • a processing module configured to convert the sample image into a binary image, and fit each image object on the binary image to a polygon based on a preset polygon fitting algorithm
  • a determining module configured to determine a spray image object according to the fitted polygon, and determine a distribution parameter of the spray in the target environment based on the determined spray image object.
  • an embodiment of the present invention further provides an intelligent terminal, including: a storage device and a processor;
  • the storage device is configured to store program instructions
  • the processor the program instruction is invoked, when the program instruction is executed, for:
  • a spray image object is determined based on the fitted polygon, and a distribution parameter of the spray in the target environment is determined based on the determined spray image object.
  • the embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium stores program instructions, when the program instructions are executed by the processor, for performing the foregoing first aspect. The method of processing the image.
  • the embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter.
  • the demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better.
  • it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
  • FIG. 1 is a schematic flow chart of a method for determining a sampled image from an image according to an embodiment of the present invention
  • FIG. 2 is a schematic structural view of an analysis instrument for a spray material according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of an image after image processing according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram showing a relationship between a sampled image and the image according to an embodiment of the present invention
  • FIG. 5 is a schematic flow chart of a method for determining a spray object image according to an embodiment of the present invention
  • FIG. 6 is a schematic diagram of another image after image processing according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of still another image after image processing according to an embodiment of the present invention.
  • Figure 8 is a schematic diagram showing the process of determining a spray image object in accordance with an embodiment of the present invention.
  • FIG. 9 is a schematic flowchart diagram of a method for processing an image according to an embodiment of the present invention.
  • FIG. 10 is a schematic flowchart diagram of another method for processing an image according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of an intelligent terminal according to an embodiment of the present invention.
  • the embodiment of the present invention can simultaneously collect the spray materials of different regions through a plurality of test papers (or a large number of test papers). On each test strip, the spray will adhere to the test paper by means of mist droplets or the like. Image capture is performed for each test strip. And for each captured image, the sample fitting algorithm analyzes all the image objects in it, finds the image object that is considered to be the spray object, based on the number of the image objects found, the average size, etc. The data is used to determine the spray distribution parameters for the spray operation in the target environment.
  • the embodiment of the present invention may substantially include three steps. First, the sample image is determined from the image including the test paper, and the sample image is regarded as the effective image area of the analysis. . The second is to analyze the sampling area, determine the spray image object, and split the image object corresponding to the spray that may be stuck to obtain a plurality of individual spray image objects. Finally, based on the determined spray image object statistics, the spray distribution parameters for the spray operation are obtained.
  • FIG. 1 is a schematic flowchart of a method for determining a sampled image from an image according to an embodiment of the present invention.
  • the analysis instrument includes a front lens 201 and a rear lens 202.
  • a cavity is formed between the front lens 201 and the rear lens 202.
  • the cavity is located inside the analyzer housing, and the cavity can be set to emit light.
  • Illumination device such as diode LED, fills the enlarged test paper to make the illumination uniform, and finally obtains a more detailed image.
  • the front lens 201 functions to enlarge the area of the test strip
  • the camera-equipped device such as a smartphone photographs an image including the enlarged test strip area through the rear lens 202.
  • a detection of the inner circle of the lens is performed so that the sampled image is finally obtained from the image for subsequent analysis.
  • image parameters of the image are adjusted.
  • the size of the captured image can be adjusted to reduce the resolution, thereby removing some significant noise and reducing the amount of calculation. That is to say, if the resolution of the image is too high and the image is too clear, many details of the test strip will appear in the image, and there may be a lot of noise. For example, the image taken by the camera with low brightness will have noise. Or the noise of the image may also be the variegated color of some mobile phones with cameras because of the low performance of the camera and other hardware.
  • the image is processed by using edge-preserving filtering. For example, bilateral filtering or peak filtering filtering processing may be used to further filter out noise, smoothing the image while maintaining the sharpness of the edge of the spray image object.
  • edge-preserving filtering For example, bilateral filtering or peak filtering filtering processing may be used to further filter out noise, smoothing the image while maintaining the sharpness of the edge of the spray image object.
  • S103 the color information is removed, the image is converted into a grayscale image, and the grayscale image is further subjected to dynamic threshold binarization processing. Based on the above processing of S101 to S103, the obtained image is as shown in FIG.
  • a closed edge contour is determined on the binarized image, and in the embodiment of the invention, a plurality of closed contours can be found. Further, the edge points corresponding to the closed edge contours are fitted into a closed circular area. In the embodiment of the present invention, a plurality of closed circular areas are determined, and the target circular shape needs to be further determined from the plurality of closed circular areas. region.
  • the target circular area is determined.
  • the determining condition of the setting includes a size condition of the circle, wherein determining the target circular area comprises: determining a radius of a circle of each of the plurality of closed circular areas, and determining a radius from the The image is 80% to 90% of the short side of the frame (the long and high sides of the picture), and the center of the circle is in the closed circular area near the center of the image, wherein 80% to 90% of the short side of the frame is taken, for example, 86. % is an empirical value, and the short side of the frame is determined by the focal length of the camera of the smart terminal such as a mobile phone and the field of view FOV.
  • the one closed circular area can be regarded as the target circular area. If more than one closed circular area that satisfies the condition is included, further screening is required.
  • the closed circular area having the smallest radius among all the closed circular regions satisfying the above-described circle radius and center position conditions may be the target circular area.
  • the sampling area is determined from the target circular area.
  • a square whose center is coincident with the circle and whose side length is fixed to the radius of the circle, for example, a square, may be selected.
  • the side length and the target circular area have a radius of 1:1, and the square area is the sampling area.
  • the side length of the sampling area can also be calculated, for example, In the case where the side length of the square and the radius of the circle are 1:1, the sampling area is an area having a side length of 1.8 cm in the center area.
  • a sample image is determined from the image in accordance with the position of the sampling area.
  • the relationship between the sampled image and the image is as shown in FIG. 4.
  • the sampled image and the image are both color images, for example, on the image shown in FIG.
  • the background color of the test paper is yellow, and the droplets formed by the spray are dark blue.
  • Subsequent calculations are based on the sampled image for image analysis.
  • the sampled image is a partial region in the captured original image, or is a partial region in the image after the size, resolution, and filtering processing of the captured image.
  • FIG. 5 it is a schematic flowchart of a method for determining a spray object image according to an embodiment of the present invention. After extracting the effective region to determine the sample image, each image object in the region where the sampled image is located is further detected, a single spray image object is determined, and the plurality of adhered spray image objects are separated.
  • the sampled image is processed by using edge-preserving filtering, for example, sampling bilateral filtering or peak filtering processing the sampled image, further filtering out noise on the sampled image, smoothing the image while maintaining the sprayed object The sharpness of the edges of the image object.
  • edge-preserving filtering for example, sampling bilateral filtering or peak filtering processing the sampled image, further filtering out noise on the sampled image, smoothing the image while maintaining the sprayed object The sharpness of the edges of the image object.
  • the sampled image is converted to a grayscale image in S502.
  • the background color of the test paper is yellow
  • the droplet formed by the spray material is dark blue.
  • the color channel information can be extracted first, and the original image is split into BGR (Blue Blue, Green Green, Red Red). ) Three color channels, only select G and R, ie red and green channels, to obtain grayscale images.
  • G and R Green Green, Red Red
  • one or two other color channels may be selected for the test strip color and the spray color to be converted to a grayscale image.
  • the grayscale image obtained by the conversion in the S502 is binarized to obtain a binarized image of two colors of black and white.
  • the binarization processing method of the dynamic threshold may be adopted.
  • the grayscale image obtained in S502 is processed.
  • FIG. 6 and FIG. 7 FIG. 6 is a result of dynamic binarization after directly converting a color picture into a grayscale image
  • FIG. 7 is a result of performing dynamic binarization processing after extracting the GR channel, and can be seen. Extracting the red and green channels and re-enhancing can retain more detail so that the tiny droplets are not judged to be the background.
  • an edge contour is extracted on the binarized image; in one embodiment, a preset polygon approximation fitting algorithm is used for each edge contour, and the edge contour is fitted to obtain a plurality of polygons.
  • each polygon contour is a concave curve, that is, non-convex.
  • each concave defect point set Convexity Defects is three points of a triangle.
  • the area threshold may range from 0.1 square millimeters to 0.15 square millimeters, for example 0.13 square millimeters.
  • a triangle composed of the extracted concave defect point set is used to first find the bottom edge height corresponding to the concave defect point set.
  • a flat triangle a triangle whose height is lower than a preset high threshold
  • a very shallow concave pocket is first removed according to the height of the triangle, and the area of the triangle is further determined.
  • the polygon needs to be split according to the concave curve.
  • such polygons may be split based on the vertices of the target triangle.
  • the triangle formed by the concave defect point set corresponding to the plurality of concave portions is sorted based on the area of each triangle, and two concave triangles having larger areas are taken as the target triangle, and the target vertices of the two target triangles are connected, and the corresponding connection is
  • the two polygons split after S508 need to be further split, and the process proceeds to step S505 to repeat the above steps until the split polygon is not Then there is a concave curve, or the area is small (already less than the preset area threshold), or the concave defect triangle does not meet the condition (the height corresponding to the target vertex in the triangle is less than the preset high threshold).
  • the polygon obtained by the split has no concave curve, or the area is smaller than the preset area threshold, or there is a concave curve, but the specified vertex of the triangle formed by the concave curve corresponds to a height lower than the threshold, the polygon under the constraint condition
  • the corresponding image object is a spray image object.
  • the split polygon is subjected to a fitting process according to a preset circle fitting algorithm to obtain a circular area of the spray.
  • the overlapping area of some polygons needs to be rounded and complemented to obtain the circular area of the spray, in the embodiment of the invention, each spray circular area Can be considered a spray image object.
  • FIG. 8 is a schematic diagram of a process for determining a spray image object according to an embodiment of the present invention.
  • the steps performed in sequence include: S1 extracts the contour; S2 performs the polygon fitting; S3 determines the concave curve; S4 detects the concave pocket in the polygon; S5 detects the concave defect point set in the concave package; S6 finds the bottom and specifies The height of the vertices; S7 determines the triangle formed by the largest set of two concave defect points based on the area; S8 connects the specified vertices of the two triangles, uses the connecting line as the dividing line, and splits to obtain two polygons; S9 performs round fitting processing , complete the coincident part, get two spray image objects.
  • the spray image object is determined in the sample image by the above description, the amount of the spray image object in the sample image corresponding to the test paper is counted, the area of each spray image object is calculated, and the spray image object is calculated.
  • the area ratio occupied in the sampled image gives the density and coverage of the spray.
  • the area of the spray image object may be approximated based on the number of pixels occupied by the spray image object, or the effective diameter of the spray image object may be obtained using a minimum circumscribed matrix, and the spray image object may be obtained based on the diameter.
  • the particle size is thus calculated for the area.
  • the parameters such as the number and area calculated by all the test papers are counted, and finally the distribution parameters of the spray materials in the target environment are obtained, and the distribution parameters may be, for example, parameters such as coverage and average diameter of the spray material.
  • the embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter.
  • the demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better.
  • it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
  • FIG. 9 is a schematic flowchart of a method for processing an image according to an embodiment of the present invention.
  • the method in the embodiment of the present invention may be performed by an intelligent terminal capable of running a corresponding program instruction, and the smart terminal may be Terminals such as smartphones and tablets.
  • the method of the embodiment of the present invention includes the following steps.
  • S901 Determine a sample image from the image; the image is obtained by capturing an object for collecting a spray in a target environment.
  • the image may be taken by a camera carried by the smart terminal performing the method of the embodiment of the present invention, and the object refers to a test paper capable of collecting a spray in a target environment, and the spray may be, for example, spraying a pesticide.
  • the image may be obtained by magnifying the test paper by a magnifying glass.
  • the sampled image is then a partial image taken from the image.
  • the sampled image may be an image corresponding to a target area centered in the image, or may be an area corresponding image selected by a user interface based on a frame selection manner, and the user may perform a frame selection sampling image area after visual observation. Operation.
  • the target area where the sampled image is located may be a triangular area, or a rectangular area, or a circular area, or a polygonal area.
  • S902 Convert the sampled image into a binary image, and fit each image object on the binary image to a polygon based on a preset polygon fitting algorithm.
  • the converted binary image is a black and white image.
  • Based on the preset polygon fitting algorithm multiple image objects on the binary image can be respectively fitted into polygons.
  • each of the fitted polygons can be simply considered to be a spray image object, and each of the spray image objects corresponds to a spray. The amount of these sprays is counted, the area of each spray image object is obtained, and the spray image objects determined by the images corresponding to the plurality of test strips are further combined with the corresponding statistical calculation results to determine the spray in the entire target environment. Distribution parameters such as the coverage of the object, the size of the spray, and the like. Or, in order to obtain a more accurate distribution parameter, a polygon splitting process or the like can be performed to obtain a more accurate spray image object, so as to obtain a more accurate distribution parameter. For the specific implementation, refer to the above embodiment. description.
  • the embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter.
  • the demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better.
  • it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
  • FIG. 10 is a schematic flowchart of another method for processing an image according to an embodiment of the present invention.
  • the method in the embodiment of the present invention may be performed by an intelligent terminal capable of running a corresponding program instruction, and the smart terminal may be It is a terminal such as a mobile phone or a tablet.
  • the method of the embodiment of the present invention includes the following steps.
  • the image may be obtained by photographing an object for collecting a spray in a target environment, the object may be various types of test papers, including spraying pesticides or In the case of water, etc., spray the droplets.
  • the image may further be taken after zooming in on an object for collecting a spray in the target environment.
  • the image after the image is captured, the image may be pre-processed, specifically, the resolution of the image may be reduced to a preset resolution value, and/or, using presets.
  • the edge-preserving filtering algorithm performs filtering processing on the image, wherein the edge-preserving filtering algorithm may be bilateral filtering or peak filtering, and the filtering algorithm for reducing resolution or performing edge preservation is mainly used to reduce image objects in the image. Reduce noise.
  • S1002 Determine a sampling area from the image to be detected.
  • the sampling area mainly refers to an effective area in the image to be detected.
  • an unrelated area for example, to photograph the corresponding structure of the magnifying glass, as shown in Fig. 3, the area outside the closed circular area in the middle is the image of the magnifying glass related structure.
  • the area needs to be removed during the detection, and only a part of the area inside the intermediate closed circular area is reserved, and this part is used as a sampling area for subsequent image analysis processing.
  • the S1002 may include: performing an edge point fitting process on the object on the image to be detected based on a preset circle fitting algorithm to obtain a plurality of closed circular regions; A target circular area is determined in the area, and a sampling area is obtained in the target circular area.
  • the sampling area may be intercepted from the target circular area based on the interception rule, or may be provided with a size-adjustable marquee to the user through a user interface, so that the user selects the sampling area, for example, the side length is adjustable.
  • the manner of determining the target circular area from the plurality of closed circular areas may include: inserting the plurality of closed circular areas A closed circular area having a size within a preset length range is determined as a target circular area. Further, if the closed circular area whose size is within a preset length range of the plurality of closed circular regions includes a plurality of, the smallest closed circle in the closed circular area within a preset length range The shaped area serves as the target circular area.
  • the predetermined length range is determined based on the length of the short side of the image, such as a length ranging from 80% to 90% of the length of the short side.
  • a closed circular area at the center position may also be taken as the target circular area, that is, the determined distance between the center of the target circular area and the center of the image is at a preset first distance. Within the threshold.
  • the capturing the sampling area in the target circular area comprises: capturing a target area as a sampling area in the target circular area; wherein an image center of the target area and the target The distance of the center of the circular area is within a preset second distance threshold, and the ratio of the size of the target area to the length of the radius of the target circular area is a preset ratio, in one embodiment, the target The area is a square area whose size is the side length of the square, and the side length of the square area is equal to the radius of the target circular area.
  • the target area may also be a rectangular area, the size of the rectangle being the length of the longer side of the rectangle, and the length of the long side of the rectangular area is 70% of the diameter of the target circular area; or
  • the target area may also be a circular area whose size refers to the diameter of the circular area, the diameter of the circular area being 70% of the diameter of the target circular area.
  • S1003 Determine, according to the position of the sampling area in the image to be detected, an area image of the corresponding position area from the image as a sample image.
  • the original image is intercepted based on the pixel position of the sampling area in the image to be detected, and the sampled image is obtained from the original image.
  • the original image may refer to an image that has been preprocessed on the original captured image.
  • the sampled image may be filtered using a preset edge-preserved filtering algorithm.
  • the edge-preserving filtering algorithm can be bilateral filtering or peak filtering
  • the S1004 Convert the sample image into a grayscale image; in an embodiment, the S1004 may include selecting two specified color channels from three color channels of the sample image; converting based on the two color channels A grayscale image of the sampled image is obtained.
  • the background color of the test paper is yellow, and the droplets are dark blue.
  • the specified two color channels include a green color channel and a red color channel, wherein the red and green channels are used according to the background color of the test paper.
  • the selected color channel is a different color channel selected from different color test strips. The extraction of red and green channels and re-binarization can retain more details, so that the tiny droplets are not judged as the background, which improves the accuracy of subsequent image analysis to determine the spray.
  • S1005 Perform binarization processing on the converted grayscale image to obtain a binary image of the sampled image.
  • the binarization processing may adopt a binarization processing manner of a dynamic threshold.
  • S1006 Fit each image object on the binary image into a polygon based on a preset polygon fitting algorithm.
  • a polygonal fitting algorithm is used to fit the irregular boundary curve on the sampled image to obtain a relatively regular polygon.
  • S1007 Determine a target polygon from the obtained polygon, and determine whether the contour of the target polygon includes a concave curve; the target polygon may be any one of the fitted polygons, or may be a fitting A polygon whose area is larger than the preset area threshold; it can also refer to the polygon with the largest area among the fitted polygons.
  • the concave curve is not included, it is determined that the target polygon is a spray image object.
  • the concave curve is not included to indicate that the target polygon does not have the adhesion of a plurality of sprays, and the single mist is adhered to the test paper, and the target polygon is a single spray image object. There is no need to perform split processing.
  • the target polygon is split according to a concave curve to obtain two or more spray image objects by splitting.
  • the target polygon is considered to have at least two droplets adhered to the test paper, and needs to be image-analyzed to obtain two or more spray images. Object.
  • the S1009 may include: extracting a set of concave defect points according to the concave curve; constructing a triangle based on the set of concave defect points; and splitting the target polygon according to the vertices of the constructed triangle to split Get the spray image object.
  • the S1009 may further include: extracting a set of concave defect points according to the concave curve, the concave defect point set includes a plurality of position points on the concave curve, for example, the concave defect point set includes Forming three vertices of a triangle; constructing a triangle based on the set of concave defect points; determining a target triangle according to the area of the constructed triangle; and splitting the target polygon according to the vertices of the target triangle to obtain a spray image by splitting Object.
  • the area of the constructed triangle may be calculated based on the area calculation formula of the triangle, wherein the length of the bottom and the length of the height may be determined according to the number of pixels.
  • the area of the constructed triangle may also be determined based on the number of pixels covered by the triangle.
  • the constructed triangle refers to a triangle whose height corresponding to the target vertex in the triangle generated according to the concave defect point set is greater than a preset high threshold.
  • the target vertex is the specified vertex mentioned in the above embodiment.
  • the point where the two lines intersect in the legend corresponding to S5 in FIG. 8 is the designated vertex, that is, the vertex corresponding to the height in the schematic diagram corresponding to S6.
  • the splitting process of the target polygon according to the concave curve may be described with reference to the corresponding embodiment of FIG. 8.
  • S1010 The polygon obtained by the splitting is subjected to a fitting process according to a preset circle fitting algorithm.
  • S1011 Round-edge complementation processing is performed on the overlapping areas of the split polygons to obtain a circular area of the spray, and each sprayed circular area is a spray image object.
  • pesticides pesticides
  • the droplets formed by spraying water and the like should exist in the shape of an approximately circular shape on the test paper.
  • the fitting method is performed by using the preset circle fitting algorithm. Please refer to FIG. 8 for implementation. The description in the example. Moreover, it is more convenient to calculate the area occupied by the spray image object based on the circle to determine the area of the spray.
  • the method further includes: issuing prompt information, where the prompt information is used to prompt the distribution parameter, specifically displaying a corresponding distribution parameter on a display interface, or by voice prompting The way to remind the corresponding distribution parameters.
  • the embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter.
  • the demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better.
  • it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
  • FIG. 11 is a schematic structural diagram of an apparatus for processing an image according to an embodiment of the present invention
  • the apparatus of the embodiment of the present invention may be disposed in an intelligent terminal such as a smart phone.
  • the device of the embodiment of the present invention includes the following structure.
  • An extraction module 1101 configured to determine, from the image, a sample image obtained by capturing an object for collecting a spray in a target environment
  • the processing module 1102 is configured to convert the sample image into a binary image, and fit each image object on the binary image to a polygon based on a preset polygon fitting algorithm;
  • the determining module 1103 is configured to determine a spray image object according to the fitted polygon, and determine a distribution parameter of the spray in the target environment based on the determined spray image object.
  • the extracting module 1101 is specifically configured to convert the image into a grayscale image, and perform binarization processing to obtain an image to be detected; and determine a sampling region from the image to be detected; A position of the sampling area in the image to be detected, and an area image of the corresponding position area is determined from the image as a sample image.
  • the extraction module 1101 is specifically configured to be based on a preset circle fitting algorithm. Performing an edge point fitting process on the object on the image to be detected to obtain a plurality of closed circular regions; determining a target circular region from the plurality of closed circular regions, and obtaining a sampling region in the target circular region .
  • the apparatus may further include: a pre-processing module 1104 for reducing the resolution of the image to a preset resolution value, and/or using a preset edge-preserving filtering algorithm pair The image is subjected to filtering processing.
  • a pre-processing module 1104 for reducing the resolution of the image to a preset resolution value, and/or using a preset edge-preserving filtering algorithm pair The image is subjected to filtering processing.
  • the extraction module 1101 is specifically configured to determine a closed circular area of the plurality of closed circular regions having a size within a preset length range as a target circular area.
  • the extraction module 1101 is specifically configured to: if a plurality of closed circular regions having a size within a preset length range of the plurality of closed circular regions include a plurality of, the preset length range The smallest closed circular area in the closed circular area inside serves as the target circular area.
  • the predetermined length range is determined based on the length of the short side of the image.
  • the determined distance between the center of the target circular area and the center of the image is within a preset first distance threshold.
  • the extraction module 1101 is specifically configured to intercept a target area as a sampling area in the target circular area; wherein an image center of the target area and a center of the target circular area The distance is within a preset second distance threshold and the ratio of the size of the target area to the radius of the target circular area is a preset ratio.
  • the processing module 1102 is specifically configured to convert the sampled image into a grayscale image; perform binarization processing on the converted grayscale image to obtain a binary image of the sampled image.
  • the processing module 1102 is specifically configured to select a specified two color channels from three color channels of the sample image; and obtain a gray image of the sample image based on the two color channels. .
  • the specified two color channels include a green color channel and a red color channel.
  • the pre-processing module 1104 is further configured to perform filtering processing on the sampled image by using a preset edge-preserving filtering algorithm.
  • the determining module 1103 is specifically configured to determine a target polygon from the obtained polygons, and determine whether the contour of the target polygon includes a concave curve; if not included The concave curve determines that the target polygon is a spray image object; if a concave curve is included, the target polygon is split according to the concave curve to split to obtain two or more spray image objects.
  • the target polygon refers to a polygon in the fitted polygon that has an area greater than a preset area threshold.
  • the determining module 1103 is specifically configured to extract a set of concave defect points according to the concave curve; construct a triangle based on the set of concave defect points; and split the target polygon according to the vertices of the constructed triangle, The spray image object is obtained by splitting.
  • the determining module 1103 is specifically configured to extract a set of concave defect points according to a concave curve, the concave defect point set includes a plurality of position points on the concave curve; and construct a triangle based on the concave defect point set And determining a target triangle according to the area of the constructed triangle; and splitting the target polygon according to the vertices of the target triangle to obtain the spray image object by splitting.
  • the area of the constructed triangle is determined based on the number of pixels covered by the triangle.
  • the constructed triangle refers to a triangle whose height corresponding to the target vertex in the triangle generated according to the concave defect point set is greater than a preset high threshold.
  • the determining module 1103 is configured to perform fitting processing on the split polygon according to a preset circle fitting algorithm; and perform round-edge complement processing on the overlapping regions of the split polygons. A circular area of the spray is obtained, each of which is a spray image object.
  • the embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter.
  • the demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better.
  • it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
  • FIG. 12 it is a schematic structural diagram of an intelligent terminal according to an embodiment of the present invention.
  • the smart terminal in the embodiment of the present invention may be a device such as a smart phone or a tablet computer.
  • the smart terminal includes
  • the electrical module or the like further includes a processor 1201 and a storage device 1202.
  • the storage device 1202 may include a volatile memory, such as a random-access memory (RAM); the storage device 1202 may also include a non-volatile memory, such as a fast A flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the storage device 1202 may further include a combination of the above types of memories.
  • RAM random-access memory
  • non-volatile memory such as a fast A flash memory, a hard disk drive (HDD) or a solid-state drive (SSD)
  • the storage device 1202 may further include a combination of the above types of memories.
  • the processor 1201 may be a central processing unit (CPU).
  • the processor 1201 may further include a hardware chip.
  • the hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof.
  • the PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general array logic (GAL), or any combination thereof.
  • the memory is further configured to store program instructions.
  • the processor 1201 can invoke the program instructions to implement corresponding methods as shown in the embodiments of Figures 1, 5, 8, 9, and 10 of the present application.
  • the processor 1201 invokes a program instruction stored in the storage device 1202, and when the program instruction is executed, is used to:
  • a spray image object is determined based on the fitted polygon, and a distribution parameter of the spray in the target environment is determined based on the determined spray image object.
  • the processor 1201 is configured to convert the image into a grayscale image, perform binarization processing to obtain an image to be detected, and determine a sampling region from the image to be detected; Describe the position of the sampling area in the image to be detected, and determine an area image of the corresponding position area from the image as a sample image.
  • the processor 1201 is configured to perform an edge point fitting process on an object on the image to be detected based on a preset circle fitting algorithm to obtain a plurality of closed circular regions; A target circular area is determined in the circular area, and a sampling area is obtained in the target circular area.
  • the processor 1201 is configured to reduce the resolution of the image to a pre- The resolution values are set, and/or the image is filtered using a preset edge-preserved filtering algorithm.
  • the processor 1201 is configured to determine a closed circular area of the plurality of closed circular regions having a size within a preset length range as a target circular area.
  • the processor 1201 is configured to: if a plurality of closed circular regions of the plurality of closed circular regions have a size within a preset length range, include a plurality of The smallest closed circular area in the closed circular area serves as the target circular area.
  • the predetermined length range is determined based on the length of the short side of the image.
  • the determined distance between the center of the target circular area and the center of the image is within a preset first distance threshold.
  • the processor 1201 is configured to intercept a target area as a sampling area in the target circular area; wherein a distance between an image center of the target area and a center of the target circular area Within a preset second distance threshold, and the ratio of the size of the target area to the radius of the target circular area is a preset ratio.
  • the processor 1201 is configured to convert the sampled image into a grayscale image; perform binarization processing on the converted grayscale image to obtain a binary image of the sampled image.
  • the processor 1201 is configured to select a specified two color channels from three color channels of the sampled image; and obtain a grayscale image of the sampled image based on the two color channel conversions.
  • the specified two color channels include a green color channel and a red color channel.
  • the processor 1201 is configured to perform filtering processing on the sampled image using a preset edge-preserving filtering algorithm.
  • the processor 1201 is configured to determine a target polygon from the obtained polygons, and determine whether the contour of the target polygon includes a concave curve; if the concave curve is not included, determine the target polygon as a spray image object; if a concave curve is included, the target polygon is split according to a concave curve to split to obtain two or more spray image objects.
  • the target polygon refers to a polygon in the fitted polygon that has an area greater than a preset area threshold.
  • the processor 1201 is configured to extract a set of concave defect points according to the concave curve; construct a triangle based on the set of concave defect points; and split the target polygon according to the vertices of the constructed triangle to Split to get the spray image object.
  • the processor 1201 is configured to extract a set of concave defect points according to a concave curve, the concave defect point set includes a plurality of position points on the concave curve; and construct a triangle based on the concave defect point set;
  • the target triangle is determined according to the area of the constructed triangle; the target polygon is split according to the vertices of the target triangle to obtain the spray image object by splitting.
  • the area of the constructed triangle is determined based on the number of pixels covered by the triangle.
  • the constructed triangle refers to a triangle whose height corresponding to the target vertex in the triangle generated according to the concave defect point set is greater than a preset high threshold.
  • the processor 1201 is configured to perform fitting processing on the split polygon according to a preset circle fitting algorithm; and perform round-edge complement processing on the overlapping regions of the split polygons to obtain A circular area of the spray, each of which is a spray image object.
  • the embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter.
  • the demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better.
  • the statistical needs of agricultural users' spray materials can be realized in equipment such as smart phones, which effectively reduces the statistical cost of the spray materials.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Geometry (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

Disclosed are an image processing method and device, the method comprising: determining a sample image from images, wherein the images are obtained by photographing a spray substance in a target environment; converting the sample image into a binary image, fitting each image object in the binary image onto a polygon on the basis of a pre-configured polygon fitting algorithm; and determining an image object of the spray according to the polygon obtained by fitting, determining a distribution parameter of the spray in the target environment on the basis of the determined image object of the spray. The method can be used to satisfy a user requirement for rapidly obtaining distribution parameters without complicated processing; the method is highly efficient for calculation purposes.

Description

一种对图像的处理方法及装置、智能终端Image processing method and device, intelligent terminal 技术领域Technical field
本发明涉及图像处理技术领域,尤其涉及一种对图像的处理方法及装置、智能终端。The present invention relates to the field of image processing technologies, and in particular, to a method and device for processing an image, and an intelligent terminal.
背景技术Background technique
对于农业上评估喷洒效率,需要对喷洒物进行分析。目前,在进行喷洒物分析时,首先需要使用专业的试纸采集,并通过计算机软件简单处理后,通过实验人员在实验室通过专业的仪器,例如专业的显微镜等,完成雾滴的识别以及提取,再由计算机软件测量大小,最终完成统计工作,十分繁琐。For the evaluation of spray efficiency in agriculture, it is necessary to analyze the spray. At present, in the analysis of spray materials, it is first necessary to use professional test paper collection, and after simple processing by computer software, the experimenter can complete the identification and extraction of the droplets through professional instruments, such as professional microscopes, in the laboratory. It is very cumbersome to measure the size by computer software and finally complete the statistical work.
因此,现有的喷洒物分析方法,大多是在实验室内完成,需要具备一定的专业能力和专业设备。而如何快捷地进行喷洒物分析成为研究的热点问题。Therefore, the existing methods of spray analysis are mostly completed in the laboratory and require certain professional capabilities and professional equipment. How to quickly perform spray analysis has become a hot topic of research.
发明内容Summary of the invention
本发明实施例提供了一种对图像的处理方法及装置、智能终端,可完全通过图像分析的方式确定喷洒物的分布。The embodiment of the invention provides a method and a device for processing an image, and an intelligent terminal, which can completely determine the distribution of the spray by means of image analysis.
第一方面,本发明实施例提供了一种对图像的处理方法,所述图像是对用于采集目标环境中的喷洒物的物体进行拍摄得到的,所述方法包括:In a first aspect, an embodiment of the present invention provides a method for processing an image, where the image is obtained by capturing an object for collecting a spray in a target environment, and the method includes:
从所述图像中确定出采样图像;Determining a sampled image from the image;
将所述采样图像转换为二值图像,并基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形;Converting the sampled image into a binary image, and fitting each image object on the binary image to a polygon based on a preset polygon fitting algorithm;
根据拟合得到的多边形确定出喷洒物图像对象,并基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。A spray image object is determined based on the fitted polygon, and a distribution parameter of the spray in the target environment is determined based on the determined spray image object.
第二方面,本发明实施例还提供了一种对图像的处理装置,所述图像是对用于采集目标环境中的喷洒物的物体进行拍摄得到的,所述装置包括:In a second aspect, the embodiment of the present invention further provides an image processing device, wherein the image is obtained by capturing an object for collecting a spray in a target environment, and the device includes:
提取模块,用于从所述图像中确定出采样图像;An extraction module, configured to determine a sample image from the image;
处理模块,用于将所述采样图像转换为二值图像,并基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形;a processing module, configured to convert the sample image into a binary image, and fit each image object on the binary image to a polygon based on a preset polygon fitting algorithm;
确定模块,用于根据拟合得到的多边形确定出喷洒物图像对象,并基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。 And a determining module, configured to determine a spray image object according to the fitted polygon, and determine a distribution parameter of the spray in the target environment based on the determined spray image object.
第三方面,本发明实施例还提供了一种智能终端,包括:存储装置和处理器;其中,In a third aspect, an embodiment of the present invention further provides an intelligent terminal, including: a storage device and a processor;
所述存储装置,用于存储程序指令,The storage device is configured to store program instructions,
所述处理器,调用所述程序指令,当所述程序指令被执行时时,用于:The processor, the program instruction is invoked, when the program instruction is executed, for:
从图像中确定出采样图像,所述图像是对用于采集目标环境中的喷洒物的物体进行拍摄得到的;Determining a sampled image from the image, the image being obtained by photographing an object for collecting a spray in a target environment;
将所述采样图像转换为二值图像,并基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形;Converting the sampled image into a binary image, and fitting each image object on the binary image to a polygon based on a preset polygon fitting algorithm;
根据拟合得到的多边形确定出喷洒物图像对象,并基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。A spray image object is determined based on the fitted polygon, and a distribution parameter of the spray in the target environment is determined based on the determined spray image object.
第四方面,本发明实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有程序指令,该程序指令被处理器运行时,用于执行上述第一方面所述的对图像的处理方法。In a fourth aspect, the embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium stores program instructions, when the program instructions are executed by the processor, for performing the foregoing first aspect. The method of processing the image.
本发明实施例能够对图像进行分析,基于多边形拟合算法来确定喷洒物在图像上的图像对象,进而进行目标环境中农药雾滴等喷洒物的分布参数的统计,能够满足用户快速得到分布参数的需求,不需要进行复杂、繁琐的处理,统计效率高,并且大多数农业喷洒也仅需要知道大致的分布参数即可,不需要进行精确的处理,本发明实施例的所述方法能够较好的满足农业用户对喷洒物的统计需求,在智能手机等设备均可实现,有效地降低了喷洒物的统计成本。The embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter. The demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better. To meet the statistical needs of agricultural users for spray materials, it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings to be used in the embodiments will be briefly described below. Obviously, the drawings in the following description are only some of the present invention. For the embodiments, those skilled in the art can obtain other drawings according to the drawings without any creative work.
图1是本发明实施例的从图像中确定出采样图像的方法的流程示意图;1 is a schematic flow chart of a method for determining a sampled image from an image according to an embodiment of the present invention;
图2是本发明实施例的一种关于喷洒物的分析仪器结构示意图;2 is a schematic structural view of an analysis instrument for a spray material according to an embodiment of the present invention;
图3是本发明实施例的一种进行图像处理后的图像的示意图;3 is a schematic diagram of an image after image processing according to an embodiment of the present invention;
图4是本发明实施例的采样图像与所述图像之间的关系示意图;4 is a schematic diagram showing a relationship between a sampled image and the image according to an embodiment of the present invention;
图5是本发明实施例的确定喷洒物图像对象的方法流程示意图; 5 is a schematic flow chart of a method for determining a spray object image according to an embodiment of the present invention;
图6是本发明实施例的另一种进行图像处理后的图像的示意图;6 is a schematic diagram of another image after image processing according to an embodiment of the present invention;
图7是本发明实施例的再一种进行图像处理后的图像的示意图;FIG. 7 is a schematic diagram of still another image after image processing according to an embodiment of the present invention; FIG.
图8是本发明实施例的对确定喷洒物图像对象的过程的简要示意图;Figure 8 is a schematic diagram showing the process of determining a spray image object in accordance with an embodiment of the present invention;
图9是本发明实施例的一种对图像的处理方法的流程示意图;FIG. 9 is a schematic flowchart diagram of a method for processing an image according to an embodiment of the present invention; FIG.
图10是本发明实施例的另一种对图像的处理方法的流程示意图;FIG. 10 is a schematic flowchart diagram of another method for processing an image according to an embodiment of the present invention; FIG.
图11是本发明实施例的一种对图像的处理装置的结构示意图;11 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present invention;
图12是本发明实施例的一种智能终端的结构示意图。FIG. 12 is a schematic structural diagram of an intelligent terminal according to an embodiment of the present invention.
具体实施方式Detailed ways
在目标环境中喷洒农药、水等物的过程中,本发明实施例可以通过多张试纸(或者大量试纸)同时采集不同区域的喷洒物。在每一张试纸上,喷洒物会以雾滴等方式沾附于试纸上。针对每一张试纸,进行图像拍摄。并针对每一个拍摄得到的图像,采样拟合算法对其中的所有图像对象进行分析,找出其中的被认为是喷洒物的图像对象,基于找到的喷洒物图像对象的个数、平均尺寸大小等数据来确定此次在目标环境中进行喷洒作业的喷洒物分布参数。In the process of spraying pesticides, water and the like in the target environment, the embodiment of the present invention can simultaneously collect the spray materials of different regions through a plurality of test papers (or a large number of test papers). On each test strip, the spray will adhere to the test paper by means of mist droplets or the like. Image capture is performed for each test strip. And for each captured image, the sample fitting algorithm analyzes all the image objects in it, finds the image object that is considered to be the spray object, based on the number of the image objects found, the average size, etc. The data is used to determine the spray distribution parameters for the spray operation in the target environment.
在拍摄试纸得到相应的包括试纸的图像后,本发明实施例大致上可以包括三个步骤,首先是从包括试纸的图像上确定出采样图像,该采样图像被认为是本次分析的有效图像区域。其次是针对采样区域进行分析,确定喷洒物图像对象,并对可能存在黏连的喷洒物对应的图像对象进行拆分,以得到多个单独的喷洒物图像对象。最后则是基于确定的喷洒物图像对象进行统计,得到进行喷洒作业的喷洒物分布参数。After the test paper is photographed to obtain the corresponding image including the test paper, the embodiment of the present invention may substantially include three steps. First, the sample image is determined from the image including the test paper, and the sample image is regarded as the effective image area of the analysis. . The second is to analyze the sampling area, determine the spray image object, and split the image object corresponding to the spray that may be stuck to obtain a plurality of individual spray image objects. Finally, based on the determined spray image object statistics, the spray distribution parameters for the spray operation are obtained.
请参考图1,是本发明实施例的从图像中确定出采样图像的方法的流程示意图。在本发明实施例中,为了更好地对图像进行分析,可以在拍摄得到包括试纸的图像后,基于一个关于喷洒物的分析仪器对图像进行放大,照相机拍摄到的是经过放大后的图像。如图2所示,该分析仪器包括前镜头201、后镜头202,前镜头201与后镜头202之间构成一个腔体,该腔***于分析仪器壳体的内部,在腔体中可设置发光二极管LED等照明装置,对放大后的试纸进行补光,使得光照均匀,最终获取到更加细致的图像。在一个实施例中,前镜头201起到放大试纸区域的作用,智能手机等带照相功能的设备透过后镜头202拍摄包括被放大后的试纸区域的图像。 Please refer to FIG. 1, which is a schematic flowchart of a method for determining a sampled image from an image according to an embodiment of the present invention. In the embodiment of the present invention, in order to better analyze the image, after the image including the test paper is captured, the image is enlarged based on an analysis instrument for the spray, and the camera captures the enlarged image. As shown in FIG. 2, the analysis instrument includes a front lens 201 and a rear lens 202. A cavity is formed between the front lens 201 and the rear lens 202. The cavity is located inside the analyzer housing, and the cavity can be set to emit light. Illumination device such as diode LED, fills the enlarged test paper to make the illumination uniform, and finally obtains a more detailed image. In one embodiment, the front lens 201 functions to enlarge the area of the test strip, and the camera-equipped device such as a smartphone photographs an image including the enlarged test strip area through the rear lens 202.
在拍摄得到图像后,做了一个镜头内圆的检测,以便于最终从所述图像中得到采样图像进行后续分析。具体如图1所示,在S101中,调整所述图像的图像参数。可以调整拍摄到的所述图像的大小,降低分辨率,由此能够去除一些明显的噪点,减少计算量。也就是说,如果图像的分辨率太高,图像太清晰,试纸的很多细节会在图像中呈现出来,可能会存在很多噪点,例如,带摄像头的手机在低亮度下拍摄的图像会存在噪点,或者图像的噪点也可能是某些带摄像头的手机因为摄像头等硬件的性能较低而产生的杂色点,在分辨率较高的情况下,这些噪点会较为明显,影响后续的图像处理及喷洒物图像对象的识别。调整图片大小,降低分辨率,虽然会过滤掉一部分喷洒物图像对象,但会过滤掉更多的噪点图像对象,方便快速计算,并且对最终结果的影响并不大。在S102中,使用边缘保持的滤波对所述图像进行处理,例如可以使用双边滤波或是峰值滤波的滤波处理方式,进一步滤除噪点,平滑图像的同时保持喷洒物图像对象边缘的锐利。在S103中,去除颜色信息,将所述图像转为灰度图,并进一步对灰度图进行动态阈值二值化处理。基于上述S101至S103的处理后,得到的图像如图3所示。After the image is taken, a detection of the inner circle of the lens is performed so that the sampled image is finally obtained from the image for subsequent analysis. Specifically, as shown in FIG. 1, in S101, image parameters of the image are adjusted. The size of the captured image can be adjusted to reduce the resolution, thereby removing some significant noise and reducing the amount of calculation. That is to say, if the resolution of the image is too high and the image is too clear, many details of the test strip will appear in the image, and there may be a lot of noise. For example, the image taken by the camera with low brightness will have noise. Or the noise of the image may also be the variegated color of some mobile phones with cameras because of the low performance of the camera and other hardware. In the case of high resolution, these noises will be more obvious, affecting subsequent image processing and spraying. Recognition of object image objects. Resizing the image and reducing the resolution will filter out some of the spray image objects, but will filter out more noise image objects for quick calculations and have little effect on the final result. In S102, the image is processed by using edge-preserving filtering. For example, bilateral filtering or peak filtering filtering processing may be used to further filter out noise, smoothing the image while maintaining the sharpness of the edge of the spray image object. In S103, the color information is removed, the image is converted into a grayscale image, and the grayscale image is further subjected to dynamic threshold binarization processing. Based on the above processing of S101 to S103, the obtained image is as shown in FIG.
在S104中,在二值化的图像上确定出闭合的边缘轮廓,在本发明实施例中,可以找到多个闭合的轮廓。进一步把这些闭合的边缘轮廓对应的边缘点拟合成闭合圆形区域,本发明实施例中,会确定出多个闭合圆形区域,需要进一步地从多个闭合圆形区域中确定目标圆形区域。In S104, a closed edge contour is determined on the binarized image, and in the embodiment of the invention, a plurality of closed contours can be found. Further, the edge points corresponding to the closed edge contours are fitted into a closed circular area. In the embodiment of the present invention, a plurality of closed circular areas are determined, and the target circular shape needs to be further determined from the plurality of closed circular areas. region.
在S105中,确定出目标圆形区域。在本发明实施例中,设置的确定条件包括圆的尺寸条件,其中,确定目标圆形区域包括:确定出多个闭合圆形区域中各个圆形区域的圆半径,从中确定出半径在所述图像的画幅短边(图片的长与高较小的边)的80%~90%,并且圆心位置在图像中心附近的闭合圆形区域,其中,画幅短边的80%~90%例如取86%是一个经验值,画幅短边与手机等智能终端的摄像头的焦距、视场角FOV决定。经过上述的圆半径和圆心位置的限制条件,如果仅有一个闭合圆形区域满足条件,则该一个闭合圆形区域可以认为是目标圆形区域。如果包括多个满足条件的闭合圆形区域,则还需要进一步进行筛选。在一个实施例中,可以将所有满足上述圆半径和圆心位置条件的闭合圆形区域中,半径最小的闭合圆形区域作为目标圆形区域。In S105, the target circular area is determined. In the embodiment of the present invention, the determining condition of the setting includes a size condition of the circle, wherein determining the target circular area comprises: determining a radius of a circle of each of the plurality of closed circular areas, and determining a radius from the The image is 80% to 90% of the short side of the frame (the long and high sides of the picture), and the center of the circle is in the closed circular area near the center of the image, wherein 80% to 90% of the short side of the frame is taken, for example, 86. % is an empirical value, and the short side of the frame is determined by the focal length of the camera of the smart terminal such as a mobile phone and the field of view FOV. After the above-mentioned limitation of the radius of the circle and the position of the center of the circle, if only one closed circular area satisfies the condition, the one closed circular area can be regarded as the target circular area. If more than one closed circular area that satisfies the condition is included, further screening is required. In one embodiment, the closed circular area having the smallest radius among all the closed circular regions satisfying the above-described circle radius and center position conditions may be the target circular area.
在S106中,从目标圆形区域中确定出采样区域。在本发明实施例中,可 以从目标圆形区域中选取出感兴趣区域ROI(region of interest)作为采样区域,在一个实施例中,可以选取一个中心与圆重合,边长与圆半径成固定比例的正方形,例如,正方形的边长与目标圆形区域的半径为1:1,该正方形区域即为采样区域,进一步地,由于镜头尺寸是固定已知的,因此,该采样区域的边长也可以计算得到,例如,在正方形的边长与圆半径为1:1的情况下,采样区域为在中心区域的边长为1.8cm的区域。In S106, the sampling area is determined from the target circular area. In the embodiment of the present invention, Taking the region of interest ROI (region of interest) as the sampling region from the target circular region, in one embodiment, a square whose center is coincident with the circle and whose side length is fixed to the radius of the circle, for example, a square, may be selected. The side length and the target circular area have a radius of 1:1, and the square area is the sampling area. Further, since the lens size is fixedly known, the side length of the sampling area can also be calculated, for example, In the case where the side length of the square and the radius of the circle are 1:1, the sampling area is an area having a side length of 1.8 cm in the center area.
在S107中,按照采样区域的位置,从所述图像中确定出采样图像。在一个实施例中,采样图像与所述图像之间的关系如图4所示,需要说明的是,所述采样图像和所述图像均为彩色图像,例如,图4所示的图像上,试纸底色为黄色,喷洒物所形成的雾滴为深蓝色。后续的计算是以该采样图像为基础进行图像分析。采样图像是拍摄得到的原始图像中的部分区域,或者为对拍摄得到的图像进行尺寸、分辨率以及滤波处理后的图像中的部分区域。In S107, a sample image is determined from the image in accordance with the position of the sampling area. In one embodiment, the relationship between the sampled image and the image is as shown in FIG. 4. It should be noted that the sampled image and the image are both color images, for example, on the image shown in FIG. The background color of the test paper is yellow, and the droplets formed by the spray are dark blue. Subsequent calculations are based on the sampled image for image analysis. The sampled image is a partial region in the captured original image, or is a partial region in the image after the size, resolution, and filtering processing of the captured image.
在确定出采样图像后,进一步再请参见图5,是本发明实施例的确定喷洒物图像对象的方法流程示意图。提取出有效区域确定采样图像后,进一步地对采样图像所在区域内的每个图像对象进行检测,确定出单个喷洒物图像对象,并把黏连的多个喷洒物图像对象分割开来。After determining the sampled image, further referring to FIG. 5, it is a schematic flowchart of a method for determining a spray object image according to an embodiment of the present invention. After extracting the effective region to determine the sample image, each image object in the region where the sampled image is located is further detected, a single spray image object is determined, and the plurality of adhered spray image objects are separated.
在S501中,使用边缘保持的滤波对所述采样图像进行处理,例如采样双边滤波或是峰值滤波对所述采样图像进行处理,进一步滤除该采样图像上的噪点,平滑图像的同时保持喷洒物图像对象边缘的锐利。In S501, the sampled image is processed by using edge-preserving filtering, for example, sampling bilateral filtering or peak filtering processing the sampled image, further filtering out noise on the sampled image, smoothing the image while maintaining the sprayed object The sharpness of the edges of the image object.
在S502中将采样图像转化为灰度图。在本发明实施例中,针对试纸底色为黄色,喷洒物所形成的雾滴为深蓝色的特性,可以先提取颜色通道信息,将原始图像拆分为BGR(Blue蓝,Green绿,Red红)三个颜色通道,仅仅选取G和R即红绿通道转化得到灰度图。当然,在其他实施例中,可以针对试纸颜色和喷洒物颜色,选择其他的一个或者两个颜色通道,转换得到灰度图。The sampled image is converted to a grayscale image in S502. In the embodiment of the present invention, the background color of the test paper is yellow, and the droplet formed by the spray material is dark blue. The color channel information can be extracted first, and the original image is split into BGR (Blue Blue, Green Green, Red Red). ) Three color channels, only select G and R, ie red and green channels, to obtain grayscale images. Of course, in other embodiments, one or two other color channels may be selected for the test strip color and the spray color to be converted to a grayscale image.
在S503中,对在所述S502中对转化得到的灰度图进行二值化处理,得到黑白两色的二值化图像,在一个实施例中可以采用动态阈值的二值化处理方式对所述S502得到的灰度图进行处理。如图6和图7所示,图6是直接将彩色图片转化为灰度图后动态二值化的结果,图7是提取GR通道后再进行动态二值化处理后的结果,可以看到提取红绿通道再二值化能够保留更多的细节,使的微小的雾滴不至于被判定为背景。 In S503, the grayscale image obtained by the conversion in the S502 is binarized to obtain a binarized image of two colors of black and white. In one embodiment, the binarization processing method of the dynamic threshold may be adopted. The grayscale image obtained in S502 is processed. As shown in FIG. 6 and FIG. 7, FIG. 6 is a result of dynamic binarization after directly converting a color picture into a grayscale image, and FIG. 7 is a result of performing dynamic binarization processing after extracting the GR channel, and can be seen. Extracting the red and green channels and re-enhancing can retain more detail so that the tiny droplets are not judged to be the background.
在S504中,在所述二值化图像上,提取出边缘轮廓;在一个实施例中,对每个边缘轮廓,均使用预置的多边形近似拟合算法,拟合边缘轮廓得到多个多边形。In S504, an edge contour is extracted on the binarized image; in one embodiment, a preset polygon approximation fitting algorithm is used for each edge contour, and the edge contour is fitted to obtain a plurality of polygons.
在S505中,判断每个多边形轮廓是否为凹曲线,即非凸。In S505, it is judged whether each polygon contour is a concave curve, that is, non-convex.
在S506中,对于面积大于一定面积阈值的多边形,针对其每个凹曲线,检测该多边形的所有凹包部分Convex Hull,从而提取出凹缺陷点集Convexity Defects,在本发明实施例中,每个凹缺陷点集是一个三角形的三个点。在一个实施例中,该面积阈值可以取0.1平方毫米到0.15平方毫米,例如取0.13平方毫米。In S506, for a polygon whose area is larger than a certain area threshold, for each concave curve, all concave portions Convex Hull of the polygon are detected, thereby extracting a concave defect point set Convexity Defects, in the embodiment of the present invention, each The set of concave defect points is three points of a triangle. In one embodiment, the area threshold may range from 0.1 square millimeters to 0.15 square millimeters, for example 0.13 square millimeters.
在S507中,对应每个凹包部分,利用提取的凹缺陷点集组成的三角形,先求出该凹缺陷点集对应的底边和高。在一个实施例中,为了防止误检测,先根据三角形的高度剔除扁平的三角形(三角形的高低于预设的高阈值的三角形),即很浅的凹包,再进一步求取三角形的面积。In S507, for each concave portion, a triangle composed of the extracted concave defect point set is used to first find the bottom edge height corresponding to the concave defect point set. In one embodiment, in order to prevent erroneous detection, a flat triangle (a triangle whose height is lower than a preset high threshold), that is, a very shallow concave pocket, is first removed according to the height of the triangle, and the area of the triangle is further determined.
在S508中,若多边形的凹陷部分有多个(即可能多个雾滴黏连),则需要根据凹曲线对该多边形进行拆分。在其中一个实施例中,可以基于目标三角形的顶点对此类多边形进行拆分。针对多个凹陷部分对应的凹缺陷点集形成的三角形,基于每一个三角形的面积进行排序,取面积较大的两个凹陷三角形作为目标三角形,连接该两个目标三角形的目标顶点,对应的连线作为拆分线对多边形进行拆分,得到两个多边形,该两个多边形中每一个多边形均可以认为是喷洒物图像对象。In S508, if there are a plurality of concave portions of the polygon (that is, a plurality of droplets may be adhered), the polygon needs to be split according to the concave curve. In one of these embodiments, such polygons may be split based on the vertices of the target triangle. The triangle formed by the concave defect point set corresponding to the plurality of concave portions is sorted based on the area of each triangle, and two concave triangles having larger areas are taken as the target triangle, and the target vertices of the two target triangles are connected, and the corresponding connection is The line splits the polygon as a split line, resulting in two polygons, each of which can be considered a spray image object.
在一个实施例中,若有多个雾滴黏连,需要再对在S508拆分后的两个多边形进行进一步的拆分,跳转到步骤S505重复执行上述步骤,直到拆分后的多边形不再是凹曲线,或是面积较小(已经小于预设的面积阈值),或是凹缺陷三角形不符合条件为止(三角形中目标顶点对应的高小于预设的高阈值)。也就是说,当拆分得到的多边形没有凹曲线,或者面积小于预设的面积阈值,或者存在凹曲线、但凹曲线构成的三角形的指定顶点对应的高小于阈值,在此限制条件下的多边形对应的图像对象为喷洒物图像对象。In an embodiment, if there are multiple droplets stuck, the two polygons split after S508 need to be further split, and the process proceeds to step S505 to repeat the above steps until the split polygon is not Then there is a concave curve, or the area is small (already less than the preset area threshold), or the concave defect triangle does not meet the condition (the height corresponding to the target vertex in the triangle is less than the preset high threshold). That is to say, when the polygon obtained by the split has no concave curve, or the area is smaller than the preset area threshold, or there is a concave curve, but the specified vertex of the triangle formed by the concave curve corresponds to a height lower than the threshold, the polygon under the constraint condition The corresponding image object is a spray image object.
在S509中,将拆分得到的多边形按照预置的圆拟合算法进行拟合处理,得到喷洒物圆形区域。其中,对于某些多边形的重合区域需要进行圆边补全处理,以得到所述喷洒物圆形区域,在本发明实施例中,每一个喷洒物圆形区域 可以认为是一个喷洒物图像对象。In S509, the split polygon is subjected to a fitting process according to a preset circle fitting algorithm to obtain a circular area of the spray. Wherein, the overlapping area of some polygons needs to be rounded and complemented to obtain the circular area of the spray, in the embodiment of the invention, each spray circular area Can be considered a spray image object.
举例来说,进一步地请参见图8,是本发明实施例的确定喷洒物图像对象的过程的简要示意图。简单来讲,依次执行的步骤包括:S1提取轮廓;S2进行多边形拟合;S3判定为凹曲线;S4检测多边形中的凹包;S5检测凹包中的凹缺陷点集;S6求底和指定顶点的高;S7基于面积确定最大的两个凹缺陷点集构成的三角形;S8连接该两个三角形的指定顶点,以连接线作为分割线,拆分得到两个多边形;S9进行圆拟合处理,补全重合部分,得到两个喷洒物图像对象。For example, further referring to FIG. 8, is a schematic diagram of a process for determining a spray image object according to an embodiment of the present invention. Briefly speaking, the steps performed in sequence include: S1 extracts the contour; S2 performs the polygon fitting; S3 determines the concave curve; S4 detects the concave pocket in the polygon; S5 detects the concave defect point set in the concave package; S6 finds the bottom and specifies The height of the vertices; S7 determines the triangle formed by the largest set of two concave defect points based on the area; S8 connects the specified vertices of the two triangles, uses the connecting line as the dividing line, and splits to obtain two polygons; S9 performs round fitting processing , complete the coincident part, get two spray image objects.
通过上述描述在采样图像中确定出了喷洒物图像对象后,针对试纸对应的采样图像中的喷洒物图像对象,进行数量统计、求取每个喷洒物图像对象的面积、计算喷洒物图像对象在采样图像中所占面积比,得到喷洒物的密度以及覆盖率。喷洒物图像对象的面积可以基于该喷洒物图像对象所占的像素点的个数来进行近似计算,或者采用最小外接矩阵得到喷洒物图像对象的有效直径,基于直径来求取喷洒物图像对象的粒径,从而进行面积计算。统计所有试纸计算得到的个数、面积等参数,最终得到所述目标环境中喷洒物的分布参数,该分布参数例如可以为该喷洒物的覆盖率、平均直径等参数。After the spray image object is determined in the sample image by the above description, the amount of the spray image object in the sample image corresponding to the test paper is counted, the area of each spray image object is calculated, and the spray image object is calculated. The area ratio occupied in the sampled image gives the density and coverage of the spray. The area of the spray image object may be approximated based on the number of pixels occupied by the spray image object, or the effective diameter of the spray image object may be obtained using a minimum circumscribed matrix, and the spray image object may be obtained based on the diameter. The particle size is thus calculated for the area. The parameters such as the number and area calculated by all the test papers are counted, and finally the distribution parameters of the spray materials in the target environment are obtained, and the distribution parameters may be, for example, parameters such as coverage and average diameter of the spray material.
本发明实施例能够对图像进行分析,基于多边形拟合算法来确定喷洒物在图像上的图像对象,进而进行目标环境中农药雾滴等喷洒物的分布参数的统计,能够满足用户快速得到分布参数的需求,不需要进行复杂、繁琐的处理,统计效率高,并且大多数农业喷洒也仅需要知道大致的分布参数即可,不需要进行精确的处理,本发明实施例的所述方法能够较好的满足农业用户对喷洒物的统计需求,在智能手机等设备均可实现,有效地降低了喷洒物的统计成本。The embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter. The demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better. To meet the statistical needs of agricultural users for spray materials, it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
再请参见图9,是本发明实施例的一种对图像的处理方法的流程示意图,本发明实施例的所述方法可以由一个能够运行相应程序指令的智能终端来执行,该智能终端可以是智能手机、平板电脑等终端。具体的,本发明实施例的所述方法包括如下步骤。FIG. 9 is a schematic flowchart of a method for processing an image according to an embodiment of the present invention. The method in the embodiment of the present invention may be performed by an intelligent terminal capable of running a corresponding program instruction, and the smart terminal may be Terminals such as smartphones and tablets. Specifically, the method of the embodiment of the present invention includes the following steps.
S901:从所述图像中确定出采样图像;所述图像是对用于采集目标环境中的喷洒物的物体进行拍摄得到的。所述图像可以是执行本发明实施例的所述方法的智能终端自带的摄像头拍摄得到的,所述物体是指能够搜集目标环境中喷洒物的试纸,所述喷洒物例如可以是喷洒农药、水等液态物质后产生的雾滴。 所述图像可以是所述试纸被放大镜放大后拍摄得到的。S901: Determine a sample image from the image; the image is obtained by capturing an object for collecting a spray in a target environment. The image may be taken by a camera carried by the smart terminal performing the method of the embodiment of the present invention, and the object refers to a test paper capable of collecting a spray in a target environment, and the spray may be, for example, spraying a pesticide. A droplet of water produced after a liquid substance such as water. The image may be obtained by magnifying the test paper by a magnifying glass.
所述采样图像则是从所述图像中截取的部分图像。该采样图像可以是所述图像中居中的一个目标区域对应的图像,或者也可以是基于用户界面通过框选的方式选出的一个区域对应图像,用户可以通过肉眼观察后执行框选采样图像区域的操作。采样图像所在的目标区域可以为三角形区域,或矩形区域,或圆形区域,或多边形区域。The sampled image is then a partial image taken from the image. The sampled image may be an image corresponding to a target area centered in the image, or may be an area corresponding image selected by a user interface based on a frame selection manner, and the user may perform a frame selection sampling image area after visual observation. Operation. The target area where the sampled image is located may be a triangular area, or a rectangular area, or a circular area, or a polygonal area.
S902:将所述采样图像转换为二值图像,并基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形。转换得到的二值图像为一个黑白图像,基于预置的多边形拟合算法,可以将二值图像上的多个图像对象分别拟合成多边形。S902: Convert the sampled image into a binary image, and fit each image object on the binary image to a polygon based on a preset polygon fitting algorithm. The converted binary image is a black and white image. Based on the preset polygon fitting algorithm, multiple image objects on the binary image can be respectively fitted into polygons.
S903:根据拟合得到的多边形确定出喷洒物图像对象,并基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。在一个实施例中,可以简单地将拟合得到的各个多边形直接认为是喷洒物图像对象,每一个喷洒物图像对象即对应一个喷洒物。对这些喷洒物进行数量统计,求取每一个喷洒物图像对象的面积,进一步地结合多个试纸所对应的图像确定出的喷洒物图像对象以及相应的统计计算结果,进而确定整个目标环境中喷洒物的覆盖情况、喷洒物尺寸大小等分布参数。或者进一步地,为了得到更为精确的分布参数,还可以执行多边形拆分等处理,得到更为准确的喷洒物图像对象,以便于统计得到更准确的分布参数,具体实现请参考上述实施例的描述。S903: Determine a spray image object according to the fitted polygon, and determine a distribution parameter of the spray in the target environment based on the determined spray image object. In one embodiment, each of the fitted polygons can be simply considered to be a spray image object, and each of the spray image objects corresponds to a spray. The amount of these sprays is counted, the area of each spray image object is obtained, and the spray image objects determined by the images corresponding to the plurality of test strips are further combined with the corresponding statistical calculation results to determine the spray in the entire target environment. Distribution parameters such as the coverage of the object, the size of the spray, and the like. Or, in order to obtain a more accurate distribution parameter, a polygon splitting process or the like can be performed to obtain a more accurate spray image object, so as to obtain a more accurate distribution parameter. For the specific implementation, refer to the above embodiment. description.
本发明实施例能够对图像进行分析,基于多边形拟合算法来确定喷洒物在图像上的图像对象,进而进行目标环境中农药雾滴等喷洒物的分布参数的统计,能够满足用户快速得到分布参数的需求,不需要进行复杂、繁琐的处理,统计效率高,并且大多数农业喷洒也仅需要知道大致的分布参数即可,不需要进行精确的处理,本发明实施例的所述方法能够较好的满足农业用户对喷洒物的统计需求,在智能手机等设备均可实现,有效地降低了喷洒物的统计成本。The embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter. The demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better. To meet the statistical needs of agricultural users for spray materials, it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
再请参见图10,是本发明实施例的另一种对图像的处理方法的流程示意图,本发明实施例的所述方法可以由一个能够运行相应程序指令的智能终端来执行,该智能终端可以是手机、平板电脑等终端。具体的,本发明实施例的所述方法包括如下步骤。FIG. 10 is a schematic flowchart of another method for processing an image according to an embodiment of the present invention. The method in the embodiment of the present invention may be performed by an intelligent terminal capable of running a corresponding program instruction, and the smart terminal may be It is a terminal such as a mobile phone or a tablet. Specifically, the method of the embodiment of the present invention includes the following steps.
S1001:将获取的图像转换为灰度图,并进行二值化处理,得到待检测图 像;在一个实施例中,所述图像可以是对用于采集目标环境中的喷洒物的物体进行拍摄得到的,所述物体可以是各种类型的试纸,所述喷洒物包括在喷洒农药或者水等情形下,喷洒的雾滴。所述图像进一步可以是在放大用于采集目标环境中的喷洒物的物体后拍摄得到的。另外,在一个实施例中,在拍摄得到所述图像后,可以对所述图像进行预处理,具体可以将所述图像的分辨率降低至预置的分辨率值,和/或,使用预置的边缘保持的滤波算法对所述图像进行滤波处理,其中,边缘保持的滤波算法可以为双边滤波或是峰值滤波,降低分辨率或者进行边缘保持的滤波算法主要用于减少图像中的图像对象,减少噪点。S1001: Convert the acquired image into a grayscale image, and perform binarization processing to obtain a to-be-detected image. In one embodiment, the image may be obtained by photographing an object for collecting a spray in a target environment, the object may be various types of test papers, including spraying pesticides or In the case of water, etc., spray the droplets. The image may further be taken after zooming in on an object for collecting a spray in the target environment. In addition, in an embodiment, after the image is captured, the image may be pre-processed, specifically, the resolution of the image may be reduced to a preset resolution value, and/or, using presets. The edge-preserving filtering algorithm performs filtering processing on the image, wherein the edge-preserving filtering algorithm may be bilateral filtering or peak filtering, and the filtering algorithm for reducing resolution or performing edge preservation is mainly used to reduce image objects in the image. Reduce noise.
S1002:从所述待检测图像中确定出采样区域。所述采样区域主要是指所述待检测图像中的有效区域。在通过放大镜等放大试纸后进行拍摄时,有可能会拍摄到无关的区域,例如拍摄到放大镜相应结构,如图3所示,在中间的闭合圆形区域以外的区域即是放大镜相关结构的图像区域,在检测时需要去除这部分区域,仅保留该中间闭合圆形区域内部的部分区域,将这部分区域作为采样区域,以便于进行后续的图像分析处理。S1002: Determine a sampling area from the image to be detected. The sampling area mainly refers to an effective area in the image to be detected. When shooting with a magnifying glass or the like, it is possible to capture an unrelated area, for example, to photograph the corresponding structure of the magnifying glass, as shown in Fig. 3, the area outside the closed circular area in the middle is the image of the magnifying glass related structure. The area needs to be removed during the detection, and only a part of the area inside the intermediate closed circular area is reserved, and this part is used as a sampling area for subsequent image analysis processing.
在一个实施例中,所述S1002可以包括:基于预置的圆拟合算法对所述待检测图像上的对象进行边缘点拟合处理,得到多个闭合圆形区域;从多个闭合圆形区域中确定出目标圆形区域,并在该目标圆形区域截取得到采样区域。该采样区域可以基于截取规则从目标圆形区域中截取得到,也可以通过一个用户界面,提供一个尺寸可调节的选取框给用户,以便于用户框选得到采样区域,例如提供边长可调的正方形选取框,或者提供半径可调的圆形选取框等。In an embodiment, the S1002 may include: performing an edge point fitting process on the object on the image to be detected based on a preset circle fitting algorithm to obtain a plurality of closed circular regions; A target circular area is determined in the area, and a sampling area is obtained in the target circular area. The sampling area may be intercepted from the target circular area based on the interception rule, or may be provided with a size-adjustable marquee to the user through a user interface, so that the user selects the sampling area, for example, the side length is adjustable. A square marquee, or a circular marquee with an adjustable radius.
在一个实施例中,按照预置的截取规则确定采样区域时,首先,所述从多个闭合圆形区域中确定出目标圆形区域的方式可以包括:将所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域确定为目标圆形区域。进一步地,若所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域包括多个,则将在预设的长度范围内的闭合圆形区域中尺寸最小的闭合圆形区域作为目标圆形区域。在一个实施例中,所述预设的长度范围是根据所述图像的短边长度确定的,例如在短边长度的80%~90%的长度范围。In one embodiment, when the sampling area is determined according to a preset intercepting rule, first, the manner of determining the target circular area from the plurality of closed circular areas may include: inserting the plurality of closed circular areas A closed circular area having a size within a preset length range is determined as a target circular area. Further, if the closed circular area whose size is within a preset length range of the plurality of closed circular regions includes a plurality of, the smallest closed circle in the closed circular area within a preset length range The shaped area serves as the target circular area. In one embodiment, the predetermined length range is determined based on the length of the short side of the image, such as a length ranging from 80% to 90% of the length of the short side.
进一步地,还可以取在中心位置的闭合圆形区域作为目标圆形区域,即:确定出的所述目标圆形区域的圆心与所述图像的中心之间的距离在预置的第一距离阈值内。 Further, a closed circular area at the center position may also be taken as the target circular area, that is, the determined distance between the center of the target circular area and the center of the image is at a preset first distance. Within the threshold.
在一个实施例中,所述在该目标圆形区域截取得到采样区域,包括:在所述目标圆形区域中截取一个目标区域作为采样区域;其中,所述目标区域的图像中心与所述目标圆形区域的圆心的距离在预置的第二距离阈值内、且所述目标区域的尺寸与所述目标圆形区域的半径的长度比值为预置的比值,在一个实施例中,该目标区域为一个正方形区域,该正方形区域的尺寸为该正方形的边长,该正方形区域的边长与所述目标圆形区域的半径相等。在其他实施例中,该目标区域也可以为一个长方形区域,该长方形的尺寸为该长方形的较长边的长度,该长方形区域的长边长度为目标圆形区域的直径的70%;或者该目标区域还可以为一个圆形区域,该圆形区域的尺寸是指该圆形区域的直径,该圆形区域的直径为目标圆形区域的直径的70%。In one embodiment, the capturing the sampling area in the target circular area comprises: capturing a target area as a sampling area in the target circular area; wherein an image center of the target area and the target The distance of the center of the circular area is within a preset second distance threshold, and the ratio of the size of the target area to the length of the radius of the target circular area is a preset ratio, in one embodiment, the target The area is a square area whose size is the side length of the square, and the side length of the square area is equal to the radius of the target circular area. In other embodiments, the target area may also be a rectangular area, the size of the rectangle being the length of the longer side of the rectangle, and the length of the long side of the rectangular area is 70% of the diameter of the target circular area; or The target area may also be a circular area whose size refers to the diameter of the circular area, the diameter of the circular area being 70% of the diameter of the target circular area.
S1003:根据所述采样区域在所述待检测图像中的位置,从所述图像中确定出对应位置区域的区域图像作为采样图像。基于采样区域在所述待检测图像中的像素位置,对原始的图像进行截取,从原始图像中获得采样图像。该原始图像可以是指对原始拍摄图像经过预处理后的图像。S1003: Determine, according to the position of the sampling area in the image to be detected, an area image of the corresponding position area from the image as a sample image. The original image is intercepted based on the pixel position of the sampling area in the image to be detected, and the sampled image is obtained from the original image. The original image may refer to an image that has been preprocessed on the original captured image.
在一个实施例中,在得到了采样图像后,可以使用预置的边缘保持的滤波算法对所述采样图像进行滤波处理。所述边缘保持的滤波算法可以为双边滤波或是峰值滤波In one embodiment, after the sampled image is obtained, the sampled image may be filtered using a preset edge-preserved filtering algorithm. The edge-preserving filtering algorithm can be bilateral filtering or peak filtering
S1004:将所述采样图像转换为灰度图;在一个实施例中,所述S1004可以包括从所述采样图像的三个颜色通道中选取指定的两个颜色通道;基于该两个颜色通道转换得到所述采样图像的灰度图。在一个实施例中,针对试纸底色为黄色,雾滴为深蓝色的特性,所述指定的两个颜色通道包括绿色颜色通道和红色颜色通道,其中,使用红绿通道是根据试纸的背景颜色选定的,在其他实施例中,所选中的颜色通道是根据不同颜色的试纸选取不同的颜色通道。提取红绿通道再二值化能够保留更多的细节,使的微小的雾滴不至于被判定为背景,提高了后续进行图像分析确定喷洒物的准确性。S1004: Convert the sample image into a grayscale image; in an embodiment, the S1004 may include selecting two specified color channels from three color channels of the sample image; converting based on the two color channels A grayscale image of the sampled image is obtained. In one embodiment, the background color of the test paper is yellow, and the droplets are dark blue. The specified two color channels include a green color channel and a red color channel, wherein the red and green channels are used according to the background color of the test paper. Selected, in other embodiments, the selected color channel is a different color channel selected from different color test strips. The extraction of red and green channels and re-binarization can retain more details, so that the tiny droplets are not judged as the background, which improves the accuracy of subsequent image analysis to determine the spray.
S1005:将转换得到的灰度图进行二值化处理,得到所述采样图像的二值图像。具体的,所述二值化处理可以采用动态阈值的二值化处理方式。S1005: Perform binarization processing on the converted grayscale image to obtain a binary image of the sampled image. Specifically, the binarization processing may adopt a binarization processing manner of a dynamic threshold.
S1006:基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形。通过多边形拟合算法来拟合采样图像上不规则的边界曲线,得到相对规整的多边形。 S1006: Fit each image object on the binary image into a polygon based on a preset polygon fitting algorithm. A polygonal fitting algorithm is used to fit the irregular boundary curve on the sampled image to obtain a relatively regular polygon.
S1007:从拟合得到的多边形中确定出目标多边形,并判断该目标多边形的轮廓是否包括凹曲线;所述目标多边形可以为拟合得到的多边形中的任意一个,也可以是指拟合得到的多边形中面积大于预置面积阈值的多边形;也可以是指拟合得到的多边形中面积最大的多边形。S1007: Determine a target polygon from the obtained polygon, and determine whether the contour of the target polygon includes a concave curve; the target polygon may be any one of the fitted polygons, or may be a fitting A polygon whose area is larger than the preset area threshold; it can also refer to the polygon with the largest area among the fitted polygons.
S1008:如果不包括凹曲线,则确定该目标多边形为一个喷洒物图像对象。在本发明实施例中,不包括凹曲线表明该目标多边形不存在多个喷洒物的黏连的情况,其为单个雾滴沾附在试纸上,该类目标多边形为一个单独的喷洒物图像对象,不需要再进行拆分处理等。S1008: If the concave curve is not included, it is determined that the target polygon is a spray image object. In the embodiment of the present invention, the concave curve is not included to indicate that the target polygon does not have the adhesion of a plurality of sprays, and the single mist is adhered to the test paper, and the target polygon is a single spray image object. There is no need to perform split processing.
S1009:如果包括凹曲线,则根据凹曲线对所述目标多边形进行拆分处理,以拆分得到两个或多个喷洒物图像对象。在本发明实施例中,如果包括凹曲线,则认为该目标多边形至少为两个雾滴黏连沾附在试纸上,需要经过图像分析对其进行拆分,得到两个或多个喷洒物图像对象。S1009: If a concave curve is included, the target polygon is split according to a concave curve to obtain two or more spray image objects by splitting. In the embodiment of the present invention, if a concave curve is included, the target polygon is considered to have at least two droplets adhered to the test paper, and needs to be image-analyzed to obtain two or more spray images. Object.
在一个实施例中,所述S1009可以包括:根据凹曲线提取出凹缺陷点集;基于凹缺陷点集构建三角形;根据构建得到的三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。在另一个实施例中,所述S1009还可以包括:根据凹曲线提取出凹缺陷点集,所述凹缺陷点集中包括所述凹曲线上的多个位置点,例如所述凹缺陷点集中包括构成三角形的三个顶点;基于凹缺陷点集构建三角形;根据构建得到的三角形的面积,确定出目标三角形;根据目标三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。在一个实施例中,构建得到的三角形的面积可以基于三角形的面积计算公式计算得到,其中底的长度和高的长度可以根据像素点的个数来确定。在一个实施例中,构建得到的三角形的面积也可以根据该三角形覆盖的像素点的数量来确定的。在一个实施例中,构建得到的三角形是指:根据凹缺陷点集生成的三角形中目标顶点所对应的高大于预设的高阈值的三角形。该目标顶点是上述实施例中提及的指定顶点,例如图8中S5所对应的图例中两条线交汇的点为指定顶点,也即是S6所对应示意图中的高所对应的顶点。具体的,根据凹曲线对所述目标多边形进行拆分处理可参考图8对应的实施例描述。In an embodiment, the S1009 may include: extracting a set of concave defect points according to the concave curve; constructing a triangle based on the set of concave defect points; and splitting the target polygon according to the vertices of the constructed triangle to split Get the spray image object. In another embodiment, the S1009 may further include: extracting a set of concave defect points according to the concave curve, the concave defect point set includes a plurality of position points on the concave curve, for example, the concave defect point set includes Forming three vertices of a triangle; constructing a triangle based on the set of concave defect points; determining a target triangle according to the area of the constructed triangle; and splitting the target polygon according to the vertices of the target triangle to obtain a spray image by splitting Object. In one embodiment, the area of the constructed triangle may be calculated based on the area calculation formula of the triangle, wherein the length of the bottom and the length of the height may be determined according to the number of pixels. In one embodiment, the area of the constructed triangle may also be determined based on the number of pixels covered by the triangle. In one embodiment, the constructed triangle refers to a triangle whose height corresponding to the target vertex in the triangle generated according to the concave defect point set is greater than a preset high threshold. The target vertex is the specified vertex mentioned in the above embodiment. For example, the point where the two lines intersect in the legend corresponding to S5 in FIG. 8 is the designated vertex, that is, the vertex corresponding to the height in the schematic diagram corresponding to S6. Specifically, the splitting process of the target polygon according to the concave curve may be described with reference to the corresponding embodiment of FIG. 8.
S1010:将拆分得到的多边形按照预置的圆拟合算法进行拟合处理。S1010: The polygon obtained by the splitting is subjected to a fitting process according to a preset circle fitting algorithm.
S1011:对拆分得到的多边形的重合区域进行圆边补全处理,得到喷洒物圆形区域,每一个喷洒物圆形区域为一个喷洒物图像对象。一般情况下,农药、 水等喷洒后形成的雾滴在试纸上应该以近似圆形的形状存在,在拆分得到多个多边形后,再采用预置的圆拟合算法进行拟合处理,同样请参考图8对应实施例中的描述。并且,基于圆形更方便计算喷洒物图像对象所占的面积,以确定喷洒物的面积。S1011: Round-edge complementation processing is performed on the overlapping areas of the split polygons to obtain a circular area of the spray, and each sprayed circular area is a spray image object. In general, pesticides, The droplets formed by spraying water and the like should exist in the shape of an approximately circular shape on the test paper. After the multiple polygons are obtained by splitting, the fitting method is performed by using the preset circle fitting algorithm. Please refer to FIG. 8 for implementation. The description in the example. Moreover, it is more convenient to calculate the area occupied by the spray image object based on the circle to determine the area of the spray.
S1012:基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。在一个实施例中,所述分布参数包括:在所述目标环境中的喷洒物的密度、喷洒物的尺寸、喷洒物所占面积比中的任意一项或多项。进一步地,为了直观地对用户进行提示,所述方法还包括:发出提示信息,所述提示信息用于提示所述分布参数,具体在一个显示界面上显示相应的分布参数,或者通过语音提示的方式提醒相应的分布参数。S1012: Determine a distribution parameter of the spray in the target environment based on the determined spray image object. In one embodiment, the distribution parameter comprises any one or more of a density of the spray, a size of the spray, and an area ratio of the spray in the target environment. Further, in order to promptly prompt the user, the method further includes: issuing prompt information, where the prompt information is used to prompt the distribution parameter, specifically displaying a corresponding distribution parameter on a display interface, or by voice prompting The way to remind the corresponding distribution parameters.
本发明实施例能够对图像进行分析,基于多边形拟合算法来确定喷洒物在图像上的图像对象,进而进行目标环境中农药雾滴等喷洒物的分布参数的统计,能够满足用户快速得到分布参数的需求,不需要进行复杂、繁琐的处理,统计效率高,并且大多数农业喷洒也仅需要知道大致的分布参数即可,不需要进行精确的处理,本发明实施例的所述方法能够较好的满足农业用户对喷洒物的统计需求,在智能手机等设备均可实现,有效地降低了喷洒物的统计成本。The embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter. The demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better. To meet the statistical needs of agricultural users for spray materials, it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
请参见图11,是本发明实施例的一种对图像的处理装置的结构示意图;本发明实施例的所述装置可以设置在智能手机等智能终端中。具体的,本发明实施例的所述装置包括如下结构。FIG. 11 is a schematic structural diagram of an apparatus for processing an image according to an embodiment of the present invention; the apparatus of the embodiment of the present invention may be disposed in an intelligent terminal such as a smart phone. Specifically, the device of the embodiment of the present invention includes the following structure.
提取模块1101,用于从图像中确定出采样图像,所述图像是对用于采集目标环境中的喷洒物的物体进行拍摄得到的;An extraction module 1101, configured to determine, from the image, a sample image obtained by capturing an object for collecting a spray in a target environment;
处理模块1102,用于将所述采样图像转换为二值图像,并基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形;The processing module 1102 is configured to convert the sample image into a binary image, and fit each image object on the binary image to a polygon based on a preset polygon fitting algorithm;
确定模块1103,用于根据拟合得到的多边形确定出喷洒物图像对象,并基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。The determining module 1103 is configured to determine a spray image object according to the fitted polygon, and determine a distribution parameter of the spray in the target environment based on the determined spray image object.
在一个实施例中,所述提取模块1101,具体用于将所述图像转换为灰度图,并进行二值化处理,得到待检测图像;从所述待检测图像中确定出采样区域;根据所述采样区域在所述待检测图像中的位置,从所述图像中确定出对应位置区域的区域图像作为采样图像。In an embodiment, the extracting module 1101 is specifically configured to convert the image into a grayscale image, and perform binarization processing to obtain an image to be detected; and determine a sampling region from the image to be detected; A position of the sampling area in the image to be detected, and an area image of the corresponding position area is determined from the image as a sample image.
在一个实施例中,所述提取模块1101,具体用于基于预置的圆拟合算法 对所述待检测图像上的对象进行边缘点拟合处理,得到多个闭合圆形区域;从多个闭合圆形区域中确定出目标圆形区域,并在该目标圆形区域截取得到采样区域。In an embodiment, the extraction module 1101 is specifically configured to be based on a preset circle fitting algorithm. Performing an edge point fitting process on the object on the image to be detected to obtain a plurality of closed circular regions; determining a target circular region from the plurality of closed circular regions, and obtaining a sampling region in the target circular region .
在一个实施例中,所述装置还可以包括:预处理模块1104,用于将所述图像的分辨率降低至预置的分辨率值,和/或,使用预置的边缘保持的滤波算法对所述图像进行滤波处理。In one embodiment, the apparatus may further include: a pre-processing module 1104 for reducing the resolution of the image to a preset resolution value, and/or using a preset edge-preserving filtering algorithm pair The image is subjected to filtering processing.
在一个实施例中,所述提取模块1101,具体用于将所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域确定为目标圆形区域。In one embodiment, the extraction module 1101 is specifically configured to determine a closed circular area of the plurality of closed circular regions having a size within a preset length range as a target circular area.
在一个实施例中,所述提取模块1101,具体用于若所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域包括多个,则将在预设的长度范围内的闭合圆形区域中尺寸最小的闭合圆形区域作为目标圆形区域。In an embodiment, the extraction module 1101 is specifically configured to: if a plurality of closed circular regions having a size within a preset length range of the plurality of closed circular regions include a plurality of, the preset length range The smallest closed circular area in the closed circular area inside serves as the target circular area.
在一个实施例中,所述预设的长度范围是根据所述图像的短边长度确定的。In one embodiment, the predetermined length range is determined based on the length of the short side of the image.
在一个实施例中,确定出的所述目标圆形区域的圆心与所述图像的中心之间的距离在预置的第一距离阈值内。In one embodiment, the determined distance between the center of the target circular area and the center of the image is within a preset first distance threshold.
在一个实施例中,所述提取模块1101,具体用于在所述目标圆形区域中截取一个目标区域作为采样区域;其中,所述目标区域的图像中心与所述目标圆形区域的圆心的距离在预置的第二距离阈值内、且所述目标区域的尺寸与所述目标圆形区域的半径的长度比值为预置的比值。In an embodiment, the extraction module 1101 is specifically configured to intercept a target area as a sampling area in the target circular area; wherein an image center of the target area and a center of the target circular area The distance is within a preset second distance threshold and the ratio of the size of the target area to the radius of the target circular area is a preset ratio.
在一个实施例中,所述处理模块1102,具体用于将所述采样图像转换为灰度图;将转换得到的灰度图进行二值化处理,得到所述采样图像的二值图像。In one embodiment, the processing module 1102 is specifically configured to convert the sampled image into a grayscale image; perform binarization processing on the converted grayscale image to obtain a binary image of the sampled image.
在一个实施例中,所述处理模块1102,具体用于从所述采样图像的三个颜色通道中选取指定的两个颜色通道;基于该两个颜色通道转换得到所述采样图像的灰度图。In one embodiment, the processing module 1102 is specifically configured to select a specified two color channels from three color channels of the sample image; and obtain a gray image of the sample image based on the two color channels. .
在一个实施例中,所述指定的两个颜色通道包括绿色颜色通道和红色颜色通道。In one embodiment, the specified two color channels include a green color channel and a red color channel.
在一个实施例中,所述预处理模块1104,还用于使用预置的边缘保持的滤波算法对所述采样图像进行滤波处理。In an embodiment, the pre-processing module 1104 is further configured to perform filtering processing on the sampled image by using a preset edge-preserving filtering algorithm.
在一个实施例中,所述确定模块1103,具体用于从拟合得到的多边形中确定出目标多边形,并判断该目标多边形的轮廓是否包括凹曲线;如果不包括 凹曲线,则确定该目标多边形为一个喷洒物图像对象;如果包括凹曲线,则根据凹曲线对所述目标多边形进行拆分处理,以拆分得到两个或多个喷洒物图像对象。In one embodiment, the determining module 1103 is specifically configured to determine a target polygon from the obtained polygons, and determine whether the contour of the target polygon includes a concave curve; if not included The concave curve determines that the target polygon is a spray image object; if a concave curve is included, the target polygon is split according to the concave curve to split to obtain two or more spray image objects.
在一个实施例中,所述目标多边形是指拟合得到的多边形中面积大于预置面积阈值的多边形。In one embodiment, the target polygon refers to a polygon in the fitted polygon that has an area greater than a preset area threshold.
在一个实施例中,所述确定模块1103,具体用于根据凹曲线提取出凹缺陷点集;基于凹缺陷点集构建三角形;根据构建得到的三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。In one embodiment, the determining module 1103 is specifically configured to extract a set of concave defect points according to the concave curve; construct a triangle based on the set of concave defect points; and split the target polygon according to the vertices of the constructed triangle, The spray image object is obtained by splitting.
在一个实施例中,所述确定模块1103,具体用于根据凹曲线提取出凹缺陷点集,所述凹缺陷点集中包括所述凹曲线上的多个位置点;基于凹缺陷点集构建三角形;根据构建得到的三角形的面积,确定出目标三角形;根据目标三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。In one embodiment, the determining module 1103 is specifically configured to extract a set of concave defect points according to a concave curve, the concave defect point set includes a plurality of position points on the concave curve; and construct a triangle based on the concave defect point set And determining a target triangle according to the area of the constructed triangle; and splitting the target polygon according to the vertices of the target triangle to obtain the spray image object by splitting.
在一个实施例中,构建得到的三角形的面积是根据该三角形覆盖的像素点的数量来确定的。In one embodiment, the area of the constructed triangle is determined based on the number of pixels covered by the triangle.
在一个实施例中,构建得到的三角形是指:根据凹缺陷点集生成的三角形中目标顶点所对应的高大于预设的高阈值的三角形。In one embodiment, the constructed triangle refers to a triangle whose height corresponding to the target vertex in the triangle generated according to the concave defect point set is greater than a preset high threshold.
在一个实施例中,所述确定模块1103,具体用于将拆分得到的多边形按照预置的圆拟合算法进行拟合处理;对拆分得到的多边形的重合区域进行圆边补全处理,得到喷洒物圆形区域,每一个喷洒物圆形区域为一个喷洒物图像对象。In an embodiment, the determining module 1103 is configured to perform fitting processing on the split polygon according to a preset circle fitting algorithm; and perform round-edge complement processing on the overlapping regions of the split polygons. A circular area of the spray is obtained, each of which is a spray image object.
需要说明的是,本发明实施例的所述装置中各个模块的实现可参考上述各个实施例中相应内容的描述,在此不赘述。It should be noted that the implementation of each module in the device in the embodiment of the present invention may be referred to the description of the corresponding content in the foregoing embodiments, and details are not described herein.
本发明实施例能够对图像进行分析,基于多边形拟合算法来确定喷洒物在图像上的图像对象,进而进行目标环境中农药雾滴等喷洒物的分布参数的统计,能够满足用户快速得到分布参数的需求,不需要进行复杂、繁琐的处理,统计效率高,并且大多数农业喷洒也仅需要知道大致的分布参数即可,不需要进行精确的处理,本发明实施例的所述方法能够较好的满足农业用户对喷洒物的统计需求,在智能手机等设备均可实现,有效地降低了喷洒物的统计成本。The embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter. The demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better. To meet the statistical needs of agricultural users for spray materials, it can be realized in equipment such as smart phones, effectively reducing the statistical cost of spray materials.
再请参见图12,是本发明实施例的一种智能终端的结构示意图。本发明实施例的所述智能终端可以是智能手机、平板电脑等设备。该智能终端包括供 电模块等,还包括:处理器1201以及存储装置1202。Referring to FIG. 12, it is a schematic structural diagram of an intelligent terminal according to an embodiment of the present invention. The smart terminal in the embodiment of the present invention may be a device such as a smart phone or a tablet computer. The smart terminal includes The electrical module or the like further includes a processor 1201 and a storage device 1202.
所述存储装置1202可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储装置1202也可以包括非易失性存储器(non-volatile memory),例如快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD);存储装置1202还可以包括上述种类的存储器的组合。The storage device 1202 may include a volatile memory, such as a random-access memory (RAM); the storage device 1202 may also include a non-volatile memory, such as a fast A flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the storage device 1202 may further include a combination of the above types of memories.
所述处理器1201可以是中央处理器(central processing unit,CPU)。所述处理器1201还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(complex programmable logic device,CPLD),现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。The processor 1201 may be a central processing unit (CPU). The processor 1201 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general array logic (GAL), or any combination thereof.
可选地,所述存储器还用于存储程序指令。所述处理器1201可以调用所述程序指令,实现如本申请图1,5、8、9以及10实施例中所示的相应方法。Optionally, the memory is further configured to store program instructions. The processor 1201 can invoke the program instructions to implement corresponding methods as shown in the embodiments of Figures 1, 5, 8, 9, and 10 of the present application.
所述处理器1201,调用所述存储装置1202中存储的程序指令,当所述程序指令被执行时,用于:The processor 1201 invokes a program instruction stored in the storage device 1202, and when the program instruction is executed, is used to:
从所述图像中确定出采样图像,所述图像是对用于采集目标环境中的喷洒物的物体进行拍摄得到的;Determining a sampled image from the image, the image being obtained by photographing an object for collecting a spray in a target environment;
将所述采样图像转换为二值图像,并基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形;Converting the sampled image into a binary image, and fitting each image object on the binary image to a polygon based on a preset polygon fitting algorithm;
根据拟合得到的多边形确定出喷洒物图像对象,并基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。A spray image object is determined based on the fitted polygon, and a distribution parameter of the spray in the target environment is determined based on the determined spray image object.
在一个实施例中,所述处理器1201,用于将所述图像转换为灰度图,并进行二值化处理,得到待检测图像;从所述待检测图像中确定出采样区域;根据所述采样区域在所述待检测图像中的位置,从所述图像中确定出对应位置区域的区域图像作为采样图像。In one embodiment, the processor 1201 is configured to convert the image into a grayscale image, perform binarization processing to obtain an image to be detected, and determine a sampling region from the image to be detected; Describe the position of the sampling area in the image to be detected, and determine an area image of the corresponding position area from the image as a sample image.
在一个实施例中,所述处理器1201,用于基于预置的圆拟合算法对所述待检测图像上的对象进行边缘点拟合处理,得到多个闭合圆形区域;从多个闭合圆形区域中确定出目标圆形区域,并在该目标圆形区域截取得到采样区域。In one embodiment, the processor 1201 is configured to perform an edge point fitting process on an object on the image to be detected based on a preset circle fitting algorithm to obtain a plurality of closed circular regions; A target circular area is determined in the circular area, and a sampling area is obtained in the target circular area.
在一个实施例中,所述处理器1201,用于将所述图像的分辨率降低至预 置的分辨率值,和/或,使用预置的边缘保持的滤波算法对所述图像进行滤波处理。In one embodiment, the processor 1201 is configured to reduce the resolution of the image to a pre- The resolution values are set, and/or the image is filtered using a preset edge-preserved filtering algorithm.
在一个实施例中,所述处理器1201,用于将所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域确定为目标圆形区域。In one embodiment, the processor 1201 is configured to determine a closed circular area of the plurality of closed circular regions having a size within a preset length range as a target circular area.
在一个实施例中,所述处理器1201,用于若所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域包括多个,则将在预设的长度范围内的闭合圆形区域中尺寸最小的闭合圆形区域作为目标圆形区域。In one embodiment, the processor 1201 is configured to: if a plurality of closed circular regions of the plurality of closed circular regions have a size within a preset length range, include a plurality of The smallest closed circular area in the closed circular area serves as the target circular area.
在一个实施例中,所述预设的长度范围是根据所述图像的短边长度确定的。In one embodiment, the predetermined length range is determined based on the length of the short side of the image.
在一个实施例中,确定出的所述目标圆形区域的圆心与所述图像的中心之间的距离在预置的第一距离阈值内。In one embodiment, the determined distance between the center of the target circular area and the center of the image is within a preset first distance threshold.
在一个实施例中,所述处理器1201,用于在所述目标圆形区域中截取一个目标区域作为采样区域;其中,所述目标区域的图像中心与所述目标圆形区域的圆心的距离在预置的第二距离阈值内、且所述目标区域的尺寸与所述目标圆形区域的半径的长度比值为预置的比值。In one embodiment, the processor 1201 is configured to intercept a target area as a sampling area in the target circular area; wherein a distance between an image center of the target area and a center of the target circular area Within a preset second distance threshold, and the ratio of the size of the target area to the radius of the target circular area is a preset ratio.
在一个实施例中,所述处理器1201,用于将所述采样图像转换为灰度图;将转换得到的灰度图进行二值化处理,得到所述采样图像的二值图像。In one embodiment, the processor 1201 is configured to convert the sampled image into a grayscale image; perform binarization processing on the converted grayscale image to obtain a binary image of the sampled image.
在一个实施例中,所述处理器1201,用于从所述采样图像的三个颜色通道中选取指定的两个颜色通道;基于该两个颜色通道转换得到所述采样图像的灰度图。In one embodiment, the processor 1201 is configured to select a specified two color channels from three color channels of the sampled image; and obtain a grayscale image of the sampled image based on the two color channel conversions.
在一个实施例中,所述指定的两个颜色通道包括绿色颜色通道和红色颜色通道。In one embodiment, the specified two color channels include a green color channel and a red color channel.
在一个实施例中,所述处理器1201,用于使用预置的边缘保持的滤波算法对所述采样图像进行滤波处理。In one embodiment, the processor 1201 is configured to perform filtering processing on the sampled image using a preset edge-preserving filtering algorithm.
在一个实施例中,所述处理器1201,用于从拟合得到的多边形中确定出目标多边形,并判断该目标多边形的轮廓是否包括凹曲线;如果不包括凹曲线,则确定该目标多边形为一个喷洒物图像对象;如果包括凹曲线,则根据凹曲线对所述目标多边形进行拆分处理,以拆分得到两个或多个喷洒物图像对象。In one embodiment, the processor 1201 is configured to determine a target polygon from the obtained polygons, and determine whether the contour of the target polygon includes a concave curve; if the concave curve is not included, determine the target polygon as a spray image object; if a concave curve is included, the target polygon is split according to a concave curve to split to obtain two or more spray image objects.
在一个实施例中,所述目标多边形是指拟合得到的多边形中面积大于预置面积阈值的多边形。 In one embodiment, the target polygon refers to a polygon in the fitted polygon that has an area greater than a preset area threshold.
在一个实施例中,所述处理器1201,用于根据凹曲线提取出凹缺陷点集;基于凹缺陷点集构建三角形;根据构建得到的三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。In one embodiment, the processor 1201 is configured to extract a set of concave defect points according to the concave curve; construct a triangle based on the set of concave defect points; and split the target polygon according to the vertices of the constructed triangle to Split to get the spray image object.
在一个实施例中,所述处理器1201,用于根据凹曲线提取出凹缺陷点集,所述凹缺陷点集中包括所述凹曲线上的多个位置点;基于凹缺陷点集构建三角形;根据构建得到的三角形的面积,确定出目标三角形;根据目标三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。In one embodiment, the processor 1201 is configured to extract a set of concave defect points according to a concave curve, the concave defect point set includes a plurality of position points on the concave curve; and construct a triangle based on the concave defect point set; The target triangle is determined according to the area of the constructed triangle; the target polygon is split according to the vertices of the target triangle to obtain the spray image object by splitting.
在一个实施例中,构建得到的三角形的面积是根据该三角形覆盖的像素点的数量来确定的。In one embodiment, the area of the constructed triangle is determined based on the number of pixels covered by the triangle.
在一个实施例中,构建得到的三角形是指:根据凹缺陷点集生成的三角形中目标顶点所对应的高大于预设的高阈值的三角形。In one embodiment, the constructed triangle refers to a triangle whose height corresponding to the target vertex in the triangle generated according to the concave defect point set is greater than a preset high threshold.
在一个实施例中,所述处理器1201,用于将拆分得到的多边形按照预置的圆拟合算法进行拟合处理;对拆分得到的多边形的重合区域进行圆边补全处理,得到喷洒物圆形区域,每一个喷洒物圆形区域为一个喷洒物图像对象。In one embodiment, the processor 1201 is configured to perform fitting processing on the split polygon according to a preset circle fitting algorithm; and perform round-edge complement processing on the overlapping regions of the split polygons to obtain A circular area of the spray, each of which is a spray image object.
需要说明的是,本发明实施例的所述处理器的具体实现可参考上述各个实施例中相应内容的描述,在此不赘述。It should be noted that the specific implementation of the processor in the embodiment of the present invention may be referred to the description of the corresponding content in the foregoing embodiments, and details are not described herein.
本发明实施例能够对图像进行分析,基于多边形拟合算法来确定喷洒物在图像上的图像对象,进而进行目标环境中农药雾滴等喷洒物的分布参数的统计,能够满足用户快速得到分布参数的需求,不需要进行复杂、繁琐的处理,统计效率高,并且大多数农业喷洒也仅需要知道大致的分布参数即可,不需要进行精确的处理,本发明实施例的所述方法能够较好的满足农业用户喷洒物的统计需求,在智能手机等设备均可实现,有效地降低了喷洒物的统计成本。The embodiment of the invention can analyze the image, determine the image object of the spray object on the image based on the polygon fitting algorithm, and then perform statistics on the distribution parameters of the spray material such as pesticide droplets in the target environment, which can satisfy the user quickly obtaining the distribution parameter. The demand does not require complicated and cumbersome processing, and the statistical efficiency is high, and most agricultural spraying only needs to know the approximate distribution parameters, and no precise processing is required, and the method of the embodiment of the present invention can be better. The statistical needs of agricultural users' spray materials can be realized in equipment such as smart phones, which effectively reduces the statistical cost of the spray materials.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。One of ordinary skill in the art can understand that all or part of the process of implementing the foregoing embodiments can be completed by a computer program to instruct related hardware, and the program can be stored in a computer readable storage medium. When executed, the flow of an embodiment of the methods as described above may be included. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
以上所揭露的仅为本发明部分实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。 The above disclosure is only a part of the embodiments of the present invention, and the scope of the present invention is not limited thereto, and thus equivalent changes made in the claims of the present invention are still within the scope of the present invention.

Claims (42)

  1. 一种对图像的处理方法,其特征在于,所述图像是对用于采集目标环境中的喷洒物的物体进行拍摄得到的,所述方法包括:A method for processing an image, wherein the image is obtained by capturing an object for collecting a spray in a target environment, the method comprising:
    从所述图像中确定出采样图像;Determining a sampled image from the image;
    将所述采样图像转换为二值图像,并基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形;Converting the sampled image into a binary image, and fitting each image object on the binary image to a polygon based on a preset polygon fitting algorithm;
    根据拟合得到的多边形确定出喷洒物图像对象,并基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。A spray image object is determined based on the fitted polygon, and a distribution parameter of the spray in the target environment is determined based on the determined spray image object.
  2. 如权利要求1所述的方法,其特征在于,所述从所述图像中确定出采样图像,包括:The method of claim 1 wherein said determining a sample image from said image comprises:
    将所述图像转换为灰度图,并进行二值化处理,得到待检测图像;Converting the image into a grayscale image and performing binarization processing to obtain an image to be detected;
    从所述待检测图像中确定出采样区域;Determining a sampling area from the image to be detected;
    根据所述采样区域在所述待检测图像中的位置,从所述图像中确定出对应位置区域的区域图像作为采样图像。And determining, according to the position of the sampling area in the image to be detected, an area image of the corresponding position area from the image as a sample image.
  3. 如权利要求2所述的方法,其特征在于,所述从所述待检测图像中确定出采样区域,包括:The method of claim 2, wherein the determining a sampling area from the image to be detected comprises:
    基于预置的圆拟合算法对所述待检测图像上的对象进行边缘点拟合处理,得到多个闭合圆形区域;Performing an edge point fitting process on the object on the image to be detected based on a preset circle fitting algorithm to obtain a plurality of closed circular regions;
    从多个闭合圆形区域中确定出目标圆形区域,并在该目标圆形区域截取得到采样区域。A target circular area is determined from a plurality of closed circular regions, and a sampling area is obtained in the target circular area.
  4. 如权利要求1-3任一项所述的方法,其特征在于,还包括:The method of any of claims 1-3, further comprising:
    将所述图像的分辨率降低至预置的分辨率值,和/或,Lowering the resolution of the image to a preset resolution value, and/or,
    使用预置的边缘保持的滤波算法对所述图像进行滤波处理。The image is filtered using a preset edge-preserved filtering algorithm.
  5. 如权利要求3所述的方法,其特征在于,所述从多个闭合圆形区域中确定出目标圆形区域,包括: The method of claim 3 wherein said determining a target circular area from a plurality of closed circular regions comprises:
    将所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域确定为目标圆形区域。A closed circular area having a size within a predetermined length of the plurality of closed circular regions is determined as a target circular area.
  6. 如权利要求5所述的方法,其特征在于,所述从多个闭合圆形区域中确定出目标圆形区域,还包括:The method of claim 5, wherein the determining the target circular area from the plurality of closed circular regions further comprises:
    若所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域包括多个,则将在预设的长度范围内的闭合圆形区域中尺寸最小的闭合圆形区域作为目标圆形区域。If a plurality of closed circular regions having a size within a predetermined length range of the plurality of closed circular regions include a plurality of, the closed circular region having the smallest size among the closed circular regions within a preset length range is used as Target circular area.
  7. 如权利要求5或6所述的方法,其特征在于,所述预设的长度范围是根据所述图像的短边长度确定的。The method of claim 5 or 6, wherein said predetermined length range is determined based on a length of a short side of said image.
  8. 如权利要求5或6所述的方法,其特征在于,确定出的所述目标圆形区域的圆心与所述图像的中心之间的距离在预置的第一距离阈值内。The method of claim 5 or claim 6 wherein the determined distance between the center of the target circular area and the center of the image is within a preset first distance threshold.
  9. 如权利要求3-8任一项所述的方法,其特征在于,所述在该目标圆形区域截取得到采样区域,包括:The method according to any one of claims 3-8, wherein the capturing the sampling area in the target circular area comprises:
    在所述目标圆形区域中截取目标区域作为采样区域;Intercepting a target area as a sampling area in the target circular area;
    其中,所述目标区域的图像中心与所述目标圆形区域的圆心的距离在预置的第二距离阈值内、且所述目标区域的尺寸与所述目标圆形区域的半径的长度比值为预置的比值。The distance between the image center of the target area and the center of the target circular area is within a preset second distance threshold, and the ratio of the size of the target area to the radius of the target circular area is Preset ratio.
  10. 如权利要求1-9任一项所述的方法,其特征在于,所述将所述采样图像转换为二值图像,包括:The method according to any one of claims 1 to 9, wherein the converting the sample image into a binary image comprises:
    将所述采样图像转换为灰度图;Converting the sampled image into a grayscale image;
    将转换得到的灰度图进行二值化处理,得到所述采样图像的二值图像。The converted grayscale image is binarized to obtain a binary image of the sampled image.
  11. 如权利要求10所述的方法,其特征在于,所述将所述采样图像转换为灰度图,包括:The method of claim 10 wherein said converting said sampled image to a grayscale image comprises:
    从所述采样图像的三个颜色通道中选取指定的两个颜色通道; Selecting two specified color channels from three color channels of the sample image;
    基于该两个颜色通道转换得到所述采样图像的灰度图。A grayscale image of the sampled image is obtained based on the two color channel transitions.
  12. 如权利要求11所述的方法,其特征在于,所述指定的两个颜色通道包括绿色颜色通道和红色颜色通道。The method of claim 11 wherein said designated two color channels comprise a green color channel and a red color channel.
  13. 如权利要求1-12任一项所述的方法,其特征在于,还包括:The method of any of claims 1 to 12, further comprising:
    使用预置的边缘保持的滤波算法对所述采样图像进行滤波处理。The sampled image is filtered using a preset edge-preserved filtering algorithm.
  14. 如权利要求1-13任一项所述的方法,其特征在于,所述根据拟合得到的多边形确定出喷洒物图像对象,包括:The method according to any one of claims 1 to 13, wherein the determining the spray image object according to the fitted polygon comprises:
    从拟合得到的多边形中确定出目标多边形,并判断该目标多边形的轮廓是否包括凹曲线;Determining a target polygon from the fitted polygons, and determining whether the contour of the target polygon includes a concave curve;
    如果不包括凹曲线,则确定该目标多边形为一个喷洒物图像对象;If the concave curve is not included, it is determined that the target polygon is a spray image object;
    如果包括凹曲线,则根据凹曲线对所述目标多边形进行拆分处理,以拆分得到两个或多个喷洒物图像对象。If a concave curve is included, the target polygon is split according to a concave curve to split to obtain two or more spray image objects.
  15. 如权利要求14所述的方法,其特征在于,所述目标多边形是指拟合得到的多边形中面积大于预置面积阈值的多边形。The method of claim 14 wherein said target polygon is a polygon of a fitted polygon having an area greater than a preset area threshold.
  16. 如权利要求14或15所述的方法,其特征在于,所述根据凹曲线对所述目标多边形进行拆分处理,以拆分得到两个或多个喷洒物图像对象,包括:The method according to claim 14 or 15, wherein the splitting the target polygon according to the concave curve to split the two or more spray image objects comprises:
    根据凹曲线提取出凹缺陷点集;Extracting a set of concave defect points according to the concave curve;
    基于凹缺陷点集构建三角形;Constructing a triangle based on a set of concave defect points;
    根据构建得到的三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。The target polygon is split according to the vertices of the constructed triangle to obtain a spray image object.
  17. 如权利要求14或15所述的方法,其特征在于,所述根据凹曲线对所述目标多边形进行拆分处理,以拆分得到两个或多个喷洒物图像对象,包括:The method according to claim 14 or 15, wherein the splitting the target polygon according to the concave curve to split the two or more spray image objects comprises:
    根据凹曲线提取出凹缺陷点集,所述凹缺陷点集中包括所述凹曲线上的多个位置点; Extracting a set of concave defect points according to the concave curve, the concave defect point concentration including a plurality of position points on the concave curve;
    基于凹缺陷点集构建三角形;Constructing a triangle based on a set of concave defect points;
    根据构建得到的三角形的面积,确定出目标三角形;Determining the target triangle according to the area of the constructed triangle;
    根据目标三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。The target polygon is split according to the vertices of the target triangle to obtain a spray image object by splitting.
  18. 如权利要求17所述的方法,其特征在于,构建得到的三角形的面积是根据该三角形覆盖的像素点的数量来确定的。The method of claim 17 wherein the area of the constructed triangle is determined based on the number of pixels covered by the triangle.
  19. 如权利要求16或17所述的方法,其特征在于,构建得到的三角形是指:根据凹缺陷点集生成的三角形中目标顶点所对应的高大于预设的高阈值的三角形。The method according to claim 16 or 17, wherein the constructed triangle refers to a triangle whose height corresponding to the target vertex in the triangle generated according to the set of concave defect points is greater than a preset high threshold.
  20. 如权利要求14-19任一项所述的方法,其特征在于,在对所述目标多边形进行拆分处理后,还包括:The method according to any one of claims 14 to 19, further comprising: after splitting the target polygon, further comprising:
    将拆分得到的多边形按照预置的圆拟合算法进行拟合处理;The polygon obtained by the splitting is subjected to a fitting process according to a preset circle fitting algorithm;
    对拆分得到的多边形的重合区域进行圆边补全处理,得到喷洒物圆形区域,每一个喷洒物圆形区域为一个喷洒物图像对象。The overlapping area of the split polygons is rounded and complemented to obtain a circular area of the spray, and each of the sprayed circular areas is a spray image object.
  21. 一种对图像的处理装置,其特征在于,所述图像是对用于采集目标环境中的喷洒物的物体进行拍摄得到的,所述装置包括:A processing device for an image, wherein the image is obtained by photographing an object for collecting a spray in a target environment, the device comprising:
    提取模块,用于从所述图像中确定出采样图像;An extraction module, configured to determine a sample image from the image;
    处理模块,用于将所述采样图像转换为二值图像,并基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形;a processing module, configured to convert the sample image into a binary image, and fit each image object on the binary image to a polygon based on a preset polygon fitting algorithm;
    确定模块,用于根据拟合得到的多边形确定出喷洒物图像对象,并基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。And a determining module, configured to determine a spray image object according to the fitted polygon, and determine a distribution parameter of the spray in the target environment based on the determined spray image object.
  22. 一种智能终端,其特征在于,包括:存储装置和处理器;An intelligent terminal, comprising: a storage device and a processor;
    所述存储装置,用于存储程序指令;The storage device is configured to store program instructions;
    所述处理器,调用所述程序指令,当所述程序指令被执行时,用于:The processor, the program instruction is invoked, when the program instruction is executed, for:
    从图像中确定出采样图像,所述图像是对用于采集目标环境中的喷洒物的 物体进行拍摄得到的;A sample image is determined from the image that is used to collect the spray in the target environment Obtained by an object;
    将所述采样图像转换为二值图像,并基于预置的多边形拟合算法将所述二值图像上的各图像对象拟合为多边形;Converting the sampled image into a binary image, and fitting each image object on the binary image to a polygon based on a preset polygon fitting algorithm;
    根据拟合得到的多边形确定出喷洒物图像对象,并基于确定出的喷洒物图像对象确定所述目标环境中喷洒物的分布参数。A spray image object is determined based on the fitted polygon, and a distribution parameter of the spray in the target environment is determined based on the determined spray image object.
  23. 如权利要求22所述的智能终端,其特征在于,The intelligent terminal of claim 22, wherein
    所述处理器,用于将所述图像转换为灰度图,并进行二值化处理,得到待检测图像;从所述待检测图像中确定出采样区域;根据所述采样区域在所述待检测图像中的位置,从所述图像中确定出对应位置区域的区域图像作为采样图像。The processor is configured to convert the image into a grayscale image, and perform binarization processing to obtain an image to be detected; determine a sampling region from the image to be detected; and wait for the sampling region according to the sampling region A position in the image is detected, and an area image of the corresponding position area is determined from the image as a sample image.
  24. 如权利要求23所述的智能终端,其特征在于,The intelligent terminal of claim 23, wherein
    所述处理器,用于基于预置的圆拟合算法对所述待检测图像上的对象进行边缘点拟合处理,得到多个闭合圆形区域;从多个闭合圆形区域中确定出目标圆形区域,并在该目标圆形区域截取得到采样区域。The processor is configured to perform an edge point fitting process on the object on the image to be detected based on a preset circle fitting algorithm to obtain a plurality of closed circular regions; and determine a target from the plurality of closed circular regions A circular area, and the sampling area is taken in the target circular area.
  25. 如权利要求22-24任一项所述的智能终端,其特征在于,A smart terminal according to any one of claims 22 to 24, characterized in that
    所述处理器,用于将所述图像的分辨率降低至预置的分辨率值,和/或,使用预置的边缘保持的滤波算法对所述图像进行滤波处理。The processor is configured to reduce a resolution of the image to a preset resolution value, and/or perform filtering processing on the image using a preset edge-preserved filtering algorithm.
  26. 如权利要求24所述的智能终端,其特征在于,The intelligent terminal of claim 24, wherein
    所述处理器,用于将所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域确定为目标圆形区域。The processor is configured to determine a closed circular area of the plurality of closed circular regions having a size within a preset length range as a target circular area.
  27. 如权利要求26所述的智能终端,其特征在于,The intelligent terminal of claim 26, wherein
    所述处理器,用于若所述多个闭合圆形区域中尺寸在预设的长度范围内的闭合圆形区域包括多个,则将在预设的长度范围内的闭合圆形区域中尺寸最小的闭合圆形区域作为目标圆形区域。 The processor is configured to: if the closed circular area having a size within a preset length range of the plurality of closed circular regions comprises a plurality of, the size of the closed circular area within a preset length range The smallest closed circular area serves as the target circular area.
  28. 如权利要求26或27所述的智能终端,其特征在于,所述预设的长度范围是根据所述图像的短边长度确定的。The intelligent terminal according to claim 26 or 27, wherein the predetermined length range is determined according to a length of a short side of the image.
  29. 如权利要求26或27所述的智能终端,其特征在于,确定出的所述目标圆形区域的圆心与所述图像的中心之间的距离在预置的第一距离阈值内。The intelligent terminal according to claim 26 or 27, wherein the determined distance between the center of the target circular area and the center of the image is within a preset first distance threshold.
  30. 如权利要求24-29任一项所述的智能终端,其特征在于,A smart terminal according to any one of claims 24 to 29, characterized in that
    所述处理器,用于在所述目标圆形区域中截取一个目标区域作为采样区域;其中,所述目标区域的图像中心与所述目标圆形区域的圆心的距离在预置的第二距离阈值内、且所述目标区域的尺寸与所述目标圆形区域的半径的长度比值为预置的比值。The processor is configured to intercept a target area as a sampling area in the target circular area; wherein a distance between an image center of the target area and a center of the target circular area is at a preset second distance The ratio of the length of the target area to the length of the target circular area and the radius of the target circular area is a preset ratio.
  31. 如权利要求22-30任一项所述的智能终端,其特征在于,A smart terminal according to any one of claims 22 to 30, characterized in that
    所述处理器,用于将所述采样图像转换为灰度图;将转换得到的灰度图进行二值化处理,得到所述采样图像的二值图像。The processor is configured to convert the sampled image into a grayscale image; perform binarization processing on the converted grayscale image to obtain a binary image of the sampled image.
  32. 如权利要求31所述的智能终端,其特征在于,The intelligent terminal of claim 31, wherein
    所述处理器,用于从所述采样图像的三个颜色通道中选取指定的两个颜色通道;基于该两个颜色通道转换得到所述采样图像的灰度图。The processor is configured to select a specified two color channels from three color channels of the sampled image; and obtain a grayscale image of the sampled image based on the two color channel conversions.
  33. 如权利要求32所述的智能终端,其特征在于,所述指定的两个颜色通道包括绿色颜色通道和红色颜色通道。The intelligent terminal of claim 32, wherein said designated two color channels comprise a green color channel and a red color channel.
  34. 如权利要求22-33任一项所述的智能终端,其特征在于,A smart terminal according to any one of claims 22 to 33, characterized in that
    所述处理器,用于使用预置的边缘保持的滤波算法对所述采样图像进行滤波处理。The processor is configured to perform filtering processing on the sampled image by using a preset edge-preserving filtering algorithm.
  35. 如权利要求22-34任一项所述的智能终端,其特征在于,The intelligent terminal according to any one of claims 22 to 34, characterized in that
    所述处理器,用于从拟合得到的多边形中确定出目标多边形,并判断该目标多边形的轮廓是否包括凹曲线;如果不包括凹曲线,则确定该目标多边形为 一个喷洒物图像对象;如果包括凹曲线,则根据凹曲线对所述目标多边形进行拆分处理,以拆分得到两个或多个喷洒物图像对象。The processor is configured to determine a target polygon from the obtained polygon, and determine whether the contour of the target polygon includes a concave curve; if the concave curve is not included, determine the target polygon as a spray image object; if a concave curve is included, the target polygon is split according to a concave curve to split to obtain two or more spray image objects.
  36. 如权利要求35所述的智能终端,其特征在于,所述目标多边形是指拟合得到的多边形中面积大于预置面积阈值的多边形。The intelligent terminal according to claim 35, wherein the target polygon is a polygon in which the area of the fitted polygon is larger than a preset area threshold.
  37. 如权利要求35或36所述的智能终端,其特征在于,A smart terminal according to claim 35 or 36, wherein
    所述处理器,用于根据凹曲线提取出凹缺陷点集;基于凹缺陷点集构建三角形;根据构建得到的三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。The processor is configured to extract a set of concave defect points according to the concave curve; construct a triangle based on the set of concave defect points; and split the target polygon according to the vertices of the constructed triangle to obtain a spray image object by splitting .
  38. 如权利要求35或36所述的智能终端,其特征在于,A smart terminal according to claim 35 or 36, wherein
    所述处理器,用于根据凹曲线提取出凹缺陷点集,所述凹缺陷点集中包括所述凹曲线上的多个位置点;基于凹缺陷点集构建三角形;根据构建得到的三角形的面积,确定出目标三角形;根据目标三角形的顶点对所述目标多边形进行拆分处理,以拆分得到喷洒物图像对象。The processor is configured to extract a set of concave defect points according to a concave curve, the concave defect point set includes a plurality of position points on the concave curve; construct a triangle based on the concave defect point set; and according to the area of the constructed triangle Determining the target triangle; splitting the target polygon according to the vertices of the target triangle to obtain the spray image object by splitting.
  39. 如权利要求38所述的智能终端,其特征在于,构建得到的三角形的面积是根据该三角形覆盖的像素点的数量来确定的。The intelligent terminal of claim 38, wherein the area of the constructed triangle is determined based on the number of pixels covered by the triangle.
  40. 如权利要求37或38所述的智能终端,其特征在于,构建得到的三角形是指:根据凹缺陷点集生成的三角形中目标顶点所对应的高大于预设的高阈值的三角形。The intelligent terminal according to claim 37 or 38, wherein the constructed triangle refers to a triangle whose height corresponding to the target vertex in the triangle generated according to the concave defect point set is greater than a preset high threshold.
  41. 如权利要求35-40任一项所述的智能终端,其特征在于,A smart terminal according to any one of claims 35 to 40, characterized in that
    所述处理器,用于将拆分得到的多边形按照预置的圆拟合算法进行拟合处理;对拆分得到的多边形的重合区域进行圆边补全处理,得到喷洒物圆形区域,每一个喷洒物圆形区域为一个喷洒物图像对象。The processor is configured to perform fitting processing on the polygon obtained by splitting according to a preset circle fitting algorithm; performing round-edge complement processing on the overlapping area of the split polygon to obtain a circular area of the spray, each A circular area of the spray is a spray image object.
  42. 一种计算机可读存储介质,其特征在于,该计算机可读存储介质中存 储有程序指令,该程序指令被处理器运行时,用于执行上述权利要求1~20任一项所述的对图像的处理方法。 A computer readable storage medium, wherein the computer readable storage medium is stored There is stored a program instruction for executing the image processing method according to any one of claims 1 to 20 when the program command is executed by the processor.
PCT/CN2017/093170 2017-07-17 2017-07-17 Image processing method and device, and intelligent terminal WO2019014810A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201780004777.7A CN108496203B (en) 2017-07-17 2017-07-17 Image processing method and device and intelligent terminal
PCT/CN2017/093170 WO2019014810A1 (en) 2017-07-17 2017-07-17 Image processing method and device, and intelligent terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/093170 WO2019014810A1 (en) 2017-07-17 2017-07-17 Image processing method and device, and intelligent terminal

Publications (1)

Publication Number Publication Date
WO2019014810A1 true WO2019014810A1 (en) 2019-01-24

Family

ID=63344775

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/093170 WO2019014810A1 (en) 2017-07-17 2017-07-17 Image processing method and device, and intelligent terminal

Country Status (2)

Country Link
CN (1) CN108496203B (en)
WO (1) WO2019014810A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111445482A (en) * 2020-03-24 2020-07-24 上海第二工业大学 Segmentation and identification method of overlapped agaricus bisporus
CN111899146A (en) * 2020-08-04 2020-11-06 西安科技大学 MATLAB engine spray image automatic screening method
CN113686867A (en) * 2021-07-15 2021-11-23 昆山丘钛微电子科技股份有限公司 Dispensing quality detection method and device, medium and camera focusing machine
CN114399507A (en) * 2022-03-25 2022-04-26 季华实验室 Mobile phone appearance quality detection method and device, electronic equipment and storage medium
CN114972750A (en) * 2022-04-29 2022-08-30 北京九章云极科技有限公司 Target coverage rate obtaining method and device and classification model training method and device
CN116503397A (en) * 2023-06-26 2023-07-28 山东天通汽车科技股份有限公司 In-vehicle transmission belt defect detection method based on image data
CN117689672A (en) * 2024-01-03 2024-03-12 广州悦瑞化妆品有限公司 Facial mask nutrient solution spraying method based on image processing

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109120757A (en) * 2018-09-27 2019-01-01 中国民用航空总局第二研究所 A kind of droplet Image Acquisition auxiliary device and method based on mobile phone photograph
CN111437420A (en) * 2019-10-26 2020-07-24 泰州三凯工程技术有限公司 Environment maintenance system based on customized filtering
CN116703922B (en) * 2023-08-08 2023-10-13 青岛华宝伟数控科技有限公司 Intelligent positioning method and system for sawn timber defect position

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1916598A (en) * 2005-08-15 2007-02-21 中国农业大学 Apparatus for measuring spectrum of fog drop, and image processing device
CN101226108A (en) * 2007-01-19 2008-07-23 中国农业机械化科学研究院 Method for testing droplet distribution consistency degree
CN101770582A (en) * 2008-12-26 2010-07-07 鸿富锦精密工业(深圳)有限公司 Image matching system and method
CN101872425A (en) * 2010-07-29 2010-10-27 哈尔滨工业大学 Empirical mode decomposition based method for acquiring image characteristics and measuring corresponding physical parameters
CN104502990A (en) * 2015-01-06 2015-04-08 中国地质大学(武汉) Geological survey method of tunnel face based on digital image

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7065242B2 (en) * 2000-03-28 2006-06-20 Viewpoint Corporation System and method of three-dimensional image capture and modeling
CN103226387B (en) * 2013-04-07 2016-06-22 华南理工大学 Video fingertip localization method based on Kinect
CN104240243B (en) * 2014-09-05 2017-05-10 南京农业大学 Adhered piglet automatic counting method based on ellipse fitting
CN107110754B (en) * 2015-10-12 2019-05-03 深圳市大疆创新科技有限公司 Spray quality detection device, system, method and sampling auxiliary device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1916598A (en) * 2005-08-15 2007-02-21 中国农业大学 Apparatus for measuring spectrum of fog drop, and image processing device
CN101226108A (en) * 2007-01-19 2008-07-23 中国农业机械化科学研究院 Method for testing droplet distribution consistency degree
CN101770582A (en) * 2008-12-26 2010-07-07 鸿富锦精密工业(深圳)有限公司 Image matching system and method
CN101872425A (en) * 2010-07-29 2010-10-27 哈尔滨工业大学 Empirical mode decomposition based method for acquiring image characteristics and measuring corresponding physical parameters
CN104502990A (en) * 2015-01-06 2015-04-08 中国地质大学(武汉) Geological survey method of tunnel face based on digital image

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111445482A (en) * 2020-03-24 2020-07-24 上海第二工业大学 Segmentation and identification method of overlapped agaricus bisporus
CN111445482B (en) * 2020-03-24 2023-03-28 上海第二工业大学 Segmentation and identification method of overlapped agaricus bisporus
CN111899146A (en) * 2020-08-04 2020-11-06 西安科技大学 MATLAB engine spray image automatic screening method
CN113686867A (en) * 2021-07-15 2021-11-23 昆山丘钛微电子科技股份有限公司 Dispensing quality detection method and device, medium and camera focusing machine
CN114399507A (en) * 2022-03-25 2022-04-26 季华实验室 Mobile phone appearance quality detection method and device, electronic equipment and storage medium
CN114972750A (en) * 2022-04-29 2022-08-30 北京九章云极科技有限公司 Target coverage rate obtaining method and device and classification model training method and device
CN114972750B (en) * 2022-04-29 2023-10-27 北京九章云极科技有限公司 Target coverage rate acquisition method, classification model training method and device
CN116503397A (en) * 2023-06-26 2023-07-28 山东天通汽车科技股份有限公司 In-vehicle transmission belt defect detection method based on image data
CN116503397B (en) * 2023-06-26 2023-09-01 山东天通汽车科技股份有限公司 In-vehicle transmission belt defect detection method based on image data
CN117689672A (en) * 2024-01-03 2024-03-12 广州悦瑞化妆品有限公司 Facial mask nutrient solution spraying method based on image processing
CN117689672B (en) * 2024-01-03 2024-05-14 广州悦瑞化妆品有限公司 Facial mask nutrient solution spraying method based on image processing

Also Published As

Publication number Publication date
CN108496203B (en) 2022-04-22
CN108496203A (en) 2018-09-04

Similar Documents

Publication Publication Date Title
WO2019014810A1 (en) Image processing method and device, and intelligent terminal
TWI805869B (en) System and method for computing dominant class of scene
CN110691193B (en) Camera switching method and device, storage medium and electronic equipment
US8594439B2 (en) Image processing
KR101573131B1 (en) Method and apparatus for capturing images
JP4351911B2 (en) Method and apparatus for evaluating photographic quality of captured images in a digital still camera
CN111667455B (en) AI detection method for brushing multiple defects
WO2015196802A1 (en) Photographing method and apparatus, and electronic device
JP2020536457A (en) Image processing methods and devices, electronic devices, and computer-readable storage media
EP3358298A1 (en) Building height calculation method and apparatus, and storage medium
US20080075385A1 (en) Detection and Correction of Flash Artifacts from Airborne Particulates
US11908160B2 (en) Method and apparatus for context-embedding and region-based object detection
US9256928B2 (en) Image processing apparatus, image processing method, and storage medium capable of determining a region corresponding to local light from an image
JP2011188496A (en) Backlight detection device and backlight detection method
RU2749033C2 (en) Method, medium and system for detecting potato virus in agricultural crop image
CN113344958B (en) Microscopic imaging scanning method and scanning system
CN113498520B (en) Character recognition method, character recognition device, and storage medium
CN109190617B (en) Image rectangle detection method and device and storage medium
WO2020038065A1 (en) Image processing method, terminal, and computer storage medium
CN110110667B (en) Processing method and system of diatom image and related components
CN110032946A (en) A kind of aluminium based on machine vision/aluminium blister package tablet identification and localization method
US8885971B2 (en) Image processing apparatus, image processing method, and storage medium
CN113781421A (en) Underwater-based target identification method, device and system
CN111669492A (en) Method for processing shot digital image by terminal and terminal
US9235882B2 (en) Method for detecting existence of dust spots in digital images based on locally adaptive thresholding

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17918427

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17918427

Country of ref document: EP

Kind code of ref document: A1