CN113223016A - Image segmentation method and device for plant seedlings, electronic equipment and medium - Google Patents

Image segmentation method and device for plant seedlings, electronic equipment and medium Download PDF

Info

Publication number
CN113223016A
CN113223016A CN202110523012.2A CN202110523012A CN113223016A CN 113223016 A CN113223016 A CN 113223016A CN 202110523012 A CN202110523012 A CN 202110523012A CN 113223016 A CN113223016 A CN 113223016A
Authority
CN
China
Prior art keywords
image
mask image
hsv
plant
rgb
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110523012.2A
Other languages
Chinese (zh)
Inventor
兰志才
王朝锟
李坚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Xihongqiao Navigation Technology Co ltd
Original Assignee
Shanghai Xihongqiao Navigation Technology Co ltd
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 Shanghai Xihongqiao Navigation Technology Co ltd filed Critical Shanghai Xihongqiao Navigation Technology Co ltd
Priority to CN202110523012.2A priority Critical patent/CN113223016A/en
Publication of CN113223016A publication Critical patent/CN113223016A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • 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/10Image acquisition modality
    • G06T2207/10024Color 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/20081Training; Learning

Abstract

The invention discloses an image segmentation method, an image segmentation device, electronic equipment and a storage medium for plant seedlings, wherein the image segmentation method comprises the following steps: acquiring an RGB image of a plant seedling planting area; carrying out color space conversion on the RGB image to obtain an HSV image of the plant seedling planting area; acquiring an appointed alternative mask image according to the HSV image; and segmenting the RGB image according to the appointed alternative mask image to obtain a segmented image containing plant seedlings. The HSV image is obtained by performing space conversion on the RGB image of the plant seedling planting area, the determination factor of the plant color is simplified, the RGB image is segmented based on the appointed alternative mask image obtained by the HSV image, the segmented image containing the plant seedling is accurately obtained, the segmentation effect is good, abnormal conditions such as abnormal insertion of the seedling and the like can be found in time, and the working efficiency of plant planting is improved.

Description

