Image segmentation method, terminal, and computer readable medium

By combining the watershed algorithm and clustering method, the image segmentation approach solves the uncertainty and outlier problem in high dynamic range scenes, achieving better image segmentation and fusion results.

CN112967298BActive Publication Date: 2026-03-03NUBIA TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110439734.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-23
Publication Date
2026-03-03
Estimated Expiration
2041-04-23

AI Technical Summary

Technical Problem

In high dynamic range scenarios, existing technologies struggle to effectively segment images, especially in handling overexposed and underexposed areas with insufficient precision, resulting in poor image fusion performance.

Method used

A method combining edge segmentation and grayscale clustering is adopted. The image is segmented by watershed algorithm and clustering method, and the grayscale mean is used for region filling and clustering to improve the segmentation accuracy.

Benefits of technology

It effectively solves the problems of regional uncertainty in edge segmentation and outliers in grayscale clustering, improves the effectiveness of image segmentation in high dynamic range scenes, and enhances image fusion effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112967298B_ABST
    Figure CN112967298B_ABST
Patent Text Reader

Abstract

The application discloses an image segmentation method, a terminal and a computer readable medium, and the method comprises the following steps: acquiring an RGB color image corresponding to a target image; acquiring a first gray image corresponding to the RGB color image; segmenting the first gray image through a watershed algorithm to obtain a plurality of segmentation regions; acquiring a gray mean value corresponding to each segmentation region; filling the corresponding segmentation region according to the gray mean value to obtain a second gray image; and segmenting the second gray image through a clustering method to obtain a corresponding segmentation image. The technical scheme of the application effectively solves the problems of uncertain segmentation region in edge segmentation and too many outliers in gray value clustering segmentation by combining edge segmentation and gray value clustering segmentation, thereby meeting the image segmentation demand in a high dynamic range scene and effectively improving the effectiveness of image segmentation in the high dynamic range scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image segmentation technology, and in particular to an image segmentation method, a terminal, and a computer-readable medium. Background Technology

[0002] In image processing, it is sometimes necessary to segment images, such as in image matting and image fusion.

[0003] In high dynamic range (HDR) scenarios, due to the limited dynamic range of digital cameras on mobile devices, images captured with a specific exposure parameter often suffer from localized underexposure or overexposure. To obtain a more complete dynamic range, exposure bracketing is often used to capture multiple frames in HDR scenarios, and these frames are then fused to obtain images with a higher dynamic range, thus improving the user experience.

[0004] In high dynamic range (HDR) images, fusing multiple frames often requires different processing for overexposed and underexposed areas to achieve better fusion results. Therefore, image region segmentation and applying different fusion processes to different regions can yield better HDR fusion results. In image segmentation for HDR scenes, segmentation based solely on object edge information is often insufficient. Summary of the Invention

[0005] The main objective of this invention is to provide an image segmentation method, a terminal, and a computer-readable medium, which aim to meet the image segmentation requirements in high dynamic range scenarios, thereby effectively improving the effectiveness of image segmentation in high dynamic range scenarios.

[0006] To achieve the above objectives, the image segmentation method proposed in this invention includes the following steps:

[0007] Obtain the RGB color image of the corresponding target image;

[0008] Obtain the first grayscale image corresponding to the RGB color image;

[0009] The first grayscale image is segmented using the watershed algorithm to obtain several segmented regions;

[0010] Obtain the average grayscale value corresponding to each segmented region;

[0011] The corresponding segmented regions are filled according to the grayscale mean to obtain a second grayscale image;

[0012] The second grayscale image is segmented using a clustering method to obtain the corresponding segmented image.

[0013] Optionally, before the step of obtaining the first grayscale image corresponding to the RGB color image, the method further includes:

[0014] The RGB color image is subjected to noise reduction processing.

[0015] Optionally, the step of denoising the RGB color image includes:

[0016] The RGB color image is denoised using Gaussian filtering.

[0017] Optionally, the step of obtaining the first grayscale image corresponding to the RGB color image includes:

