Painting object processing method and device, electronic equipment and storage medium
By detecting the user's box selection operation on the drawing image interface, automatically identifying and matching the elements and layers that constitute the target painting object, the problem of cumbersome and inaccurate operation of selecting painting objects in multiple layers is solved, and the selection efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202311604206.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-27
- Publication Date
- 2025-05-27
AI Technical Summary
In the multi-layer painting image interface, users need to find and select multiple painting elements that constitute the painting object one by one, resulting in cumbersome selection operations, low efficiency and poor accuracy.
By detecting the user's box selection operation on the drawing image interface, the target painting object in the target area is identified, and the target painting elements that constitute the target painting object and the target layer where it is located are automatically matched in multiple layers.
It realizes that when there are many layers and the target painting objects are complex, the elements and layers that constitute the target painting objects are quickly and accurately selected, improving the user experience.
Smart Images

Figure CN120045111A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of this specification relate to the technical field of terminals, and in particular, to a method, apparatus, electronic device, and storage medium for processing painting objects. Background Art
[0002] Currently, users can implement various functions based on electronic devices. For example, users can implement a painting function based on an electronic device. Usually, during the painting process, operations on a certain painting object are often involved. For example, a copy operation or a move operation on a certain painting object is performed. Before that, it is necessary to select the painting object. In fact, selecting the painting object is to select various painting elements that make up the painting object. And the various painting elements that make up the painting object are often distributed in multiple layers. This means that the user needs to search layer by layer for the layers where the above-mentioned various painting elements are located, and then select the corresponding painting elements in that layer. The above selection method has the following two problems: First, the selection operation process is relatively cumbersome, resulting in a low selection efficiency for selecting painting objects; Second, in the case of a large number of layers, the selection accuracy may be poor because the layers corresponding to all elements that make up the painting object cannot be found during the selection process. Summary of the Invention
[0003] Embodiments of this specification provide a method, apparatus, electronic device, and storage medium for processing painting objects, which can quickly and accurately select the target painting elements and their corresponding layers that make up the target painting object in the painting image interface, and improve the user experience.
[0004] In a first aspect, embodiments of this specification provide a method for processing a painting object, the method including:
[0005] Display a painting image interface, where the painting image interface includes a picture displayed by combining multiple layers;
[0006] Detect a user's box selection operation on a target area in the painting image interface;
[0007] In response to the box selection operation, identify the target painting object in the target area;
[0008] Select at least one target painting element corresponding to the target painting object and its corresponding target layer in the multiple layers.
[0009] In the embodiments of this specification, the painting image interface can be considered to include multiple painting objects. For each painting object, it may include multiple painting elements, and these multiple painting elements may be distributed in multiple layers. When it is detected that the user has selected a target area in the painting image interface and a target painting object is recognized from within this target area, it can be considered that the user currently intends to select this target painting object. On this basis, among the existing multiple layers, multiple target painting elements that make up the above-mentioned target painting object and the target layers where they are located can be automatically matched. That is to say, in the case of a large number of layers and a relatively complex selected target painting object, this method can quickly and accurately match the target painting elements that make up the target painting object and the layers where they are located, avoiding cumbersome operations by the user, improving the efficiency and accuracy when selecting the target painting object, and providing a better user experience.
[0010] Optionally, after detecting that the user has performed a box selection operation on the target area on the painting image interface, the method further includes:
[0011] Displaying a box selection operation identifier corresponding to the box selection operation on the painting image interface.
[0012] In the embodiments of this specification, after detecting that the user has performed a box selection operation on the target area on the painting image interface, the box selection operation identifier corresponding to the box selection operation can be prominently presented on this painting image interface, so as to facilitate the user to accurately judge whether the box selection operation has been successfully performed.
[0013] Optionally, the box selection operation identifier is a box selection trajectory identifier corresponding to the box selection operation.
[0014] In the embodiments of this specification, the box selection operation identifier presented on the painting image interface can be a box selection trajectory identifier, so as to accurately judge whether the box selection operation has been successfully performed through the formed box selection operation trajectory.
[0015] Optionally, the box selection trajectory identifier includes any one of the following:
[0016] When the box selection operation is a box selection based on a rectangular box, the box selection trajectory identifier is a rectangular trajectory identifier;
[0017] When the box selection operation is a box selection based on a circular box, the box selection trajectory identifier is a circular trajectory identifier;
[0018] When the box selection operation is a box selection based on an oval box, the box selection trajectory identifier is an oval trajectory identifier;
[0019] When the box selection operation is a box selection based on a triangular box, the box selection trajectory identifier is a triangular trajectory identifier.
[0020] In the embodiments of this specification, when a selection operation is performed through borders of different shapes, a trajectory of the corresponding shape will appear on the painting image interface. That is to say, borders of multiple shapes are supported to select a target painting object, and it is possible to determine whether the selection operation is successfully performed based on the shape of the presented trajectory.
[0021] Optionally, the selection trajectory identifier is the contour identifier of the target painting object.
[0022] In the embodiments of this specification, the selection trajectory identifier can also be the contour identifier of the target painting object. By displaying this contour identifier, the user can accurately determine whether the selection operation is successfully performed.
[0023] Optionally, after selecting at least one target painting element corresponding to the target painting object and the target layer where it is located from the multiple layers, the method further includes:
[0024] Differentially display the target layer and other layers in the multiple layers.
[0025] In the embodiments of this specification, the existing multiple layers can be divided into a target layer and other layers. The target layer is the layer containing the target painting elements that make up the target painting object, and the other layers are the layers that do not contain the target painting elements that make up the target painting object. By differentially displaying the target layer and other layers, that is, the target image and other layers are presented with different display effects, the user can effectively distinguish which are the target layers and which are the other layers when viewing.
[0026] Optionally, differentially displaying the target layer and other layers in the multiple layers includes:
[0027] Adjust the arrangement order of the target layer to the first M positions in the multiple layers, where M is equal to the number of target layers;
[0028] Differentially display the target layer located in the first M positions and the other layers.
[0029] In the embodiments of this specification, adjust the arrangement order of the target layer to the first M positions in the multiple layers, and differentially display the target layer after adjusting the sorting order and the other layers, so that the user can more centrally view the selected target layer.
[0030] Optionally, the method further includes:
[0031] In the target layer, display the selected target painting element.
[0032] In the embodiments of the present specification, for the selected target layer, the target painting elements selected in the target layer and used to form the target painting object can be displayed, so that the user can determine which of the target painting elements used to form the target painting object have been selected, and thus can timely determine whether there are unselected target painting elements.
[0033] Optionally, the target layer further includes other unselected painting elements. In the target layer, displaying the selected target painting elements includes:
[0034] In the target layer, differentially display the selected target painting elements and the unselected other painting elements.
[0035] In the embodiments of the present specification, when there are both target painting elements used to form the target painting object and other painting elements not used to form the target painting object in the target layer, the target painting elements and other painting elements are differentially displayed, that is, the target painting elements and other painting elements present different display effects, so that the user can determine which of the target painting elements used to form the target painting object have been selected, and thus can timely determine whether there are unselected target painting elements.
[0036] Optionally, the method further includes:
[0037] Based on the correspondence between the marquee operation and the painting object operation, determine the painting object operation corresponding to the marquee operation;
[0038] Apply the painting object operation corresponding to the marquee operation to the selected target painting object.
[0039] In the embodiments of the present specification, in the case where there are multiple types of marquee operations performed on the target area, different types of marquee operations can be associated with different painting object operations required to be performed after the target painting object in the target area is selected. On this basis, once a certain specific type of marquee operation is detected, after the above-mentioned target painting object is selected, the corresponding painting object operation will be automatically performed on the target painting object, without the user having to manually select the relevant operation required to be performed after the target painting object is selected, improving the efficiency of performing relevant operations on the target painting object.
[0040] Optionally, in response to the marquee operation, identifying the target painting object in the target area includes:
[0041] In response to the marquee operation, generate a to-be-identified image sample corresponding to the target area;
[0042] Input the image sample to be recognized into the painting object recognition model to recognize the target painting object.
[0043] In the embodiments of this specification, based on the pre-trained painting object recognition model, the target area selected by the user can be recognized, so as to more accurately recognize the target painting object in the target area, thereby improving the accuracy of subsequently selecting the target painting elements and the layers where they are located that constitute the target painting object.
[0044] Optionally, selecting at least one target painting element corresponding to the target painting object and the target layer where it is located from the multiple layers includes:
[0045] Obtain the overall contour area of the position where the target painting object is located, and the local contour areas of the positions where the painting elements included in each of the multiple layers are located. The overall contour area is used to indicate the closed area formed by the edges of the target painting object, and the local contour is used to indicate the closed area formed by the edges of the painting elements.
[0046] In response to the overall contour area including at least one target local contour area among the multiple local contour areas, select the at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from the multiple layers.
[0047] In the embodiments of this specification, by respectively obtaining the overall contour area of the position where the target painting object is located and the local contour areas of the positions where the painting elements included in each of the existing multiple layers are located, that is, obtaining an overall contour area of a specific position and multiple local contour areas of specific positions. If the overall contour area of the above specific position includes the target local contour area of a specific position among the multiple local contour areas, that is, the target local contour area is a part of the overall contour area, it can be relatively simply determined that the target painting element corresponding to the target local contour area is used to constitute the target painting object. On this basis, the above target painting elements and the target layer where they are located can be automatically selected, omitting the cumbersome manual search process, improving the efficiency and accuracy when selecting the target painting object, and making the user experience better.
[0048] Optionally, in response to the overall contour area including at least one target local contour area among the multiple local contour areas, selecting the at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from the multiple layers includes:
[0049] Determine whether the overall contour area includes the at least one target local contour area among the multiple local contour areas;
[0050] In response to the overall contour region including the at least one target local contour region, select the at least one target painting element corresponding to the at least one target local contour region and the target layer where the at least one target painting element is located from the multiple layers.
[0051] In the embodiments of this specification, after obtaining the overall contour region of the target painting object and the local contour regions of the painting elements included in each of the existing multiple layers, it is possible to determine whether the overall contour region includes each target local contour among the above-mentioned multiple local contours. Once it is determined that the overall contour region includes the target local contour region, the target painting element corresponding to the target local contour region and the target layer where it is located are quickly and accurately selected, which not only improves the search efficiency but also avoids omission of certain layers.
[0052] Optionally, obtaining the overall contour region of the position where the target painting object is located and the local contour regions of the painting elements included in each of the multiple layers includes:
[0053] Obtain the binary image of the target painting object and the binary images of the painting elements included in each layer. The binary image of the target painting object is used to indicate the overall contour region of the position where the target painting object is located, and the binary images of the painting elements included in each layer are used to indicate the local contour regions of the corresponding painting elements.
[0054] In the embodiments of this specification, when a target painting object is recognized in the target area of the painting image interface, on the one hand, a binary image corresponding to the target painting object is generated. That is, in this binary image, different pixel values (binary 0 and binary 1) are used to distinguish and represent the area where the target painting object is located in the painting image interface from other areas, so as to more accurately form the overall contour region of the position where the target painting object is located. On the other hand, binary images corresponding to the painting elements included in each layer can also be generated. That is, in this binary image, different pixel values (binary 0 and binary 1) are used to distinguish and represent the area where the painting elements are located in the layer from other areas, so as to more accurately form the local contour regions corresponding to the positions where the painting elements are located in the layer.
[0055] Optionally, the painting image interface has an alpha channel. Obtaining the overall contour region of the position where the target painting object is located and the local contour regions of the painting elements included in each of the multiple layers includes:
[0056] Obtain the binary mask corresponding to the transparency channel of the target painting object, and the binary masks corresponding to the transparency channels of the painting elements included in each layer. The binary mask corresponding to the transparency channel of the target painting object is used to indicate the overall contour area of the position where the target painting object is located, and the binary masks corresponding to the transparency channels of the painting elements included in each layer are used to indicate the local contour areas of the positions where the painting elements are located.
[0057] In the embodiments of this specification, if there is a transparency channel in the painting image interface and a target painting object is recognized in the target area of the painting image interface, on the one hand, the binary mask corresponding to the transparency channel of the target painting object can be obtained. That is, in this binary mask, different pixel values (binary 0 and binary 1) are used to distinguish and represent the area where the target painting object is located in the painting image interface from other areas in the painting image interface, so as to more accurately form the overall contour area of the position where the target painting object is located. On the other hand, the binary masks corresponding to the transparency channels of the painting elements included in each layer can also be obtained. In this binary mask, different pixel values (binary 0 and binary 1) are used to distinguish and represent the area where the painting element is located in the layer from other areas in the layer, so as to more accurately form the local contour areas of the positions where the painting elements in the layer are located.
[0058] Optionally, the binary image of the target painting object uses pixel points with a pixel value of binary 1 to represent the overall contour area of the position where the target painting object is located, and uses pixel points with a pixel value of binary 0 to represent other areas in the painting image interface except the overall contour area. In the binary image of the painting elements included in each layer, pixel points with a pixel value of binary 1 are used to represent the local contour area of the position where the painting element is located, and pixel points with a pixel value of binary 0 are used to represent other areas in the layer except the local contour area. Determining whether the overall contour area includes at least one target local contour area among the multiple local contour areas includes:
[0059] Perform an AND operation on the pixel values of the pixel points at the corresponding positions of the binary image of the target painting object and the binary images of the painting elements included in the target layer among the multiple layers to obtain an operation result image. Among them, when there are pixel points with a pixel value of binary 1 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel values in the operation result image are pixel points with a pixel value of binary 0, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0060] In the embodiments of this specification, when the binary images corresponding to the target painting object and the binary images corresponding to the painting elements included in each layer represent the target areas (i.e., the overall contour area where the target painting object is located and the local contour areas where the painting elements in the layer are located) based on the pixels with a pixel value of 1, and represent the background areas (i.e., the areas other than the overall contour area in the painting image interface and the areas other than the local contour areas in the layer) based on the pixels with a pixel value of 0, the binary image corresponding to the target painting object can be subjected to a pixel-by-pixel AND operation with the binary image corresponding to the painting elements included in the target layer to obtain an operation result image. When there are pixels with a pixel value of 1 in the operation result image, it indicates that there is a common part between the binary image corresponding to the target painting object and the binary image corresponding to the painting elements included in the target layer. At this time, it can be considered that the overall contour area represented by the binary image corresponding to the target painting object includes the target local contour area represented by the binary image corresponding to the painting elements included in the target layer. On the contrary, when all the pixels in the operation result image have a pixel value of 0, it indicates that there is no common part between the binary image corresponding to the target painting object and the binary image corresponding to the painting elements included in the target layer. At this time, it can be considered that the overall contour area represented by the binary image corresponding to the target painting object does not include the target local contour area represented by the binary image corresponding to the painting elements included in the target layer, so as to accurately determine which target local contour areas corresponding to the painting elements in which layers are included in the overall contour area where the target painting object is located.
[0061] The binary image of the target painting object represents the overall contour area where the target painting object is located through the pixels with a binary pixel value of 0, and represents the other areas in the painting image interface except the overall contour area through the pixels with a binary pixel value of 1. In the binary image of the painting elements included in each layer, the local contour area where the painting elements are located is represented through the pixels with a binary pixel value of 0, and the other areas in the layer except the local contour area are represented through the pixels with a binary pixel value of 1. Determining whether the overall contour area includes at least one target local contour area among the multiple local contour areas includes:
[0062] Perform an OR operation on the pixel values of the corresponding position pixel points of the binary image of the target painting object and the binary image of the painting elements included in the target layer among the multiple layers to obtain an operation result image. Wherein, when there are pixel points with a pixel value of binary 0 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel points in the operation result image have a pixel value of binary 1, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0063] In the embodiments of this specification, when the binary image corresponding to the target painting object and the binary images corresponding to the painting elements included in each layer are both based on the pixel points with a pixel value of 0 to represent the target area (that is, the overall contour area where the target painting object is located and the local contour area where the painting elements in the layer are located), and based on the pixel points with a pixel value of 1 to represent the background area (that is, the area other than the overall contour area in the painting image interface and the area other than the local contour area in the layer), the binary image corresponding to the target painting object can be subjected to a per-pixel OR operation with the binary image corresponding to the painting elements included in the target layer to obtain an operation result image. When there are pixel points with a pixel value of 0 in the operation result image, it indicates that there is a common part between the binary image corresponding to the target painting object and the binary image corresponding to the painting elements included in the target layer. At this time, it can be considered that the overall contour area represented by the binary image corresponding to the target painting object includes the target local contour area represented by the binary image corresponding to the painting elements included in the target layer. On the contrary, when all the pixel points in the operation result image have a pixel value of 1, it indicates that there is no common part between the binary image corresponding to the target painting object and the binary image corresponding to the painting elements included in the target layer. At this time, it can be considered that the overall contour area represented by the binary image corresponding to the target painting object does not include the target local contour area represented by the binary image corresponding to the painting elements included in the target layer, so as to accurately determine which target local contour areas corresponding to the painting elements in which layers are included in the overall contour area where the target painting object is located.
[0064] Optionally, the binary mask of the transparency channel of the target painting object represents the overall contour area of the position where the target painting object is located by pixel points with a binary value of 1, and represents other areas in the painting image interface except the overall contour area by pixel points with a binary value of 0. In the binary mask of each painting element included in each layer, the local contour area of the position where the painting element is located is represented by pixel points with a binary value of 1, and other areas in the layer except the local contour area are represented by pixel points with a binary value of 0. Determining whether the overall contour area includes at least one target local contour area among the multiple local contour areas includes:
[0065] Performing an AND operation on the pixel values of the pixel points at corresponding positions between the binary mask of the target painting object and the binary masks of the painting elements included in the target layer among the multiple layers to obtain an operation result image. When there are pixel points with a binary value of 1 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel values in the operation result image are pixel points with a binary value of 0, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0066] In the embodiments of this specification, when the binary mask corresponding to the transparency channel of the target painting object and the binary masks corresponding to the painting elements included in each layer both represent the target area (i.e., the overall contour area where the target painting object is located and the local contour areas where the elements in the layer are located) based on the pixels with a pixel value of 1, and represent the background area (i.e., the area other than the overall contour area in the painting image interface and the area other than the local contour area in the layer) based on the pixels with a pixel value of 0, the binary mask corresponding to the transparency channel of the target painting object can be subjected to a per-pixel AND operation with the binary mask corresponding to the transparency channel of the painting elements included in the target layer to obtain an operation result image. When there are pixels with a pixel value of 1 in the operation result image, it indicates that there is a common part between the binary mask corresponding to the transparency channel of the target painting object and the binary image corresponding to the transparency channel of the painting elements in the target layer. At this time, it can be considered that the overall contour area represented by the binary mask corresponding to the transparency channel of the target painting object includes the target local contour area represented by the binary mask corresponding to the transparency channel of the painting elements included in the target layer. Conversely, when all the pixels in the operation result image have a pixel value of 0, it indicates that there is no common part between the binary mask corresponding to the transparency channel of the target painting object and the binary mask corresponding to the transparency channel of the painting elements included in the target layer. At this time, it can be considered that the overall contour area represented by the binary mask corresponding to the transparency channel of the target painting object does not include the target local contour area represented by the binary mask corresponding to the transparency channel of the painting elements included in the target layer, so as to accurately determine which target local contour areas corresponding to the painting elements in which layers are included in the overall contour area where the target painting object is located.
[0067] Optionally, the binary mask of the transparency channel of the target painting object represents the overall contour area where the target painting object is located through the pixels with a binary pixel value of 0, and represents the other areas in the painting image interface other than the overall contour area through the pixels with a binary pixel value of 1. In the binary image of the painting elements included in each layer, the local contour area where the painting elements are located is represented through the pixels with a binary pixel value of 0, and the other areas in the layer other than the local contour area are represented through the pixels with a binary pixel value of 1. Determining whether the overall contour area includes at least one target local contour area among the multiple local contour areas includes:
[0068] Perform an OR operation on the pixel values of the corresponding position pixel points between the binary mask of the transparency channel of the target painting object and the binary mask of the transparency channel of the painting elements included in the target layer among the multiple layers, to obtain an operation result image. Among them, when there are pixel points with a pixel value of binary 0 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel points in the operation result image have a pixel value of binary 1, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0069] In the embodiments of this specification, when the binary masks corresponding to the transparency channels of the target painting object, and the binary masks corresponding to the painting elements included in each layer are both based on the pixel points with a pixel value of 0 to represent the target areas (that is, the overall contour area where the target painting object is located and the local contour area where the painting elements in the layer are located), and based on the pixel points with a pixel value of 1 to represent the background areas (that is, the areas other than the overall contour area in the painting image interface, and the areas other than the local contour area in the layer), the binary mask corresponding to the transparency channel of the target painting object can be subjected to a per-pixel OR operation with the binary mask corresponding to the transparency channel of the painting elements included in the target layer to obtain an operation result image. When there are pixel points with a pixel value of 0 in the operation result image, it indicates that there is a common part between the binary mask corresponding to the transparency channel of the target painting object and the binary image corresponding to the transparency channel of the painting elements included in the target layer. At this time, it can be considered that the overall contour area represented by the binary mask corresponding to the transparency channel of the target painting object includes the target local contour area represented by the binary mask corresponding to the transparency channel of the painting elements included in the target layer. On the contrary, when all the pixel points in the operation result image have a pixel value of 1, it indicates that there is no common part between the binary mask corresponding to the transparency channel of the target painting object and the binary mask corresponding to the transparency channel of the painting elements included in the target layer. At this time, it can be considered that the overall contour area represented by the binary mask corresponding to the transparency channel of the target painting object does not include the target local contour area represented by the binary mask corresponding to the transparency channel of the painting elements included in the target layer, so as to accurately determine which target local contour areas corresponding to the painting elements in which layers are included in the overall contour area where the target painting object is located.
[0070] In response to the overall contour area including the at least one target local contour area, selecting, from the multiple layers, the at least one target painting element corresponding to the at least one target local contour area and the target layer where the at least one target painting element is located, includes:
[0071] In response to the overall contour region including the at least one target local contour region, determine at least one target painting element identifier corresponding to the at least one target local contour region;
[0072] Select the at least one target painting element corresponding to the at least one target painting element identifier and the target layer where it is located from the multiple layers.
[0073] In the embodiments of this specification, when the overall contour region of the position where the target painting object is located includes the target local contour region corresponding to a certain painting element in the target layer, first, the painting element identifier corresponding to the above painting element can be determined, and then the above painting element and the layer where it is located can be accurately selected from the multiple layers according to the above painting element identifier.
[0074] In a second aspect, the embodiments of this specification provide a processing device for a painting object, and the device includes:
[0075] A display unit, configured to display a painting image interface, where the painting image interface includes a screen in which multiple layers are combined and displayed;
[0076] A detection unit, configured to detect a user's box selection operation on the target area on the painting image interface;
[0077] An identification unit, configured to identify the target painting object in the target area in response to the box selection operation;
[0078] A selection unit, configured to select at least one target painting element corresponding to the target painting object and the target layer where it is located from the multiple layers.
[0079] Optionally, the display unit is configured to:
[0080] Display a box selection operation identifier corresponding to the box selection operation on the painting image interface.
[0081] Optionally, the box selection operation identifier is a box selection trajectory identifier corresponding to the box selection operation.
[0082] Optionally, the box selection trajectory identifier includes any one of the following:
[0083] When the box selection operation is box selection based on a rectangular box, the box selection trajectory identifier is a rectangular trajectory identifier;
[0084] When the box selection operation is box selection based on a circular box, the box selection trajectory identifier is a circular trajectory identifier;
[0085] When the box selection operation is box selection based on an oval box, the box selection trajectory identifier is an oval trajectory identifier;
[0086] When the box selection operation is based on a triangular box for selection, the box selection trajectory identifier is a triangular trajectory identifier.
[0087] Optionally, the box selection trajectory identifier is the contour identifier of the target painting object.
[0088] Optionally, the display unit is further configured to:
[0089] Differentially display the target layer and other layers among the multiple layers.
[0090] Optionally, the display unit is specifically configured to:
[0091] Adjust the arrangement order of the target layer to the first M positions among the multiple layers, where M is equal to the number of target layers;
[0092] Differentially display the target layer located in the first M positions and the other layers
[0093] Optionally, the display unit is further configured to:
[0094] In the target layer, display the selected target painting elements.
[0095] Optionally, the target layer further includes other painting elements, and the display unit is specifically configured to:
[0096] In the target layer, differentially display the included target painting elements and the other painting elements.
[0097] Optionally, the device further includes:
[0098] A determination unit, configured to determine the painting object operation corresponding to the box selection operation based on the correspondence between the box selection operation and the painting object operation;
[0099] An operation unit, configured to apply the painting object operation corresponding to the box selection operation to the selected target painting object.
[0100] Optionally, the recognition unit is specifically configured to:
[0101] In response to the box selection operation, generate a to-be-recognized image sample corresponding to the target area;
[0102] Input the to-be-recognized image sample into a painting object recognition model to recognize the target painting object.
[0103] Optionally, the selection unit includes:
[0104] An outline acquisition unit that acquires an overall outline area of the position where the target painting object is located, and a local outline area of the position where each painting element included in each of the multiple layers is located. The overall outline area is used to indicate a closed area formed by the edges of the target painting object, and the local outline is used to indicate a closed area formed by the edges of the painting elements.
[0105] An element selection unit that, in response to the overall outline area including at least one target local outline area among the multiple local outline areas, selects the at least one target painting element corresponding to the at least one target local outline area and the target layer where it is located from the multiple layers.
[0106] Optionally, the element selection unit includes:
[0107] A determination subunit that determines whether the overall outline area includes the at least one target local outline area among the multiple local outline areas.
[0108] An element selection subunit that, in response to the overall outline area including the at least one target local outline area, selects the at least one target painting element corresponding to the at least one target local outline area and the target layer where it is located from the multiple layers.
[0109] Optionally, the outline acquisition unit is specifically configured to:
[0110] Acquire a binary image of the target painting object and binary images of the painting elements included in each layer. The binary image of the target painting object is used to indicate the overall outline area of the position where the target painting object is located, and the binary images of the painting elements included in each layer are used to indicate the local outline areas of the corresponding painting elements.
[0111] Optionally, the painting image interface has an alpha channel. The outline acquisition unit is specifically configured to:
[0112] Acquire a binary mask corresponding to the alpha channel of the target painting object and binary masks corresponding to the alpha channels of the painting elements included in each layer. The binary mask corresponding to the alpha channel of the target painting object is used to indicate the overall outline area of the position where the target painting object is located, and the binary masks corresponding to the alpha channels of the painting elements included in each layer are used to indicate the local outline areas of the positions where the painting elements are located.
[0113] Optionally, the binary image of the target painting object represents the overall contour area of the position where the target painting object is located through pixel points with a pixel value of binary 1, and represents other areas in the painting image interface except the overall contour area through pixel points with a pixel value of binary 0. In the binary image of the painting elements included in each layer, the local contour area of the position where the painting elements are located is represented through pixel points with a pixel value of binary 1, and other areas in the layer except the local contour area are represented through pixel points with a pixel value of binary 0. The determining subunit is specifically configured to:
[0114] Perform an AND operation on the pixel values of the pixel points at corresponding positions between the binary image of the target painting object and the binary images of the painting elements included in the target layer among the multiple layers to obtain an operation result image. When there are pixel points with a pixel value of binary 1 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel points in the operation result image have a pixel value of binary 0, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0115] Optionally, the binary image of the target painting object represents the overall contour area of the position where the target painting object is located through pixel points with a pixel value of binary 0, and represents other areas in the painting image interface except the overall contour area through pixel points with a pixel value of binary 1. In the binary image of the painting elements included in each layer, the local contour area of the position where the painting elements are located is represented through pixel points with a pixel value of binary 0, and other areas in the layer except the local contour area are represented through pixel points with a pixel value of binary 1. The determining subunit is specifically configured to:
[0116] Perform an AND operation on the pixel values of the pixel points at corresponding positions between the binary image of the target painting object and the binary images of the painting elements included in the target layer among the multiple layers to obtain an operation result image. When there are pixel points with a pixel value of binary 0 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel points in the operation result image have a pixel value of binary 1, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0117] Optionally, the binary mask of the transparency channel of the target painting object represents the overall contour area of the position where the target painting object is located by pixel points with a pixel value of binary 1, and represents other areas in the painting image interface except the overall contour area by pixel points with a pixel value of binary 0. In the binary mask of each painting element included in each layer, the local contour area of the position where the painting element is located is represented by pixel points with a pixel value of binary 1, and other areas in the layer except the local contour area are represented by pixel points with a pixel value of binary 0. The determining subunit is specifically configured to:
[0118] Perform an AND operation on the pixel values of the corresponding position pixel points of the binary mask of the target painting object and the binary mask of the painting elements included in the target layer among the multiple layers to obtain an operation result image. Among them, when there are pixel points with a pixel value of binary 1 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel values in the operation result image are pixel points with a pixel value of binary 0, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0119] Optionally, the binary mask of the transparency channel of the target painting object represents the overall contour area of the position where the target painting object is located by pixel points with a pixel value of binary 0, and represents other areas in the painting image interface except the overall contour area by pixel points with a pixel value of binary 1. In the binary image of each painting element included in each layer, the local contour area of the position where the painting element is located is represented by pixel points with a pixel value of binary 0, and other areas in the layer except the local contour area are represented by pixel points with a pixel value of binary 1. The determining subunit is specifically configured to:
[0120] Perform an AND operation on the pixel values of the corresponding position pixel points of the binary mask of the transparency channel of the target painting object and the binary mask of the transparency channel of the painting elements included in the target layer among the multiple layers to obtain an operation result image. Among them, when there are pixel points with a pixel value of binary 0 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel values in the operation result image are pixel points with a pixel value of binary 1, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0121] Optionally, the element selection subunit is specifically configured to:
[0122] In response to the overall contour region including the at least one target local contour region, determine at least one target painting element identifier corresponding to the at least one target local contour region;
[0123] Select the at least one target painting element corresponding to the at least one target painting element identifier and the target layer where it is located from the multiple layers.
[0124] In a third aspect, an embodiment of the present specification provides an electronic device, the electronic device includes a memory for storing computer program instructions and a processor for executing the program instructions. Wherein, when the computer program instructions are executed by the processor, the terminal is triggered to execute the steps of the method according to any one of the embodiments in the first aspect.
[0125] In a fourth aspect, an embodiment of the present specification provides a computer-readable storage medium, the computer-readable storage medium is used for storing computer instructions, and when the computer instructions are run on a computer, the computer is enabled to execute the steps of the method according to any one of the embodiments in the first aspect or the second aspect.
[0126] In a fifth aspect, an embodiment of the present specification provides a computer program product, the computer program product includes computer instructions, and when the computer instructions are run on a computer, the computer is enabled to execute the steps of the method according to any one of the embodiments in the first aspect or the second aspect.
[0127] It should be understood that the technical solutions of the second to fifth aspects of the embodiments of the present specification are consistent with those of the first aspect of the embodiments of the present specification, and the beneficial effects obtained by each aspect and the corresponding feasible implementation manners are similar, and will not be described in detail. Description of the Drawings
[0128] In order to more clearly illustrate the technical solutions of the embodiments of the present specification, the drawings required to be used in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0129] Figure 1 A schematic diagram of selecting a painting object in a traditional manner provided by an embodiment of the present specification;
[0130] Figure 2 A schematic diagram of the structure of an electronic device provided by an embodiment of the present specification;
[0131] Figure 3 A schematic diagram of the software structure of an electronic device provided by an embodiment of the present specification;
[0132] Figure 4Schematic flowchart of a method for processing a painting object provided by an embodiment of this specification;
[0133] Figure 5 Schematic flowchart of a method for displaying a marquee operation identifier provided by an embodiment of this specification;
[0134] Figure 6 Schematic diagram of a marquee trace identifier provided by an embodiment of this specification;
[0135] Figure 7 Another schematic diagram of a marquee trace identifier provided by an embodiment of this specification;
[0136] Figure 8 Schematic flowchart of a method for identifying a target painting object provided by an embodiment of this specification;
[0137] Figure 9 Schematic flowchart of a method for displaying a target layer provided by an embodiment of this specification;
[0138] Figure 10 Schematic diagram of differential display of a target layer and other layers based on brightness provided by an embodiment of this specification;
[0139] Figure 11 Schematic flowchart of a method for differential display of a target layer and other layers provided by an embodiment of this specification;
[0140] Figure 12 Another schematic diagram of differential display of a target layer and other layers based on brightness provided by an embodiment of this specification;
[0141] Figure 13 Schematic flowchart of a method for displaying painting elements provided by an embodiment of this specification;
[0142] Figure 14 Schematic diagram of displaying painting elements provided by an embodiment of this specification;
[0143] Figure 15 Schematic flowchart of a method for differential display of painting elements in the same layer provided by an embodiment of this specification;
[0144] Figure 16 Schematic diagram of differential display of painting elements in the same layer provided by an embodiment of this specification;
[0145] Figure 17 Schematic flowchart of a method for performing related operations on a target painting object provided by an embodiment of this specification;
[0146] Figure 18Schematic flowchart of a method for matching painting objects provided in an embodiment of this specification;
[0147] Figure 19 Schematic flowchart of a method for obtaining an overall contour region and a local contour region provided in an embodiment of this specification;
[0148] Figure 20 Schematic diagram of a binary image corresponding to a target painting object provided in an embodiment of this specification;
[0149] Figure 21 Schematic diagram of another binary image corresponding to a target painting object provided in an embodiment of this specification;
[0150] Figure 22 Schematic diagram of a binary image corresponding to a painting element provided in an embodiment of this specification;
[0151] Figure 23 Schematic diagram of another binary image corresponding to a painting element provided in an embodiment of this specification;
[0152] Figure 24 Schematic flowchart of another method for obtaining an overall contour region and a local contour region provided in an embodiment of this specification;
[0153] Figure 25 Schematic flowchart of a method for selecting a layer corresponding to a target painting object provided in an embodiment of this specification;
[0154] Figure 26 Schematic flowchart of a method for determining whether an overall contour region includes at least one target local contour region based on an AND operation provided in an embodiment of this specification;
[0155] Figure 27 Schematic flowchart of another method for determining whether an overall contour region includes a target local contour region based on an AND operation provided in an embodiment of this specification;
[0156] Figure 28 Schematic diagram of an AND operation provided in an embodiment of this specification;
[0157] Figure 29 Schematic flowchart of a method for determining whether an overall contour region includes a target local contour region based on an OR operation provided in an embodiment of this specification;
[0158] Figure 30 Schematic flowchart of another method for determining whether an overall contour region includes a target local contour region based on an OR operation provided in an embodiment of this specification;
[0159] Figure 31Schematic diagram of an OR operation provided by an embodiment of this specification;
[0160] Figure 32 Schematic flowchart of a method for selecting a painting element and its layer based on a painting element identifier provided by an embodiment of this specification;
[0161] Figure 33 Schematic structural diagram of a processing device for a painting object provided by an embodiment of this specification. Detailed implementation manners
[0162] To better understand the technical solutions of this specification, the embodiments of this specification will be described in detail below with reference to the accompanying drawings.
[0163] It should be clear that the described embodiments are only a part of the embodiments of this specification, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this specification without creative efforts shall fall within the scope of protection of this specification.
[0164] The terms used in the embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit this specification. The singular forms "a", "the" and "said" used in the embodiments of this specification and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.
[0165] The following explains the professional terms involved in the embodiments of this specification.
[0166] Binary image: A grayscale image (or color image) is converted into an image with only two colors, where one color represents the target object and the other color represents the background. In a binary image, each pixel has only two values, usually represented by binary 0 or binary 1, or can also be represented by two other different numbers.
[0167] Alpha channel: A channel in an image used to represent the transparency or opacity of each pixel. In an RGBA image, each pixel consists of four channels: red (R), green (G), blue (B), and alpha (A). The value range of the alpha channel is usually from 0 to 255, where 0 represents completely transparent and 255 represents completely opaque.
[0168] Mask: A matrix or image with the same size as the original image, where the element values are used to indicate whether the pixels at the corresponding positions are selected or masked. In image processing, a mask is usually a binary image (i.e., a binary mask), where the element values have only two values, usually 0 and 1. Non-zero elements in the mask indicate that the pixels at the corresponding positions are selected or masked (i.e., appear white), while zero elements indicate that the pixels at the corresponding positions are not selected or masked (i.e., appear black), or zero elements in the mask indicate that the pixels at the corresponding positions are selected or masked (i.e., appear black), while non-zero elements indicate that the pixels at the corresponding positions are not selected or masked (i.e., appear white).
[0169] Currently, users can implement various functions based on an electronic device. For example, users can implement a painting function based on an electronic device. Usually, during the painting process, relevant operations often need to be performed on a certain painting object in the painting image interface. For example, performing a moving operation or a copying operation on a certain painting object, etc. Before that, it is necessary to select the painting object to which the relevant operation is to be performed. In fact, selecting a painting object is equivalent to selecting the elements that make up the painting object, and the elements that make up the painting object are often distributed in multiple layers. Then, in order to select the painting object, it is necessary to search layer by layer in the existing layers, and then select the layers that contain the elements that make up the painting object, so as to achieve the selection of the painting object.
[0170] Please refer to Figure 1 , which is a schematic diagram of selecting a painting object in a traditional method provided by an embodiment of this specification. As Figure 1 shown, there are two painting objects in the painting image interface 10. The first painting object is a person 101, and the second painting object is a small grass 102. Among them, the person 101 is composed of a head element 1011, a hand element 1012, a body element 1013, and a foot element 1014, and the head element 1011, the hand element 1012, the body element 1013, and the foot element 1014 are located in different layers respectively; the small grass 102 is entirely located in the same layer. If the user wants to select the person 101, it is necessary to sequentially find the layer where the head element 1011 is located, the layer where the hand element 1012 is located, the layer where the body element is located, and the layer where the foot element is located, and select all of the head element 1011 and the layer where it is located, the hand element 1012 and the layer where it is located, the body element 1013 and the layer where it is located, and the foot element 1014 and the layer where it is located, so as to achieve the selection of the person 101.
[0171] The process of selecting a painting object described above mainly has the following two problems: First, it is necessary to manually search each existing layer one by one, and the operation process is rather cumbersome, resulting in low efficiency in selecting the painting object; Second, when the number of existing layers is large, some elements and their corresponding layers that constitute the painting object may be omitted due to negligence, resulting in poor accuracy in selecting the painting object.
[0172] In view of this, the embodiments of this specification provide a method for processing a painting object. In this method, the user selects a target area in the painting image interface by drawing a box around it. By doing so, the user can automatically match multiple target painting elements that constitute the target painting object and their corresponding target layers among multiple existing layers. That is to say, in the case of a large number of layers and a relatively complex target painting object to be selected, this method can quickly and accurately select the target painting elements that constitute the target painting object and their corresponding layers, avoiding cumbersome operations for the user, improving the efficiency and accuracy when selecting the target painting object, and providing a better user experience.
[0173] Please refer to Figure 2 , which is a schematic structural diagram of an electronic device provided by the embodiments of this specification. The painting layer processing method in the embodiments of this specification can be applied to the electronic device 20. For example, the electronic device 20 can be a smart phone, a tablet computer, a personal computer (PC), a personal digital assistant (PDA), a vehicle-mounted device, a robot, etc. There is no special limitation on the electronic device 20 here.
[0174] The electronic device 20 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0175] It can be understood that the structure illustrated in the embodiments of this specification does not constitute a specific limitation on the electronic device 20. In other embodiments of this specification, the electronic device 20 may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0176] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0177] The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
[0178] A memory can also be set in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can save the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the said memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0179] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0180] It can be understood that the interface connection relationships among the modules illustrated in the embodiments of this specification are only illustrative descriptions and do not constitute a structural limitation on the electronic device 20. In other embodiments of this specification, the electronic device 20 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0181] The charging management module 140 is used to receive a charging input from a charger. Among them, the charger can be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 can receive the charging input from the wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 can receive the wireless charging input through the wireless charging coil of the electronic device 20. While charging the battery 142, the charging management module 140 can also supply power to the electronic device 20 through the power management module 141.
[0182] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives the inputs from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, etc. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 can also be disposed in the same device.
[0183] The wireless communication function of the electronic device 20 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.
[0184] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 20 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 can be multiplexed as the diversity antenna of the wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0185] The mobile communication module 150 can provide solutions for wireless communications such as 2G / 3G / 4G / 5G applied to the electronic device 20. The mobile communication module 150 can include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves by the antenna 1, filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves through the antenna 1 and radiate it out. In some embodiments, at least some functional modules of the mobile communication module 150 can be disposed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 can be disposed in the same device.
[0186] In some embodiments, the electronic device 20 can establish a communication connection with the mobile communication network of the operator through the mobile communication module 150, and access the Internet through the mobile communication network.
[0187] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 20, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSSs), frequency modulation (FM), near field communication (NFC), infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive signals to be sent from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.
[0188] In some embodiments, the electronic device 20 may establish a communication connection with the Internet through the wireless communication module 160 to access the Internet.
[0189] In some embodiments, the antenna 1 of the electronic device 20 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 20 can communicate with the network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).
[0190] The electronic device 20 implements the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is used to execute mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change the display information.
[0191] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 20 may include one or N display screens 194, where N is a positive integer greater than 1.
[0192] The electronic device 20 can implement the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.
[0193] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera photosensitive element. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0194] The camera 193 is used to capture static images or videos. An object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in standard RGB, YUV, etc. formats. In some embodiments, the electronic device 20 may include one or N cameras 193, where N is a positive integer greater than 1.
[0195] The digital signal processor is used to process digital signals. Besides being able to process digital image signals, it can also process other digital signals. For example, when the electronic device 20 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.
[0196] The video codec is used to compress or decompress digital videos. The electronic device 20 can support one or more video codecs. In this way, the electronic device 20 can play or record videos in multiple coding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0197] The NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between human brain neurons, it can quickly process the input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device 20 can be realized, such as: image recognition, face recognition, voice recognition, text understanding, etc.
[0198] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 20. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.
[0199] The internal memory 121 can be used to store computer-executable program code, and the executable program code includes instructions. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, image playback function, etc.). The data storage area can store the data created during the use of the electronic device 20 (such as audio data, phone book, etc.). In addition, the internal memory 121 can include high-speed random access memory and can also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 20 by running the instructions stored in the internal memory 121 and / or the instructions stored in the memory provided in the processor.
[0200] The electronic device 20 can implement audio functions through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and the application processor, etc. For example, music playback, recording, etc.
[0201] The touch sensor 180K, also referred to as a "touch control device". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 together form a touch screen, also referred to as a "touch control screen". The touch sensor 180K is used to detect touch operations acting thereon or in its vicinity. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 20, at a position different from that of the display screen 194.
[0202] In some embodiments, the electronic device can implement the display of a painting image interface through a GPU, a display screen 194, and a processor 110. The painting image interface can include multiple painting objects, and the above-mentioned painting data is stored in the internal memory 121. When the touch sensor 180K detects a user's box selection operation on the target area in the painting image interface, the detected box selection operation can be transmitted to the processor 110. The processor 110 can obtain the painting data from the internal memory 121, identify the target painting object within the target area according to the position of the box selection operation, and then obtain the overall contour area of the position where the target painting object is located. For example, a binary image corresponding to the target painting object is generated (or a binary mask of the transparency channel of the target painting object is obtained), and the local contour areas of the positions where the painting elements included in each existing layer are located. For example, a binary image corresponding to the painting elements included in each layer is generated (or a binary mask of the transparency channel of the painting elements included in each layer). Among them, the binary image corresponding to the target painting object (or the binary mask of the transparency channel of the target painting object obtained) can be used to indicate the overall contour area of the position where the target painting object is located, and the binary image corresponding to the painting elements included in each layer (or the binary mask of the transparency channel of the painting elements included in each layer) is used to indicate the local overall contour of the position where the included painting elements are located. If the processor 110 determines that the corresponding position pixels between the binary image corresponding to the target painting object (or the binary mask of the transparency channel of the target painting object obtained) and the binary image corresponding to the painting elements included in the target layer (or the binary mask of the transparency channel of the painting elements included in the target layer) are subjected to an AND operation to obtain an operation result image. When the above binary image (or binary mask) uses pixel points with a binary value of 1 to represent the overall contour area and the local contour area, and there are pixel points with a binary value of 1 in the operation result image, the above painting elements and the target layer where they are located are selected; or, if the processor 110 determines that the corresponding position pixels between the binary image corresponding to the target painting object (or the binary mask of the transparency channel of the target painting object obtained) and the binary image corresponding to the target layer (or the binary mask of the transparency channel of the painting elements included in the target layer) are subjected to an OR operation to obtain an operation result image. When the above binary image (or binary mask) uses pixel points with a binary value of 0 to represent the overall contour area and the local contour area, and there are pixel points with a binary value of 0 in the operation result image, the above painting elements and the target layer where they are located are selected. On this basis, the selection effect after all the elements and the layers that make up the target painting object are selected is displayed through the display screen 194 and the GPU.
[0203] The software system of the electronic device 20 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present invention, taking the Android system with a layered architecture as an example, the software structure of the electronic device 20 is illustratively described.
[0204] Figure 3 It is a schematic diagram of the software structure of the electronic device 20 according to the embodiments of the present invention.
[0205] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0206] The application layer may include a series of application packages.
[0207] As Figure 3 shown, the application packages may include applications such as a camera, a gallery, a calendar, a call, a map, a painting application, WLAN, Bluetooth, music, video, short message, a browser, etc. (only some are shown in the figure). Among them, most of these applications need to access the Internet. For example, navigation, browser, video, music, etc.
[0208] In some embodiments, after the painting application detects that the user has selected a target area in the painting image interface, it can identify the target area. If a target painting object is identified from the target area, it can then obtain the overall contour area of the location where the target painting object is located. For example, a binary image corresponding to the target painting object (or a binary mask of the transparency channel of the target painting object) is generated, as well as the local contour areas of the locations where the painting elements included in each existing layer are located. For example, a binary image corresponding to the painting elements included in each layer (or a binary mask of the transparency channel of the painting elements included in each layer) is generated. Among them, the binary image corresponding to the target painting object (or the binary mask of the transparency channel of the target painting object) can be used to indicate the overall contour area of the location where the target painting object is located, and the binary image corresponding to the painting elements included in each layer (or the binary mask of the transparency channel of the painting elements included in each layer) is used to indicate the local overall contour of the location where the included painting elements are located. Then, the painting application performs an AND operation on the corresponding position pixels between the binary image corresponding to the target painting object (or the binary mask of the transparency channel of the target painting object) and the binary image corresponding to the painting elements included in the target layer (or the binary mask of the transparency channel of the painting elements included in each layer) to obtain an operation result image. When the above binary image (or binary mask) uses pixel points with a binary value of 1 to represent the overall contour area and the local contour area, once there is a pixel point with a binary value of 1 in the operation result image, the painting element identifier of the painting element is passed to the application framework layer. Alternatively, the painting application performs an OR operation on the corresponding position pixels between the binary image corresponding to the target painting object (or the binary mask of the transparency channel of the target painting object) and the binary image corresponding to the painting elements included in the target layer (or the binary mask of the transparency channel of the painting elements included in the target layer) to obtain an operation result image. When the above binary image (or binary mask) uses pixel points with a binary value of 0 to represent the overall contour area and the local contour area, once there is a pixel point with a binary value of 0 in the operation result image, the painting element identifier of the painting element is passed to the application framework layer.
[0209] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.
[0210] The application framework layer may also include a window manager, a content provider, a view system, a telephone manager, a resource manager, a notification manager, etc.
[0211] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0212] The content provider is used to store and obtain data, and make this data accessible to application programs. The data may include control panel data, videos, images, audio, incoming and outgoing calls, browsing history and bookmarks, phone books, etc.
[0213] In some embodiments, after receiving the painting element identifier, the window manager and the content provider in the application framework layer can select the painting element corresponding to the painting element identifier and the layer where it is located, and present the visual effect that the painting element and the layer where it is located are selected on the painting image interface.
[0214] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build application programs. The display interface can be composed of one or more views. For example, the display interface of the control panel can include a view for displaying text and a view for displaying pictures.
[0215] The phone manager is used to provide the communication function of the electronic device 20. For example, the management of call status (including answering, hanging up, etc.).
[0216] The resource manager provides various resources for application programs, such as localized strings, icons, pictures, layout files, video files, and so on.
[0217] The notification manager enables application programs to display notification information in the status bar. It can be used to convey notification-type messages, which can automatically disappear after a short stay without user interaction. For example, the notification manager is used to inform that the download is completed, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as the notification of a background-running application program, and can also be a notification that appears on the screen in the form of a dialogue window. For example, prompting text information in the status bar, emitting a prompt sound, the electronic device vibrating, the indicator light flashing, etc.
[0218] Android Runtime includes a core library and a virtual machine. Android runtime is responsible for the scheduling and management of the Android system.
[0219] The core library consists of two parts: one part is the functional functions that need to be called by the Java language, and the other part is the core library of Android.
[0220] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0221] The system library can include multiple functional modules. For example: Surface Manager, Media Libraries, 3D graphics processing library (e.g., OpenGL ES), 2D graphics engine (e.g., SGL), etc.
[0222] The Surface Manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
[0223] The Media Libraries support the playback and recording of multiple common audio and video formats, as well as static image files, etc. The Media Libraries can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0224] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.
[0225] The 2D graphics engine is the drawing engine for 2D drawing.
[0226] The kernel layer is the layer between hardware and software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.
[0227] The following introduces the technical solutions provided in the embodiments of this specification in conjunction with the accompanying drawings. The technical solutions involved in the following embodiments can all be implemented in an electronic device with the hardware architecture as shown in Figure 2 and the software architecture as shown in Figure 3 .
[0228] Please refer to Figure 4 , which is a schematic flowchart of a method for processing a painting object provided in the embodiments of this specification. The process of this method is described as follows:
[0229] Step 201: Display the painting image interface.
[0230] In the embodiments of this specification, during the drawing process, the user will draw different drawing elements in multiple layers, that is, each layer includes at least one drawing element. By combining and displaying these multiple layers, the effect of displaying the drawing image interface can be achieved. The displayed drawing image interface may include multiple drawing objects. For example, the multiple drawing objects may include animals, people, mountains, rivers, buildings, etc. In this specification, the types of these multiple drawing objects are not particularly limited.
[0231] Step 202: Detect that the user performs a selection operation on the target area on the drawing image interface.
[0232] In the embodiments of this specification, when there are multiple drawing objects on the drawing image interface, if the user wants to select a target drawing object among the multiple drawing objects, the user can perform a selection operation on the target area on the drawing image interface. It should be understood that the target area here is an area that can cover the target drawing object, and the specific size and shape of the target area are not particularly limited here. At the same time, the selection operation here is used to trigger the selection of the target drawing object that may exist in the target area, and the selection operation itself cannot directly play the role of selecting the target drawing object that may exist in the target area.
[0233] In some embodiments, after the user performs a selection operation on the target area, the performed selection operation can be visually presented so that the user can determine whether the selection operation is successfully performed.
[0234] Please refer to Figure 5 , which is a schematic flowchart of a method for displaying a selection operation identifier provided by the embodiments of this specification. After executing step 202, step 301 can also be continued:
[0235] Step 301: Display a selection operation identifier corresponding to the selection operation on the drawing image interface.
[0236] In the embodiments of this specification, the selection operation identifier can be used to indicate whether the user has performed a selection operation on the target area. The selection operation identifier can be related to the selection operation process. For example, the selection operation identifier can be a selection trace identifier. Of course, the selection operation identifier can also be unrelated to the selection operation. For example, the selection operation identifier √ is used to indicate that the user has performed a selection operation on the target area.
[0237] The following will detail the case where the selection operation identifier is a selection trace identifier.
[0238] Case 1: The selection trace identifier is a trace identifier corresponding to a regular shape.
[0239] Please refer to Figure 6, A schematic diagram of a selection trace identifier provided in an embodiment of this specification. As Figure 6 shown in (a), when performing a selection operation on a target area based on a rectangular frame, the selection trace identifier is a rectangular trace identifier. It should be understood that when the above rectangular trace identifier is incomplete (i.e., does not form a closed rectangle), it indicates that the selection operation fails; as Figure 6 shown in (b), when performing a selection operation on a target area based on a circular frame, the selection trace identifier is a circular trace identifier. It should be understood that when the above circular trace identifier is incomplete (i.e., does not form a closed circle), it indicates that the selection operation fails; as Figure 6 shown in (c), when performing a selection operation on a target area based on a triangular frame, the selection trace identifier is a triangular trace identifier. It should be understood that when the above triangular trace identifier is incomplete (i.e., does not form a closed triangle), it indicates that the selection operation fails; as Figure 6 shown in (d), when performing a selection operation on a target area based on an oval frame, the selection trace identifier is an oval trace identifier. It should be understood that when the above oval trace identifier is incomplete (i.e., does not form a closed oval), it indicates that the selection operation fails.
[0240] It should be understood that in the above embodiment, the target area is the closed area formed by the above selection trace identifier (rectangular trace identifier, circular trace identifier, triangular trace identifier, or oval trace identifier). At this time, the target area includes the area where the target painting object is located.
[0241] Case 2: The selection trace identifier is the trace identifier corresponding to an irregular shape.
[0242] Please refer to Figure 7 , Another schematic diagram of a selection trace identifier provided in an embodiment of this specification. As Figure 7 shown, when performing a selection operation along the edge of the target painting object (a person), the selection trace identifier is the contour identifier of the target painting object (a person). It should be understood that when the above contour identifier is incomplete (i.e., does not form a closed contour curve), it indicates that the selection operation fails.
[0243] It should be understood that in the above embodiment, the target area is the closed area formed by the contour identifier. At this time, the target area is equivalent to the area where the target painting object is located. Step 203: In response to the selection operation, identify the target painting object in the target area.
[0244] In the embodiments of this specification, after the user performs a selection operation on a target area in the drawing image interface, the electronic device can determine that the user wants to select a certain drawing object that may exist in the target area. On this basis, the electronic device can identify the target area to obtain the target drawing object in the target area, where the area where the target drawing object is located is the area actually required by the user to select (i.e., SelectArea).
[0245] Please refer to Figure 8 , which is a schematic flowchart of a method for identifying a target drawing object provided by the embodiments of this specification. Step 203 can be specifically implemented by executing sub-steps 2031 to 2032:
[0246] Step 2031: In response to the selection operation, generate a to-be-identified image sample corresponding to the target area.
[0247] Step 2032: Input the to-be-identified image sample into the drawing object recognition model to identify the target drawing object.
[0248] In the embodiments of this specification, the drawing object recognition model can be considered to be trained based on a large number of drawing image samples. For example, the drawing object recognition model can be a convolutional neural network model (CNN), a Visual Geometry Group (VGG), a Residual Network (ResNet), an EfficientNet, etc. There is no special limitation on the drawing object recognition model here. By generating a to-be-identified image sample from the target area selected by the user and inputting it into the above-mentioned drawing object recognition model, the "intelligent selection area" function can be realized, that is, the area where the target drawing object is located can be identified from the to-be-identified image sample.
[0249] Step 204: Select at least one target drawing element corresponding to the target drawing object and the target layer where it is located from multiple layers.
[0250] In the embodiments of this specification, in the existing multiple layers, each layer includes at least one drawing element, so the multiple layers can be considered to include multiple drawing elements. Among these multiple drawing elements, some drawing elements are used to form the target drawing object, while other drawing elements are not used to form the target drawing object. Then, after the target drawing object is identified from the target area, at least one target drawing element used to form the target drawing object can be automatically matched from the above-mentioned multiple drawing elements, and the at least one target drawing element and the target layer where it is located are selected, so as to achieve the purpose of selecting the target drawing object.
[0251] In some embodiments, in the case of multiple layers, the selected target layer and the other unselected layers can be represented in different ways, so that when the user views, they can effectively distinguish which are the selected target layers.
[0252] Please refer to Figure 9 , which is a schematic flowchart of a method for displaying a target layer provided in an embodiment of this specification. After step 204 is executed, step 302 can also be continued:
[0253] Step 302: Differentially display the target layer and other layers among multiple layers.
[0254] In the embodiments of this specification, the difference in displaying the target layer and other layers can be mainly reflected by different brightness, or a combination of dynamic / static methods, etc. There is no special limitation on the specific method of differential display here.
[0255] Please refer to Figure 10 , which is a schematic diagram of differentially displaying a target layer and other layers based on brightness provided in an embodiment of this specification. As Figure 10 shown, the target drawing object (Person 101) includes a head element 1011, a hand element 1012, a body element 1013, and a foot element 1014. The head element 1011 is located in layer 1, the hand element is located in layer 5, the body element is located in layer 3, and the foot element is located in layer 4. Then the target layers (layer 1, layer 3, layer 4, and layer 5) can be displayed in a highlighted manner, while other layers (layer 2) that do not contain any drawing elements of Person 101 are displayed in a low-brightness manner.
[0256] In some embodiments, when the number of existing layers is large, if the arrangement order of the target layers is relatively scattered, it is not conducive to the user to view the selected target layers. Therefore, in the embodiments of this specification, the arrangement position of the target layers can be adjusted to a more prominent position so that the user can more conveniently view the selected target layers.
[0257] Please refer to Figure 11 , which is a schematic flowchart of a method for differentially displaying a target layer and other layers provided in an embodiment of this specification. Step 302 can be specifically implemented by executing sub-steps 3021 to 3022:
[0258] Step 3021: Adjust the arrangement order of the target layers to the first M positions among multiple layers.
[0259] In the embodiments of this specification, M is the number of target layers. That is to say, regardless of the original position of the target layers among multiple layers, during the rearrangement process, the first M positions will be reserved according to the number of target layers. These M positions are used to arrange the target layers, and other layers are arranged behind.
[0260] Step 3022: Differentially display the target layers located in the first M positions and other layers.
[0261] In the embodiments of this specification, after reordering, the first M target layers can be displayed differently from other layers, so that users can quickly view the selected target layers.
[0262] Please refer to Figure 12 , which is another schematic diagram provided by the embodiments of this specification for differentially displaying the target layer and other layers based on brightness. As Figure 12 shown, the target painting object (Person 101) includes a head element 1011, a hand element 1012, a body element 1013, and a foot element 1014. The head element 1011 is located on layer 1, the hand element is located on layer 5, the body element is located on layer 3, and the foot element is located on layer 4. Then, the arrangement order of the target layers (layer 1, layer 3, layer 4, and layer 5) is adjusted to the first four positions and displayed in a highlighted manner, while the arrangement order of the other layers (layer 2) that do not include any painting elements of Person 101 is adjusted to the last position and displayed in a low-light manner. Thus, in the case where users can effectively distinguish the target layers from other layers, they can quickly view the target layers arranged in the front.
[0263] In some embodiments, in addition to prominently displaying the target layer, the painting elements that make up the target painting object in the target layer can also be prominently displayed, so that users can determine which of the target painting elements used to form the target painting object have been selected, and thus can timely determine whether there are unselected target painting elements.
[0264] Please refer to Figure 13 , which is a schematic flowchart of a method for displaying painting elements provided by the embodiments of this specification. After step 302 is executed, step 303 can be continued:
[0265] Step 303: In the target layer, display the selected target painting elements.
[0266] Please refer to Figure 14 , which is a schematic diagram for displaying painting elements provided by the embodiments of this specification. As Figure 14As shown, the target painting object (Person 101) includes a head element 1011, a hand element 1012, a body element 1013, and a foot element 1014. The head element 1011 is located on layer 1, the hand element is located on layer 5, the body element is located on layer 3, and the foot element is located on layer 4. Then, while highlighting the target layers (layer 1, layer 3, layer 4, and layer 5), the head element 1011 located on layer 1, the body element 1013 located on layer 3, the foot element 1014 located on layer 4, and the hand element 1012 located on layer 5 are also highlighted. Other layers (layer 2) that do not contain any painting elements of Person 101 and the unselected grass element 102 in layer 2 are dimmed, so that the user can effectively distinguish the target layers from other layers and can quickly view which painting elements that make up Person 101 have been selected, thereby determining whether there are any unselected painting elements among the painting elements that make up Person 101.
[0267] In some embodiments, in addition to the target painting elements used to form the target painting object, the target layer may also include other elements. In the embodiments of this specification, in the same target layer, different display methods may be adopted for different painting elements based on whether they form the target painting object.
[0268] Please refer to Figure 15 , which is a schematic flowchart of a method for differentially displaying painting elements in the same layer provided by the embodiments of this specification. Step 303 can be specifically implemented by executing sub-step 3031:
[0269] Step 3031: Differentially display the selected target painting elements and other unselected painting elements in the target layer.
[0270] In the embodiments of this specification, when there are both target painting elements used to form the target painting object and other painting elements that do not form the target painting object in the target layer, the target painting elements and other painting elements are differentially displayed, that is, the target painting elements and other painting elements present different display effects, so that the user can determine which of the target painting elements used to form the target painting object have been selected, thereby timely determining whether there are any unselected target painting elements.
[0271] Please refer to Figure 16 , which is a schematic diagram of differentially displaying painting elements in the same layer provided by the embodiments of this specification. As Figure 15As shown, the target painting object (Person 101) includes a head element 1011, a hand element 1012, a body element 1013, and a foot element 1014. The head element 1011 is located on layer 1, the hand element is located on layer 5, the body element is located on layer 3, and the foot element is located on layer 4. Then, while highlighting the target layers (layer 1, layer 3, layer 4, and layer 5), the head element 1011 located on layer 1, the body element 1013 located on layer 3, the foot element 1014 located on layer 4, and the hand element 1012 located on layer 5 are also highlighted. Other layers (layer 2) that do not contain any painting elements of Person 101 and the grass element 102 not selected in layer 2 are dimmed. At the same time, the star element 103 located on layer 1 but not used to form the target painting object (Person 101) is also dimmed. Thus, when the user can effectively distinguish the target layers from other layers, they can also quickly view which painting elements that make up Person 101 have been selected, so as to determine whether there are any unselected painting elements among the painting elements that make up Person 101.
[0272] In some embodiments, after the user selects a target painting object in the painting image interface, they may need to manually select the corresponding operation option to trigger the implementation of relevant operations on the selected target painting object, resulting in low efficiency in implementing relevant operations on the target painting object.
[0273] Please refer to Figure 17 , which is a schematic flowchart of a method for implementing relevant operations on a target painting object provided by an embodiment of this specification. After step 204 is executed, steps 205 to 206 can also be executed:
[0274] Step 205: Based on the correspondence between the marquee operation and the painting object operation, determine the painting object operation corresponding to the marquee operation.
[0275] Step 206: Apply the painting object operation corresponding to the marquee operation to the selected target painting object.
[0276] In the embodiments of this specification, since there are multiple types of selection operations, different selection operations can be established in one-to-one correspondence with different painting object operations after the target painting object is selected. For example, when the selection operation is to select the target painting object based on a rectangular frame, the corresponding painting object operation is a copy operation; or, when the selection operation is to select the target painting object based on an oval frame, the corresponding painting object operation is a move operation; when the selection operation is to select the target painting object based on a triangular frame, the corresponding painting object operation is a mirror symmetry operation. Then, when the user triggers the selection of the target painting object based on the selection operation, the corresponding painting object operation of the selection operation can be automatically implemented on the selected target painting object, so that the user does not need to manually select the relevant operations to be implemented after the target painting object is selected, and the efficiency of performing relevant operations on the target painting object is improved.
[0277] Next, how to match the target painting element corresponding to the target painting object and the target layer where it is located will be described in detail.
[0278] Please refer to Figure 18 , which is a schematic flowchart of a method for matching painting objects provided in the embodiments of this specification. Step 204 can be specifically implemented through sub-steps 2041 to 2042:
[0279] Step 2041: Obtain the overall contour area of the position where the target painting object is located, and the local contour areas of the positions where the painting elements included in each of the multiple layers are located.
[0280] In the embodiments of this specification, after detecting the target painting object within the target area selected by the user, the electronic device can know that the user's intention is to select the target painting object. At this time, on the one hand, the electronic device can determine the overall contour area of the position where the target painting object is located. Here, the overall contour area is used to indicate the closed area formed by the edges of the target painting object. On the other hand, the electronic device can determine the local contour areas of the positions where the painting elements included in each of the existing multiple layers are located. Here, the local contour area is used to indicate the closed area formed by the edges of the painting elements, that is, to determine an overall contour area of the position where a target painting object is located, and local contour areas of the positions where multiple painting elements are located.
[0281] Next, how to obtain the overall contour area of the position where the target painting object is located, and the local contour areas of the positions where the elements included in each layer are located will be described in detail.
[0282] Please refer to Figure 19 , which is a schematic flowchart of a method for obtaining the overall contour area and local contour areas provided in the embodiments of this specification.
[0283] Step 2041 can be specifically implemented by executing sub-step 401:
[0284] Sub-step 401: Obtain the binary image of the target painting object and the binary images of the painting elements included in each layer.
[0285] In the embodiments of this specification, when a target painting object is recognized in the target area of the painting image interface, a binary image corresponding to the target painting object and binary images corresponding to the painting elements included in each layer are generated. It should be understood that the process of generating the binary image of the target painting object is similar to the process of generating the binary images of the painting elements included in the layer. In both cases, the original color image is first converted into a grayscale image, and then an appropriate threshold is selected. The pixel points in the grayscale image with a grayscale value greater than the threshold are set to white (i.e., the pixel value is binary 1), and the pixel points with a grayscale value less than the threshold are set to black (i.e., the pixel value is binary 0); or the pixel points in the grayscale image with a grayscale value greater than the threshold are set to black (i.e., the pixel value is binary 0), and the pixel points with a grayscale value less than the threshold are set to white (i.e., the pixel value is binary 1). The above threshold can be set according to the actual situation and is not particularly limited in this specification.
[0286] For the binary image corresponding to the target painting object, it can be used to indicate the overall contour area of the position where the target painting object is located. For example, as Figure 20 shown, in the binary image corresponding to the target painting object, the overall contour area of the position where the target painting object is located is represented by the pixel points with a pixel value of binary 1, and the other areas in the painting image interface except the overall contour area of the position where the target painting object is located are represented by the pixel points with a pixel value of binary 0, that is, the white area represents the overall contour area of the position where the target painting object is located, and the black area represents the background area. Or, as Figure 21 shown, in the binary image corresponding to the target painting object, the overall contour area of the position where the target painting object is located is represented by the pixel points with a pixel value of binary 0, and the other areas in the painting image interface except the target painting object are represented by the pixel points with a pixel value of binary 1, that is, the black area represents the overall contour area of the position where the target painting object is located, and the white area represents the background area.
[0287] For the binary image corresponding to the painting elements included in each layer, it can be used to indicate the local contour area where the painting elements are located. For example, in the binary image corresponding to the painting elements included in each layer, the local contour area where the painting elements are located is represented by the pixel points with a binary value of 1, and the other areas in the layer except the local contour area where the painting elements are located are represented by the pixel points with a binary value of 0. That is, the white area represents the local contour area where the painting elements are located, and the black area represents the background area. As Figure 22 shown, it is the binary image corresponding to the painting elements included in layer 4. In this binary image, the white area represents the local contour area where the foot elements are located, and the black area represents the background area; alternatively, in the binary image corresponding to the painting elements included in each layer, the local contour area where the painting elements are located is represented by the pixel points with a binary value of 0, and the other areas in the layer except the local contour area where the painting elements are located are represented by the pixel points with a binary value of 1. That is, the black area represents the local contour area where the painting elements are located, and the white area represents the background area. As Figure 23 shown, it is the binary image corresponding to layer 4. In this binary image, the black area represents the local contour area where the foot elements are located, and the white area represents the background area.
[0288] Please refer to Figure 24 , which is a schematic flowchart of another method for obtaining the overall contour area and the local contour area provided by the embodiments of this specification. Step 2041 can be specifically implemented by executing sub-step 402:
[0289] Step 402: Obtain the binary mask corresponding to the transparency channel of the target painting object, and the binary masks corresponding to the transparency channels of the painting elements included in each layer.
[0290] In the embodiments of this specification, the painting image interface has an alpha channel, and naturally, the multiple layers that make up the painting layer interface also have corresponding alpha channels. After the electronic device identifies the target painting object within the target area selected by the user, it can obtain the binary mask corresponding to the alpha channel of the target painting object (that is, the binary mask of the area that can be considered to be selected by the user, mask_selectArea), and the binary masks corresponding to the alpha channels of the painting elements included in each layer. It should be understood that the process of generating the binary mask of the alpha channel of the target painting object is similar to the process of generating the binary mask of the alpha channel of the painting elements included in the layer. Both are to first extract the alpha channel of the original image (painting image interface or layer), and then perform binary processing on the extracted alpha channel, setting the pixel points with pixel values greater than the threshold to white (that is, the pixel value is binary 1), and setting the pixel points with pixel values less than the threshold to black (that is, the pixel value is binary 0); or, setting the pixel points with pixel values greater than the threshold to black (that is, the pixel value is binary 0), and setting the pixel points with pixel values less than the threshold to white (that is, the pixel value is binary 1). The above threshold can be set according to the actual situation and is not particularly limited in this specification. Of course, other methods can also be used to obtain the binary mask corresponding to the alpha channel of the original image, which is not particularly limited here.
[0291] For the binary mask corresponding to the alpha channel of the target painting object, it can be used to indicate the overall contour area of the target painting object. For example, in the binary mask corresponding to the alpha channel of the target painting object, the overall contour area of the position where the target painting object is located is represented by the pixel points with pixel values of binary 1, and the other areas in the painting image interface except the overall contour area of the position where the target painting object is located are represented by the pixel points with pixel values of binary 0, that is, the white area represents the overall contour area of the position where the target painting object is located, and the black area represents the background area. It should be understood that in the above scenario, the visual effect of the binary mask corresponding to the alpha channel of the target painting object is the same as the visual effect of the binary image of the target painting object, that is, the same as Figure 20 the visual effect. Or, in the binary mask corresponding to the alpha channel of the target painting object, the overall contour area of the position where the target painting object is located is represented by the pixel points with pixel values of binary 0, and the other areas in the painting image interface except the target painting object are represented by the pixel points with pixel values of binary 1, that is, the black area represents the overall contour area of the position where the target painting object is located, and the white area represents the background area. It should be understood that in the above scenario, the visual effect of the binary mask corresponding to the alpha channel of the target painting object is also the same as the visual effect of the binary image of the target painting object, that is, the same as Figure 21 the visual effect.
[0292] For the binary image corresponding to the transparency channel of the painting elements included in each layer, it can be used to indicate the local contour area where the painting elements are located. For example, in the binary mask corresponding to the transparency channel of the painting elements included in each layer, the local contour area where the painting elements are located is represented by the pixel points with the pixel value of binary 1, and the other areas in the layer except the local contour area where the painting elements are located are represented by the pixel points with the pixel value of binary 0. That is, the white area represents the local contour area where the painting elements are located, and the black area represents the background area. It should be understood that in the above scenario, the visual effect of the binary mask corresponding to the transparency channel of the painting elements is the same as the visual effect of the binary image of the painting elements. For example, when the target layer is layer 4, it is the same as Figure 22 the visual effect. Or, in the binary mask corresponding to the transparency channel of the painting elements included in each layer, the local contour area where the painting elements are located is represented by the pixel points with the pixel value of binary 0, and the other areas in the layer except the local contour area where the painting elements are located are represented by the pixel points with the pixel value of binary 1. That is, the black area represents the local contour area where the painting elements are located, and the white area represents the background area. It should be understood that in the above scenario, the visual effect of the binary mask corresponding to the transparency channel of the painting elements is the same as the visual effect of the binary image of the target painting elements. For example, when the target layer is layer 4, it is the same as Figure 23 the visual effect.
[0293] Step 2042: In response to the overall contour area including at least one target local contour area among the multiple local contour areas, select at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from the multiple layers.
[0294] In the embodiments of this specification, since the target painting object is composed of painting elements of some of the existing multiple layers, it can be considered that the overall contour area of the position where the target painting object is located can be composed of the local contour areas of the positions where the painting elements of the above-mentioned partial layers are located. Then, after obtaining the overall contour area of the position where a target painting object is located and the multiple local contour areas of the positions where multiple painting elements are located (one painting element corresponds to one local contour area), if the electronic device determines that the overall contour area includes a target local contour area among the multiple local contour areas, it indicates that the target local contour area is a part of the overall contour area, thus relatively simply determining that the target painting element corresponding to the target local contour area is used to form the target painting object. On this basis, the above-mentioned target painting element and the target layer where it is located can be automatically selected, omitting the cumbersome manual search process, improving the efficiency and accuracy when selecting the target painting object, and making the user experience better.
[0295] In some embodiments, in order to detect which local contour areas belong to the overall contour area without omission, a traversal method can be adopted to sequentially determine whether each local contour area belongs to the overall contour area.
[0296] Please refer to Figure 25 , which is a schematic flowchart of a method for selecting a layer corresponding to a target painting object provided by the embodiments of this specification.
[0297] Step 2042 can be specifically implemented by executing sub-step 501 and sub-step 502:
[0298] Step 501: Determine whether the overall contour area includes at least one target local contour area among the multiple local contour areas.
[0299] In the embodiments of this specification, the layers corresponding to the painting image interface can be considered to be arranged in a certain order. Therefore, based on the arrangement order of the existing multiple layers, it can be sequentially determined whether the overall contour area includes at least one target local contour area among the multiple local contour areas.
[0300] For example, please continue to refer to 14. If the target painting object is Person 101, the overall contour area of the position where Person 101 is located can be sequentially determined in the forward order from Layer 1 to Layer 5 to see if it includes the target local contour areas of the positions where the painting elements included in each of Layer 1, Layer 2, Layer 3, Layer 4, and Layer 5 are located; or, in the reverse order from Layer 5 to Layer 1, it can be sequentially determined whether the overall contour area of the position where Person 101 is located includes the target local contour areas corresponding to the painting elements included in each of Layer 5, Layer 4, Layer 3, Layer 2, and Layer 1.
[0301] The following will detail how to determine whether the overall contour region includes a target local contour region among multiple local contour regions.
[0302] Method 1: Based on the AND operation method.
[0303] Please refer to Figure 26 , which is a flowchart showing a method for determining whether an overall contour region includes at least one target local contour region based on the AND operation provided in an embodiment of this specification. Step 501 can be specifically implemented by executing sub-step 5011:
[0304] Step 5011: Perform an AND operation on the pixel values of the corresponding position pixel points of the binary image of the target painting object and the binary image of the painting elements included in the target layer among multiple layers to obtain an operation result image.
[0305] In the embodiments of this specification, when in the binary image corresponding to the target painting object, the overall contour region of the position where the target painting object is located is represented by pixel points with a pixel value of binary 1, and the other regions in the painting image interface except the overall contour region of the position where the target painting object is located are represented by pixel points with a pixel value of binary 0; and in the binary image corresponding to the painting elements included in each layer, the local contour region of the position where the painting elements are located is represented by pixel points with a pixel value of binary 1, and the other regions in the layer except the local contour region of the position where the painting elements are located are represented by pixel points with a pixel value of binary 0, that is, both the binary image corresponding to the target painting object and the binary image corresponding to the painting elements represent the foreground region (overall contour region or local contour region) by white and represent the background region by black, the AND operation can be performed on the pixel values of the corresponding position pixel points of the binary image corresponding to the target painting object and the binary images corresponding to the painting elements included in the target layer among multiple layers, so as to obtain an operation result image. When there are pixel points with a pixel value of binary 1 in the operation result image, it can be considered that the overall contour region includes the target local contour region corresponding to the target painting element; on the contrary, when all the pixel points in the operation result image have a pixel value of binary 0, it can be considered that the overall contour region does not include the target local contour region corresponding to the target painting element.
[0306] It should be understood that in the above embodiments, performing an AND operation on the pixel values of the corresponding positions of the binarized image of the target painting object and the binarized image of the painting elements included in the target layer is equivalent to performing a multiplication operation on the pixel values of the corresponding positions of the two. In the obtained operation result image, if there are pixel points with a pixel value of binary 1 (i.e., the result of the multiplication operation is not empty), it can be considered that the overall contour area includes the target local contour area corresponding to the target painting element; conversely, when all the pixel points in the operation result image have a pixel value of binary 0 (i.e., the result of the multiplication operation is empty), it can be considered that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0307] Please refer to Figure 27 , which is a schematic flowchart of another method for determining whether the overall contour area includes the target local contour area based on the AND operation provided by the embodiments of this specification. Step 501 can be specifically implemented by executing sub-step 5012:
[0308] Step 5012: Perform an AND operation on the pixel values of the corresponding positions of the binarized mask of the target painting object and the binarized masks of the painting elements included in the target layer among multiple layers to obtain an operation result image.
[0309] In the embodiments of this specification, when in the binarized mask corresponding to the transparency channel of the target painting object, the overall contour area of the position where the target painting object is located is represented by pixel points with a pixel value of binary 1, and the other areas in the painting image interface except the overall contour area of the position where the target painting object is located are represented by pixel points with a pixel value of binary 0, and in the binarized mask corresponding to the transparency channel of each painting element included in the layer, the local contour area of the position where the painting element is located is represented by pixel points with a pixel value of binary 1, and the other areas in the layer except the local contour area of the position where the painting element is located are represented by pixel points with a pixel value of binary 0, that is, both the binarized mask corresponding to the transparency channel of the target painting object and the binarized mask corresponding to the transparency channel of the layer represent the foreground area (overall contour area or local contour area) by white and represent the background area by black, the binarized mask corresponding to the transparency channel of the target painting object and the binarized masks corresponding to the transparency channels of the painting elements included in the target layer among multiple layers can be used to perform an AND operation on the pixel values of the corresponding positions to obtain an operation result image. When there are pixel points with a pixel value of binary 1 in the operation result image, it can be considered that the overall contour area includes the target local contour area corresponding to the target layer; conversely, when all the pixel points in the operation result image have a pixel value of binary 0, it can be considered that the overall contour area does not include the target local contour area corresponding to the target layer.
[0310] It should be understood that in the above embodiments, performing an AND operation on the pixel values of the corresponding positions of the binary image corresponding to the transparency channel of the target painting object and the binary mask corresponding to the transparency channel of the painting elements included in the target layer is equivalent to performing a multiplication operation on the pixel values of the corresponding positions of the two. In the resulting operation result image, if there are pixel points with a pixel value of binary 1 (i.e., the result of the multiplication operation is not empty), it can be considered that the overall contour area includes the target local contour area corresponding to the target painting element; conversely, when all the pixel points in the operation result image have a pixel value of binary 0 (i.e., the result of the multiplication operation is empty), it can be considered that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0311] Please refer to Figure 28 , which is a schematic diagram of an AND operation provided by an embodiment of this specification. As Figure 28 shown, the binary image (or binary mask) 601 of the target painting object (person) is respectively subjected to a per-pixel AND operation with the binary image (or binary mask) 602 of the head element, the binary image (or binary mask) 603 of the grass element, the binary image (or binary mask) 604 of the body element, the binary image (or binary mask) 605 of the foot element, and the binary image (or binary mask) 606 of the hand element, to obtain the corresponding operation result images 607 to 611. Among them, there are pixel points with a pixel value of binary 1 in the operation result image 607, indicating that the overall contour area where the target painting object is located includes the target local contour area where the head element is located; all the pixel points in the operation result image 608 have a pixel value of binary 0, indicating that the overall contour area where the target painting object is located does not include the target local contour area where the grass element is located; there are pixel points with a pixel value of binary 1 in the operation result image 609, indicating that the overall contour area where the target painting object is located includes the target local contour area where the body element is located; there are pixel points with a pixel value of binary 1 in the operation result image 610, indicating that the overall contour area where the target painting object is located includes the target local contour area where the foot element is located; there are pixel points with a pixel value of binary 1 in the operation result image 611, indicating that the overall contour area where the target painting object is located includes the target local contour area where the hand element is located.
[0312] Method 2: Based on the OR operation method.
[0313] Please refer to Figure 29 , which is a schematic flowchart of a method for determining whether the overall contour area includes the target local contour area based on the OR operation provided by an embodiment of this specification. Step 501 can be specifically implemented by executing sub-step 5013:
[0314] Step 5013: Perform an OR operation on the pixel values of the corresponding position pixel points of the binary image of the target painting object and the binary images of the painting elements included in the target layer among the multiple layers to obtain an operation result image.
[0315] In the embodiments of this specification, in the binary image corresponding to the target painting object, the overall contour area of the position where the target painting object is located is represented by pixel points with a binary value of 0, and the other areas in the painting image interface except the overall contour area of the position where the target painting object is located are represented by pixel points with a binary value of 1; and in the binary image corresponding to the painting elements included in each layer, the local contour area of the position where the painting element is located is represented by pixel points with a binary value of 0, and the other areas in the layer except the local contour area of the position where the painting element is located are represented by pixel points with a binary value of 1. That is, when the binary image corresponding to the target painting object and the binary image corresponding to the painting element both represent the foreground area (overall contour area or local contour area) in black and represent the background area in white, the pixel values of the corresponding position pixel points of the binary image corresponding to the target painting object and the binary images of the painting elements included in the target layer among the multiple layers can be subjected to an OR operation to obtain the operation result image. When there are pixel points with a binary value of 0 in the operation result image (that is, there are both pixel points with a binary value of 0 and pixel points with a binary value of 1), it can be considered that the overall contour area includes the target local contour area corresponding to the target painting element layer; on the contrary, when all the pixel points in the operation result image have a binary value of 1 (that is, there are no pixel points with a binary value of 0), it can be considered that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0316] Please refer to Figure 30 , which is a schematic flowchart of another method for determining whether the overall contour area includes the target local contour area based on the OR operation provided by the embodiments of this specification. Step 501 can be specifically implemented by executing sub-step 5014:
[0317] Step 5014: Perform an OR operation on the pixel values of the corresponding position pixel points of the binary mask of the transparency channel of the target painting object and the binary masks of the transparency channels of the painting elements included in the target layer among the multiple layers to obtain an operation result image.
[0318] In the embodiments of this specification, in the binary mask corresponding to the transparency channel of the target painting object, the overall contour area of the position where the target painting object is located is represented by pixel points with a binary value of 0, and the other areas in the painting image interface except the overall contour area of the position where the target painting object is located are represented by pixel points with a binary value of 1. In the binary mask corresponding to the transparency channel of each painting element included in each layer, the local contour area of the position where the painting element is located is represented by pixel points with a binary value of 0, and the other areas in the layer except the local contour area of the position where the painting element is located are represented by pixel points with a binary value of 1. That is, when the binary mask corresponding to the transparency channel of the target painting object and the binary mask corresponding to the transparency channel of the painting object included in the target layer in multiple layers both represent the foreground area (overall contour area or local contour area) in black and represent the background area in white, the binary mask corresponding to the transparency channel of the target painting object can be subjected to an OR operation on the pixel values of the pixel points at the corresponding positions with the binary masks corresponding to the transparency channels of the painting elements included in the target layer in multiple layers to obtain an operation result image. When there are pixel points with a binary value of 0 in the operation result image (that is, there are both pixel points with a binary value of 0 and pixel points with a binary value of 1), it can be considered that the overall contour area includes the target local contour area corresponding to the target layer; conversely, when all the pixel points in the operation result image have a binary value of 1 (that is, there are no pixel points with a binary value of 0), it can be considered that the overall contour area does not include the target local contour area corresponding to the target layer.
[0319] Please refer to Figure 31 , which is a schematic diagram of an OR operation provided by the embodiments of this specification. As Figure 31As shown, the binary image (or binary mask) 701 of the target painting object (person) is respectively subjected to a per-pixel OR operation with the binary image (or binary mask) 702 of the head element, the binary image (or binary mask) 703 of the grass element, the binary image (or binary mask) 704 of the body element, and the binary image (or binary mask) 705 of the foot element, to obtain corresponding operation result images 707 to 711. Among them, there are pixel points with a binary value of 0 in the operation result image 707, indicating that the overall contour area of the position where the target painting object is located includes the target local contour area of the position where the head element is located; all the pixel points in the operation result image 708 have a binary value of 1, indicating that the overall contour area of the position where the target painting object is located does not include the target local contour area of the position where the grass element is located; there are pixel points with a binary value of 0 in the operation result image 709, indicating that the overall contour area of the position where the target painting object is located includes the target local contour area of the position where the body element is located; there are pixel points with a binary value of 0 in the operation result image 710, indicating that the overall contour area of the position where the target painting object is located includes the target local contour area of the position where the foot element is located; there are pixel points with a binary value of 0 in the operation result image 711, indicating that the overall contour area of the position where the target painting object is located includes the target local contour area of the position where the hand element is located.
[0320] Step 502: In response to the overall contour area including at least one target local contour area, select at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from multiple layers.
[0321] In the embodiments of this specification, if the electronic device determines that the above overall contour area includes at least one target local contour area among the above multiple local contour areas, then the target painting elements corresponding to the at least one target local contour area and the target layer where they are located are selected quickly and accurately, which not only improves the search efficiency but also avoids some layers from being omitted.
[0322] In some embodiments, it can be considered that there is a corresponding painting element identifier for each painting element in the existing multiple layers. Then, during the process of selecting layers, the painting element identifier of the painting element to be selected can be determined first, and then the corresponding painting element and layer are selected based on the painting element identifier.
[0323] Please refer to Figure 32 , which is a schematic flowchart of a method for selecting a painting element and the layer where it is located based on a painting element identifier provided by the embodiments of this specification. Step 502 can be specifically implemented by executing sub-step 5021 and sub-step 5022:
[0324] Step 5021: In response to the overall contour area including at least one target local contour area, determine at least one target painting element identifier corresponding to the at least one target local contour area.
[0325] Step 5022: Select at least one target painting element corresponding to the at least one target painting element identifier and the target layer where it is located from multiple layers.
[0326] In the embodiments of this specification, the painting element identifier may only include element information. For example, 10 indicates the first painting element in layer 1, and 13 indicates the second painting element in layer 2. Of course, the painting element identifier may also include both the layer information to which it belongs and the element information. For example, the painting element identifier may be 5_2, where 5 is used to represent that the painting element belongs to layer 5, and 2 is used to represent the second painting element. Then the painting element identifier 5_2 can be used to represent the second painting element in layer 5. It should be understood that the painting element identifier can be represented by Arabic numerals, or by Roman numerals, and of course, it can also be identified by a custom string method, and no special limitation is made here.
[0327] Please refer to Figure 33 , based on the same inventive concept, is a schematic structural diagram of a processing device for a painting object provided in the embodiments of this specification. The device includes:
[0328] A display unit 801, configured to display a painting image interface, and the painting image interface includes a picture in which multiple layers are combined and displayed;
[0329] A detection unit 802, configured to detect a user's box selection operation on a target area on the painting image interface;
[0330] An identification unit 803, configured to identify a target painting object in the target area in response to the box selection operation;
[0331] A selection unit 804, configured to select at least one target painting element corresponding to the target painting object and the target layer where it is located from multiple layers.
[0332] Optionally, the display unit 801 is configured to:
[0333] Display a box selection operation identifier corresponding to the box selection operation on the painting image interface.
[0334] Optionally, the box selection operation identifier is a box selection trajectory identifier corresponding to the box selection operation.
[0335] Optionally, the box selection trajectory identifier includes any one of the following:
[0336] When the box selection operation is to select by a rectangular box, the box selection trajectory identifier is a rectangular trajectory identifier;
[0337] When the selection operation is based on a circular frame, the selection trajectory identifier is a circular trajectory identifier;
[0338] When the selection operation is based on an oval frame, the selection trajectory identifier is an oval trajectory identifier;
[0339] When the selection operation is based on a triangular frame, the selection trajectory identifier is a triangular trajectory identifier.
[0340] Optionally, the selection trajectory identifier is the contour identifier of the target painting object.
[0341] Optionally, the display unit 801 is further configured to:
[0342] Differentially display the target layer and other layers in multiple layers.
[0343] Optionally, the display unit 801 is specifically configured to:
[0344] In multiple layers, adjust the arrangement order of the target layer to the first M positions, where M is equal to the number of target layers;
[0345] Differentially display the target layer located in the first M positions and other layers.
[0346] Optionally, the display unit 801 is further configured to:
[0347] In the target layer, display the selected target painting elements.
[0348] Optionally, the target layer further includes other unselected painting elements, and the display unit 801 is specifically configured to:
[0349] In the target layer, differentially display the selected target painting elements and other unselected painting elements.
[0350] Optionally, the device further includes:
[0351] A determination unit, configured to determine the painting object operation corresponding to the selection operation based on the correspondence between the selection operation and the painting object operation;
[0352] An operation unit, configured to apply the painting object operation corresponding to the selection operation to the selected target painting object.
[0353] Optionally, the recognition unit 803 is specifically configured to:
[0354] In response to the selection operation, generate a to-be-recognized image sample corresponding to the target area;
[0355] Input the to-be-recognized image sample into the painting object recognition model to recognize the target painting object.
[0356] Optionally, the selection unit 804 includes:
[0357] A contour acquisition unit that acquires the overall contour area of the position where the target painting object is located, and the local contour areas of the positions where the painting elements included in each of the multiple layers are located. The overall contour area is used to indicate the closed area formed by the edges of the target painting object, and the local contour is used to indicate the closed area formed by the edges of the painting elements.
[0358] An element selection unit that, in response to the overall contour area including at least one target local contour area among the multiple local contour areas, selects at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from the multiple layers.
[0359] Optionally, the element selection unit includes:
[0360] A determination subunit that determines whether the overall contour area includes at least one target local contour area among the multiple local contour areas.
[0361] An element selection subunit that, in response to the overall contour area including at least one target local contour area, selects at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from the multiple layers.
[0362] Optionally, the contour acquisition unit is specifically configured to:
[0363] Acquire the binary image of the target painting object and the binary images of the painting elements included in each layer. The binary image of the target painting object is used to indicate the overall contour area of the position where the target painting object is located, and the binary images of the painting elements included in each layer are used to indicate the local contour areas of the corresponding painting elements.
[0364] Optionally, the painting image interface has an alpha channel. The contour acquisition unit is specifically configured to:
[0365] Acquire the binary mask corresponding to the alpha channel of the target painting object and the binary masks corresponding to the alpha channels of the painting elements included in each layer. The binary mask corresponding to the alpha channel of the target painting object is used to indicate the overall contour area of the position where the target painting object is located, and the binary masks corresponding to the alpha channels of the painting elements included in each layer are used to indicate the local contour areas of the positions where the painting elements are located.
[0366] Optionally, the binary image of the target painting object represents the overall contour area of the position where the target painting object is located through the pixel points with pixel value of binary 1, and represents the other areas in the painting image interface except the overall contour area through the pixel points with pixel value of binary 0. In the binary image of the painting elements included in each layer, the local contour area of the position where the painting elements are located is represented through the pixel points with pixel value of binary 1, and the other areas in the layer except the local contour area are represented through the pixel points with pixel value of binary 0. The determining subunit is specifically configured to:
[0367] Perform an AND operation on the pixel values of the corresponding position pixel points of the binary image of the target painting object and the binary images of the painting elements included in the target layer among multiple layers to obtain an operation result image. Wherein, when there are pixel points with pixel value of binary 1 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel points in the operation result image have pixel value of binary 0, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0368] Optionally, the binary image of the target painting object represents the overall contour area of the position where the target painting object is located through the pixel points with pixel value of binary 0, and represents the other areas in the painting image interface except the overall contour area through the pixel points with pixel value of binary 1. In the binary image of the painting elements included in each layer, the local contour area of the position where the painting elements are located is represented through the pixel points with pixel value of binary 0, and the other areas in the layer except the local contour area are represented through the pixel points with pixel value of binary 1. The determining subunit is specifically configured to:
[0369] Perform an AND operation on the pixel values of the corresponding position pixel points of the binary image of the target painting object and the binary images of the painting elements included in the target layer among multiple layers to obtain an operation result image. Wherein, when there are pixel points with pixel value of binary 0 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel points in the operation result image have pixel value of binary 1, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0370] Optionally, the binary mask of the transparency channel of the target painting object represents the overall contour area of the position where the target painting object is located by the pixel points with pixel value of binary 1, and represents the other areas in the painting image interface except the overall contour area by the pixel points with pixel value of binary 0. The binary mask of the painting elements included in each layer represents the local contour area of the position where the painting elements are located by the pixel points with pixel value of binary 1, and represents the other areas in the layer except the local contour area by the pixel points with pixel value of binary 0. The determining subunit is specifically configured to:
[0371] Perform an AND operation on the pixel values of the corresponding position pixel points between the binary mask of the target painting object and the binary masks of the painting elements included in the target layer among the multiple layers to obtain an operation result image. Wherein, when there are pixel points with pixel value of binary 1 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel values in the operation result image are pixel points with pixel value of binary 0, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0372] Optionally, the binary mask of the transparency channel of the target painting object represents the overall contour area of the position where the target painting object is located by the pixel points with pixel value of binary 0, and represents the other areas in the painting image interface except the overall contour area by the pixel points with pixel value of binary 1. The binary image of the painting elements included in each layer represents the local contour area of the position where the painting elements are located by the pixel points with pixel value of binary 0, and represents the other areas in the layer except the local contour area by the pixel points with pixel value of binary 1. The determining subunit is specifically configured to:
[0373] Perform an AND operation on the pixel values of the corresponding position pixel points between the binary mask of the transparency channel of the target painting object and the binary masks of the transparency channels of the painting elements included in the target layer among the multiple layers to obtain an operation result image. Wherein, when there are pixel points with pixel value of binary 0 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel values in the operation result image are pixel points with pixel value of binary 1, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
[0374] Optionally, the element selection subunit is specifically configured to:
[0375] In response to the overall contour area including at least one target local contour area, determine at least one target painting element identifier corresponding to the at least one target local contour area;
[0376] Select at least one target painting element corresponding to at least one target painting element identifier and the target layer where it is located among multiple layers.
[0377] The embodiments of this specification also provide a computer storage medium. Among them, the computer storage medium stores computer instructions. When the computer instructions run on a computer, the computer is made to execute as Figure 4 - 5 , Figure 8 - Figure 9 , Figure 11 , Figure 13 , Figure 15 , Figure 17 - Figure 19 , Figure 24 - Figure 27 and Figure 29 - Figure 30 the method described above.
[0378] The embodiments of this specification provide a computer program product. The computer program product includes computer instructions. When the computer instructions run on a computer, the computer is made to execute as Figure 4 - 5 , Figure 8 - Figure 9 , Figure 11 , Figure 13 , Figure 15 , Figure 17 - Figure 19 , Figure 24 - Figure 27 and Figure 29 - Figure 30 the method described above.
[0379] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any other arbitrary combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the processes or functions described in the embodiments of this specification are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access, or a data storage device such as a server or data center that contains one or more collections of available media. The available media can be magnetic media (such as floppy disks, hard disks, magnetic tapes), optical media (such as DVDs), or semiconductor media. The semiconductor media can be a solid state drive (SSD).
[0380] The above are only the preferred embodiments of this specification and are not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification shall be included within the scope of protection of this specification.
Claims
1. A method for processing a painting object, characterized in that, the method includes: displaying a painting image interface, where the painting image interface includes a picture displayed by combining multiple layers; detecting a user's operation of selecting a target area on the painting image interface; responding to the selection operation, identifying the target painting object in the target area; selecting at least one target painting element corresponding to the target painting object and the target layer where it is located in the multiple layers.
2. The method according to claim 1, characterized in that, after detecting the user's operation of selecting a target area on the painting image interface, the method further includes: displaying a selection operation identifier corresponding to the selection operation on the painting image interface.
3. The method according to claim 2, characterized in that, the selection operation identifier is a selection track identifier corresponding to the selection operation.
4. The method according to claim 3, characterized in that, the selection track identifier includes any one of the following: when the selection operation is selection based on a rectangular frame, the selection track identifier is a rectangular track identifier; when the selection operation is selection based on a circular frame, the selection track identifier is a circular track identifier; when the selection operation is selection based on an oval frame, the selection track identifier is an oval track identifier; when the selection operation is selection based on a triangular frame, the selection track identifier is a triangular track identifier.
5. The method according to claim 3, characterized in that, the selection track identifier is an outline identifier of the target painting object.
6. The method according to claim 1, characterized in that, after selecting at least one target painting element corresponding to the target painting object and the target layer where it is located in the multiple layers, the method further includes: differentially displaying the target layer and other layers in the multiple layers.
7. The method according to claim 6, characterized in that, differentially displaying the target layer and other layers in the multiple layers includes: adjusting the arrangement order of the target layer to the first M positions in the multiple layers, where M is equal to the number of the target layers; differentially displaying the target layer located in the first M positions and the other layers.
8. The method according to claim 6 or 7, characterized in that, the method further includes: displaying the selected target painting element in the target layer.
9. The method according to claim 8, characterized in that, the target layer further includes other painting elements, and displaying the included target painting element in the target layer includes: differentially displaying the included target painting element and the other painting elements in the target layer.
10. The method according to claim 4, characterized in that, the method further includes: determining a painting object operation corresponding to the selection operation based on the corresponding relationship between the selection operation and the painting object operation; applying the painting object operation corresponding to the selection operation to the selected target painting object.
11. The method according to claim 1, wherein, responding to the box selection operation, identifying the target painting object in the target area includes: responding to the box selection operation, generating a to-be-identified image sample corresponding to the target area; inputting the to-be-identified image sample into a painting object recognition model to identify the target painting object.
12. The method according to any one of claims 1-11, wherein, selecting at least one target painting element corresponding to the target painting object and the target layer where it is located from the multiple layers includes: obtaining an overall contour area of the position where the target painting object is located, and local contour areas of the positions where the painting elements included in each of the multiple layers are located, the overall contour area being used to indicate a closed area formed by the edges of the target painting object, and the local contour being used to indicate a closed area formed by the edges of the painting elements; responding to the overall contour area including at least one target local contour area among the multiple local contour areas, selecting the at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from the multiple layers.
13. The method according to claim 12, wherein, responding to the overall contour area including at least one target local contour area among the multiple local contour areas, selecting the at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from the multiple layers includes: determining whether the overall contour area includes the at least one target local contour area among the multiple local contour areas; responding to the overall contour area including the at least one target local contour area, selecting the at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from the multiple layers.
14. The method according to claim 13, wherein, obtaining the overall contour area of the position where the target painting object is located, and the local contour areas of the positions where the painting elements included in each of the multiple layers are located includes: obtaining a binary image of the target painting object and binary images of the painting elements included in each layer, the binary image of the target painting object being used to indicate the overall contour area of the position where the target painting object is located, and the binary images of the painting elements included in each layer being used to indicate the local contour areas of the corresponding painting elements.
15. The method according to claim 13, wherein, the painting image interface has an alpha channel, and obtaining the overall contour area of the position where the target painting object is located, and the local contour areas of the positions where the painting elements included in each of the multiple layers are located includes: Obtain the binary mask corresponding to the transparency channel of the target painting object, and the binary masks corresponding to the transparency channels of the painting elements included in each layer. The binary mask corresponding to the transparency channel of the target painting object is used to indicate the overall contour area of the position where the target painting object is located, and the binary masks corresponding to the transparency channels of the painting elements included in each layer are used to indicate the local contour areas of the positions where the painting elements are located.
16. The method according to claim 14, wherein, the binary image of the target painting object represents the overall contour area of the position where the target painting object is located through pixel points with a pixel value of binary 1, and represents other areas in the painting image interface except the overall contour area through pixel points with a pixel value of binary 0. In the binary image of the painting elements included in each layer, the local contour area of the position where the painting element is located is represented through pixel points with a pixel value of binary 1, and other areas in the layer except the local contour area are represented through pixel points with a pixel value of binary 0. Determining whether the overall contour area includes at least one target local contour area among the multiple local contour areas includes: Performing an AND operation on the pixel values of the pixel points at corresponding positions between the binary image of the target painting object and the binary images of the painting elements included in the target layer among the multiple layers to obtain an operation result image. When there are pixel points with a pixel value of binary 1 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element. When all the pixel points in the operation result image have a pixel value of binary 0, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
17. The method according to claim 14, wherein, the binary image of the target painting object represents the overall contour area of the position where the target painting object is located through pixel points with a pixel value of binary 0, and represents other areas in the painting image interface except the overall contour area through pixel points with a pixel value of binary 1. In the binary image of the painting elements included in each layer, the local contour area of the position where the painting element is located is represented through pixel points with a pixel value of binary 0, and other areas in the layer except the local contour area are represented through pixel points with a pixel value of binary 1. Determining whether the overall contour area includes at least one target local contour area among the multiple local contour areas includes: Perform an AND operation on the pixel values of the corresponding position pixel points of the binary image of the target painting object and the binary image of the painting elements included in the target layer among the multiple layers to obtain an operation result image. Wherein, when there are pixel points with a pixel value of binary 0 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element; when all the pixel values in the operation result image are pixel points of binary 1, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
18. The method according to claim 15, wherein, the binary mask of the transparency channel of the target painting object represents the overall contour area of the position where the target painting object is located through pixel points with a pixel value of binary 1, and represents other areas in the painting image interface except the overall contour area through pixel points with a pixel value of binary 0. In the binary mask of the painting elements included in each layer, the local contour area of the position where the painting element is located is represented through pixel points with a pixel value of binary 1, and other areas in the layer except the local contour area are represented through pixel points with a pixel value of binary 0. Determining whether the overall contour area includes at least one target local contour area among the multiple local contour areas includes: Perform an AND operation on the pixel values of the corresponding position pixel points of the binary mask of the target painting object and the binary mask of the painting elements included in the target layer among the multiple layers to obtain an operation result image. Wherein, when there are pixel points with a pixel value of binary 1 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element; when all the pixel values in the operation result image are pixel points of binary 0, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
19. The method according to claim 15, wherein, the binary mask of the transparency channel of the target painting object represents the overall contour area of the position where the target painting object is located through pixel points with a pixel value of binary 0, and represents other areas in the painting image interface except the overall contour area through pixel points with a pixel value of binary 1. In the binary image of the painting elements included in each layer, the local contour area of the position where the painting element is located is represented through pixel points with a pixel value of binary 0, and other areas in the layer except the local contour area are represented through pixel points with a pixel value of binary 1. Determining whether the overall contour area includes at least one target local contour area among the multiple local contour areas includes: Perform an AND operation on the pixel values of the corresponding position pixel points between the binary mask of the transparency channel of the target painting object and the binary mask of the transparency channel of the painting elements included in the target layer among the multiple layers, to obtain an operation result image. Wherein, when there are pixel points with a pixel value of binary 0 in the operation result image, it indicates that the overall contour area includes the target local contour area corresponding to the target painting element; when all the pixel points in the operation result image have a pixel value of binary 1, it indicates that the overall contour area does not include the target local contour area corresponding to the target painting element.
20. The method according to any one of claims 13-19, characterized in that in response to the overall contour area including the at least one target local contour area, selecting the at least one target painting element corresponding to the at least one target local contour area and the target layer where it is located from the multiple layers, including: in response to the overall contour area including the at least one target local contour area, determining at least one target painting element identifier corresponding to the at least one target local contour area; selecting the at least one target painting element corresponding to the at least one target painting element identifier and the target layer where it is located from the multiple layers.
21. An electronic device, characterized in that the electronic device includes a memory for storing computer program instructions and a processor for executing the program instructions. Wherein, when the computer program instructions are executed by the processor, the electronic device is triggered to execute the steps of the method according to any one of claims 1-20.
22. A computer-readable storage medium, characterized in that the computer-readable storage medium is used to store computer instructions, and when the computer instructions run on a computer, the computer is caused to execute the steps of the method according to any one of claims 1-20.
23. A computer program product, characterized in that the computer program product contains computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the steps of the method according to any one of claims 1-20.