Image processing method and device and related equipment
By blurring the image and adding display elements of the target shape, identifying and fusing the image subject objects, the problem of lack of fun and flexibility in the shadow effect in the prior art is solved, and the effect improvement and fun enhancement of image processing is achieved .
Patent Information
- Application Number
- CN202411264927.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-12-13
AI Technical Summary
The prior art lacks interest and flexibility in achieving shadow effects, making it difficult to improve the effect and interest of image processing.
By blurring the image and adding display elements of the target shape, identifying and fusing the image subject object, improving the flexibility and fun of image processing, while ensuring the quality of the image subject object.
It realizes the flexibility and fun of image processing through display elements of different shapes, and at the same time, it reduces the impact on the object area of the image subject during blurring, thereby improving the effect of image processing.
Smart Images

Figure CN119130850A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus and related equipment. Background Art
[0002] With the continuous development of various applications, users can publish content information through various applications, wherein the content information may include images. In the process of publishing content information, users can perform special effects processing on the images in the content information, for example, adding shadow effects to the images. However, currently, the methods for implementing shadow effects are single and lack of interest and flexibility. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, apparatus and related equipment, which can improve the effect and flexibility of image processing and enhance the interest of images.
[0004] In a first aspect, an embodiment of the present application provides an image processing method, comprising:
[0005] In response to an image display operation, acquiring a first image to be displayed;
[0006] A second image is displayed after processing the first image, wherein the displayed second image includes the first image area after blurring and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area in which an image subject object identified from the first image is displayed.
[0007] In a second aspect, an embodiment of the present application provides an image processing device, including:
[0008] an acquisition unit, configured to acquire a first image to be displayed in response to an image display operation;
[0009] A display unit is used to display a second image after processing the first image, wherein the displayed second image includes the first image area after blurring, and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area, in which an image subject object identified from the first image is displayed.
[0010] In a third aspect, an embodiment of the present application provides a computing device, comprising: a processor and a memory, wherein the processor is used to execute the method described in the first aspect above.
[0011] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores program instructions, and when the program instructions are executed, the method described in the first aspect above is implemented.
[0012] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes program instructions, and when the program instructions are executed by a processor, the method described in the first aspect is implemented.
[0013] The embodiment of the present application can process a first image and display a second image after the processing of the first image, wherein the second image includes a first image area including display elements of a target shape after blurring, and the flexibility and interest of image processing can be increased by display elements of different shapes. The second image also includes a second image area of an image main object identified from the first image, and the quality of the image area where the image main object is located can be guaranteed while increasing the interest of the image, so as to reduce the impact on the image area where the image main object is located in the image when blurring the image, which helps to improve the effect of image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0015] Figure 1 It is a schematic diagram of an application scenario of an image processing method provided in an embodiment of the present application;
[0016] Figure 2 It is a flowchart of an image processing method provided in an embodiment of the present application;
[0017] Figure 3 This is a schematic diagram of an interface of a highlight point of an image provided by an embodiment of the present application;
[0018] Figure 4 is a schematic diagram of an interface of highlight points of another image provided by an embodiment of the present application;
[0019] Figure 5 is a schematic diagram of an interface of a first image after blurring provided in an embodiment of the present application;
[0020] Figure 6 is a schematic diagram of a blurred image interface provided by an embodiment of the present application;
[0021] Figure 7is a schematic diagram of an interface of a second image provided in an embodiment of the present application;
[0022] Figure 8 is a flowchart of another image processing method provided in an embodiment of the present application;
[0023] Fig. 9 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0024] Fig.10 It is a structural diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0027] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0028] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0029] In a specific implementation, the computing device described in the embodiments of the present application includes, but is not limited to, other portable devices such as mobile phones, laptop computers, or tablet computers with a touch surface (e.g., a touch screen display and / or a touch pad). It should also be understood that in some embodiments, the device is not a portable communication device, but a desktop computer with a touch surface (e.g., a touch screen display and / or a touch pad).
[0030] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0031] The embodiments of the present application provide an image processing method, apparatus, and related equipment. The image processing method can be applied to application scenarios such as image publishing and image transmission that require image processing. The present application does not specifically limit the application scenarios of the image processing method.
[0032] The embodiment of the present application can obtain a first image to be displayed in response to an image display operation; and display a second image after processing the first image, wherein the displayed second image includes the first image area after blurring, and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area, in which the main image object identified from the first image is displayed, wherein the target shape may include but is not limited to one or more shapes. By processing the first image to obtain a second image including a display element of a target shape, it is helpful to increase the interest and flexibility of the image, and by processing the first image to obtain a second image including an image main object, the quality of the image main object can be guaranteed while processing the first image, thereby improving the effect of image processing.
[0033] The image processing method provided in the embodiments of the present application can be applied to an image processing device, which can be set in a computing device. In some embodiments, the computing device can include but is not limited to smart phones, tablet computers, laptop computers, desktop computers, vehicle-mounted smart terminals, smart watches and other terminal devices; in other embodiments, the computing device can include but is not limited to independent servers, cluster servers or cloud servers, etc.
[0034] The image processing method provided in the embodiment of the present application is schematically described below with reference to the accompanying drawings.
[0035] Please attend Figure 1 , Figure 1 is a schematic diagram of an application scenario of an image processing method provided in an embodiment of the present application, the application scenario includes a terminal device 11 ( Figure 1 The scenario shown takes the case where the terminal device 11 is a desktop computer as an example).
[0036] In actual applications, the terminal device 11 can respond to an image display operation, obtain a first image to be displayed, and display a second image after processing the first image, wherein the displayed second image includes the blurred first image area, and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area, and the image subject object identified from the first image is displayed in the second image area.
[0037] It should be understood that Figure 1 The application scenarios shown are only examples. In actual applications, in addition to the terminal device 11 independently executing the image processing method provided in the embodiment of the present application, the server can also independently execute the image processing method provided in the embodiment of the present application; the terminal device and the server can also collaborate to execute the image processing method provided in the embodiment of the present application, for example, the terminal device receives an image display operation, obtains a first image to be displayed, and sends the first image to the server, so that the server displays a second image after processing the first image, wherein the displayed second image includes the first image area after blurring, and also includes a display element of a target shape in the first image area, the displayed second image also includes a second image area, and the image subject object identified from the first image is displayed in the second image area, and the generated second image is sent to the terminal device, so that the terminal device displays the processed second image on the screen of the terminal device in image processing scenarios such as image publishing.
[0038] See also Figure 2 , Figure 2 is a flowchart of an image processing method provided by an embodiment of the present application, such as Figure 2 The image processing method in the embodiment shown can be applied to an image processing device, which is arranged in a computing device. The method may at least include the following steps.
[0039] S201: In response to an image display operation, acquiring a first image to be displayed.
[0040] In an embodiment of the present application, the computing device may acquire the first image to be displayed in response to an image display operation. In some embodiments, the image display operation may be input by a user through a terminal device.
[0041] Optionally, the user may input a first image to be displayed on the user interface of the terminal device, and trigger the image display operation by touching an image display control on the user interface of the terminal device to obtain the first image to be displayed.
[0042] Optionally, the user interface of the terminal device may include an image display option, which is used to enable the image processing function. The user can trigger the image selection interface of the terminal device by touching the image display option, and can select the first image to be displayed from the image storage file of the terminal device by touching the image selection control or image selection area on the image selection interface.
[0043] Optionally, the computing device may also receive an image display request sent by a user through other terminal devices. The image display request may carry the first image to be displayed. When receiving the image display request, the computing device may trigger an image display operation to obtain the first image to be displayed carried by the image display request.
[0044] In some embodiments, the first image to be displayed may include an image subject object, and the image subject object may include but is not limited to any one or more of a person, an animal, a plant, and the like.
[0045] S202: Displaying a second image after processing the first image, wherein the displayed second image includes the blurred first image area and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area, and the image subject object identified from the first image is displayed in the second image area.
[0046] In an embodiment of the present application, a computing device may display a second image after processing a first image, wherein the displayed second image includes the blurred first image area, and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area, and the image subject object identified from the first image is displayed in the second image area. In some embodiments, the target shape may include, but is not limited to, any one or more shapes such as a heart shape, a triangle, a circle, a polygon, etc.
[0047] In one embodiment, when displaying a second image after processing a first image, the computing device can determine an image area to be processed of the first image; blur the first image based on the image area to be processed, obtain the second image based on the blurred first image, and display the second image.
[0048] The embodiment of the present application can add color and blur effects to the first image by blurring the first image, thereby increasing the interest of the blurred first image.
[0049] In one embodiment, when the computing device obtains the second image based on the blurred first image, it can detect whether the blurred first image satisfies the smoothing condition; if the detection result is yes, the main image object in the first image is identified, the image area where the main image object is located in the first image is determined, and the second image is obtained based on the blurred first image and the image area where the main image object is located, and the second image is displayed; if the detection result is no, the blurred first image is determined to be the second image.
[0050] Optionally, the blurred first image satisfies the smoothing condition if the smoothness of the blurred first image is less than a smoothness threshold. If the detection result is that the smoothness of the blurred first image is less than the smoothness threshold, then it is determined that the blurred first image satisfies the smoothing condition. If the detection result is that the smoothness of the blurred first image is greater than or equal to the smoothness threshold, then it is determined that the blurred first image does not satisfy the smoothing condition.
[0051] Among them, the smoothness of the blurred first image can be determined based on the noise of the blurred first image. When the noise of the blurred first image is greater than the noise threshold, it can be determined that the smoothness of the blurred first image is less than the smoothness threshold. When the noise of the blurred first image is less than or equal to the noise threshold, it can be determined that the smoothness of the blurred first image is greater than or equal to the smoothness threshold.
[0052] The embodiment of the present application determines whether the display elements of the blurred first image are smooth based on the noise of the blurred first image, which helps to further smooth the blurred first image if it is not smooth, thereby improving the image processing effect.
[0053] In one embodiment, when determining the image area to be processed of the first image, the computing device can obtain a pixel point set of the first image, and determine a highlight point set from each pixel point of the pixel point set of the first image, wherein the highlight point set includes pixel points in the first image whose brightness values meet the brightness condition; and determine that the image area corresponding to the highlight point set is the image area to be processed of the first image.
[0054] Specific can Figure 3 Take the image as an example to explain each pixel in the highlight point set of the image. Figure 3 is a schematic diagram of an interface of a highlight point of an image provided by an embodiment of the present application, such as Figure 3 As shown, the image region where each white point (such as point 31) is located corresponds to the highlight point of the image.
[0055] In one embodiment, when determining a set of highlight points from each pixel point of a set of pixel points of a first image, the computing device may convert the first image into a grayscale image, and perform edge detection on the grayscale image to obtain an edge image; determine the contour of the edge image, and determine a target contour that satisfies a highlight point condition based on the contour of the edge image, and calculate the center point of the target contour; determine each pixel point that satisfies the brightness condition based on the brightness value of the center point and the brightness values of each pixel point within a preset range around the center point to obtain the set of highlight points.
[0056] In one embodiment, when the computing device determines each pixel point that meets the brightness condition based on the brightness value of the center point and the brightness values of each pixel point within a preset range around the center point, the computing device can calculate the difference between the brightness value of the center point and the brightness values of each pixel point within a preset range around the center point. If it is detected that the difference is greater than a preset brightness threshold, the pixel point corresponding to the difference can be determined as a highlight point. Optionally, the computing device can also determine that the pixel point corresponding to the difference is a highlight point when it is detected that the difference is within a preset threshold range. The brightness condition for determining the highlight point in this embodiment of the application can be any custom value and is not specifically limited.
[0057] Specific can Figure 4 Take the image as an example to illustrate the highlights of the image. Figure 4 is a schematic diagram of an interface of another highlight point of an image provided by an embodiment of the present application, such as Figure 4 As shown, each framed area (such as image area 41) is a highlight area of the image.
[0058] When the computing device performs edge detection on the grayscale image to obtain the edge image, it may use a preset edge detection algorithm (such as the Canny edge detection algorithm) to detect the edge of the grayscale image to obtain the edge image.
[0059] When determining the contour of the edge image, the computing device may use a function for determining the edge (such as the findContours function) to determine the corresponding contour in the edge image.
[0060] When the computing device determines the target contour that meets the highlight point condition based on the contour of the edge image, it can obtain the size and shape of the determined contour of the edge image, and filter out the target contour whose size and shape meet the highlight point condition from the edge image according to the size and shape of the contour of the edge image. In some embodiments, the size of the contour may include but is not limited to information such as the length, width, height, and area of the contour, and the shape of the contour may include but is not limited to a square, rectangle, triangle, polygon, etc.
[0061] When the computing device filters out target contours whose sizes and shapes meet the highlight point conditions from the edge image based on the size and shape of the contours of the edge image, it can determine the areas corresponding to contours of different shapes based on the size and shape of the contours of the edge image, and determine that the contours whose areas are greater than a preset area threshold are the target contours that meet the highlight point conditions.
[0062] When calculating the center point of the target contour, the computing device can calculate the center point of the target contour based on the information of the target contour. In one example, when using OpenCV to calculate the center point of the target contour, the moments function can be used to calculate the center point of the target contour, where the moments function is used to calculate the geometric properties of the contour in the image. These geometric properties (i.e., moments) can be used to calculate the center, area, direction, etc. of the contour. Moments are divided into spatial moments, central moments, and normalized central moments. Spatial moments are simple aggregations of pixel intensity values in an image (such as area), while central moments are aggregations relative to the centroid of the contour. The normalized central moment is invariant in terms of scale, rotation, and translation.
[0063] In one embodiment, when the computing device performs blurring processing on the first image based on the image area to be processed, the computing device may obtain the display parameter value of each highlight point in the highlight point set, the display parameter value including the color value and / or the brightness value; determine the display element corresponding to each highlight point according to the display parameter value of each highlight point, and the shape and / or color of the display elements corresponding to different display parameter values are different; add the corresponding display element to the position area of each highlight point, and perform blurring processing on the first image after adding each display element, so as to obtain the blurred first image. In some embodiments, the shape and / or color of the display elements corresponding to different display parameter values may also be the same.
[0064] In one embodiment, the display parameter value includes a color value; when the computing device determines the display element corresponding to each highlight point according to the display parameter value of each highlight point, it can determine the display element corresponding to the color value of each highlight point according to the preset mapping relationship between the color value and the display element. The preset mapping relationship between the color value and the display element includes but is not limited to the mapping relationship between the color value and the shape of the display element, and the mapping relationship between the color value and the shape and color of the display element.
[0065] For example, assuming there are n highlight points, the display parameter values include color values, if the color values of k highlight points match the display element in a heart shape, the color values of m highlight points match the display element in a circular shape, and the color values of nkm highlight points match the display element in a square shape, then it can be determined that the shape of the display element of the k highlight points is heart-shaped, the shape of the display element of the m highlight points is circular, and the shape of the display element of the nkm highlight points is square, where k is less than n and m is less than n.
[0066] The shape of the display element can be defined by a binary function, where the input of the binary function can be a two-dimensional vector p, where p refers to the position coordinates of a highlight point, and the output of the binary function is a floating point number, which represents the distance from the highlight point corresponding to p to the display element. This binary function is implemented by adding the square of the x-coordinate of point p and the square of the y-coordinate of point p plus a preset value calculated in a certain way.
[0067] In another embodiment, the display parameter value includes a brightness value; when the computing device determines the display element corresponding to each highlight point according to the display parameter value of each highlight point, it can determine the display element corresponding to the brightness value of each highlight point according to a preset mapping relationship between the brightness value and the display element. The preset mapping relationship between the brightness value and the display element includes but is not limited to a mapping relationship between the brightness value and the shape of the display element, and a mapping relationship between the brightness value and the shape and color of the display element.
[0068] In another embodiment, the display parameter value includes a color value and a brightness value; when the computing device determines the display element corresponding to each highlight point according to the display parameter value of each highlight point, it can determine the display element corresponding to the color value and brightness value of each highlight point according to the preset mapping relationship among the color value, brightness value and display element. The preset mapping relationship among the color value, brightness value and display element includes but is not limited to the mapping relationship between the color value, brightness value and the shape of the display element, and the mapping relationship between the color value, brightness value and the shape and color of the display element.
[0069] In one implementation, when the computing device adds corresponding display elements to the location area of each highlight point, it may add display elements of the shape to the location area corresponding to the highlight point according to the area corresponding to the shape of the display element.
[0070] The embodiments of the present application can improve the flexibility of image processing and increase the interest of the image by selecting display elements of the same or different shapes and / or colors for different highlight points.
[0071] In one embodiment, when the computing device blurs the first image after adding each display element to obtain the blurred first image, the computing device can obtain the first position information of each pixel in the first image after adding each display element and the second position information of each display element; determine the distance between each pixel and each display element based on the first position information of each pixel and the second position information of each display element, and determine each pixel whose distance is less than a preset threshold as a pixel to be processed; obtain the first color value of each pixel to be processed, and blur each pixel to be processed in the first image based on the first color value and the preset blur degree value to obtain the blurred first image.
[0072] In one embodiment, when the computing device obtains the first position information of each pixel in the first image after adding each display element and the second position information of each display element, it can calculate the first position information of each pixel in the first image after adding each display element and the second position information of each display element by defining a two-dimensional vector. In one example, the two-dimensional vector can be unitUV, which can be initialized to 1.35 and 1.0 multiplied by the blur step blurSize, and then divided by the screen size screenSize. The blur step refers to the number of pixels within a preset range around a pixel, and the screen size includes the length, width, area, etc. of the screen.
[0073] The embodiments of the present application can effectively control parameters such as blur intensity and the size of display elements by controlling the blur step size.
[0074] In an optional embodiment, the display elements may be represented by curve equations corresponding to different shapes. When the computing device determines the distance between each pixel point and each display element based on the first position information of each pixel point and the second position information of each display element, it may determine the first position information of each pixel point based on the position coordinates of each pixel point, determine the second position information of each display element based on the curve equation corresponding to the shape of each display element, and further determine the distance between each pixel point and each display element based on the position coordinates of each pixel point and the curve equation corresponding to the shape of each display element.
[0075] The computing device can use multiple for loops to traverse the position coordinates of each pixel point around a pixel point in order to calculate the blur effect. Specifically, the computing device can use four nested for loops, corresponding to different pixel ranges, to capture all image areas that need to be blurred. Each loop also contains some conditional judgments to exclude pixels that do not need to be blurred. In general, the purpose of these loops is to sample and weight the surrounding pixels in order to generate the final blurred second image.
[0076] Furthermore, when the computing device determines that the distance between a pixel and a display element is less than a preset distance threshold, it may determine that the pixel is within the display element, that is, determine that the pixel is a pixel to be processed.
[0077] In one embodiment, when the computing device performs blur processing on each pixel to be processed in the first image according to the first color value and the preset blur value to obtain the blurred first image, the computing device can calculate the second color value of each pixel to be processed according to the first color value and the preset blur value; determine the weighted color value of each pixel to be processed according to the first color value, the second color value and the color weight value; and adjust each pixel to be processed according to the weighted color value of each pixel to be processed to blur each pixel to obtain the blurred first image. The preset blur value can be a predefined floating point variable amount. For example, the amount can be assigned a value of 40.0, and the amount is added to the result of 0.9987 multiplied by 500 to obtain a new amount.
[0078] In an optional embodiment, when calculating the second color value of each pixel to be processed based on the first color value and the preset blurriness value, the computing device can calculate the product of the first color value and the preset blurriness value, and determine the second color value of each pixel to be processed based on the sum of the product and the preset value.
[0079] In one example, the computing device may calculate the product of the ninth power of the first color value of each pixel to be processed and a preset blur value, and then add 0.4 to the product of each pixel to be processed to obtain the second color value of each pixel to be processed.
[0080] In one embodiment, different color values may correspond to the same color weight value. When the computing device determines the weighted color value of each pixel to be processed based on the first color value, the second color value and the color weight value, it may calculate the sum of the first color value and the second color value corresponding to each pixel to be processed, and then calculate the product of the sum of the first color value and the second color value and the color weight value to obtain the weighted color value of each pixel to be processed.
[0081] In one embodiment, different color values may correspond to different color weight values, the first color value corresponds to the first color weight value, the second color value corresponds to the second color weight value, and when the computing device determines the weighted color value of each pixel to be processed based on the first color value, the second color value and the color weight value, it may calculate the product of the first color value corresponding to each pixel to be processed and the first color weight value, calculate the product of the second color value corresponding to each pixel to be processed and the second color weight value, and calculate the sum of the product of the first color value corresponding to each pixel to be processed and the first color weight value and the product of the second color value corresponding to each pixel to be processed and the second color weight value to obtain the weighted color value of each pixel to be processed.
[0082] In some embodiments, each color weight value is a numerical value greater than or equal to 0 and less than or equal to 1.
[0083] In one embodiment, after determining the weighted color value of each pixel to be processed based on the first color value, the second color value and the color weight value, the computing device can calculate the sum of the second color value and the color weight value, and determine the sum of the second color value and the color weight value as the corresponding new color weight value, so as to facilitate the subsequent use of the new color weight value to calculate the weighted color values of other pixels to be processed.
[0084] Specific can Figure 5 Taking the first image after blurring as an example, Figure 5 is a schematic diagram of an interface of a first image after blurring provided in an embodiment of the present application, such as Figure 5 The figure shows the blur effect of each heart-shaped display element in the first image 51 after blur processing.
[0085] In one embodiment, when obtaining the second image based on the blurred first image and the image region where the main object of the image is located, the computing device may perform Gaussian blur processing on the blurred first image based on the pixel value of each pixel point in the blurred first image and a preset Gaussian weight to obtain a blurred image; and fuse the image region where the main object of the image is located in the first image with the blurred image to obtain the second image. In some embodiments, the preset Gaussian weight is a value greater than or equal to 0 and less than or equal to 1.
[0086] In one embodiment, when a computing device fuses an image region where an image main object in a first image is located with a blurred image to obtain a second image, the computing device can obtain target position information of the image region where the image main object is located in the first image, determine an image region corresponding to the target position information in the blurred image, and superimpose the image main object onto the image region corresponding to the target position information in the blurred image to achieve fusion processing of the image region where the image main object is located with the blurred image to obtain a second image.
[0087] Specific can be combined Figure 5 , Figure 6 and Figure 7 A schematic description is given of performing Gaussian blur processing on the blurred first image according to the pixel value of each pixel point in the blurred first image and the preset Gaussian weight to obtain a blurred image. Figure 6 is a schematic diagram of a blurred image interface provided by an embodiment of the present application, Figure 7 is a schematic diagram of an interface of a second image provided in an embodiment of the present application. Figure 5 As shown in FIG. 1 , since the blur effect of each heart-shaped display element in the first image 51 after blur processing is not smooth enough (that is, the noise of the noise is greater than the noise threshold), the computing device may Figure 5 The first image 51 after the blurring process is subjected to Gaussian blurring process to obtain the following Figure 6 In the blurred image, the main object of the image is also blurred by Gaussian blur processing, so the image area where the main object of the image identified from the first image is located can be fused with the blurred image to obtain Figure 7 The second image is shown.
[0088] The embodiment of the present application can make the display elements in the blurred image smoother by performing Gaussian blur processing on the blurred first image, and further obtain the second image by fusing the image area where the clear image main object identified from the first image is located with the blurred image, so as to obtain a high-quality second image with smooth display elements and clear image main object, which helps to improve the flexibility and effect of image processing.
[0089] In an embodiment of the present application, a computing device processes a first image and displays a second image after the processing of the first image, wherein the second image includes a first image area including display elements of a target shape after blurring, so that the flexibility and interest of image processing can be increased by display elements of different shapes. The second image also includes a second image area of an image main object identified from the first image, so that the quality of the image area where the image main object is located can be guaranteed while increasing the interest of the image, so as to reduce the impact on the image area where the image main object is located in the image when blurring the image, which helps to improve the effect of image processing.
[0090] See also Figure 8 , Figure 8 is a flow chart of another image processing method provided in an embodiment of the present application, such as Figure 8 The image processing method in the embodiment shown can be applied to an image processing device, which is arranged in a computing device. The method may at least include the following steps.
[0091] S801: In response to an image display operation, acquiring a first image to be displayed.
[0092] S802: Determine an image region to be processed of the first image.
[0093] In the embodiment of the present application, when determining the image region to be processed of the first image, the computing device may use the following steps to determine the image region to be processed of the first image.
[0094] S8021: Acquire a pixel point set of the first image, and determine a highlight point set from the pixel point set of the first image, and determine that an image area corresponding to the highlight point set is an image area to be processed of the first image.
[0095] The specific implementation example is as follows Figure 2 The embodiments are described in detail and will not be repeated here.
[0096] S803: Perform blurring processing on the first image based on the image area to be processed.
[0097] The computing device can obtain the display parameter value of each highlight point in the highlight point set, and determine the display element corresponding to each highlight point based on the display parameter value of each highlight point, wherein the shape and / or color of the display elements corresponding to different display parameter values are different; add the corresponding display element to the position area of each highlight point, and blur the first image after adding each display element to obtain the blurred first image.
[0098] S804: Obtain a second image according to the blurred first image, and display the second image.
[0099] In an embodiment of the present application, when the computing device obtains the second image based on the blurred first image, it may execute the following steps when it is detected that the blurred first image satisfies the smoothing condition.
[0100] S8041: Identify the main image object in the first image, and fuse the blurred first image with the image area where the main image object is located to obtain the second image.
[0101] The specific implementation process is as mentioned above Figure 2 The embodiments are described in detail and will not be repeated here.
[0102] In an embodiment of the present application, the computing device determines an image area to be processed of the first image, blurs the first image based on the image area to be processed, thereby increasing the flexibility and interest of image processing through display elements of different shapes, identifies the main image object in the first image, and fuses the blurred first image with the image area where the main image object is located to obtain the second image. This can increase the interest of the image while ensuring the quality of the image area where the main image object is located, thereby reducing the impact on the image area where the main image object is located in the image when blurring the image, and helping to improve the effect of image processing.
[0103] See also Fig. 9 , Fig. 9 901 is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application. Specifically, the image processing device is arranged in a computing device, and the image processing device comprises: an acquisition unit 901 and a display unit 902;
[0104] An acquisition unit 901 is used to acquire a first image to be displayed in response to an image display operation;
[0105] The display unit 902 is used to display a second image after processing the first image, wherein the displayed second image includes the first image area after blurring, and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area, in which the image main object identified from the first image is displayed.
[0106] Further, when the display unit 902 displays the second image after processing the first image, it is specifically used to:
[0107] determining an image area to be processed of the first image;
[0108] The first image is blurred based on the image area to be processed, the second image is obtained according to the blurred first image, and the second image is displayed.
[0109] Further, when the display unit 902 obtains the second image according to the blurred first image, it is specifically used to:
[0110] Detecting whether the first image after blurring satisfies a smoothing processing condition;
[0111] If the detection result is yes, identifying the main image object in the first image, determining the image region where the main image object is located in the first image, obtaining the second image according to the blurred first image and the image region where the main image object is located, and displaying the second image;
[0112] If the detection result is no, then the first image after blurring is determined to be the second image.
[0113] Further, when the display unit 902 determines the image area to be processed of the first image, it is specifically used to:
[0114] Acquire a pixel point set of the first image, and determine a highlight point set from each pixel point of the pixel point set of the first image, wherein the highlight point set includes pixel points in the first image whose brightness values meet a brightness condition;
[0115] An image region corresponding to the set of highlight points is determined as the image region to be processed of the first image.
[0116] Further, when the display unit 902 determines the highlight point set from each pixel point of the pixel point set of the first image, it is specifically used to:
[0117] Converting the first image into a grayscale image, and performing edge detection on the grayscale image to obtain an edge image;
[0118] Determine the contour of the edge image, determine the target contour that meets the highlight point condition based on the contour of the edge image, and calculate the center point of the target contour;
[0119] According to the brightness value of the center point and the brightness values of each pixel point in a preset range around the center point, each pixel point that meets the brightness condition is determined to obtain the highlight point set.
[0120] Further, when the display unit 902 performs blur processing on the first image based on the image area to be processed, it is specifically used to:
[0121] Obtaining display parameter values of each highlight point in the highlight point set, wherein the display parameter values include color values and / or brightness values;
[0122] Determining display elements corresponding to the respective highlight points according to display parameter values of the respective highlight points, wherein display elements corresponding to different display parameter values have different shapes and / or colors;
[0123] Corresponding display elements are added to the position areas of the respective highlight points, and the first image after adding the respective display elements is blurred to obtain the blurred first image.
[0124] Furthermore, when the display unit 902 performs blur processing on the first image after adding each display element to obtain the blurred first image, it is specifically used to:
[0125] Acquire first position information of each pixel in the first image after each display element is added and second position information of each display element;
[0126] Determine the distance between each pixel and each display element according to the first position information of each pixel and the second position information of each display element, and determine each pixel whose distance is less than a preset threshold as a pixel to be processed;
[0127] The first color value of each pixel to be processed is obtained, and blur processing is performed on each pixel to be processed in the first image according to the first color value and a preset blur degree value to obtain the blurred first image.
[0128] Further, the display unit 902 performs blur processing on each pixel to be processed in the first image according to the first color value and the preset blur level value to obtain the blurred first image, which is specifically used for:
[0129] Calculating the second color value of each pixel to be processed according to the first color value and a preset blur level value;
[0130] Determining a weighted color value of each pixel to be processed according to the first color value, the second color value and a color weight value;
[0131] According to the weighted color value of each pixel to be processed, each pixel to be processed is adjusted to perform blur processing on each pixel to be processed, so as to obtain the first image after blur processing.
[0132] Further, when the display unit 902 obtains the second image according to the blurred first image and the image region where the main object of the image is located, it is specifically used to:
[0133] According to the pixel value of each pixel point in the first image after the blurring process and the preset Gaussian weight, the first image after the blurring process is subjected to Gaussian blurring to obtain a blurred image;
[0134] The image area where the main object of the image is located in the first image is fused with the blurred image to obtain the second image.
[0135] In an embodiment of the present application, an image processing device can process a first image and display a second image after processing the first image, wherein the second image includes a first image area including display elements of a target shape after blurring, so that the flexibility and interest of image processing can be increased by display elements of different shapes. The second image also includes a second image area of an image main object identified from the first image, so that the quality of the image area where the image main object is located can be guaranteed while increasing the interest of the image, so as to reduce the impact on the image area where the image main object is located in the image when blurring the image, which helps to improve the effect of image processing.
[0136] See also Fig.10 , Fig.10 1 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. As shown in the figure, the computing device in this embodiment may include: one or more processors 1001, memory 1002, bus 1003 and communication interface 1004, the processor 1001, communication interface 1004 and memory 1002 are connected through bus 1003; memory 1002 is used to store programs; processor 1001 is used to call the program stored in the above memory through bus 1003, and perform the following steps:
[0137] In response to an image display operation, acquiring a first image to be displayed;
[0138] A second image is displayed after processing the first image, wherein the displayed second image includes the first image area after blurring and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area in which an image subject object identified from the first image is displayed.
[0139] Further, when the processor 1001 displays the second image after processing the first image, it is specifically configured to:
[0140] determining an image area to be processed of the first image;
[0141] The first image is blurred based on the image area to be processed, the second image is obtained according to the blurred first image, and the second image is displayed.
[0142] Further, when the processor 1001 obtains the second image according to the blurred first image, it is specifically configured to:
[0143] Detecting whether the first image after blurring satisfies a smoothing processing condition;
[0144] If the detection result is yes, identifying the main image object in the first image, determining the image region where the main image object is located in the first image, obtaining the second image according to the blurred first image and the image region where the main image object is located, and displaying the second image;
[0145] If the detection result is no, then the first image after blurring is determined to be the second image.
[0146] Further, when the processor 1001 determines the image area to be processed of the first image, it is specifically configured to:
[0147] Acquire a pixel point set of the first image, and determine a highlight point set from each pixel point of the pixel point set of the first image, wherein the highlight point set includes pixel points in the first image whose brightness values meet a brightness condition;
[0148] An image region corresponding to the set of highlight points is determined as the image region to be processed of the first image.
[0149] Further, when the processor 1001 determines the highlight point set from each pixel point of the pixel point set of the first image, it is specifically configured to:
[0150] Converting the first image into a grayscale image, and performing edge detection on the grayscale image to obtain an edge image;
[0151] Determine the contour of the edge image, determine the target contour that meets the highlight point condition based on the contour of the edge image, and calculate the center point of the target contour;
[0152] According to the brightness value of the center point and the brightness values of each pixel point in a preset range around the center point, each pixel point that meets the brightness condition is determined to obtain the highlight point set.
[0153] Further, when the processor 1001 performs blurring processing on the first image based on the image area to be processed, it is specifically configured to:
[0154] Obtaining display parameter values of each highlight point in the highlight point set, wherein the display parameter values include color values and / or brightness values;
[0155] Determining display elements corresponding to the respective highlight points according to display parameter values of the respective highlight points, wherein display elements corresponding to different display parameter values have different shapes and / or colors;
[0156] Corresponding display elements are added to the position areas of the respective highlight points, and the first image after adding the respective display elements is blurred to obtain the blurred first image.
[0157] Further, the processor 1001 performs blur processing on the first image after adding each display element to obtain the blurred first image, specifically for:
[0158] Acquire first position information of each pixel in the first image after each display element is added and second position information of each display element;
[0159] Determine the distance between each pixel and each display element according to the first position information of each pixel and the second position information of each display element, and determine each pixel whose distance is less than a preset threshold as a pixel to be processed;
[0160] The first color value of each pixel to be processed is obtained, and blur processing is performed on each pixel to be processed in the first image according to the first color value and a preset blur degree value to obtain the blurred first image.
[0161] Further, the processor 1001 performs blur processing on each pixel to be processed in the first image according to the first color value and the preset blur level value to obtain the blurred first image, specifically for:
[0162] Calculating the second color value of each pixel to be processed according to the first color value and a preset blur level value;
[0163] Determining a weighted color value of each pixel to be processed according to the first color value, the second color value and a color weight value;
[0164] According to the weighted color value of each pixel to be processed, each pixel to be processed is adjusted to perform blur processing on each pixel to be processed, so as to obtain the first image after blur processing.
[0165] Further, when the processor 1001 obtains the second image according to the blurred first image and the image region where the main object of the image is located, it is specifically used to:
[0166] According to the pixel value of each pixel point in the first image after the blurring process and the preset Gaussian weight, the first image after the blurring process is subjected to Gaussian blurring to obtain a blurred image;
[0167] The image area where the main object of the image is located in the first image is fused with the blurred image to obtain the second image.
[0168] In an embodiment of the present application, a computing device can process a first image and display a second image after the processing of the first image, wherein the second image includes a first image area including display elements of a target shape after blurring, so that the flexibility and interest of image processing can be increased by display elements of different shapes. The second image also includes a second image area of an image main object identified from the first image, so that the quality of the image area where the image main object is located can be guaranteed while increasing the interest of the image, so as to reduce the impact on the image area where the image main object is located in the image when blurring the image, which helps to improve the effect of image processing.
[0169] It should be understood that in the embodiment of the present application, the processor 1001 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0170] The memory 1002 may include a read-only memory and a random access memory, and provide instructions and data to the processor 1001. A portion of the memory 1002 may also include a non-volatile random access memory. For example, the memory 1002 may also store information about the device type.
[0171] In a specific implementation, the processor 1001 described in the embodiment of the present application can execute the implementation method described in the image processing method provided in the embodiment of the present application, and can also execute the implementation method of the image processing device described in the embodiment of the present application, which will not be repeated here.
[0172] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores program instructions, and when the program instructions are executed, any of the above-mentioned image processing methods is implemented.
[0173] The computer-readable storage medium may be an internal storage unit of the device described in any of the foregoing embodiments, such as a hard disk or memory of the device. The computer-readable storage medium may also be an external storage device of the device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of the device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the mobile device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0174] The embodiments of the present application also provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device executes the methods provided in the above various embodiments.
[0175] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0176] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the terminals and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0177] In the several embodiments provided in the present application, it should be understood that the disclosed computing devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.
[0178] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0179] The units in the terminal in the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0180] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0181] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0182] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0183] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. An image processing method, characterized in that: include: In response to an image display operation, acquiring a first image to be displayed; A second image is displayed after processing the first image, wherein the displayed second image includes the first image area after blurring and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area in which an image subject object identified from the first image is displayed.
2. The method according to claim 1, characterized in that The displaying of a second image after processing the first image includes: determining an image area to be processed of the first image; The first image is blurred based on the image area to be processed, the second image is obtained according to the blurred first image, and the second image is displayed.
3. The method according to claim 2, characterized in that The step of obtaining the second image according to the blurred first image includes: Detecting whether the first image after blurring satisfies a smoothing processing condition; If the detection result is yes, identifying the main image object in the first image, determining the image region where the main image object is located in the first image, obtaining the second image according to the blurred first image and the image region where the main image object is located, and displaying the second image; If the detection result is no, then the first image after blurring is determined to be the second image.
4. The method according to claim 2, characterized in that: The determining of the image area to be processed of the first image includes: Acquire a pixel point set of the first image, and determine a highlight point set from each pixel point of the pixel point set of the first image, wherein the highlight point set includes pixel points in the first image whose brightness values meet a brightness condition; An image region corresponding to the set of highlight points is determined as the image region to be processed of the first image.
5. The method according to claim 4, characterized in that The step of determining a highlight point set from each pixel point of the pixel point set of the first image includes: Converting the first image into a grayscale image, and performing edge detection on the grayscale image to obtain an edge image; Determine the contour of the edge image, determine the target contour that meets the highlight point condition based on the contour of the edge image, and calculate the center point of the target contour; According to the brightness value of the center point and the brightness values of each pixel point in a preset range around the center point, each pixel point that meets the brightness condition is determined to obtain the highlight point set.
6. The method according to claim 5, characterized in that The blurring the first image based on the image area to be processed includes: Obtaining display parameter values of each highlight point in the highlight point set, wherein the display parameter values include color values and / or brightness values; Determining display elements corresponding to the respective highlight points according to display parameter values of the respective highlight points, wherein display elements corresponding to different display parameter values have different shapes and / or colors; Corresponding display elements are added to the position areas of the respective highlight points, and the first image after adding the respective display elements is blurred to obtain the blurred first image.
7. The method according to claim 6, characterized in that The step of performing blur processing on the first image after adding each display element to obtain the blurred first image includes: Acquire first position information of each pixel in the first image after each display element is added and second position information of each display element; Determine the distance between each pixel and each display element according to the first position information of each pixel and the second position information of each display element, and determine each pixel whose distance is less than a preset threshold as a pixel to be processed; The first color value of each pixel to be processed is obtained, and blur processing is performed on each pixel to be processed in the first image according to the first color value and a preset blur degree value to obtain the blurred first image.
8. The method according to claim 7, characterized in that The blurring of each pixel to be processed in the first image according to the first color value and the preset blur level value to obtain the blurred first image includes: Calculating the second color value of each pixel to be processed according to the first color value and a preset blur level value; Determining a weighted color value of each pixel to be processed according to the first color value, the second color value and a color weight value; According to the weighted color value of each pixel to be processed, each pixel to be processed is adjusted to perform blur processing on each pixel to be processed, so as to obtain the first image after blur processing.
9. The method according to claim 3, characterized in that: The step of obtaining the second image according to the blurred first image and the image region where the main object of the image is located comprises: According to the pixel value of each pixel point in the first image after the blurring process and the preset Gaussian weight, the first image after the blurring process is subjected to Gaussian blurring to obtain a blurred image; The image area where the main object of the image is located in the first image is fused with the blurred image to obtain the second image.
10. An image processing device, characterized in that: include: an acquisition unit, configured to acquire a first image to be displayed in response to an image display operation; A display unit is used to display a second image after processing the first image, wherein the displayed second image includes the first image area after blurring, and also includes a display element of a target shape in the first image area, and the displayed second image also includes a second image area, in which an image subject object identified from the first image is displayed.
11. A computing device, characterized in that: The method comprises a processor and a memory, wherein the processor and the memory are connected to each other, wherein the memory is used to store a computer program, and the processor is configured to call the computer program to execute the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, which, when executed, implement the method according to any one of claims 1 to 9.
13. A computer program product, characterized in that The computer program product comprises program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