[0018] Get the RGB values ​​of an RGB color image;

[0019] Let the minimum value in the RGB values ​​be the corresponding grayscale value;

[0020] The first grayscale image is generated based on the grayscale values.

[0021] Optionally, before the step of segmenting the first grayscale image using the watershed algorithm, the method further includes:

[0022] Detect the edges of the first grayscale image;

[0023] Obtain all contours within the stated edge.

[0024] Optionally, the step of detecting the edges of the first grayscale image includes:

[0025] The edges of the first grayscale image are detected using the Canny operator.

[0026] Optionally, the step of segmenting the first grayscale image using the watershed algorithm includes:

[0027] Calculate the gradient value of the first grayscale image;

[0028] The region with a gradient value less than a predetermined threshold is taken as the centroid.

[0029] The centroid pixel is initialized as the boundary pixel of the corresponding region;

[0030] Calculate the grayscale distance between pixels in the region and pixels on the boundary;

[0031] The pixels in the region are classified according to the grayscale distance;

[0032] Update the corresponding boundary pixels based on the classification of the region pixels.

[0033] Optionally, the step of segmenting the second grayscale image using clustering includes:

[0034] Obtain the cluster centroids;

[0035] Calculate the Euclidean distance between each segmented region and the cluster centroid;

[0036] The segmented regions are classified according to the Euclidean distance.

[0037] Update the cluster centroids based on the mean gray value of the classified regions;

[0038] Determine whether the updated cluster centroids converge;

[0039] If so, output the segmentation result;

[0040] If not, calculate the Euclidean distance between each segmented region and the cluster centroid.

[0041] Furthermore, the present invention also proposes a terminal, including a memory, a processor, and an implementation program of an image segmentation method stored in the memory and executable on the processor. When the implementation program of the image segmentation method is executed by the processor, the following steps are taken:

[0042] Obtain the RGB color image of the corresponding target image;

[0043] Obtain the first grayscale image corresponding to the RGB color image;

[0044] The first grayscale image is segmented using the watershed algorithm to obtain several segmented regions;

[0045] Obtain the average grayscale value corresponding to each segmented region;

[0046] The corresponding segmented regions are filled according to the grayscale mean to obtain a second grayscale image;

[0047] The second grayscale image is segmented using a clustering method to obtain the corresponding segmented image.

[0048] Furthermore, the present invention also proposes a computer-readable medium storing an implementation program of an image segmentation method, wherein the implementation program of the image segmentation method, when executed, performs the following steps:

[0049] Obtain the RGB color image of the corresponding target image;

[0050] Obtain the first grayscale image corresponding to the RGB color image;

[0051] The first grayscale image is segmented using the watershed algorithm to obtain several segmented regions;

[0052] Obtain the average grayscale value corresponding to each segmented region;

[0053] The corresponding segmented regions are filled according to the grayscale mean to obtain a second grayscale image;

[0054] The second grayscale image is segmented using a clustering method to obtain the corresponding segmented image.

[0055] The technical solution of this invention effectively solves the problems of uncertain segmentation regions in edge segmentation and numerous outliers in gray-scale clustering segmentation by combining edge segmentation and gray-scale clustering segmentation, thereby meeting the image segmentation requirements in high dynamic range scenes and effectively improving the effectiveness of image segmentation in high dynamic range scenes. Attached Figure Description

[0056] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.

[0057] Figure 1 A schematic diagram of the hardware structure of a mobile terminal to implement various embodiments of the present invention;

[0058] Figure 2 A communication network system architecture diagram provided for an embodiment of the present invention;

[0059] Figure 3 This is a flowchart of an embodiment of the image segmentation method of the present invention;

[0060] Figure 4 for Figure 3 The flowchart shown is a step-by-step flowchart of an embodiment of the steps for obtaining a first grayscale image corresponding to the RGB color image;

[0061] Figure 5 for Figure 3 The flowchart shown is an embodiment of the step of segmenting the first grayscale image using the watershed algorithm;