Image segmentation method and device for plant seedlings, electronic equipment and medium
Technical Field
The embodiment of the invention relates to the technical field of image processing, in particular to an image segmentation method and device for plant seedlings, electronic equipment and a medium.
Background
In the field of crop planting, such as the planting process of rice seedlings, the rice seedlings are transplanted only manually, and the requirement of modern agricultural planting cannot be met due to low efficiency. With the development of the intellectualization of agricultural machinery, the planting efficiency can be obviously improved by adopting the artificial intelligent rice transplanter to automatically transplant rice.
However, when the artificial intelligent rice transplanter is used for transplanting rice seedlings, due to the lack of artificial correction, poor working of the sensor in rainy, foggy and snowy weather and interference of impurities such as soil, rocks and mulching films, abnormal conditions such as abnormal insertion of the rice seedlings cannot be found in time, so that artificial reseeding or re-operation may be needed, the working efficiency of the artificial intelligent rice transplanter is low, and unnecessary cost is increased.
Disclosure of Invention
The embodiment of the invention provides an image segmentation method, device, electronic equipment and storage medium for plant seedlings, so as to accurately determine the plant seedlings in an automatic planting process, and timely find abnormal conditions in the seedling planting process.
In a first aspect, an embodiment of the present invention provides an image segmentation method for plant seedlings, including:
acquiring an RGB image of a plant seedling planting area;
carrying out color space conversion on the RGB image to obtain an HSV image of the plant seedling planting area;
acquiring an appointed alternative mask image according to the HSV image;
and segmenting the RGB image according to the appointed alternative mask image to obtain a segmented image containing plant seedlings.
In a second aspect, an embodiment of the present invention provides an image segmentation apparatus for plant seedlings, including:
the RGB image acquisition module of the plant seedling planting area is used for acquiring RGB images of the plant seedling planting area;
the HSV image acquisition module of the plant seedling planting area is used for carrying out color space conversion on the RGB image to acquire an HSV image of the plant seedling planting area;
the appointed alternative mask image acquisition module is used for acquiring an appointed alternative mask image according to the HSV image;
and the image segmentation module of the plant seedlings is used for segmenting the RGB image according to the appointed alternative mask image to obtain a segmented image containing the plant seedlings.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the methods of any of the embodiments of the present invention.
In a fourth aspect, the embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the method of any of the embodiments of the present invention.
In the embodiment of the invention, the RGB image of the plant seedling planting area is subjected to spatial conversion to obtain the HSV image, the determination factor of the plant color is simplified, the RGB image is segmented based on the specified alternative mask image obtained by the HSV image, the segmented image containing the plant seedling is accurately obtained, the segmentation effect is good, abnormal conditions such as abnormal insertion of the seedling and the like can be found in time, and the working efficiency of plant planting is improved.
Drawings
FIG. 1 is a flowchart of an image segmentation method for plant seedlings according to an embodiment of the present invention;
FIG. 2 is a flowchart of an image segmentation method for plant seedlings according to a second embodiment of the present invention;
FIG. 3 is a schematic structural view of an image segmentation apparatus for plant seedlings according to a third embodiment of the present invention;
fig. 4 is a block diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an image segmentation method for a plant seedling according to an embodiment of the present invention, which is applicable to a case of segmenting an image of a plant seedling, and can be performed by an image segmentation apparatus for a plant seedling according to an embodiment of the present invention, where the apparatus can be implemented by software and/or hardware, and the method according to an embodiment of the present invention specifically includes the following steps:
and S101, acquiring an RGB image of a plant seedling planting area.
Optionally, acquiring the RGB image of the plant seedling planting area may include: collecting an original image of a plant seedling planting area; the color space of the original image is corrected by gamma correction to obtain an RGB image.
The plant seedling may be a rice seedling, and the specific type of plant to be planted is not limited in this embodiment. In the process of automatic transplanting, the artificial intelligent transplanter shoots a plant seedling planting area through an optical sensor arranged above the artificial intelligent transplanter, and the terminal equipment acquires an original image of the plant seedling planting area shot by the optical sensor, such as a paddy field image.
The original images received by the artificial intelligent rice transplanter under the condition of turning and the condition that the optical sensor is blocked are invalid, so that marks are added to the original images acquired under the conditions, the marked original images are excluded in the subsequent image processing process, and only the original images without the marks are adopted for segmentation.
In the present embodiment, after the original image is acquired, the original image is preprocessed to reduce interference of the sun light and the rain and fog weather on the image as much as possible. For example, the color space of the original image is corrected by gamma correction to obtain an RGB image.
And S102, carrying out color space conversion on the RGB image to obtain an HSV image of the plant seedling planting area.
Specifically, the color of each pixel in the RGB image is generally determined by the superposition of three channel colors of R (red), G (green), and B (blue) on each other. And at the time of color space conversion, normalization is first performed for each pixel in accordance with formula (1):
Figure BDA0003064810780000041
Figure BDA0003064810780000042
Figure BDA0003064810780000043
wherein, R is a red division value of each pixel in the RGB image, G is a green division value of each pixel in the RGB image, B is a blue division value of each pixel in the RGB image, R ' is a normalized red division value of each pixel, G ' is a normalized green division value of each pixel, and B ' is a normalized blue division value of each pixel.
And after obtaining the normalized division value of each pixel in the RGB image, C may be specifically adoptedmaxMax (R ', G ', B ') represents the maximum component after normalization, using CminMin (R ', G ', B ') represents the minimum component after normalization, and Δ ═ C is usedmax-CminRepresenting the difference between the normalized maximum and minimum components. Then, the following formula (2) is used to obtain the tone division value after color space conversion of each pixel in the RGB image:
Figure BDA0003064810780000051
wherein H represents the hue division value, R ' is the normalized red division value of each pixel, G ' is the normalized green division value of each pixel, B ' is the normalized blue division value of each pixel, CmaxTo illustrate the normalized maximum component, Δ is the difference between the normalized maximum and minimum components.
The saturation value after color space conversion of each pixel in the RGB image is obtained using the following formula (3):
Figure BDA0003064810780000052
wherein S represents a saturation value, CmaxTo illustrate the normalized maximum component, Δ is the difference between the normalized maximum and minimum components.
The lightness division value after color space conversion of each pixel in the RGB image is obtained using the following formula (4):
V=Cmax (4)
wherein V represents a lightness division value, CmaxTo show the maximum component after normalization.
It should be noted that, after the above color space conversion, since the seedling of the rice is usually green, when the seedling is determined by the color, the RGB image usually requires R, G and B three elements to determine green, which is relatively complicated, and in the HSV image, since S saturation is mainly determined by the parameter of the camera, and V brightness is mainly determined by the illumination intensity, which is not related to the color, only one element of H hue is used to determine green, so that the factor for determining the plant color can be simplified after the space conversion.
And step S103, acquiring a specified alternative mask image according to the HSV image.
Optionally, acquiring the specified alternative mask image according to the HSV image may include: acquiring a control group mask image containing plant seedlings according to the HSV image; acquiring clustering centers of HSV images and alternative mask images corresponding to each clustering center; and calculating the overlapping area ratio of each candidate mask image to the control group mask image, and taking the candidate mask image with the largest overlapping area ratio as a designated candidate mask image.
Specifically, in the present embodiment, since the division values of H, S and V of each pixel in the HSV image are known, it is possible to determine whether the color of each pixel in the HSV image is a seedling color, and generate a control group mask image in which the division value range of the seedling color is as shown in the following formula (5):
Figure BDA0003064810780000061
where H denotes a hue division value, S denotes a saturation division value, and V denotes a lightness division value. So as to reserve the pixels in the HSV image within the range of the formula (5) to obtain the mask image of the control group, in which the seedlings are determined to be contained, and of course, other objects may be included.
Optionally, obtaining the clustering center of the HSV image may include: judging whether the plant seedling images at the previous adjacent time are successfully segmented, if so, acquiring a historical clustering center acquired at the previous time, and using the historical clustering center as a clustering center of the HSV image, otherwise, calculating a minimum external rectangle of a plant seedling communicating region according to the reference group mask image, and clustering according to pixel points contained in the minimum external rectangle to acquire the clustering centers of the HSV image, wherein the number of the clustering centers of the HSV image is at least two.
Optionally, acquiring an alternative mask image corresponding to each cluster center may include: determining the distance between a pixel point in the HSV image and each clustering center; taking the clustering center with the minimum distance as a clustering center to which the pixel point belongs; and determining an area formed by the pixel points belonging to each clustering center, and taking the formed area as an alternative mask image corresponding to the clustering center.
Specifically, in this embodiment, cluster centers of the HSV images are obtained, the number of the cluster centers is at least two, the cluster centers can be applied to the HSV images, and the distance between a pixel point in the HSV image and each cluster center is determined, for example, there are two cluster centers: and A and B, if the distance between the pixel point 1 and the clustering center A is smaller than the distance between the pixel point 1 and the clustering center B, the clustering center A is used as the clustering center to which the pixel point 1 belongs. Therefore, a plurality of pixel points belonging to the clustering center A can be determined, and the region formed by the pixel points belonging to the clustering center A is used as the alternative mask image corresponding to the clustering center A. Similarly, the manner of obtaining the alternative mask image corresponding to the clustering center B is substantially the same, and the detailed description is omitted in this embodiment. And the number of the acquired alternative mask images is the same as the number of the cluster centers in the present embodiment.
It should be noted that, in the embodiment, when the cluster center of the HSV image is obtained, a specific manner is adopted to first determine whether the adjacent plant seedling image at the previous time is successfully segmented, and if the segmentation is successful, the historical cluster center obtained at the previous time is directly used as the cluster center of the HSV image, and the cluster center does not need to be obtained by recalculation, so that the segmentation efficiency can be further improved. However, when it is determined that the adjacent plant seedling image at the previous time is not successfully segmented, the historical cluster center obtained at the previous time is also inaccurate, so that the image segmentation process cannot be used, and recalculation is required to obtain the cluster center.
The method comprises the steps of obtaining a cluster center of an HSV image, calculating the minimum circumscribed rectangle of a plant seedling connected region according to a reference group mask image, and obtaining the number of the minimum circumscribed rectangles. After the minimum circumscribed rectangle is obtained, clustering is specifically performed on pixel points contained in all circumscribed rectangles, and a clustering center of the HSV image is obtained. And a K-means clustering algorithm may be specifically adopted to cluster the pixel points included in all the circumscribed rectangles, the embodiment does not limit the specific algorithm adopted for clustering, the number of clusters obtained by the K-means clustering algorithm is at least two, and the embodiment does not limit the specific number of the obtained cluster centers.
Optionally, after the region is used as the candidate mask image corresponding to the cluster center, the method further includes: preprocessing each alternative mask image according to a pre-selected user interested area; and forming the preprocessed alternative mask images into an alternative mask image set. The calculating the overlapping region area ratio of each alternative mask image to the control group mask image may include: and calculating the area ratio of the overlapping region of each preprocessed candidate mask image in the candidate mask image set and the control group mask image.
It should be noted that, because a user may pre-select a region of interest (ROI) in an HSV image, and the region of ROI selected by the user may only include a partial region of an alternative Mask image, in this embodiment, each alternative Mask image is preprocessed according to the region of ROI, an area of the preprocessed alternative Mask image is generally not larger than an area before being preprocessed, and the preprocessed alternative Mask images form an alternative Mask image set, and assuming that the number of the acquired alternative Mask images is n, the alternative Mask image set is L { Mask ═ L1Mask2 ... MasknAnd each preprocessed alternative mask image in the set L is not overlapped with each other.
When calculating the area ratio of the overlapping region of each candidate mask image and the control group mask image, specifically, the area ratio of the overlapping region of each preprocessed candidate mask image and the control group image in the candidate mask image set is calculated, and specifically, the area ratio of the overlapping region of the preprocessed candidate mask image and the control group image may be calculated according to the following formula (6):
Figure BDA0003064810780000091
wherein S represents the area ratio of the overlapping region, MaskiRepresenting the preprocessed Mask image, Mask, of the ith sheetstdRepresenting the control mask image. In this embodiment, the formula (6) is used to calculate the overlapping area ratio of each preprocessed candidate mask image to the control mask image, and the preprocessed candidate mask image with the largest overlapping area ratio is used as the designated candidate mask image.
And step S104, segmenting the RGB image according to the specified alternative mask image to obtain a segmented image containing plant seedlings.
Specifically, in this embodiment, after the specified candidate mask image is obtained, the RGB image of the plant seedling planting region is directly segmented according to the specified candidate mask image, and since the obtained specified candidate mask image accurately covers the region range of the rice seedling, accurate segmentation can be achieved by applying the specified candidate mask image to the RGB image, and a segmented image including the plant seedling is obtained.
In the embodiment of the invention, the RGB image of the plant seedling planting area is subjected to spatial conversion to obtain the HSV image, the determination factor of the plant color is simplified, the RGB image is segmented based on the specified alternative mask image obtained by the HSV image, the segmented image containing the plant seedling is accurately obtained, the segmentation effect is good, abnormal conditions such as abnormal insertion of the seedling and the like can be found in time, and the working efficiency of plant planting is improved.
Example two
Fig. 2 is a flowchart of an image segmentation method for plant seedlings according to an embodiment of the present invention, which is based on the foregoing embodiment, and further includes, after acquiring a designated alternative mask image according to an HSV image: and determining that the designated alternative image is a qualified seedling area.
As shown in fig. 2, the method of the embodiment of the present disclosure specifically includes:
step S201, an RGB image of a plant seedling planting area is obtained.
Optionally, acquiring the RGB image of the plant seedling planting area may include: collecting an original image of a plant seedling planting area; the color space of the original image is corrected by gamma correction to obtain an RGB image.
And S202, performing color space conversion on the RGB image to obtain an HSV image of the plant seedling planting area.
And step S203, acquiring a specified alternative mask image according to the HSV image.
Optionally, acquiring the specified alternative mask image according to the HSV image may include: acquiring a control group mask image containing plant seedlings according to the HSV image; acquiring clustering centers of HSV images and alternative mask images corresponding to each clustering center; and calculating the overlapping area ratio of each candidate mask image to the control group mask image, and taking the candidate mask image with the largest overlapping area ratio as a designated candidate mask image.
Optionally, obtaining the clustering center of the HSV image may include: judging whether the plant seedling images at the previous adjacent time are successfully segmented, if so, acquiring a historical clustering center acquired at the previous time, and using the historical clustering center as a clustering center of the HSV image, otherwise, calculating a minimum external rectangle of a plant seedling communicating region according to the reference group mask image, and clustering according to pixel points contained in the minimum external rectangle to acquire the clustering centers of the HSV image, wherein the number of the clustering centers of the HSV image is at least two.
Optionally, acquiring an alternative mask image corresponding to each cluster center may include: determining the distance between a pixel point in the HSV image and each clustering center; taking the clustering center with the minimum distance as a clustering center to which the pixel point belongs; and determining an area formed by the pixel points belonging to each clustering center, and taking the formed area as an alternative mask image corresponding to the clustering center.
Optionally, after the region is used as the candidate mask image corresponding to the cluster center, the method further includes: preprocessing each alternative mask image according to a pre-selected user interested area; and forming the preprocessed alternative mask images into an alternative mask image set. The calculating the overlapping region area ratio of each alternative mask image to the control group mask image may include: and calculating the area ratio of the overlapping region of each preprocessed candidate mask image in the candidate mask image set and the control group mask image.
Step S204, determining that the RGB first moment of the specified alternative mask image is positioned in the color area of the plant seedling, and the area ratio of the specified alternative mask image to the RGB image is smaller than a specified threshold value.
Specifically, in this embodiment, after the designated candidate mask image is obtained, it is further determined whether the determined designated candidate mask image is a qualified seedling area, and only when the designated candidate mask image is determined to be a qualified seedling area, the designated mask image is used for subsequent RGB image segmentation, thereby ensuring the accuracy of image segmentation.
In the determination of the eligibility of the designated mask image, the determination may be made on the condition that the RGB first moment of the designated alternative mask image is determined to be located within the color region of the plant seedling and the area ratio of the designated mask image to the RGB image is required to be smaller than a designated threshold, for example, the designated threshold may be set to 20%. In the present embodiment, only 20% is taken as an example for explanation, and the user can set a specific value of the designated threshold according to the accuracy requirement of the segmentation in practical application. Of course, the user may determine the acceptability of the designated mask image using other determination conditions, and the present embodiment is not limited thereto.
And S205, segmenting the RGB image according to the specified alternative mask image to obtain a segmented image containing plant seedlings.
In the embodiment of the invention, the RGB image of the plant seedling planting area is subjected to spatial conversion to obtain the HSV image, the determination factor of the plant color is simplified, the RGB image is segmented based on the specified alternative mask image obtained by the HSV image, the segmented image containing the plant seedling is accurately obtained, the segmentation effect is good, abnormal conditions such as abnormal insertion of the seedling and the like can be found in time, and the working efficiency of plant planting is improved. And before the specified alternative mask image is applied to the RGB image for image segmentation, the qualification of the specified alternative mask image is judged, so that the accuracy of the segmentation image of the plant seedling can be further improved.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an image segmentation apparatus for plant seedlings provided by an embodiment of the present invention, which specifically includes: an RGB image acquisition module 310 of a plant seedling planting area, an HSV image acquisition module 320 of the plant seedling planting area, a designated alternative mask image acquisition module 330 and an image segmentation module 340 of the plant seedling.
The RGB image acquisition module 310 of the plant seedling planting area is used for acquiring RGB images of the plant seedling planting area;
an HSV image acquiring module 320 of the plant seedling planting area, configured to perform color space conversion on the RGB image to acquire an HSV image of the plant seedling planting area;
a designated alternative mask image obtaining module 330, configured to obtain a designated alternative mask image according to the HSV image;
and the image segmentation module 340 for the plant seedlings is used for segmenting the RGB image according to the specified alternative mask image to obtain a segmented image containing the plant seedlings.
Optionally, the RGB image obtaining module 310 of the plant seedling planting area is configured to collect an original image of the plant seedling planting area; and correcting the color space of the original image through gamma correction to obtain the RGB image.
Optionally, the designated alternative mask image obtaining module 330 includes:
the contrast group mask image acquisition sub-module is used for acquiring a contrast group mask image containing plant seedlings according to the HSV image;
the cluster center and alternative mask image acquisition sub-module is used for acquiring cluster centers of the HSV images and alternative mask images corresponding to the cluster centers;
and the appointed alternative mask image submodule is used for calculating the overlapping area ratio of each alternative mask image and the control group mask image and taking the alternative mask image with the largest overlapping area ratio as the appointed alternative mask image.
Optionally, the cluster center and alternative mask image obtaining sub-module is configured to determine whether the plant seedling image at the previous adjacent time is successfully segmented, if yes, obtain a historical cluster center obtained at the previous time, and use the historical cluster center as a cluster center of the HSV image,
otherwise, calculating the minimum circumscribed rectangle of the plant seedling connection region according to the reference group mask image, clustering according to pixel points contained in the minimum circumscribed rectangle, and obtaining the clustering centers of the HSV images, wherein the number of the clustering centers of the HSV images is at least two.
Optionally, the cluster center and alternative mask image obtaining sub-module is configured to determine a distance between a pixel point in the HSV image and each cluster center;
taking the clustering center with the minimum distance as the clustering center to which the pixel point belongs;
and determining an area formed by the pixel points belonging to each clustering center, and taking the formed area as an alternative mask image corresponding to the clustering center.
Optionally, the apparatus further includes an alternative mask image set constructing module, configured to pre-process each alternative mask image according to a pre-selected user region of interest;
forming an alternative mask image set by the preprocessed alternative mask images;
and designating an alternative mask image submodule, and further calculating the overlapping area ratio of each preprocessed alternative mask image in the alternative mask image set to the control group mask image.
Optionally, the device further comprises a qualification determination module for specifying alternative mask images, which is used to determine that the RGB first moment of the specified alternative mask image is located in the color area of the plant seedling, and the area ratio of the specified alternative mask image to the RGB image is smaller than a specified threshold.
The device can execute the image segmentation device method for the plant seedlings provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, reference may be made to the method provided in any embodiment of the present invention.
Example four
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. FIG. 4 illustrates a block diagram of an exemplary electronic device 412 suitable for use in implementing embodiments of the present invention. The electronic device 412 shown in fig. 4 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present invention.
As shown in fig. 4, the electronic device 412 is in the form of a general purpose computing device. The components of the electronic device 412 may include, but are not limited to: one or more processors 416, a memory 428, and a bus 418 that couples the various system components (including the memory 428 and the processors 416).
Bus 418 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 412 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 412 and includes both volatile and nonvolatile media, removable and non-removable media.
The memory 428 is used to store instructions. Memory 428 can include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)430 and/or cache memory 432. The electronic device 412 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 434 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 418 by one or more data media interfaces. Memory 428 can include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 440 having a set (at least one) of program modules 442 may be stored, for instance, in memory 428, such program modules 442 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. The program modules 442 generally perform the functions and/or methodologies of the described embodiments of the invention.
The electronic device 412 may also communicate with one or more external devices 414 (e.g., keyboard, pointing device, display 424, etc.), with one or more devices that enable a user to interact with the electronic device 412, and/or with any devices (e.g., network card, modem, etc.) that enable the electronic device 412 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 422. Also, the electronic device 412 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 420. As shown, network adapter 420 communicates with the other modules of electronic device 412 over bus 418. It should be appreciated that although not shown in FIG. 4, other hardware and/or software modules may be used in conjunction with the electronic device 412, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processor 416 performs various functional applications and data processing by executing instructions stored in the memory 428, such as performing the following:
acquiring an RGB image of a plant seedling planting area; carrying out color space conversion on the RGB image to obtain an HSV image of the plant seedling planting area; acquiring an appointed alternative mask image according to the HSV image; and segmenting the RGB image according to the appointed alternative mask image to obtain a segmented image containing plant seedlings.
EXAMPLE five
The fifth embodiment of the present invention also provides a storage medium containing computer-executable instructions, which when executed by a computer processor, is used to perform an image segmentation method for plant seedlings, the method comprising:
acquiring an RGB image of a plant seedling planting area; carrying out color space conversion on the RGB image to obtain an HSV image of the plant seedling planting area; acquiring an appointed alternative mask image according to the HSV image; and segmenting the RGB image according to the appointed alternative mask image to obtain a segmented image containing plant seedlings.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the operations of the method described above, and can also perform related operations in the image segmentation method for plant seedlings provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, and the computer software product may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes instructions for enabling an electronic device (which may be a personal computer, a server, or a network device) to execute the method for segmenting the image of the plant seedling according to the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. An image segmentation method for plant seedlings is characterized by comprising the following steps:
acquiring an RGB image of a plant seedling planting area;
carrying out color space conversion on the RGB image to obtain an HSV image of a plant seedling planting area;
acquiring a specified alternative mask image according to the HSV image;
and segmenting the RGB image according to the appointed alternative mask image to obtain a segmented image containing plant seedlings.
2. The method of claim 1, wherein the obtaining of the RGB image of the plant seedling planting area comprises:
collecting an original image of a plant seedling planting area;
and correcting the color space of the original image through gamma correction to obtain the RGB image.
3. The method of claim 1, wherein said acquiring a specified alternative mask image from said HSV image comprises:
acquiring a control group mask image containing plant seedlings according to the HSV image;
acquiring clustering centers of HSV images and alternative mask images corresponding to each clustering center;
and calculating the overlapping area ratio of each alternative mask image to the control group mask image, and taking the alternative mask image with the largest overlapping area ratio as the specified alternative mask image.
4. The method of claim 3, wherein said obtaining cluster centers for HSV images comprises:
judging whether the plant seedling image at the previous adjacent moment is successfully segmented, if so, acquiring a historical clustering center acquired at the previous moment, and taking the historical clustering center as the clustering center of the HSV image,
otherwise, calculating the minimum circumscribed rectangle of the plant seedling connection region according to the reference group mask image, clustering according to pixel points contained in the minimum circumscribed rectangle, and obtaining the clustering centers of the HSV images, wherein the number of the clustering centers of the HSV images is at least two.
5. The method of claim 3, wherein the obtaining the alternative mask image corresponding to each of the cluster centers comprises:
determining the distance between a pixel point in the HSV image and each clustering center;
taking the clustering center with the minimum distance as the clustering center to which the pixel point belongs;
and determining an area formed by the pixel points belonging to each clustering center, and taking the formed area as an alternative mask image corresponding to the clustering center.
6. The method according to claim 5, wherein after the using the formed region as the candidate mask image corresponding to the cluster center, further comprises:
preprocessing each alternative mask image according to a pre-selected user interested area;
forming an alternative mask image set by the preprocessed alternative mask images;
the calculating the overlapping region area ratio of each alternative mask image and the control group mask image comprises the following steps:
and calculating the area ratio of the overlapping region of each preprocessed candidate mask image in the candidate mask image set and the control group mask image.
7. The method according to any one of claims 1 to 6, wherein after acquiring the specified alternative mask image from the HSV image, further comprising:
determining that the RGB first moment of the specified alternative mask image is located in the color area of the plant seedling, and the area ratio of the specified alternative mask image to the RGB image is less than a specified threshold value.
8. An image segmentation device for plant seedlings, comprising:
the RGB image acquisition module of the plant seedling planting area is used for acquiring RGB images of the plant seedling planting area;
the HSV image acquisition module is used for carrying out color space conversion on the RGB image to acquire an HSV image of the plant seedling planting area;
a designated alternative mask image acquisition module used for acquiring a designated alternative mask image according to the HSV image;
and the image segmentation module of the plant seedling is used for segmenting the RGB image according to the specified alternative mask image to obtain a segmented image containing the plant seedling.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202110523012.2A 2021-05-13 2021-05-13 Image segmentation method and device for plant seedlings, electronic equipment and medium Pending CN113223016A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110523012.2A CN113223016A (en) 2021-05-13 2021-05-13 Image segmentation method and device for plant seedlings, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110523012.2A CN113223016A (en) 2021-05-13 2021-05-13 Image segmentation method and device for plant seedlings, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN113223016A true CN113223016A (en) 2021-08-06

