Image drawing method and device, equipment and storage medium
By obtaining and utilizing the distance field information of the target object, determining and drawing the target image area, the problem of loss of details in text drawing is solved and the visual effect is improved.
Patent Information
- Application Number
- CN202310768211.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-27
- Publication Date
- 2024-12-27
AI Technical Summary
During the text drawing process, especially in the text display in the video, special parts such as small lines and tips are likely to lead to the loss of details, resulting in poor drawing effect.
By obtaining the corresponding distance field information of multiple image areas in the image of the target object, the target image area is determined, and the distance field value of the target point is determined based on the information, the target image area is drawn on the display interface to retain the detailed information of the object. .
It effectively avoids the loss of object details, improves the drawing effect, and ensures the clear and complete rendering of text and other image elements.
Smart Images

Figure CN119205980A_ABST
Abstract
Description
Technical Field
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to methods, devices, apparatuses, and computer-readable storage media for image rendering. Background Art
[0002] Currently, there is an increasing demand for text drawing, such as text display in videos. Text may have some special parts, such as thin lines, sharp points, etc. In the process of drawing text, these special parts are prone to loss of details, resulting in poor text drawing effect. Therefore, a solution is expected to retain detailed information when drawing text and present it to users in a clearer and more complete way. Summary of the invention
[0003] In a first aspect of the present disclosure, an image drawing method is provided. The method comprises: obtaining corresponding distance field information of multiple image areas in an image of a target object, each of the multiple image areas is defined by multiple sampling points, and the distance field information of the image area comprises corresponding distance field values and distance field changes of the multiple sampling points relative to the target object; based on the corresponding distance field information, determining a target image area in the multiple image areas, wherein a boundary of the target object is at least partially located in the target image area; based on the distance field information of the target image area, determining a distance field value of a target point in the target image area relative to the target object; and drawing the target image area on a display interface based on the distance field value of the target point.
[0004] In a second aspect of the present disclosure, a device for image drawing is provided. The device includes: an information acquisition module configured to acquire corresponding distance field information of multiple image areas in an image of a target object, each of the multiple image areas is defined by multiple sampling points, and the distance field information of the image area includes corresponding distance field values and distance field changes of the multiple sampling points relative to the target object; a first determination module configured to determine a target image area in the multiple image areas based on the corresponding distance field information, wherein a boundary of the target object is at least partially located in the target image area; a second determination module configured to determine a distance field value of a target point in the target image area relative to the target object based on the distance field information of the target image area; and a drawing module configured to draw the target image area on a display interface based on the distance field value of the target point.
[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. When the instructions are executed by the at least one processing unit, the device executes the method of the first aspect.
[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect.
[0007] It should be understood that the contents described in this content section are not intended to limit the key features or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0009] Figure 1 A schematic diagram showing an example environment in which embodiments of the present disclosure can be implemented;
[0010] Figure 2 A schematic diagram showing an example shape drawn using a conventional scheme;
[0011] Figure 3A A schematic diagram showing a portion of an example shape in a sampling grid according to some embodiments of the present disclosure;
[0012] Figure 3B A schematic diagram showing a portion of another example shape in a sampling grid according to some embodiments of the present disclosure;
[0013] Figure 4A A flowchart of an image drawing method according to some embodiments of the present disclosure is shown;
[0014] Figure 4B A flowchart showing a method for determining a distance field value of a target point according to some embodiments of the present disclosure is shown;
[0015] Figure 5A A schematic diagram showing a portion of an example target object in a sampling grid according to some embodiments of the present disclosure;
[0016] Figure 5B A schematic diagram showing a portion of another example target object in a sampling grid according to some embodiments of the present disclosure;
[0017] Figure 5C A schematic diagram showing a portion of a further example target object in a sampling grid according to some embodiments of the present disclosure;
[0018] Figure 6 A flow chart of a method for determining a set of target sampling points according to some embodiments of the present disclosure is shown;
[0019] Fig. 7A and Figure 7B A schematic diagram showing fused distance field estimation according to some embodiments of the present disclosure is shown;
[0020] Figure 8 A schematic diagram showing a plurality of lines in a target image area according to some embodiments of the present disclosure;
[0021] Fig. 9 A schematic diagram showing example shapes drawn according to some embodiments of the present disclosure;
[0022] Fig.10 A block diagram showing an apparatus for image rendering according to some embodiments of the present disclosure; and
[0023] Fig.11 A block diagram illustrating an electronic device in which one or more embodiments of the present disclosure may be implemented is shown. DETAILED DESCRIPTION
[0024] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0025] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0026] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0027] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0028] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0029] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0030] It should be noted that the titles of any sections / subsections provided herein are not restrictive. Various embodiments are described throughout this article, and any type of embodiment may be included under any section / subsection. In addition, the embodiments described in any section / subsection may be combined in any manner with any other embodiments described in the same section / subsection and / or different sections / subsections.
[0031] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may be included below. The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may be included below.
[0032] As used herein, the term "sampling point" may correspond to a pixel in an image to be drawn that includes a target object (also referred to as an image to be drawn). For example, a sampling point may refer to a center point of a corresponding pixel. The term "target point" may refer to a point in the image to be drawn that may correspond to a pixel in the image to be drawn.
[0033] The area defined by multiple sampling points may also be referred to as a sampling area or an image area. There may be no other sampling points inside the sampling area. The sampling area may be composed of various shapes, such as a triangle, a square, etc. The sampling points may be the vertices of the sampling area. Taking a square sampling area as an example, the sampling points of a sampling area may be the four vertices of the sampling area. The sampling area is also called a sampling grid, and these two terms are used interchangeably in the present disclosure.
[0034] Figure 1 A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. In the example environment 100, the electronic device 110 draws the target object 130 using the image 120 of the target object 130. For example, the electronic device 110 can draw the target object 130 on a display interface, such as a screen or a canvas, and the resolution of the drawn display interface can be greater than the resolution of the image 120.
[0035] The electronic device 110 may be any type of device with computing capabilities, including a terminal device. The terminal device may be any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an electronic book device, a gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof.
[0036] In some embodiments, the electronic device 110 may run an application. The application may be, for example, a content sharing or content creation application, which can at least provide users with services related to content consumption, such as content creation, editing, etc. The application may have image drawing requirements, such as in the process of video creation or editing.
[0037] In order to draw the target object 130, the electronic device 110 may use the distance field of the target object 130. The distance field of the target object 130 records the shortest distance value between each sampling point inside and outside the target object and the contour line (also called the boundary) of the target object 130, also called the distance field value. In some embodiments, a signed distance field (also called a signed distance field) of the target object 130 may be used. A signed distance field refers to a distance field that identifies the inside and outside of the target object 130 by the sign of the distance field value. For example, the distance field value of the sampling point inside the target object 130 may be set to a negative value, and the distance field value of the sampling point outside the target object 130 may be set to a positive value.
[0038] exist Figure 1In the example of , image 120 is a distance field image of target object 130, specifically a directed distance field image. In other words, the value of each pixel in image 120 represents the shortest distance between the center point (i.e., sampling point) of the pixel and target object 130, and the positive or negative value represents whether the pixel is located inside or outside the target object 130. Such a distance field image can be regarded as a sampling network composed of multiple sampling grids. Each sampling grid is defined by multiple sampling points. For example, the sampling grid can be square and defined by four sampling points.
[0039] For example, when the sampling point falls outside the contour of the target object, the distance field value of the sampling point can be expressed as a positive number, and when it falls inside the contour, the distance field value of the sampling point can be expressed as a negative number. When drawing the target object, the distance field value of each grid point is calculated on the final rendering grid. Then, the points with distance field values less than zero can be determined as the internal area of the target object. Alternatively, a predetermined range with distance field values (for example, a range of 0-d, where d can be set as a threshold) can be determined, and a stroke effect is used when drawing points with distance field values within the predetermined range.
[0040] Despite Figure 1 In the example of the target object 130 shown as a circle, it should be understood that this is only exemplary and not intended to be limiting. In the embodiments of the present disclosure, the target object 130 included in the image 120 can be any element that needs to be drawn, such as an arbitrary shape or a pattern composed of multiple shapes. In particular, in some embodiments, the target object 130 can represent a text or a part of a text. The target object 130 can also represent other types of elements or parts thereof, such as representing numbers, symbols, patterns, etc.
[0041] It should be understood that the structure and function of environment 100 are described for exemplary purposes only, and do not imply any limitation on the scope of the present disclosure. Electronic device 110 may include any suitable structure and function to implement drawing for target objects. In addition, the image of the target object may have any suitable resolution.
[0042] Taking shapes as an example, as mentioned above, sometimes the resolution of the canvas or screen to which the shape is drawn may be greater than the resolution of the image of the shape (e.g., the distance field image). In this case, the points to be drawn corresponding to certain pixels in the final canvas or screen do not have distance field values. In order to draw shapes, the traditional solution is to determine the sampling points of the sampling grid where the points to be drawn are located, and then interpolate the distance field values of these sampling points to obtain the distance field values of the points to be drawn. It can be seen that the resolution of the sampling network that stores the distance field information has a huge impact on the final drawing effect.
[0043] When drawing a shape using the above-mentioned conventional solution, some details (eg, smaller parts) on the shape are lost during drawing. Figure 2 A schematic diagram of an example shape drawn using a conventional scheme is shown. Figure 2 Take the shape shown in FIG. 1 as an example. In this example, the shape to be drawn represents the letter G. The original shape of the upper edge portion 200 of the shape should be a thin arc. When the shape is drawn using a traditional solution, the final effect may be that the upper edge portion 200 of the shape is broken when drawn, such as Figure 2 As shown. The reason for this line breaking phenomenon is that if the upper edge portion 200 falls inside a sampling grid, then since the sampling points are all located outside the upper edge portion 200, the distance field values of these sampling points (represented by the shortest distance between the sampling points and the upper edge portion 200) are all positive. In this case, the inner area of the arc cannot be determined by interpolation, which may result in the loss of information of the upper edge portion 200 (i.e., the information of this part of the line), which in turn leads to the line breaking phenomenon.
[0044] Next, combine Figure 3A and Figure 3B Further analysis is conducted on the problem of missing details that may occur when drawing images. Figure 3A Schematic diagram showing portions of example shapes in a sampling grid according to some embodiments of the present disclosure. Figure 3A As shown, the portion of shape 310 in sampling grid 320 is a "sharp corner". Sampling grid 320 includes sampling points 311, 312, 313, and 314. Since the sharp corner of shape 310 is located inside sampling grid 320, sampling points 311-314 are all located outside shape 310. In this example, the distance field value of sampling points 311 and 312 is +XX, indicating that the distance field value is a positive number with a value of XX. The distance field value of sampling points 313 and 314 is +YY, indicating that the distance field value is a positive number with a value of YY. Since the distance field values of sampling points 311-314 relative to shape 310 are all positive numbers, this will cause the interpolation values of all points in the sharp corner of shape 320 to be positive numbers, so that it is drawn as the outer area of shape 310. As a result, when drawing shape 310, the sharp corner of shape 310 inside sampling grid 320 is lost.
[0045] Figure 3B FIG. 1 is a schematic diagram showing a portion of another example shape in a sampling grid according to some embodiments of the present disclosure. Figure 3BAs shown, shape 330 is presented as a "strip" in sampling grid 340. Sampling grid 340 includes sampling points 331, 332, 333, and 334. Since the strip of shape 330 is located inside sampling grid 340, sampling points 331-334 are all located outside shape 330. In this example, the distance field value of sampling points 331-334 is +ZZ, indicating that the distance field value is a positive number with a value of ZZ. Since the distance field values of sampling points 331-334 relative to shape 330 are all positive numbers, this will cause the interpolation values of all points in the strip of shape 330 in sampling grid 340 to be positive numbers, and thus it is drawn as the outer area of shape 330. As a result, when drawing shape 330, the strip of shape 330 inside sampling grid 340 is lost.
[0046] The above text uses shape as an example to analyze the problem of detail loss that may occur when drawing an image. In order to at least partially solve the above problem, an embodiment of the present disclosure proposes a solution for image drawing. According to an embodiment of the present disclosure, the target object is drawn using the distance field values and distance field changes of multiple sampling points corresponding to multiple image areas in the image of the target object. Specifically, based on the corresponding distance field information, the target image area in the multiple image areas is determined, and based on the distance field information of the target image area, the distance field value of the target point in the target image area relative to the target object is determined. Then, based on the distance field value of the target point, the target image area is drawn on the display interface. In an embodiment of the present disclosure, the distance field change is used to draw the target object, which helps to restore the detail information of the object inside the sampling area so as to retain the detail information of the object when drawing the target object. In this way, the loss of object details can be avoided as much as possible, thereby advantageously improving the visual effect of the drawn object.
[0047] Some example embodiments of the present disclosure are described below with continued reference to the accompanying drawings. Figure 4A FIG. 4 is a flowchart of an image drawing method according to some embodiments of the present disclosure. In some embodiments, the method 400 may be, for example, Figure 1 The electronic device 110 is shown as being executed.
[0048] In block 410, the corresponding distance field information of multiple image regions in the image of the target object is obtained. Each image region is defined by multiple sampling points, and the distance field information of the image region includes the corresponding distance field values and distance field changes of the multiple sampling points relative to the target object. In the following, for the convenience of description, the image of the target object is referred to as the image to be drawn or the target image. The target object can be any shape or a pattern composed of multiple shapes that need to be drawn. As an example, the target object can represent text, numbers, symbols, patterns, or other types of elements. Multiple sampling points can define each image region (i.e., sampling region or sampling grid) in the multiple image regions in the image of the target object. There may be no other sampling points inside the sampling region. As an example, the sampling region can be a rectangular grid formed by the center points of four pixels in the image 120 (i.e., four sampling points). The distance field value of each sampling point can indicate the distance between the sampling point and the target object, such as the shortest distance to the boundary corresponding to the target. The distance field change of each sampling point can indicate the change of the distance field at the sampling point relative to the target object, for example, the distance field change can be a gradient. It should be understood that the gradient can be a representation of the distance field change, and the gradient is used as an example in the following description for exemplary purposes only.
[0049] The distance field value of each sampling point may be determined in any suitable manner. In some embodiments, a distance field corresponding to each sampling area may be generated for the target object. Based on the generated distance field of the target object, each sampling point on each sampling area and the point on the target object closest to each sampling point may be obtained. Thus, the distance value and gradient of each sampling point may be calculated.
[0050] The distance field change (e.g., gradient) is a vector and may include a gradient direction and a gradient value. In some embodiments, such as in some distance fields (e.g., a signed distance field), the magnitude of the gradient value is fixed. In this case, it is not necessary to store the gradient value, so only the gradient direction may be stored. Thus, the consumption of storage resources during image rendering may be saved.
[0051] A certain number of bits (e.g., 8 bits) of storage space can be used to store 360-degree angle information to represent the gradient direction. Taking 8 bits of storage space as an example, the possible angle error can be controlled within 360÷(2 8)÷2, that is, within 0.7 degrees. The error of the gradient value can be controlled below 0.012. However, traditionally, a method of directly storing the gradient value is adopted, using 1 bit of storage space for each coordinate axis direction to represent the positive and negative signs, and 3 bits of storage space are used to store discrete values between 0 and 1. In this traditional solution, the error of the gradient value is controlled below 0.125. In this embodiment, by storing the gradient direction, the error can be reduced and the accuracy of the stored gradient information can be improved.
[0052] At block 420, a target image region among the plurality of image regions is determined based on the corresponding distance field information of the plurality of image regions in the image of the target object. The boundary of the target object is at least partially located in the target image region. In other words, the target image region has at least a portion of the boundary of the target object.
[0053] In actual scenes, not every sampling region or image region may include the boundary of the target object, or for other reasons (e.g., the balance between computational complexity and rendering effect improvement). In view of this, some sampling regions in the image 120 may be processed using gradient information, while other sampling regions may be processed using other suitable methods, which is also referred to as a "degradation strategy". Therefore, it is necessary to determine the region that needs to use gradient information from each sampling region of the image 120, that is, the target image region. The following will describe an example of determining the target image region with reference to the "degradation strategy".
[0054] In block 430, based on the distance field information of the target image area, a distance field value of the target point in the target image area relative to the target object is determined. As mentioned above, the distance field information includes both the distance field value and the distance field change. The distance field value of the target point can be determined using any suitable approximate algorithm or exact algorithm. Figure 4B An example describing how to determine a distance field value based on a gradient.
[0055] In block 440, based on the determined distance field value of the target point, the target image area is drawn on the display interface. For example, the target object can be drawn on the screen. If there are multiple target image areas, the drawing process can be performed for each target image area. For other image areas that are not determined as target image areas, the distance field value of the drawing point can be calculated and drawn according to any other suitable existing or future developed method. Thus, the image of the target object can be drawn on the display interface.
[0056] Reference now Figure 4B , which shows a flow chart of a method 450 for determining a distance field value of a target point according to some embodiments of the present disclosure. The method 450 can be considered as an example implementation of block 430.
[0057] At block 460, a set of target sampling points is determined from the plurality of target sampling points. For a target point in a target image region, a set of target sampling points is determined from the plurality of target sampling points defining the target image region. That is, for each point to be drawn in the target image region, a set of target sampling points to be considered subsequently is determined, also referred to as reference sampling points.
[0058] In order to determine the reference sampling points, these sampling points in the target image area can be grouped, and the sampling points in the same group can be regarded as the same line segment expressing the target object. Take a square target image area as an example. The distance field information corresponding to the four sampling points on the target image area can contain information of up to four contour lines. In most cases, the structure of the lines contained in the target image area consists of only two line segments, and the structure of the lines can be, for example, thin lines or sharp corners. Therefore, according to the gradient direction of the four sampling points, it can be determined which of the four sampling points can be divided into a group of target sampling points.
[0059] To this end, in some embodiments, if the difference between the gradients of two sampling points among a plurality of sampling points of a target image region is less than a threshold difference, it can be considered that the two sampling points express a line segment, that is, the two sampling points can be divided into the same group of target sampling points. The specific value of the threshold difference is related to the form of the distance field and the shape of the target image region. Without considering the gradient value, the gradient difference between the two sampling points is the difference in the gradient direction, and the threshold difference can be a threshold angle. For example, for a square target image region, if the angle difference in the gradient direction between the two sampling points is less than 45 degrees, the two sampling points can be divided into the same group of target sampling points. In this way, it is possible to determine how many line segments there are inside the target image region, and to group the plurality of sampling points, that is, to determine which sampling points form a group of target sampling points.
[0060] In some embodiments, the target image region may include only one boundary line of the target object. In this case, all sampling points of the target image region express the same line. These sampling points are determined as reference sampling points for the target point. That is, when the distance field value of the target point is subsequently determined, the distance information of all these sampling points can be used.
[0061] refer to Figure 5A Describe an example. Figure 5A Schematic diagram showing a portion of an example target object in a sampling grid according to some embodiments of the present disclosure. Figure 5A As shown, shape 510 occupies the lower half of target image region 505. Target image region 505 includes sampling points 511, 512, 513, and 514. Figure 5AThe arrows at each sampling point in represent the gradient direction of the corresponding sampling point. As shown by the arrows, the gradient directions of the sampling points 511, 512, 513, and 514 are all vertically downward (note that the sampling points 513 and 514 are inside the shape, and their signed distance field values are negative, so the gradient directions are vertically downward). The angle difference of the gradient directions between these sampling points is 0 degrees, which is less than the threshold difference. Therefore, it can be determined that the sampling points 511, 512, 513, and 514 are the same group of target sampling points, which indicate the boundary of the shape 510 in the target image area 505. In this example, for any target point in the target image area 505, the reference sampling points determined in box 420 are all the sampling points included in the target image area 505.
[0062] In some embodiments, the target image region may include multiple boundary lines of the target object. Figure 6 How to determine the reference sampling point in such an embodiment is described below. Figure 6 A flow chart of a method 600 for determining a set of target sampling points according to some embodiments of the present disclosure is shown. The method 600 can be viewed as an example implementation of block 460.
[0063] In block 610, a plurality of lines indicating the boundary of the target object in the target image region are determined, each line being represented by at least one sampling point among the plurality of target sampling points. Considering the diversity of the target object, its boundary in the target image region may not be a straight line. On the other hand, considering the size of the target image region, in actual scenes, the boundary is usually an arc with a relatively small curvature. In view of this, the line represented by the sampling points can be used to approximate the boundary of the target object in the target image region.
[0064] In some embodiments, these lines indicating the boundaries may be pre-calculated and stored. During the process of drawing the target object, they may be read from a memory (e.g., a cache). Alternatively, these lines may be calculated and stored when the target object is drawn for the first time (e.g., the first frame of a video).
[0065] In some embodiments, the line indicating the boundary may be determined by grouping the sampling points. For example, the plurality of sampling points may be grouped based on their respective gradients to obtain a plurality of groups of sampling points, wherein the difference between the gradients of the sampling points in the same group is less than a threshold difference. As mentioned above, without considering the gradient value, the gradient difference between two sampling points is the difference in the gradient direction, and accordingly, the threshold difference may be a threshold angle. For example, for a target image region that is a square, the threshold angle may be 45 degrees. In such an embodiment, for each group of sampling points in the plurality of groups of sampling points, the line indicating the boundary represented by the group of sampling points may be determined as one of the plurality of lines.
[0066] refer to Figure 5B Describe an example. Figure 5B FIG. 1 is a schematic diagram showing a portion of another example target object in a sampling grid according to some embodiments of the present disclosure. In this example, Figure 5B As shown, shape 525 appears as a sharp angle including two lines in target image region 520. Target image region 520 includes sampling points 530, 531, 532, and 533. Figure 5B The arrows at each sampling point in the graph represent the gradient direction of the corresponding sampling point. As shown by the arrows, the angle difference between the gradient directions of the sampling points 530 and 532 is less than the threshold difference (45 degrees in this example), so it can be determined that the sampling points 530 and 532 are one group of the multiple groups of sampling points. The angle difference between the gradient directions of the sampling points 531 and 533 is also less than the threshold difference, so it can be determined that the sampling points 531 and 533 are another group of the multiple groups of sampling points. In this example, according to the respective gradient directions of the sampling points 530-533, after grouping these four sampling points, two groups of sampling points can be obtained. The sampling points 530 and 532 are the same group of target sampling points, which are used to represent the boundary line 526 located on the left side of the line 515 in the shape 525. The sampling points 531 and 533 are the same group of target sampling points, which are used to represent the boundary line 527 located on the right side of the line 515 in the shape 525.
[0067] refer to Figure 5C Another example is described. In this example, Figure 5C As shown, the shape 545 appears in the target image region 540 as a strip including an upper boundary line 546 and a lower boundary line 547. The target image region 540 includes sampling points 560, 561, 562, and 563. Figure 5C The arrows at each sampling point in the graph represent the gradient direction of the corresponding sampling point. As shown by the arrows, the angle difference between the gradient directions of sampling points 560 and 561 is less than the threshold difference (45 degrees in this example), so it can be determined that sampling points 560 and 561 are one group of multiple groups of sampling points. The angle difference between the gradient directions of sampling points 562 and 563 is also less than the threshold difference, so it can be determined that sampling points 562 and 563 are another group of multiple groups of sampling points. In this example, according to the respective gradient directions of sampling points 560-563, after grouping these four sampling points, two groups of sampling points can be obtained. Sampling points 560 and 561 are the same group of target sampling points, used to represent the upper boundary line 546 in shape 545. Sampling points 562 and 563 are the same group of target sampling points, used to represent the lower boundary line 547 in shape 545.
[0068] In such an embodiment, based on the gradients of the sampling points, sampling points corresponding to the same boundary may be found, and these sampling points may be used to represent the boundary.
[0069] Continue to refer Figure 6 At block 620, a line is selected from the plurality of lines based on the position of the target point in the target image region. In some embodiments, the distance between the target point and each of the plurality of lines may be calculated, and then a line closest to the target point may be selected from the plurality of lines.
[0070] In the drawing of the target object, if the closest line needs to be calculated for each target point, the amount of calculation will increase. In view of this, in some embodiments, a line can be selected from multiple lines according to a sub-region in the target image region. For example, multiple sub-regions in the target image region can be determined, and each sub-region includes one line from multiple lines. Then, based on the position of the target point in the adopted region, the sub-region where the target point is located can be determined from the multiple sub-regions. For the target point, a line located in the determined sub-region can be selected from the multiple lines.
[0071] Depending on the specific style of the target object in the target image area, there may be different ways of dividing the sub-areas. In some embodiments, the plurality of lines may include a first straight line segment and a second straight line segment intersecting in the target image area. The target image area may be divided into a plurality of sub-areas by a reference line. Specifically, a reference line that bisects the angle between the first straight line segment and the second straight line segment may be determined. Based on the reference line, the target image area may be divided into a first sub-area including the first straight line segment and a second sub-area including the second straight line segment.
[0072] Continue to refer Figure 5B In this example, the first straight line segment can be used to indicate (e.g., approximately) boundary line 526, and the second straight line segment can be used to indicate boundary line 527. Figure 5B In the example of , the angle formed by the shape 525 in the target image region 520 can be made into an angle bisector 515 as a reference line. Thus, it can be determined that the target image region 520 includes two sub-regions, a sub-region located on the left side of the angle bisector 515 in the target image region 520, and a sub-region located on the right side of the angle bisector 515 in the target image region 520. Then, by the position of the target point, it can be determined in which sub-region the target point is located, so that the line for the target point can be selected. For example, for the target point in the sub-region on the left, the boundary line 526 can be selected. For the target point in the sub-region on the right, the boundary line 527 can be selected.
[0073] Reference below Fig. 7A and Figure 7B This is illustrated with an example. Fig. 7A and Figure 7BA schematic diagram of fused distance field estimation according to some embodiments of the present disclosure is shown. In the case where the target image region includes two lines, it is first necessary to perform straight line approximation estimation on the arc using more than one sampling point, and fuse multiple straight lines defined by the sampling points belonging to the arc with equal weights to obtain an average straight line.
[0074] like Fig. 7A As shown, straight line 705 is defined or represented by sampling points 701 and 703, which corresponds to the left boundary of the shape in the target image area, and straight line 710 is defined or represented by sampling points 702 and 704, which corresponds to the right boundary of the shape in the target image area. From the intersection point of straight line 705 and straight line 710 (denoted as point M), draw the angle bisector 715 of the two straight lines. Draw perpendicular lines 720 and 725 of the two straight lines respectively, and the intersection point of perpendicular line 720 and the target image area is denoted as point T1, the intersection point of perpendicular line 725 and the target image area is denoted as point T2, and the intersection point of angle bisector 715 and the target image area is denoted as point Q. Fig. 7A The accurate distance field made by the shape of Figure 7B As shown, for the target point located between the corners QMT1, the distance field estimation of the straight line 705 can be used (that is, the straight line 705 is selected). For the target point located between the corners QMT2, the distance field estimation of the straight line 710 can be used, that is, the straight line 710 is selected. For the target point located between the corners T1MT2, the circular distance field estimation can be used, that is, the distance from the target point to the point M is the distance field value of the point.
[0075] For the scene of drawing shapes, especially text drawing, as long as it does not affect the distance field value of the main body of the shape, some errors in the distance value estimation of the external area have no effect. Figure 5B As described, the target image region is divided into two sub-regions using an angle bisector, and the target point in each sub-region can use the distance field estimation value of the closer straight line segment.
[0076] References Figure 5B , Fig. 7A and Figure 7B An example of a "sharp corner" case is described. Similarly, for Figure 5CIn the example in, a midline 550 that bisects the shape 545 can be drawn between the upper boundary line 546 and the lower boundary line 547 of the shape 545. Therefore, it can be determined that the target image region 540 includes two sub-regions, a sub-region in the target image region 540 that is located above the midline 550, and a sub-region in the target image region 540 that is located below the midline 550. Then, by the position of the target point, it is determined in which sub-region the target point is located, so that the line for the target point can be selected. For example, for a target point located in the upper sub-region, the upper boundary line 546 can be selected. For a target point located in the lower sub-region, the lower boundary line 547 can be selected.
[0077] Continue to refer Figure 6 In block 630, sampling points representing the selected line from the plurality of target sampling points are determined as a set of target sampling points. Figure 5B In the example of FIG. 5 , for a target point in a sub-region located on the left side of the angle bisector 515, a boundary line 526 represented by sampling points 530 and 532 is selected, and thus these sampling points 530 and 532 are determined as reference sampling points for the target point. For a target point in a sub-region located on the right side of the angle bisector 515, a boundary line 527 represented by sampling points 531 and 533 is selected, and thus the sampling points 531 and 533 are determined as reference sampling points for the target point.
[0078] exist Figure 5C In the example of , for the target point in the sub-area above the center line 550, the upper boundary line 546 represented by the sampling points 560 and 561 is selected, and the sampling points 560 and 561 are determined as the reference sampling points for the target point. For the target point in the sub-area below the center line 550, the lower boundary line 547 represented by the sampling points 562 and 563 is selected, and the sampling points 562 and 563 are determined as the reference sampling points for the target point.
[0079] The above describes how to determine a reference sampling point for a target point with reference to a plurality of figures and examples. Figure 4A At block 470 , a distance field value of a target point is determined based on corresponding distance field values and corresponding distance field changes of a set of target sampling points (ie, reference sampling points).
[0080] Since arcs are common in various shapes, strictly speaking, the distance field value of the target point can be determined based on the distance between the target point and the arc expressed by the reference sampling points. In some embodiments, a second-order Bezier curve composed of the distance field values and gradients of these reference sampling points can be determined. For example, if an arc is expressed by i sampling points, the arc can be represented by a second-order Bezier curve composed of the distance field values and gradients of these sampling points. The distance field value of the target point can be determined by the distance between the target point and the second-order Bezier curve.
[0081] In some embodiments, in order to further simplify the calculation, an approximate hybrid strategy of multiple straight-line distances may be sampled, for example, an inverse distance weighted (IDW) interpolation may be used. Specifically, the weights of the reference sampling points may be determined based on the distances of the reference sampling points from the target point. Then, the distance field value of the target point may be determined based on the weights, distance field values, and gradients of the reference sampling points.
[0082] As an example, if the line in the target image area is an arc, the distance field data around the arc can be restored by using a multiple linear distance approximation mixture. i ,... (i.e., reference sampling points) can be expressed as:
[0083]
[0084] where d p Represents the distance field value of point P, d i Represents the distance field value of the i-th sampling point, represents the gradient of the distance field at the i-th sampling point, It represents the inverse of the distance between the target point P and the sampling point i. represents the normalized weight based on the influence of sampling point i on the estimated distance value of target point P, Represents the estimate of the distance field value of the target point P based on the sampling point i.
[0085] Determining the distance field value of the target point in this way can transform the straight line estimates of multiple sampling points into a fused arc estimate. In this way, the distance field can be estimated in a simple and efficient way, and a high accuracy of the distance field estimation can be maintained.
[0086] The above reference FIG4 describes the use of gradient information of the distance field to estimate the distance field value of the target point, thereby drawing a shape. As mentioned above, a "degradation strategy" can be used to determine the target image area to be drawn using gradient information. An example of a degradation strategy is described below.
[0087] In some embodiments, if the number of the plurality of lines indicating the boundary of the target object in the sampling area (as described above with reference to block 610) does not exceed a predetermined number, the gradient information may be used for the sampling area. That is, the sampling area may be determined as the target image area. The predetermined number may be any suitable value, such as 2. That is, if the number of boundary lines included in the sampling area exceeds a predetermined number, the gradient information may not be used.
[0088] Alternatively or additionally, in some embodiments, if the distance field values of the multiple sampling points defining the sampling area are all less than a predetermined value, the gradient information may be used for the sampling area. That is, the sampling area may be determined as the target image area. If the distance field value of a certain sampling point is greater than the predetermined value, it means that there may be no boundary of the target object passing through the sampling area. In this case, the gradient information may not be used for the sampling area. The specific size of the predetermined value may depend on the shape of the sampling area and the form of the distance field. For example, in the case of a square sampling area and a directed distance field, the predetermined value may be 1.414. If the absolute value of the distance value of a sampling point in a certain sampling area is greater than 1.414, it means that there is no boundary of the target object passing through the sampling area, and other image rendering schemes, such as traditional schemes, may be considered.
[0089] Alternatively or additionally, in some embodiments, if the reference line bisecting the angle (as described above) is unique, the gradient information may be used for the sampling region, that is, the sampling region may be determined as the target image region. Figure 8 FIG. 4 is a schematic diagram showing a plurality of lines in a sampling area according to some embodiments of the present disclosure. Figure 8 As shown, in this example, the sampling area 801 includes two boundary lines of the target object, namely, line 810 and line 840. By bisecting the angle between line 810 and line 840 in the sampling area, two reference lines can be obtained, namely, reference line 820 and reference line 850. Since the reference lines in this example are not unique, the target points in the sampling area 801 may not be processed using gradient information.
[0090] In this embodiment, by adopting a degradation strategy, it is possible to ensure that gradient information is applied to a suitable sampling area to improve the visual effect.
[0091] In order to use gradient information to draw the target object, such as described with reference to FIG. 4, additional information needs to be determined. In some embodiments, in order to ensure drawing efficiency, this information can be predetermined and stored so that it can be used directly when drawing. The information that can be predetermined and stored can be information that does not depend on the target point P, such as but not limited to the distance field values and gradients of multiple sampling points, information related to multiple lines (e.g., determined in box 610), or information related to multiple sub-areas (e.g., determined in box 620). In some embodiments, it is necessary to draw the target object in multiple frames in the video. For example, such information can be determined in advance or when the target object is first drawn, and such information can be stored during the drawing process of the video. For example, such information can be cached. Thus, it is not necessary to calculate repeatedly in the drawing of each frame.
[0092] In some embodiments, information related to the above-mentioned degradation strategy can also be determined and stored. For example, it can be determined for which sampling areas need to use gradient information, and these sampling areas are marked. During the drawing process, method 400 is only performed on the sampling areas with the mark.
[0093] As an example, Fig. 9 1 shows example shapes drawn according to some embodiments of the present disclosure. Figure 2 In comparison, the originally missing parts can be drawn, thereby improving the visual effect.
[0094] Fig.10 A schematic structural block diagram of an apparatus 1000 for image drawing according to some embodiments of the present disclosure is shown. The apparatus 1000 may be implemented in an electronic device 110. Each module / component in the apparatus 1000 may be implemented by hardware, software, firmware or any combination thereof.
[0095] like Fig.10 As shown, the device 1000 includes an information acquisition module 1010, which is configured to acquire corresponding distance field information of multiple image areas in an image of a target object, each of the multiple image areas is defined by multiple sampling points, and the distance field information of the image area includes corresponding distance field values and distance field changes of the multiple sampling points relative to the target object. The device 1000 also includes a first determination module 1020, which is configured to determine a target image area among the multiple image areas based on the corresponding distance field information, and the boundary of the target object is at least partially located in the target image area. The device 1000 also includes a second determination module 1030, which is configured to determine the distance field value of the target point in the target image area relative to the target object based on the distance field information of the target image area. The device 1000 further includes a drawing module 1040, which is configured to draw the target image area on the display interface based on the distance field value of the target point.
[0096] In some embodiments, the target image area is defined by a plurality of target sampling points, and the second determination module 1030 is further configured to determine a group of target sampling points from the plurality of target sampling points; and determine the distance field value of the target point based on the corresponding distance field values and the corresponding distance field changes of the group of target sampling points.
[0097] In some embodiments, the second determination module 1030 is further configured to determine a plurality of lines indicating a boundary of the target object in the target image region, each line being represented by at least one sampling point from among the plurality of target sampling points; select a line from the plurality of lines based on a position of the target point in the target image region; and determine the sampling points representing the selected line from among the plurality of target sampling points as a set of target sampling points.
[0098] In some embodiments, the second determination module 1030 is further configured to group the multiple target sampling points based on the corresponding distance field changes of the multiple target sampling points to obtain multiple groups of target sampling points, wherein the difference between the corresponding distance field changes of the target sampling points in the same group is less than a threshold difference; and for each group of target sampling points in the multiple groups of target sampling points, determine a line indicating a boundary represented by the group of target sampling points as one of the multiple lines.
[0099] In some embodiments, the second determination module 1030 is also configured to divide the target image area into multiple sub-areas based on multiple lines, each sub-area including one line from the multiple lines; determine the sub-area where the target point is located from the multiple sub-areas based on the position of the target point in the target image area; and select a line from the multiple lines that is located in the determined sub-area.
[0100] In some embodiments, the multiple lines include a first straight line segment and a second straight line segment intersecting in the target image area, and a reference line that bisects the angle between the first straight line segment and the second straight line segment is determined; and based on the reference line, the target image area is divided into a first sub-area including the first straight line segment and a second sub-area including the second straight line segment.
[0101] In some embodiments, the target object is included in multiple frames of a video, and at least one of the following is stored during the rendering of the video: corresponding distance field values and corresponding distance field changes of multiple target sampling points, information related to multiple lines, or information related to multiple sub-regions.
[0102] In some embodiments, the second determination module 1030 is further configured to determine corresponding weights of a group of target sampling points based on corresponding distances between a group of target sampling points and the target point; and determine the distance field value of the target point based on the corresponding weights, corresponding distance field values, and corresponding distance field changes of the group of target sampling points.
[0103] In some embodiments, the second determination module 1030 is further configured to determine a group of target sampling points from the plurality of sampling points, including: in response to a difference between corresponding distance field changes of the plurality of sampling points being less than a threshold difference, determining the plurality of sampling points as a group of target sampling points.
[0104] In some embodiments, the second determination module 1030 is further configured to determine, for each image region among the multiple image regions, the image region as a target image region if corresponding distance field values of multiple sampling points defining the image region are all less than a predetermined value.
[0105] Fig.11 1 shows a block diagram of an electronic device 1100 in which one or more embodiments of the present disclosure may be implemented. It should be understood that Fig.11The electronic device 1100 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. Fig.11 The electronic device 1100 shown can be used to implement Figure 1 An electronic device 110.
[0106] like Fig.11 As shown, the electronic device 1100 is in the form of a general electronic device. The components of the electronic device 1100 may include, but are not limited to, one or more processors or processing units 1110, a memory 1120, a storage device 1130, one or more communication units 1140, one or more input devices 1150, and one or more output devices 1160. The processing unit 1110 may be an actual or virtual processor and is capable of performing various processes according to a program stored in the memory 1120. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the electronic device 1100.
[0107] The electronic device 1100 typically includes a plurality of computer storage media. Such media may be any accessible media that is accessible to the electronic device 1100, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 1120 may be a volatile memory (e.g., a register, a cache, a random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 1130 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data and may be accessed within the electronic device 1100.
[0108] The electronic device 1100 may further include additional removable / non-removable, volatile / non-volatile storage media. Fig.11 As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. Memory 1120 may include a computer program product 1125 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.
[0109] The communication unit 1140 implements communication with other electronic devices through a communication medium. Additionally, the functions of the components of the electronic device 1100 can be implemented in a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 1100 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0110] The input device 1150 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 1160 may be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 1100 may also communicate with one or more external devices (not shown) through the communication unit 1140 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 1100, or communicate with any device that allows the electronic device 1100 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).
[0111] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
[0112] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0113] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0114] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0115] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0116] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.
Claims
1. An image drawing method, comprising: Acquire corresponding distance field information of a plurality of image regions in an image of a target object, wherein each image region of the plurality of image regions is defined by a plurality of sampling points, and the distance field information of the image region includes corresponding distance field values and distance field changes of the plurality of sampling points relative to the target object; Based on the corresponding distance field information, determining a target image region among the multiple image regions, wherein a boundary of the target object is at least partially located within the target image region; Determining, based on the distance field information of the target image area, a distance field value of a target point in the target image area relative to the target object; as well as The target image area is drawn on a display interface based on the distance field value of the target point.
2. The method according to claim 1, wherein the target image area is defined by a plurality of target sampling points, and determining the distance field value of the target point relative to the target object comprises: determining a set of target sampling points from the plurality of target sampling points; as well as The distance field value of the target point is determined based on the corresponding distance field values and the corresponding distance field changes of the set of target sampling points.
3. The method according to claim 2, wherein determining the set of target sampling points from the plurality of target sampling points comprises: determining a plurality of lines indicating a boundary of the target object in the target image region, each line being represented by at least one sampling point of the plurality of target sampling points; selecting a line from the plurality of lines based on a position of the target point in the target image area; as well as The sampling points representing the selected line among the plurality of target sampling points are determined as the group of target sampling points.
4. The method of claim 3, wherein determining the plurality of lines comprises: Based on the corresponding distance field changes of the multiple target sampling points, the multiple target sampling points are grouped to obtain multiple groups of target sampling points, and the difference between the corresponding distance field changes of the target sampling points in the same group is less than a threshold difference; as well as For each group of target sampling points in the plurality of groups of target sampling points, a line indicating the boundary represented by the group of target sampling points is determined as one of the plurality of lines.
5. The method of claim 3, wherein selecting a line from the plurality of lines comprises: Based on the multiple lines, the target image area is divided into multiple sub-areas, each sub-area includes one line of the multiple lines; Based on the position of the target point in the target image area, determining the sub-area in which the target point is located from among the multiple sub-areas; and A line among the plurality of lines that is located in the determined sub-region is selected.
6. The method of claim 5, wherein the plurality of lines include a first straight line segment and a second straight line segment intersecting in the target image area, and determining a reference line that bisects the angle between the first straight line segment and the second straight line segment; and Based on the reference line, the target image area is divided into a first sub-area including the first straight line segment and a second sub-area including the second straight line segment.
7. The method of claim 6, wherein the target object is included in a plurality of frames of a video, and at least one of the following is stored during the rendering process of the video: The corresponding distance field values and corresponding distance field changes of the plurality of target sampling points, information relating to the plurality of lines, or Information related to the plurality of sub-regions.
8. The method of claim 2, wherein determining the distance field value of the target point based on the corresponding distance field values and the corresponding distance field changes of the set of target sampling points comprises: determining corresponding weights of the group of target sampling points based on corresponding distances between the group of target sampling points and the target point; as well as The distance field value of the target point is determined based on the corresponding weights, the corresponding distance field values and the corresponding distance field changes of the set of target sampling points.
9. The method according to claim 2, wherein determining the set of target sampling points from the plurality of sampling points comprises: In response to a difference between corresponding distance field changes of the plurality of sampling points being less than a threshold difference, the plurality of sampling points are determined as the set of target sampling points.
10. The method according to claim 1, wherein determining the target image area comprises: For each image region among the multiple image regions, if the corresponding distance field values of the multiple sampling points defining the image region are all smaller than a predetermined value, the image region is determined as the target image region.
11. A device for image rendering, comprising: an information acquisition module, configured to acquire corresponding distance field information of a plurality of image regions in an image of a target object, wherein each image region of the plurality of image regions is defined by a plurality of sampling points, and the distance field information of the image region includes corresponding distance field values and distance field changes of the plurality of sampling points relative to the target object; A first determining module is configured to determine a target image region among the multiple image regions based on the corresponding distance field information, wherein a boundary of the target object is at least partially located within the target image region; A second determination module is configured to determine a distance field value of a target point in the target image area relative to the target object based on the distance field information of the target image area; as well as A drawing module is configured to draw the target image area on a display interface based on the distance field value of the target point.
12. An electronic device comprising: at least one processing unit; as well as At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method according to any one of claims 1 to 10 when executed by the at least one processing unit.
13. A computer-readable storage medium having a computer program stored thereon, wherein the computer program can be executed by a processor to implement the method according to any one of claims 1 to 10.