[0062] Figure 6 for Figure 3 The flowchart shown is an embodiment of the step of segmenting the second grayscale image using a clustering method;

[0063] Figure 7 This is a flowchart of the second embodiment of the image segmentation method of the present invention;

[0064] Figure 8 This is a flowchart of the third embodiment of the image segmentation method of the present invention.

[0065] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0066] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0067] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "module," "part," or "unit" may be used interchangeably.

[0068] Terminals can be implemented in various forms. For example, the terminals described in this invention may include mobile terminals such as mobile phones, tablets, laptops, handheld computers, personal digital assistants (PDAs), portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, etc., as well as fixed terminals such as digital TVs and desktop computers.

[0069] The following description will use a mobile terminal as an example. Those skilled in the art will understand that, apart from elements specifically designed for mobile purposes, the construction according to embodiments of the present invention can also be applied to fixed-type terminals.

[0070] Please see Figure 1 This is a schematic diagram of the hardware structure of a mobile terminal implementing various embodiments of the present invention. The mobile terminal 100 may include: an RF (Radio Frequency) unit 101, a WiFi module 102, an audio output unit 103, an A / V (Audio / Video) input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, a processor 110, and a power supply 111, etc. Those skilled in the art will understand that... Figure 1 The mobile terminal structure shown does not constitute a limitation on the mobile terminal. The mobile terminal may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0071] The following is combined Figure 1 A detailed introduction to each component of the mobile terminal:

[0072] The radio frequency unit 101 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 110; additionally, it transmits uplink data to the base station. Typically, the radio frequency unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, and a duplexer. Furthermore, the radio frequency unit 101 can also communicate wirelessly with networks and other devices. The aforementioned wireless communications may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA2000 (Code Division Multiple Access 2000), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division Duplexing-Long Term Evolution), and TDD-LTE (Time Division Duplexing-Long Term Evolution).

[0073] WiFi is a short-range wireless transmission technology. Mobile terminals, through the WiFi module 102, can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 1 WiFi module 102 is shown, but it is understood that it is not a necessary component of a mobile terminal and can be omitted as needed without changing the nature of the invention.

[0074] The audio output unit 103 can convert audio data received by the radio frequency unit 101 or the WiFi module 102 or stored in the memory 109 into audio signals and output them as sound when the mobile terminal 100 is in call signal receiving mode, call mode, recording mode, voice recognition mode, broadcast receiving mode, etc. Furthermore, the audio output unit 103 can also provide audio output related to specific functions performed by the mobile terminal 100 (e.g., call signal receiving sound, message receiving sound, etc.). The audio output unit 103 may include a speaker, a buzzer, etc.

[0075] The A / V input unit 104 is used to receive audio or video signals. The A / V input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos acquired by an image capture device (such as a camera) in video capture mode or image capture mode. The processed image frames can be displayed on the display unit 106. The image frames processed by the GPU 1041 can be stored in the memory 109 (or other storage media) or transmitted via the radio frequency unit 101 or the WiFi module 102. The microphone 1042 can receive sound (audio data) in operating modes such as telephone call mode, recording mode, and voice recognition mode, and can process such sound into audio data. The processed audio (voice) data can be converted into a format that can be transmitted to a mobile communication base station via the radio frequency unit 101 in telephone call mode. The microphone 1042 can implement various types of noise cancellation (or suppression) algorithms to eliminate (or suppress) noise or interference generated during the reception and transmission of audio signals.

[0076] The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1061 according to the ambient light level, and the proximity sensor can turn off the display panel 1061 and / or backlight when the mobile terminal 100 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, tapping), etc. Other sensors that may be configured in the phone, such as fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0077] The display unit 106 is used to display information input by the user or information provided to the user. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

[0078] User input unit 107 can be used to receive input numerical or character information, and generate key signal inputs related to user settings and function control of the mobile terminal. Specifically, user input unit 107 may include touch panel 1071 and other input devices 1072. Touch panel 1071, also known as touch screen, can collect touch operations on or near the user (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near touch panel 1071), and drive corresponding connection devices according to a pre-set program. Touch panel 1071 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to processor 110, and can receive and execute commands from processor 110. In addition, touch panel 1071 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1071, the user input unit 107 may also include other input devices 1072. Specifically, other input devices 1072 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc., without being limited here.