Family

ID=77095432

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110523012.2A Pending CN113223016A (en) 2021-05-13 2021-05-13 Image segmentation method and device for plant seedlings, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN113223016A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050185838A1 (en) * 2004-02-23 2005-08-25 Luca Bogoni System and method for toboggan based object segmentation using divergent gradient field response in images
CN102208099A (en) * 2011-05-30 2011-10-05 华中科技大学 Illumination-change-resistant crop color image segmentation method
KR20130078130A (en) * 2011-12-30 2013-07-10 전남대학교산학협력단 Method for object segmentation by combination of gaussian mixture model and rgb clustering
WO2018149253A1 (en) * 2017-02-16 2018-08-23 华为技术有限公司 Image processing method and device
CN110188764A (en) * 2019-05-31 2019-08-30 浙江口碑网络技术有限公司 Character color identifying processing method and device
CN110310341A (en) * 2019-07-02 2019-10-08 广州视源电子科技股份有限公司 The generation method of default parameters, device, equipment and storage medium in color algorithm

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050185838A1 (en) * 2004-02-23 2005-08-25 Luca Bogoni System and method for toboggan based object segmentation using divergent gradient field response in images
CN102208099A (en) * 2011-05-30 2011-10-05 华中科技大学 Illumination-change-resistant crop color image segmentation method
KR20130078130A (en) * 2011-12-30 2013-07-10 전남대학교산학협력단 Method for object segmentation by combination of gaussian mixture model and rgb clustering
WO2018149253A1 (en) * 2017-02-16 2018-08-23 华为技术有限公司 Image processing method and device
CN110188764A (en) * 2019-05-31 2019-08-30 浙江口碑网络技术有限公司 Character color identifying processing method and device
CN110310341A (en) * 2019-07-02 2019-10-08 广州视源电子科技股份有限公司 The generation method of default parameters, device, equipment and storage medium in color algorithm

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郭英华;: "基于HSV色彩空间的图像分割", 黑龙江冶金, no. 02 *