[0079] Furthermore, the touch panel 1071 may cover the display panel 1061. When the touch panel 1071 detects a touch operation on or near it, it transmits the information to the processor 110 to determine the type of touch event. Subsequently, the processor 110 provides corresponding visual output on the display panel 1061 based on the type of touch event. Although in Figure 1 In this embodiment, the touch panel 1071 and the display panel 1061 are two independent components to realize the input and output functions of the mobile terminal. However, in some embodiments, the touch panel 1071 and the display panel 1061 can be integrated to realize the input and output functions of the mobile terminal. The specific implementation is not limited here.

[0080] Interface unit 108 serves as an interface through which at least one external device can connect to mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, and so on. Interface unit 108 may be used to receive input (e.g., data, power, etc.) from the external device and transmit the received input to one or more elements within mobile terminal 100, or it may be used to transmit data between mobile terminal 100 and the external device.

[0081] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback, image playback, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, phonebook, etc.). Furthermore, the memory 109 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0082] The processor 110 is the control center of the mobile terminal. It connects various parts of the mobile terminal via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 109, and by calling data stored in the memory 109, it performs various functions and processes data of the mobile terminal, thereby providing overall monitoring of the mobile terminal. The processor 110 may include one or more processing units; preferably, the processor 110 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 110.

[0083] The mobile terminal 100 may also include a power supply 111 (such as a battery) that supplies power to various components. Preferably, the power supply 111 can be logically connected to the processor 110 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.

[0084] although Figure 1 As not shown, the mobile terminal 100 may also include a Bluetooth module, etc., which will not be described in detail here.

[0085] To facilitate understanding of the embodiments of the present invention, the communication network system on which the mobile terminal of the present invention is based is described below.

[0086] Please see Figure 2 , Figure 2 This invention provides a communication network system architecture diagram. The communication network system is an LTE system based on the universal mobile communication technology. The LTE system includes a UE (User Equipment) 201, an E-UTRAN (Evolved UMTS Terrestrial Radio Access Network) 202, an EPC (Evolved Packet Core) 203, and the operator's IP services 204, which are connected in sequence.

[0087] Specifically, UE201 can be the aforementioned terminal 100, which will not be elaborated here.

[0088] E-UTRAN202 includes eNodeB2021 and other eNodeB2022s. Among them, eNodeB2021 can connect to other eNodeB2022s through backhaul (e.g., X2 interface), and eNodeB2021 connects to EPC203. eNodeB2021 can provide UE201 with access to EPC203.

[0089] EPC203 may include MME (Mobility Management Entity) 2031, HSS (Home Subscriber Server) 2032, other MMEs 2033, SGW (Serving Gateway) 2034, PGW (Packet Data Network Gateway) 2035, and PCRF (Policy and Charging Rules Function) 2036, etc. Among them, MME2031 is the control node that handles signaling between UE201 and EPC203, providing bearer and connection management. HSS2032 provides registers to manage functions such as the Home Location Register (not shown in the diagram) and stores user-specific information such as service characteristics and data rates. All user data can be sent through SGW2034. PGW2035 can provide UE 201 IP address allocation and other functions. PCRF2036 is the policy and charging control decision point for service data flow and IP bearer resources. It selects and provides available policy and charging control decisions for the policy and charging enforcement function unit (not shown in the figure).

[0090] IP services 204 may include the Internet, intranet, IMS (IP Multimedia Subsystem), or other IP services.

[0091] Although the above description uses the LTE system as an example, those skilled in the art should understand that the present invention is not only applicable to the LTE system, but also to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA, and future new network systems, etc., which are not limited here.

[0092] Based on the aforementioned mobile terminal hardware structure and communication network system, various embodiments of the method of the present invention are proposed.

[0093] like Figure 3 As shown, Figure 3 This is a flowchart of the first embodiment of the image segmentation method of the present invention.

[0094] In this embodiment, the image segmentation method includes the following steps:

[0095] Step S310: Obtain the RGB color image of the corresponding target image.

[0096] Step S320: Obtain the first grayscale image corresponding to the RGB color image.

[0097] Specifically, such as Figure 4 As shown, Figure 4 for Figure 3 The flowchart shown is an embodiment of the step of obtaining a first grayscale image corresponding to the RGB color image. In this embodiment, the step of obtaining a first grayscale image corresponding to the RGB color image includes:

[0098] Step S321: Obtain the RGB values ​​of the RGB color image.

[0099] Specifically, it retrieves the RGB values ​​at all locations in an RGB color image.

[0100] Step S322: Set the minimum value among the RGB values ​​to the corresponding grayscale value.

[0101] Specifically, let the minimum value of corresponding points in the RGB three channels of the RGB color image be: This is the grayscale value corresponding to that position.

[0102] Step S323: Generate the first grayscale image based on the grayscale value.

[0103] Specifically, the RGB color image is processed to grayscale based on the grayscale value to generate the first grayscale image.

[0104] Step S330: The first grayscale image is segmented using the watershed algorithm to obtain several segmented regions.

[0105] Specifically, such as Figure 5 As shown, Figure 5 for Figure 3 The flowchart illustrates an embodiment of the steps for segmenting the first grayscale image using the watershed algorithm. In this embodiment, the steps for segmenting the first grayscale image using the watershed algorithm include:

[0106] Step S331: Calculate the gradient value of the first grayscale image.

[0107] Step S332: The region with a gradient value less than a predetermined threshold is taken as the centroid.

[0108] Step S333: Initialize the centroid pixel as the boundary pixel of the corresponding region.

[0109] Step S334: Calculate the grayscale distance between the region pixels and the boundary pixels.

[0110] Step S335: Classify the pixels in the region according to the grayscale distance.

[0111] Step S336: Update the corresponding boundary pixels according to the classification of the region pixels.

[0112] Specifically, first, calculate the image gradient map; Next, by analyzing the image gradient map, we obtain gradient values ​​that are less than a predetermined threshold. The region is used as the centroid for image segmentation; then, the centroid pixel is initialized as the boundary pixel of the region; next, eight-directional judgment is performed on the 3*3 neighborhood around the boundary pixel, and the gray-level distance between the region pixel and the boundary pixel is calculated. If the gray-level distance is less than a predetermined threshold, the region is segmented. If the pixels in this region are in the same category as the boundary pixels, then they belong to the same category; otherwise, they do not. Then, based on the classification of the region pixels, update the boundary pixels of the classified region; next, if a pixel connects two or more regions with different centroids, then the pixel is considered to be a boundary pixel of image segmentation; repeat the above steps until all pixels have been traversed, thereby achieving the segmentation of the first grayscale image and forming several segmented regions.

[0113] Step S340: Obtain the average grayscale value corresponding to each segmented region.

[0114] Specifically, the grayscale value of the position within each segmented region is obtained, and the average grayscale value of each segmented region is calculated.

[0115] Step S350: Fill the corresponding segmented region according to the grayscale mean to obtain a second grayscale image.

[0116] Specifically, the corresponding segmented regions are processed based on the grayscale mean to obtain a grayscale processed image, namely the second grayscale image mentioned above.

[0117] Step S360: The second grayscale image is segmented using a clustering method to obtain the corresponding segmented image.

[0118] Specifically, such as Figure 6 As shown, Figure 6 for Figure 3The flowchart shown is an embodiment of the step of segmenting the second grayscale image using a clustering method. In this embodiment, the step of segmenting the second grayscale image using a clustering method includes:

[0119] Step S361: Obtain the cluster centroids.

[0120] Specifically, preset parameters such as the number of cluster categories K, the maximum number of algorithm iterations Num, and the centroid iteration threshold TH are obtained, along with the number of segmented regions n of the second grayscale image and the average grayscale value of each segmented region. ,in: .from K objects are randomly selected as cluster centroids.

[0121] Step S362: Calculate the Euclidean distance between each segmented region and the cluster centroid.

[0122] Specifically, for each segmented region, the formula is used. (Where i = 1, 2, 3, ..., n; j = 1, 2, 3, ..., K) Calculate the Euclidean distance between it and the K cluster centroids.

[0123] Step S363: Classify each segmented region according to the Euclidean distance.

[0124] Specifically, regions whose Euclidean distance to the cluster centroid is less than a preset value are classified into the same category. Generally, the regions with the smallest Euclidean distance to the cluster centroid are classified into the same category. ,j=1,2,3……,K.

[0125] Step S364: Update the cluster centroids based on the mean gray values ​​of the classified regions.

[0126] Specifically, obtain the average grayscale value of all segmented regions within the same category. And according to the formula Calculate the grayscale mean of each category, and use it as... , As the new cluster centroid.

[0127] Step S365: Determine whether the updated cluster centroids have converged; if yes, proceed to step S666; otherwise, return to step S362.

[0128] Specifically, repeat steps S662 to S664 until the algorithm converges, the cluster centroids stabilize, or the maximum number of iterations Num is reached, then execute step S666.

[0129] Step S666: Output the segmentation result.

[0130] Specifically, the category to which each region belongs is obtained as the result of image segmentation.

[0131] The technical solution of this embodiment effectively solves the problems of uncertain segmentation regions in edge segmentation and numerous outliers in grayscale clustering segmentation by combining edge segmentation and grayscale clustering segmentation. This satisfies the image segmentation requirements in high dynamic range scenes and effectively improves the effectiveness of image segmentation in high dynamic range scenes.

[0132] like Figure 7 As shown, Figure 7 This is a flowchart of the second embodiment of the image segmentation method of the present invention.

[0133] In this embodiment, the image segmentation method includes the following steps:

[0134] Step S410: Obtain the RGB color image of the corresponding target image.

[0135] Step S420: Denoise reduction processing is performed on the RGB color image.

[0136] Specifically, in this embodiment, the noise reduction process for the RGB color image is performed by using Gaussian filtering.

[0137] Step S430: Obtain the first grayscale image corresponding to the RGB color image.

[0138] Step S440: The first grayscale image is segmented using the watershed algorithm to obtain several segmented regions.

[0139] Step S450: Obtain the average grayscale value corresponding to each segmented region.

[0140] Specifically, the grayscale value of the position within each segmented region is obtained, and the average grayscale value of each segmented region is calculated.

[0141] Step S460: Fill the corresponding segmented region according to the grayscale mean to obtain a second grayscale image.

[0142] Step S470: The second grayscale image is segmented using a clustering method to obtain the corresponding segmented image.

[0143] Compared with the technical solution of the first embodiment, the technical solution of this embodiment adds a step of noise reduction processing on the RGB color image to eliminate the negative impact of noise on image segmentation, thereby further improving the effectiveness of image segmentation in high dynamic range scenes.

[0144] like Figure 8 As shown, Figure 8This is a flowchart of the third embodiment of the image segmentation method of the present invention.

[0145] In this embodiment, the image segmentation method includes the following steps:

[0146] Step S510: Obtain the RGB color image of the corresponding target image.

[0147] Step S520: Denoise reduction processing is performed on the RGB color image.

[0148] Step S530: Obtain the first grayscale image corresponding to the RGB color image.

[0149] Step S540: Detect the edges of the first grayscale image and obtain all contours within the edges.

[0150] Specifically, in this embodiment, the edges of the first grayscale image are detected using the Canny operator.

[0151] Step S550: The first grayscale image is segmented using the watershed algorithm to obtain several segmented regions.

[0152] Step S560: Obtain the average grayscale value corresponding to each segmented region.

[0153] Specifically, the grayscale value of the position within each segmented region is obtained, and the average grayscale value of each segmented region is calculated.

[0154] Step S570: Fill the corresponding segmented region according to the grayscale mean to obtain a second grayscale image.

[0155] Step S580: The second grayscale image is segmented using a clustering method to obtain the corresponding segmented image.

[0156] Compared with the technical solution of the second embodiment described above, the technical solution of this embodiment adds the detection of the edge of the first grayscale image and the acquisition of all contours within the edge, thereby effectively ensuring the accuracy of image segmentation achieved by the watershed algorithm, and thus ensuring the effectiveness of image segmentation in high dynamic range scenes.

[0157] This invention also proposes a terminal, including a memory, a processor, and an implementation program for an image segmentation method stored in the memory and executable on the processor. When executed by the processor, the implementation program for the image segmentation method implements all the steps in the embodiments of the above-described image segmentation method. Since the terminal can execute all the steps in any of the above embodiments, this mobile terminal possesses at least all the beneficial effects brought about by the technical solutions of the above-described method embodiments, which will not be elaborated further here.

[0158] The present invention also proposes a computer-readable medium storing an implementation program of an image segmentation method. When executed, the implementation program of the image segmentation method can perform all the steps in any of the above embodiments. Since the computer-readable medium can execute all the steps in any of the above embodiments, the present computer-readable medium at least has all the beneficial effects brought about by the technical solutions of the above method embodiments, which will not be elaborated further here.

[0159] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0160] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0161] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0162] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.

Claims

1. An image segmentation method characterized by, The method comprises the following steps: obtaining an RGB color image corresponding to a target image; performing noise reduction processing on the RGB color image; obtaining a first gray image corresponding to the RGB color image; detecting edges of the first gray image and obtaining all contours within the edges; segmenting the first gray image based on the edges and contours by a watershed algorithm to obtain a plurality of segmentation regions; obtaining a gray mean value corresponding to each of the segmentation regions; filling the corresponding segmentation regions according to the gray mean values to obtain a second gray image; segmenting the second gray image by a clustering method to obtain a corresponding segmented image; The step of segmenting the second gray image by the clustering method comprises: obtaining a clustering centroid, which is a gray mean value of the segmentation regions; calculating the Euclidean distance between the gray mean value of each segmentation region and the gray mean value of the clustering centroid; classifying each segmentation region according to the Euclidean distance; updating the clustering centroid according to the gray mean value of the classified region; judging whether the updated clustering centroid converges; if yes, outputting a segmentation result; if no, repeating the calculation of the Euclidean distance between each segmentation region and the clustering centroid and the subsequent steps.

2. The image segmentation method of claim 1, wherein, The step of performing noise reduction processing on the RGB color image comprises: performing noise reduction processing on the RGB color image by a Gaussian filter.

3. The image segmentation method of claim 2, wherein, The step of obtaining a first gray image corresponding to the RGB color image comprises: obtaining an RGB value of the RGB color image; regarding the minimum value in the RGB value as a corresponding gray value; generating the first gray image according to the gray value.

4. The image segmentation method of claim 1, wherein, The step of detecting edges of the first gray image comprises: detecting the edges of the first gray image by a canny operator.

5. The image segmentation method of claim 4, wherein, The step of segmenting the first gray image by the watershed algorithm comprises: calculating gradient values of the first gray image; regarding regions with gradient values less than a predetermined threshold as centroids; initializing centroid pixels as boundary pixels of the corresponding regions; calculating gray distances between region pixels and boundary pixels; classifying the region pixels according to the gray distances; updating the corresponding boundary pixels according to the classification of the region pixels.

6. A terminal, characterized by comprising: The computer readable medium stores an implementation program of an image segmentation method, and the implementation program of the image segmentation method is executed to implement the steps of the image segmentation method according to any one of claims 1 to 5.

7. A computer readable medium characterized by The computer readable medium stores an implementation program of an image segmentation method, and the implementation program of the image segmentation method is executed to implement the steps of the image segmentation method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Image segmentation method based on mark watershed algorithm and kernel evolution clustering

    CN102509270A