Similar Documents

Publication Publication Date Title
CN110619632B (en) Mango example confrontation segmentation method based on Mask R-CNN
US20230017425A1 (en) System and method for determining damage on crops
CN113040034B (en) Water-saving irrigation control system and control method
CN111080526A (en) Method, device, equipment and medium for measuring and calculating farmland area of aerial image
CN108875759B (en) Image processing method and device and server
CN112700488A (en) Living body long blade area analysis method, system and device based on image splicing
CN108629289A (en) The recognition methods in farmland and system, applied to the unmanned plane of agricultural
CN113160053B (en) Pose information-based underwater video image restoration and splicing method
CN109919088B (en) Automatic extraction method for identifying individual plants of pitaya in karst region
CN109451292B (en) Image color temperature correction method and device
CN111062341B (en) Video image area classification method, device, equipment and storage medium
CN113223016A (en) Image segmentation method and device for plant seedlings, electronic equipment and medium
Peng et al. Weed recognition using image blur information
CN116721344A (en) Vegetation detection method, device and equipment based on aerial photographing equipment
CN113034449B (en) Target detection model training method and device and communication equipment
CN113492981B (en) Broadcasting control method, broadcasting control device, terminal equipment, unmanned equipment and medium
Chen et al. Measurement of the distance from grain divider to harvesting boundary based on dynamic regions of interest
CN112989924A (en) Target detection method, target detection device and terminal equipment
CN111798467B (en) Image segmentation method, device, equipment and storage medium
CN113643181B (en) In-situ array type root phenotype monitoring system and working method thereof
CN116012718B (en) Method, system, electronic equipment and computer storage medium for detecting field pests
CN117593387A (en) Crop canopy coverage rate evaluation method and system
CN116844075B (en) Tillage environment judging method and system
CN116258968B (en) Method and system for managing fruit diseases and insects
CN114485612B (en) Route generation method and device, unmanned operation vehicle, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination