Group head portrait processing method and device, electronic equipment and storage medium
By converting group avatar images to a color space and determining global grayscale features, the problem of high false detection rate in group avatar detection is solved, achieving fast and accurate group avatar recognition and unread message location, thus improving user experience.
Patent Information
- Application Number
- CN202511669727.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-02-17
AI Technical Summary
Existing technologies have a high false positive rate when detecting group avatars, and cannot quickly and accurately identify group avatars, affecting the efficiency of users in obtaining unread messages.
By converting the avatar images in the first application to the first color space, global grayscale features are determined. The group avatars are then identified using the global grayscale features and threshold determination, thus avoiding false detections by traditional face detection algorithms.
It improves the accuracy and efficiency of group avatar detection, reduces the false detection rate, achieves real-time detection without relying on the network, and protects user privacy and data security.
Smart Images

Figure CN121542076A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of electronic equipment technology, and specifically relates to a method, apparatus, electronic device and storage medium for processing group headshots. Background Technology
[0002] With the rapid development of mobile internet technology, instant messaging and social networking applications have become indispensable tools for people's daily social interactions and work. In these applications, avatars serve as visual identifiers for users and groups, playing important roles such as identity recognition, quick location tracking, and information enhancement.
[0003] Generally, profile pictures can be divided into two types: individual profile pictures and group profile pictures. Currently, when detecting profile pictures, face detection algorithms or general object detection frameworks are usually used to locate and identify faces or objects in the image. However, these technologies usually assume that the image contains only one subject, that is, only one face, and identify it as the user's profile picture. Therefore, if the above method is used to detect group profile pictures, the false detection rate is relatively high. Summary of the Invention
[0004] The purpose of this application is to provide a group avatar processing method, apparatus, electronic device, and storage medium that can quickly and accurately detect group avatars to obtain unread messages in the group, thereby improving the efficiency of users in obtaining unread messages in the group.
[0005] In a first aspect, embodiments of this application provide a method for processing group avatars, the method comprising: Retrieve the first profile picture image of the first session entry in the first application; The first avatar image is converted to the first color space to obtain the second avatar image; Based on the pixels in the second avatar image, determine the global grayscale features of the second avatar image; If the global grayscale feature is greater than or equal to the first threshold, the first avatar image is determined to be a group avatar.
[0006] Secondly, embodiments of this application provide a group avatar processing device, the device comprising: The acquisition module is used to acquire the first avatar image of the first session entry in the first application; The conversion module is used to convert the first avatar image to a first color space to obtain a second avatar image; The first determining module is used to determine the global grayscale features of the second avatar image based on the pixels in the second avatar image; The second determining module is used to determine that the first avatar image is a group avatar when the global grayscale feature is greater than or equal to the first threshold.
[0007] Thirdly, embodiments of this application provide an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can run on the processor, and the programs or instructions, when executed by the processor, implement the method as described in the first aspect.
[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the method described in the first aspect.
[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0010] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.
[0011] In this embodiment, group avatars are typically composed of multiple small images pieced together, with dividing lines or borders in between. The color distribution is more complex, resulting in an overall appearance that is more "grayish" or "messy." Individual avatars, on the other hand, usually have more uniform and vibrant colors. Therefore, by converting the first avatar image of the first session entry in the first application to a first color space to obtain a second avatar image, and then determining the global grayscale features of the second avatar image based on its pixels, group avatars can be effectively identified using these grayscale features. This effectively captures the unique color and structural features of the pieces within the group avatar, making it more robust than traditional face detection algorithms or general object detection frameworks. Furthermore, the accuracy of group avatar detection can be improved by using the global grayscale features of the second avatar image and determining a first threshold. Additionally, the solution in this embodiment is executed by an electronic device, eliminating the need to upload to the cloud for execution and relying on no network. This allows for real-time group avatar detection, improving its efficiency. Attached Figure Description
[0012] Figure 1 This is a flowchart illustrating a group avatar processing method provided in some embodiments of this application; Figure 2 This is a schematic diagram of the main interface of the first application provided in some embodiments of this application; Figure 3 This is a schematic diagram of the segmentation of a first headshot image provided in some embodiments of this application; Figure 4 This is a flowchart illustrating a group avatar processing method provided in some embodiments of this application; Figure 5 This is a schematic diagram of the chat interface for a first session entry provided in some embodiments of this application; Figure 6 These are schematic diagrams illustrating the structure of a group avatar processing device according to some embodiments of this application; Figure 7 These are schematic diagrams illustrating the structure of an electronic device according to some embodiments of this application; Figure 8 These are schematic diagrams illustrating the hardware structure of an electronic device according to some embodiments of this application. Detailed Implementation
[0013] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0014] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and are not limited in number; for example, a first object can be one or N objects. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0015] The terminology used in the embodiments of this invention will be explained below.
[0016] Group avatar: In instant messaging or social applications, this refers to the identifying image set for a multi-person chat group. It is usually automatically generated by the system based on a combination of individual avatars from some group members, or manually uploaded by the group administrator from the device's photo album or selected from the platform's image library. The group avatar appears as the core visual identifier of the group in various scenarios, including the group chat interface, chat list, and message notifications.
[0017] A personal profile picture is an identifying image used on digital platforms such as social media, forums, games, and work applications to represent a user's personal identity.
[0018] HSV color space: A color space created based on the intuitive characteristics of color, also known as the Hexcone Model. The HSV color model refers to a subset of visible light in the three-dimensional color space of hue (H), saturation (S), and value (V), which contains all colors in a certain color gamut.
[0019] Lab color model: This model consists of lightness (L) and color channels a and b. It is device-independent and based on human physiological visual characteristics, with a color gamut exceeding that of computer monitors. The lightness component L in Lab mode ranges from 0 to 100, while the a and b channels cover the spectrum from green to red and from blue to yellow, respectively.
[0020] Luminance component, blue chrominance component, and red chrominance component (YCbCr): A color space primarily used for video and image compression. Its core idea is to separate luminance information from color information. Y represents the luminance (Luma) component, which contains the grayscale information of the image; Cb represents the difference between the blue component and the luminance value; and Cr represents the difference between the red component and the luminance value.
[0021] Hue, Saturation, and Lightness (HSL): HSL is a representation of points in the RGB color model on a cylindrical coordinate system. Hue (H) is the basic attribute of color, what we commonly refer to as the color name, such as red or yellow. Saturation (S) refers to the purity of a color; the higher the saturation, the purer the color, and the lower the saturation, the more grayish it appears. It ranges from 0-100%. Lightness (L) also ranges from 0-100%.
[0022] The markings in this application are text, symbols, images, etc. used to indicate information, and can be displayed in the form of controls or other containers, including but not limited to text markings, symbol markings, and image markings.
[0023] The technical solution of this application embodiment can be applied to scenarios involving the detection of group avatars in instant messaging applications or social applications. For example, a user might want to locate the group chat they have joined by detecting which avatars are group chats on the main interface of their instant messaging application, and then locate unread messages in the group chat.
[0024] The group avatar processing method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0025] Figure 1This is a flowchart illustrating a group avatar processing method provided in an embodiment of this application. The executing entity of the group avatar processing method can be an electronic device, which can be, but is not limited to, a personal computer (PC), a smartphone, a tablet computer, or a personal digital assistant (PDA).
[0026] like Figure 1 As shown, the group avatar processing method provided in this application embodiment may include steps 110-140.
[0027] Step 110: Obtain the first avatar image of the first session entry in the first application.
[0028] The first application can be any application used for group avatar processing, such as an instant messaging application or other social networking application, and is not limited in this embodiment. It should be noted that the following embodiments use an instant messaging application as an example for illustration.
[0029] The first session entry can be any session entry in the main interface of the first application. The first avatar image can be the avatar image corresponding to the first session entry.
[0030] In one example, refer to Figure 2 , Figure 2 This is the main interface of an instant messaging application. The main interface 21 includes multiple conversation entries. If it is necessary to detect whether the avatar of conversation entry 22 is a group avatar, then conversation entry 22 is the first conversation entry, and the image of avatar 23 of conversation entry 22 is the first avatar image.
[0031] In some embodiments of this application, to avoid adding noise to group avatar processing and improve the accuracy and efficiency of group avatar processing, step 110 may specifically include: Once it is confirmed that the user's authorization information has been received, the main interface of the first application is captured. The profile picture of the first conversation entry is cropped to obtain the first profile picture of the first conversation entry.
[0032] The authorization information may be information that the user authorizes the electronic device to collect from the main interface of the first application.
[0033] The main interface may include at least one session entry, and at least one session entry may include a first session entry, such as... Figure 2 As shown, the main interface 21 includes multiple session entries, among which the first session entry 22 is included.
[0034] In some embodiments of this application, user authorization information is required when capturing the main interface of the first application. Specifically, this can be determined when the electronic device receives permission from the user by enabling and granting access in the system settings. If the electronic device does not receive user authorization information, it cannot capture the main interface of the first application.
[0035] When an electronic device receives authorization information from a user, it can capture the main interface of the first application, then crop the avatar image of the first session entry in the main interface to obtain the first avatar image of the first session entry.
[0036] In some embodiments of this application, when the electronic device receives authorization information from the user, the group avatar processing service provided by the electronic device must comply with the operating system specifications. For example, if the operating system of the electronic device is Android, the Android platform needs to declare AccessibilityService and indicate its purpose within the visible range.
[0037] Furthermore, when the electronic device receives authorization information from the user, the group avatar processing service provided by the electronic device should also limit the scope of event subscription. Specifically, the limited events can be events directly related to the traversal of at least one session item list in the main interface, typically: events related to changes in window content, i.e., TYPE_WINDOW_CONTENT_CHANGED; events related to scrolling of at least one session item list in the main interface, i.e., TYPE_VIEW_SCROLLED; and, if necessary, events related to click feedback confirmation, i.e., TYPE_VIEW_CLICKED. In this embodiment, the group avatar processing service does not subscribe to events unrelated to the scenario of this embodiment, such as focus changes and text changes, to reduce noise in the group avatar processing.
[0038] In this embodiment, the group avatar processing service provided by the electronic device also provides a feedback type service. This feedback type service can use a general feedback type to meet the requirements of reading the structure and initiating clicks / scrolls. For example, after the group avatar processing service provided by the electronic device receives a subscription to the feedback type service, it only uses it to determine that a new item has appeared, and then continues to traverse and locate the avatar view. It will not send "group avatar / individual avatar" back to the system as accessibility "feedback content".
[0039] Furthermore, the group avatar processing service provided in this application adopts a method of minimizing the acquisition area to acquire data from the main interface. That is, it only acquires the minimum information necessary for locating the avatar, such as the screen coordinates of the avatar area and the entry identifier. Here, the entry identifier may be, for example, the location or sequence number of the adapter, without reading the specific message text, the full nickname, the message body, or other content irrelevant to the determination. Subsequent cropping is also only applied to the avatar area image.
[0040] Traversing at least one session item list in the main interface can be done through hierarchical traversal based on the system-provided accessible node tree ViewTree. Specifically, starting with getRootInActiveWindow(), the list container, such as RecyclerView / ListView, is located first. Then, the session item container and avatar view are filtered by attributes such as role, class name, hintText, contentDescription, and boundsInScreen. That is, after locating the list container, each session item container is traversed in breadth-first order within the list container, i.e., each session item in the main interface is traversed. Then, within a single item container, the avatar view (ImageView class) and its boundsInScreen are searched in depth-first order, and the item index and avatar rectangle are recorded. Finally, the avatar is cropped.
[0041] When iterating through the view creation process for at least one session item in the main interface, a lazy loading of the virtualized list is employed. This is combined with sequential scrolling and incremental collection of window change events. In other words, when iterating through the view creation process for at least one session item in the main interface, only the currently visible session items are created. Invisible session items are not iterated over initially; that is, invisible views are not in the node tree. As the main interface view scrolls, old views are recycled, and new views are reused and created. Therefore, we need sequential scrolling to trigger the appearance and collection of more items, and during collection, only newly appearing items are collected to avoid repeated reading of session items.
[0042] In scenarios where the avatar area of a conversation entry in the main interface is obscured by a floating layer, pop-up window, input method keyboard, or floating window, or in scenarios where the avatar area of a conversation entry in the main interface is partially covered by another window in split-screen mode, filtering can be performed based on the display ID and the boundary of the avatar area. Specifically, filtering can be performed by checking whether the node's displayId and boundsInScreen fall within the avatar area of the conversation entry. If so, nodes that are obscured or not currently displayed can be discarded.
[0043] In the embodiments of this application, the main interface of the first application is captured only after the user's authorization information is confirmed to be received. This ensures the security of the user's privacy data in the first application. In addition, the first avatar image of the first session entry can be obtained by cropping the avatar image of the first session entry. In this way, only the avatar image of the first session entry is obtained, and the message text in the first session entry is not obtained. This avoids adding noise to the group avatar processing and improves the accuracy and efficiency of the group avatar processing.
[0044] In some embodiments of this application, when capturing the main interface of the first application, the pixel frame bitmap of the currently active window of the main interface of the first application is captured. Specifically, the pixel frame bitmap of the currently active window of the main interface can be obtained from the screenshot or surface copy interface provided by the system, such as the screen, window rendering surface, or application rendering cache.
[0045] After acquiring the pixel frame bitmap of the currently active window of the main interface of the first application, the pixel frame bitmap of the currently active window of the main interface of the first application can be normalized to a fixed size according to the long side, such as 128 or 160, to maintain the aspect ratio of the pixel frame bitmap, and a certain safety margin is reserved around the avatar area of the pixel frame bitmap, such as 2 to 4 pixels. The specific safety margin can be determined according to the resolution of the avatar, and is not limited in this embodiment.
[0046] In some embodiments of this application, cropping the avatar image of the first session entry to obtain the first avatar image of the first session entry may specifically include: Based on the type of the profile picture image of the first session entry, determine the target cropping method for cropping the profile picture image of the first session entry; The profile picture of the first conversation entry is cropped according to the target cropping method to obtain the first profile picture of the first conversation entry.
[0047] The target cropping method can be a method of cropping the avatar image of the first session entry.
[0048] In some embodiments of this application, when cropping the avatar image of the first session entry, different cropping methods can be used to crop it according to the different types of the avatar image of the first session entry, and then the avatar image of the first session entry can be cropped using the corresponding cropping method to obtain the first avatar image of the first session entry.
[0049] In the case where the avatar image of the first session entry is a rounded or circular image, such as Figure 2The avatar image 23 of the session entry 22 shown has rounded corners 231. As a result, the four corners of the avatar image 23 will have transparent or semi-transparent pixels. For example, if the transparency of a pixel is less than 1, the edges of the four corners will have a smooth transition. In this case, the avatar image 23 of the session entry 22 can be cropped by using an inscribed rectangle. For rounded corners, transparent edges can be removed based on the transparency threshold or the rounded corner radius. If necessary, morphological closing operations can be performed to repair the transparent or semi-transparent edges.
[0050] If the visible area of the avatar image in the first session entry extends beyond the screen due to animation or split-screen, or if the avatar image is obscured by speech bubbles, badges, etc., then... Figure 2 As shown, the avatar image 23 of conversation entry 22 is obscured by unread marker 232. In this case, if the obscuration area is small, the avatar image of the first conversation entry is cropped using centering and edge padding to ensure that the main body of the cropped avatar image is centered. If the obscuration area is large, the cropping frame is reduced using a conservative window, and the edge unit weights are reduced during the feature statistics stage to suppress the impact.
[0051] In the embodiments of this application, different cropping methods are used to crop the avatar images according to different types of avatar images, rather than using a uniform cropping method to crop the avatar images, which improves the accuracy of avatar image cropping and thus ensures the accuracy of subsequent group avatar processing.
[0052] Step 120: Convert the first avatar image to the first color space to obtain the second avatar image.
[0053] The first color space can be a pre-defined color space, such as HSV color space, or Lab, YCbCr, or HSL, etc., and is not limited in this embodiment.
[0054] It should be noted that the following embodiments use the HSV color space as an example for illustration.
[0055] The second avatar image can be the avatar image obtained by converting the first avatar image to the first color space.
[0056] Step 130: Determine the global grayscale features of the second avatar image based on the pixels in the second avatar image.
[0057] The global grayscale feature of the second headshot image can be the grayscale feature of the pixels in the second headshot image.
[0058] In some embodiments of this application, step 130 may specifically include: The second avatar image is divided into N sub-avatar regions; For each sub-avatar region, the proportion of pixels in the sub-avatar region that meet the first grayscale condition is counted to obtain the region grayscale features corresponding to each sub-avatar region. Based on the regional grayscale features corresponding to each sub-headshot region, the global grayscale features of the second headshot image are determined.
[0059] The N sub-avatar regions can be the N avatar regions obtained after dividing the second avatar image, where N can be a positive integer.
[0060] Continue to refer to Figure 2 The avatar image 23 in conversation entry 22 can be segmented to obtain, as follows: Figure 3 The four sub-avatar areas shown are sub-avatar area 31, sub-avatar area 32, sub-avatar area 33 and sub-avatar area 34.
[0061] For each sub-avatar region, the first grayscale condition can be the condition that the color channel values of the pixels in that sub-avatar region must satisfy.
[0062] It should be noted that the first grayscale condition corresponding to each sub-avatar area can be the same or different. The specific condition can be set according to the user's needs, and is not limited in this embodiment.
[0063] For each sub-avatar region, the corresponding grayscale feature of the sub-avatar region can be the proportion of pixels in the sub-avatar region that meet the first grayscale condition.
[0064] In some embodiments of this application, when the first color space is the HSV color space, the first grayscale condition may include: the saturation channel value is less than or equal to the saturation threshold, and the lightness channel value is less than or equal to the lightness threshold.
[0065] The aforementioned saturation threshold can be a pre-set threshold for the saturation channel value. For example, the saturation threshold can be set to 20%. The specific value of the saturation threshold can be set by the user according to their needs, and is not limited in this embodiment.
[0066] The aforementioned brightness threshold can be a pre-set threshold for the brightness channel value. For example, the brightness threshold can be 30%. The specific value of the brightness threshold can be set by the user according to their needs, and is not limited in this embodiment.
[0067] In some embodiments of this application, the second avatar image can be divided into N sub-avatar regions. Then, for each sub-avatar region, the proportion of pixels in the sub-avatar region that meet the first grayscale condition is counted to obtain the regional grayscale features corresponding to each sub-avatar region. Based on the regional grayscale features corresponding to each sub-avatar region, the global grayscale features of the second avatar image can be determined.
[0068] In the embodiments of this application, by dividing the second sub-headshot image into N sub-headshot regions, the global grayscale features of the second headshot image are determined by the grayscale features of the regions corresponding to each sub-headshot region. This preserves the spatial location information of each pixel in the second headshot image, retaining local structure and features, rather than directly counting the pixels in the entire second headshot image. Because performing global statistics on the second headshot image would lose the spatial distribution information of the pixels, the solution of this application embodiment can improve the robustness of features, thereby improving the detection accuracy of group headshots.
[0069] In some embodiments of this application, to improve the accuracy of the second avatar image segmentation, the segmentation of the second avatar image to obtain N sub-avatar regions may specifically include: Get the minimum side length of the second avatar image; The grid density for dividing the second headshot image is determined based on the minimum side length; The second avatar image is divided into N sub-avatar regions based on the grid density.
[0070] Wherein, the minimum side length of the second avatar image can be the length of the minimum side of the second avatar image, such as... Figure 2 In the second avatar image, the smallest side is side 25, and the length L of side 25 can be obtained.
[0071] In some embodiments of this application, the grid density for dividing the second avatar image can be determined based on the minimum side length of the second avatar image, and then the second avatar image can be divided according to the grid density to obtain N sub-avatar regions.
[0072] The aforementioned grid density is directly proportional to the minimum side length. That is, the smaller the minimum side length, the lower the grid density for dividing the second profile picture, and the fewer sub-profile picture regions the image is divided into. Conversely, the larger the minimum side length, the higher the grid density for dividing the second profile picture, and the more sub-profile picture regions the image is divided into. For example, when the minimum side length is less than 90mm, the grid density for dividing the second profile picture can divide it into 3×3=9 sub-profile picture regions. When the minimum side length is between 90mm and 192mm, the grid density for dividing the second profile picture can divide it into 4×4=16 sub-profile picture regions. When the minimum side length is greater than 192mm, the grid density for dividing the second profile picture can divide it into 5×5=25 sub-profile picture regions.
[0073] In the embodiments of this application, the number of sub-avatar regions into which the second avatar image is divided is determined based on the minimum side length of the second avatar image, rather than dividing all avatar images into the same number of sub-avatar regions. This avoids the problem of inaccurate avatar image division when all avatar images are divided into the same number of sub-avatar regions. The method of the embodiments of this application improves the accuracy of avatar image division, thereby improving the accuracy of group avatar processing.
[0074] In some embodiments of this application, when dividing the second headshot image into N sub-headshot regions according to the grid density, the second headshot image can be divided using horizontal midlines, vertical midlines, and auxiliary lines, such as... Figure 3 As shown, there is a vertical center line 311 between sub-avatar areas 31 and 32, and between sub-avatar areas 33 and 34, and a horizontal center line 312 between sub-avatar areas 31 and 33.
[0075] When a group profile picture is composed of the individual profile pictures of group members, there are dividing lines between the profile pictures of each member, such as... Figure 2 As shown, the avatar image 23 is composed of multiple individual avatars, and there is a dividing line 26 between two adjacent individual avatars. Therefore, if a clear dividing line is detected in the second avatar image, if the added horizontal center line, vertical center line and auxiliary line are at the dividing point, the horizontal center line, vertical center line and auxiliary line can be added near the dividing line to increase the sensitivity of "puzzle segmentation".
[0076] It should be noted that the horizontal center line, vertical center line, and auxiliary lines mentioned above are only for the convenience of sampling / statistical analysis and will not change the grid boundaries.
[0077] It should be noted that, Figure 2There is a dividing line between each adjacent personal profile picture, but Figure 2 Only one dividing line is marked in the middle.
[0078] In some embodiments of this application, the saturation threshold and brightness threshold in the first grayscale condition described above can be determined based on the size information of the first portrait image. Specifically, it can be: Obtain the first sample set; Based on the sample saturation threshold and the sample brightness threshold, the first sample group head image is processed to obtain the first predicted label of the first sample group head image. If the first predicted label and the first sample label match, determine that the sample saturation threshold and brightness threshold correspond to the first sample size information.
[0079] The first sample set can be a sample set used to determine saturation and brightness thresholds. The avatar images in this first sample set can include group avatars with various background colors, and can also include individual avatars with various background colors. Specifically, the first sample set can include first sample group avatar images, first sample labels for the first sample group avatar images, and first sample size information for the first sample group avatar images.
[0080] The aforementioned first sample group head image can be a group head image used to determine the saturation threshold and brightness threshold. The first sample label can be a label for the first sample group head image, specifically indicating whether the first sample group head image is a group head image or an individual image. The first sample size information can be the size information of the first sample group head image.
[0081] The sample saturation threshold and sample brightness threshold can be preset saturation thresholds and brightness thresholds used to process the first sample group of headshot images.
[0082] The predicted label can be the label of the first sample group head image after processing the first sample group head image based on the sample saturation threshold and brightness threshold.
[0083] In some embodiments of this application, a first sample set is obtained, and then the first sample group of avatar images is processed according to a sample saturation threshold and a brightness threshold to obtain a first predicted label for the first sample group of avatar images. If the first predicted label matches the first sample label (i.e., the first predicted label and the first sample label are the same), the sample saturation threshold and the sample brightness threshold are determined to correspond to the first sample size information. In other words, by segmenting the avatar images with different size information in the first sample set and fitting saturation thresholds and brightness thresholds, the correspondence between the saturation thresholds and brightness thresholds and the size information can be obtained.
[0084] In the embodiments of this application, by pre-fitting the correspondence between different size information and saturation and brightness thresholds, the region grayscale features of the sub-head portrait regions of the head portrait image with different size information can be statistically analyzed directly based on the correspondence, thereby improving the statistical efficiency of the region grayscale features of the sub-head portrait regions of the head portrait image.
[0085] In some embodiments of this application, in order to improve the statistical accuracy of the regional grayscale features of the sub-headshot regions, before calculating the proportion of pixels in the sub-headshot region that meet the first grayscale condition for each sub-headshot region to obtain the regional grayscale features corresponding to each sub-headshot region, the method described above may further include: For each sub-avatar region, the sub-avatar region is offset inward along the edge of the sub-avatar region by a first number of pixels to obtain the target sub-avatar region. For each sub-avatar region, the proportion of pixels in the sub-avatar region that meet the first grayscale condition is calculated to obtain the region grayscale features corresponding to each sub-avatar region. Specifically, this may include: For each target sub-headshot region, the proportion of pixels in the target sub-headshot region that meet the first grayscale condition is calculated to obtain the region grayscale features corresponding to each target sub-headshot region.
[0086] The first quantity can be a pre-set quantity, such as 2 to 4.
[0087] For each sub-avatar region, the corresponding target sub-avatar region can be the sub-avatar region obtained by offsetting the sub-avatar region inward by a first number of pixels along the edge of the sub-avatar region. That is, for each sub-avatar region, the corresponding target sub-avatar region can be the sub-avatar region obtained by shrinking the sub-avatar region inward by a first number of pixels along the edge of the sub-avatar region.
[0088] In some embodiments of this application, for each sub-headshot region, in order to avoid edge aliasing of the sub-headshot region and affect the statistics of pixels in the sub-headshot region, the sub-headshot region can be shrunk inward by a first number of pixels along the edge of the sub-headshot region to obtain the target sub-headshot region. Thus, for each target sub-headshot region, the proportion of pixels in the target sub-headshot region that meet the first grayscale condition is counted to obtain the region grayscale features corresponding to each target sub-headshot region.
[0089] In the embodiments of this application, for each sub-headshot region, a target sub-headshot region is obtained by shifting the sub-headshot region inward along its edge by a first number of pixels. Then, the proportion of pixels in the target sub-headshot region that meet the first grayscale condition is counted to obtain the regional grayscale features corresponding to each target sub-headshot region. This avoids edge aliasing of the sub-headshot region, which affects the statistics of pixels in the sub-headshot region and improves the statistical accuracy of the regional grayscale features of the sub-headshot region.
[0090] In some embodiments of this application, in order to improve the accuracy of determining the grayscale features corresponding to the first sub-headshot region, for each sub-headshot region, the proportion of pixels in the sub-headshot region that meet the first grayscale condition is statistically analyzed to obtain the regional grayscale features corresponding to each sub-headshot region. Specifically, this may include: If more than a second threshold pixel is occluded in the first sub-headshot region, at least one pixel in the second sub-headshot region adjacent to the first sub-headshot region is obtained. The proportion of pixels satisfying the first grayscale condition in at least one second sub-headshot region is calculated to obtain the first region grayscale features corresponding to at least one second sub-headshot region. The proportion of pixels in the first sub-headshot region that meet the first grayscale condition is counted to obtain the grayscale feature of the second region corresponding to the first sub-headshot region. Based on the grayscale features of the first region of at least one second sub-avatar region, the grayscale features of the second region are compensated to obtain the grayscale features of the region corresponding to the first sub-avatar region.
[0091] The first sub-avatar area can be any one of the N sub-avatar areas.
[0092] The second threshold can be a pre-set threshold for the number of pixels obscured in the first sub-headshot area. The second threshold can be 20%, and the specific value of the second threshold can be set by the user according to their needs. It is not limited in this embodiment.
[0093] At least one second sub-avatar region can be at least one sub-image region adjacent to the first sub-avatar region among N sub-avatar regions. That is, the N sub-avatar regions can include the first sub-avatar region and at least one second sub-avatar region. For example... Figure 3 As shown, when the first sub-avatar area is sub-avatar area 32, at least one second sub-avatar area can be sub-avatar area 31 and sub-avatar area 34.
[0094] For each second sub-avatar region corresponding to at least one second sub-avatar region, the corresponding first region grayscale feature can be obtained by statistically analyzing the proportion of pixels in the second sub-avatar region that satisfy the first grayscale condition in that second sub-avatar region.
[0095] The grayscale feature of the first region can be obtained by statistically analyzing the proportion of pixels in the first sub-headshot region that meet the first grayscale condition in the first sub-headshot region.
[0096] In some embodiments of this application, when more than a first threshold pixel is occluded in the first sub-headshot region, such as when more than 20% of the pixels in the first sub-headshot region are occluded, pixels from at least one second sub-headshot region adjacent to the first sub-headshot region can be obtained. In this way, the grayscale features of the second region of the first sub-headshot region can be compensated according to the grayscale features of the first region of each of the at least one second sub-headshot region, so as to obtain the grayscale features of the region corresponding to the first sub-headshot region.
[0097] In some embodiments of this application, the possible reasons for the pixels in the first sub-avatar area being occluded include, but are not limited to: the transparent or semi-transparent edges resulting from the circular or rounded corner display of the first sub-avatar area; the corner mark, logo, red dot, etc. covering a corner of the first sub-avatar area; the split screen, pop-up overlay, input method overlay, etc. obscuring a part of the first sub-avatar area; and rendering reuse causing the sampling position of individual units to fall in the invalid pixel area.
[0098] When compensating the grayscale features of the second region of the first sub-headshot region based on the grayscale features of the first region of at least one second sub-headshot region respectively, and obtaining the grayscale features of the region corresponding to the first sub-headshot region, the grayscale features of the region corresponding to the first sub-headshot region can be obtained by following formula (1):
[0099] In the above formula (1), This is the first child avatar area. This represents the grayscale features of the first region of the first sub-head image region. The proportion of unobstructed pixels in the first sub-headshot area within the first sub-headshot area. A set of at least one second sub-avatar region that is adjacent to the first sub-avatar region. For the first The grayscale features of the second region of the second sub-head image area. For the first child portrait area and the second The positional weight of the second sub-headshot region, which is related to the positional weight of the first sub-headshot region and the positional weight of the second sub-headshot region. The distance between the second child avatar areas is related to this.
[0100] When using the above formula (1) to determine the grayscale features of the region corresponding to the first sub-head image region, the position weight of the first sub-head image region is reduced, so as to avoid the first sub-head image region being abnormally magnified locally.
[0101] In the embodiments of this application, when more than a first threshold pixel is occluded in the first sub-headshot region, the grayscale features of the second region of the first sub-headshot region can be compensated based on the grayscale features of the first region of at least one second sub-headshot region adjacent to the first sub-headshot region. This allows the grayscale features of the region corresponding to the first sub-headshot region to be obtained. This avoids errors in determining the grayscale features of the first sub-headshot region due to pixel occlusion, which would affect the accuracy of subsequent group headshot processing and improve the accuracy of determining the grayscale features of the region corresponding to the first sub-headshot region.
[0102] In some embodiments of this application, in order to improve the accuracy of determining the global grayscale features of the second avatar image, the step of determining the global grayscale features of the first avatar image based on the regional grayscale features corresponding to each sub-avatar region may specifically include: The grayscale features of each sub-headshot region are weighted and fused with the positional weights pre-assigned to each sub-headshot region to obtain the global grayscale features of the first headshot image.
[0103] For each sub-avatar area, its corresponding position weight can be a pre-set position weight. The position weight of each sub-avatar area can be determined based on its position and size information. The specific position weight of each sub-avatar area can be set by the user according to their needs, and is not limited in this embodiment.
[0104] In some embodiments of this application, after obtaining the regional grayscale features corresponding to each sub-headshot region, the regional grayscale features corresponding to each sub-headshot region and the position weights pre-assigned to each sub-headshot region can be weighted and fused to obtain the global grayscale features of the second headshot image.
[0105] In the embodiments of this application, the global grayscale features of the second avatar image are obtained by weighted and fused calculation of the grayscale features corresponding to each sub-avatar region and the positional weights pre-assigned to each sub-avatar region. This avoids using the grayscale features of a single sub-avatar region as the global grayscale features of the second avatar image, which would cause the global grayscale features of the second avatar image to be interfered with by local noise or irrelevant information. It also avoids the situation where the average of the grayscale features of each sub-avatar region is used as the global grayscale features of the second avatar image, ignoring the distribution of grayscale features in the image, which would lead to inaccurate global grayscale features of the determined second avatar image. The solution of this application, while preserving global information, introduces key spatial distribution priors, improving the accuracy of determining the global grayscale features of the second avatar image.
[0106] Step 140: If the global grayscale feature is greater than or equal to the first threshold, determine the first avatar image as the group avatar.
[0107] The first threshold can be a pre-set threshold for global grayscale features. The first threshold can be 0.3. The specific first threshold can be set by the user according to their needs, and is not limited in this embodiment.
[0108] In some embodiments of this application, if the global grayscale feature is greater than or equal to a first threshold, the first avatar image can be determined to be a group avatar, such as... Figure 2 As shown, if the global grayscale feature of the avatar image 23 is greater than or equal to the first threshold, the avatar image 23 can be determined to be a group avatar rather than an individual avatar.
[0109] In some embodiments of this application, prior to step 140, the method described above may further include: Obtain the size information of the first avatar image; The first threshold is determined based on the minimum side length and the pre-set correspondence between the minimum side length and the grayscale feature threshold.
[0110] The size information of the first avatar image may include the minimum side length of the first avatar image.
[0111] In some embodiments of this application, the first threshold can be determined based on the minimum side length of the first portrait image and the pre-set correspondence between the minimum side length and the grayscale feature threshold. That is, when the first color space is the HSV color space, the value of the first threshold can be related to the minimum side length of the first portrait image. Specifically, for example, when the minimum side length is less than 96mm, the first threshold can be 0.3±0.03, and when the minimum side length is greater than 192mm, the first threshold can be 0.25±0.02.
[0112] In the embodiments of this application, the first threshold is determined based on the size information of the first avatar image and the correspondence between the preset minimum side length and the grayscale feature threshold, rather than using the same grayscale feature threshold for all avatar images, thereby improving the detection accuracy of each avatar image.
[0113] In some embodiments of this application, in order to improve the efficiency of users viewing unread messages in a group, such as... Figure 4 As shown, after step 140, the method described above may further include steps 150 and 160.
[0114] Step 150: If it is determined that the first conversation entry has an unread mark, retrieve the unread messages in the chat interface of the first conversation entry.
[0115] The unread flag can be a flag indicating that there are unread messages in the first session entry, such as... Figure 2 The unread superscript number 232.
[0116] In some embodiments of this application, the unread marker in the first session entry can be searched based on the accessible node attribute. If the unread marker in the first session entry is found, that is, if the unread marker in the first session entry is determined to exist, the chat interface of the first session entry can be accessed to obtain the unread messages in the chat interface of the first session entry.
[0117] Continue to refer to Figure 2 If an unread tag 232 is detected in the avatar image 23, it can enter the following... Figure 5 The chat interface 51 of the shown conversation entry 22 retrieves unread messages 52.
[0118] In some embodiments of this application, after entering the chat interface of the first session entry, unread messages can be located by automatic page turning. Specifically, there are two ways to use automatic page turning to locate unread messages: Accessible actions: Directly invoke actions provided by the system's accessibility features, such as ACTION_CLICK to open a session and ACTION_SCROLL_FORWARD to turn pages.
[0119] Synthesized gestures: On interfaces that do not support the above actions, simulate the "press → move → lift" swipe, with a sampling interval of 10–20ms to ensure smooth scrolling.
[0120] When automatically turning pages, remember the timestamp or entry number of the "last read" and continue scrolling down from the anchor point. Only collect newly appearing messages each time you scroll to avoid missing or repeating them.
[0121] Step 160: Process the unread messages and generate message summaries for the unread messages.
[0122] In some embodiments of this application, when it is determined that the first avatar image is a group avatar and the first conversation entry has an unread mark, the unread messages in the chat interface of the first conversation entry can be obtained, and then the unread messages can be processed to generate a message summary corresponding to the unread messages.
[0123] After obtaining unread messages from the chat interface of the first conversation entry, the unread messages can be sent to the summary module of the electronic device. Based on this summary module, the unread messages can be processed, the topics and keywords of the unread messages can be extracted, and a message summary corresponding to the unread messages can be generated.
[0124] It should be noted that, to meet the resource and latency constraints of the electronic device, an input limit needs to be set for the "summary module," such as a maximum of P messages or a maximum of Q characters. When the limit is exceeded, only the most recent P messages or the most recent T-minute window are taken; alternatively, the long input can be divided into multiple segments for separate summaries, and then the segments can be merged hierarchically to ensure completion within the latency and memory budget.
[0125] In the embodiments of this application, when it is determined that the first conversation entry has an unread mark, the unread messages in the chat interface of the first conversation entry are retrieved. This avoids blindly entering the chat interface of the first conversation entry, which could lead to failure in retrieving unread messages if there are no unread messages in the first conversation entry, thus avoiding the waste of runtime resources. Furthermore, by processing the unread messages in the chat interface of the first conversation entry, a message summary corresponding to the unread messages can be generated, allowing users to promptly understand the content of unread messages in the group and improving the efficiency of viewing unread messages in the group.
[0126] The group avatar processing method provided in this application can be executed by a group avatar processing device. This application uses the example of a group avatar processing device executing the group avatar processing method to illustrate the group avatar processing device provided in this application.
[0127] Figure 6 This is a schematic diagram illustrating the structure of a group portrait processing device according to an exemplary embodiment. Figure 6 As shown, the group avatar processing device 600 may include: The acquisition module 610 is used to acquire the first avatar image of the first session entry in the first application; The conversion module 620 is used to convert the first avatar image to a first color space to obtain a second avatar image; The first determining module 630 is used to determine the global grayscale features of the second avatar image based on the pixels in the second avatar image; The second determining module 640 is used to determine the first avatar image as a group avatar when the global grayscale feature is greater than or equal to the first threshold.
[0128] In the embodiments of this application, group avatars are typically composed of multiple small images pieced together, with dividing lines or borders in between. The color distribution is more complex, resulting in an overall appearance that is more "grayish" or "messy." In contrast, individual avatars usually have more uniform and vibrant colors. Therefore, by converting the first avatar image of the first session entry in the first application to a first color space to obtain a second avatar image, and then determining the global grayscale features of the second avatar image based on its pixels, group avatars can be effectively identified using these grayscale features. This effectively captures the unique color and structural features of the pieces in the group avatar puzzle, making it more robust than traditional face detection algorithms or general object detection frameworks. Furthermore, the accuracy of group avatar detection can be improved by using the global grayscale features of the second avatar image and determining a first threshold. Additionally, the solution in this application is executed by an electronic device, eliminating the need to upload to the cloud for execution and relying on no network. This allows for real-time group avatar detection, improving its efficiency.
[0129] In some embodiments of this application, the first determining module is specifically used for: The second avatar image is divided into N sub-avatar regions, where N is a positive integer; For each sub-avatar region, the proportion of pixels in the sub-avatar region that meet the first grayscale condition is calculated to obtain the region grayscale features corresponding to each sub-avatar region. Based on the grayscale features of each sub-avatar region, the global grayscale features of the second avatar image are determined.
[0130] In some embodiments of this application, the first determining module is specifically used for: Obtain the minimum side length of the second avatar image; The grid density for dividing the second avatar image is determined based on the minimum side length, and the grid density is proportional to the minimum side length. The second avatar image is divided into N sub-avatar regions based on the grid density.
[0131] In some embodiments of this application, the apparatus further includes: The third determining module is used to, before calculating the proportion of pixels in the sub-avatar region that meet the first grayscale condition in the sub-avatar region for each sub-avatar region and obtaining the region grayscale features corresponding to each sub-avatar region, shift the sub-avatar region inward along the edge of the sub-avatar region by a first number of pixels to obtain the target sub-avatar region. The first determining module is specifically used for: For each target sub-headshot region, the proportion of pixels in the target sub-headshot region that meet the first grayscale condition is calculated to obtain the region grayscale features corresponding to each target sub-headshot region.
[0132] In some embodiments of this application, the first determining module is specifically used for: If more than a second threshold pixel is occluded in the first sub-avatar area, obtain the pixel of at least one second sub-avatar area adjacent to the first sub-avatar area. The N sub-avatar areas include the first sub-avatar area and the at least one second sub-avatar area. The proportion of pixels in each of the at least one second sub-headshot regions that satisfy the first grayscale condition is calculated to obtain the first region grayscale features corresponding to each of the at least one second sub-headshot regions. The proportion of pixels in the first sub-headshot region that meet the first grayscale condition is counted to obtain the grayscale feature of the second region corresponding to the first sub-headshot region. Based on the grayscale features of the first region of each of the at least one second sub-avatar region, the grayscale features of the second region are compensated to obtain the grayscale features of the region corresponding to the second sub-avatar region.
[0133] In some embodiments of this application, the first color space includes the HSV color space, and the first grayscale condition includes: the saturation channel value is less than or equal to the saturation threshold, and the brightness channel value is less than or equal to the brightness threshold, wherein the saturation threshold and the brightness threshold are determined based on the size information of the first avatar image.
[0134] In some embodiments of this application, the first determining module is specifically used for: The grayscale features of each sub-avatar region are weighted and fused with the positional weights pre-assigned to each sub-avatar region to obtain the global grayscale features of the second avatar image.
[0135] In some embodiments of this application, the acquisition module is further configured to: before determining that the first avatar image is a group avatar when the global grayscale feature is greater than or equal to a first threshold, acquire the size information of the first avatar image, wherein the size information includes the minimum side length of the first avatar image; The device further includes a fourth determining module, used to determine the first threshold based on the minimum side length and a pre-set correspondence between the minimum side length and the grayscale feature threshold.
[0136] In some embodiments of this application, the acquisition module is further configured to: after determining that the first avatar image is a group avatar, and if it is determined that the first conversation entry has an unread mark, acquire unread messages in the chat interface of the first conversation entry; The device further includes a generation module, used to process the unread messages and generate a message digest corresponding to the unread messages.
[0137] In some embodiments of this application, the acquisition module is specifically used for: Upon confirming that user authorization information has been received, the main interface of the first application is captured, wherein the main interface includes at least one session entry, and the at least one session entry includes the first session entry; The profile picture of the first conversation entry is cropped to obtain the first profile picture of the first conversation entry.
[0138] The group avatar processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0139] The group avatar processing device in this application embodiment can be a device with an operating system. The operating system can be Android, iOS, or other possible operating systems, and this application embodiment does not specifically limit it.
[0140] The group avatar processing device provided in this application embodiment can achieve... Figure 1 and Figure 4 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0141] Optionally, such as Figure 7 As shown, this application embodiment also provides an electronic device 700, including a processor 701 and a memory 702. The memory 702 stores a program or instructions that can run on the processor 701. When the program or instructions are executed by the processor 701, they implement the various steps of the above-described group avatar processing method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0142] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0143] Figure 8 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0144] The electronic device 800 includes, but is not limited to, components such as: radio frequency unit 801, network module 802, audio output unit 803, input unit 804, sensor 805, display unit 806, user input unit 807, interface unit 808, memory 809, and processor 810.
[0145] Those skilled in the art will understand that the electronic device 800 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 810 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 8 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0146] The processor 810 is configured to acquire a first avatar image of a first session entry in a first application; convert the first avatar image to a first color space to obtain a second avatar image; determine the global grayscale features of the second avatar image based on the pixels in the second avatar image; and determine the first avatar image as a group avatar if the global grayscale features are greater than or equal to a first threshold.
[0147] Thus, group avatars are typically composed of multiple small images pieced together, with dividing lines or borders in between, resulting in a more complex color distribution and an overall appearance that is more "grayish" or "messy." In contrast, individual avatars usually have more uniform and vibrant colors. Therefore, by converting the first avatar image of the first session entry in the first application to the first color space to obtain the second avatar image, and then determining the global grayscale features of the second avatar image based on the pixels in the second avatar image, group avatars can be identified using the grayscale features of the avatars. This effectively captures the unique color and structural features of the pieces in the group avatars, making it more robust than traditional face detection algorithms or general object detection frameworks. Furthermore, by using the global grayscale features of the second avatar image and determining a first threshold, the accuracy of group avatar detection can be improved. In addition, the solution in this embodiment is executed by an electronic device, without needing to be uploaded to the cloud for execution, and is not dependent on the network, enabling real-time detection of group avatars and improving the efficiency of group avatar detection.
[0148] Optionally, the processor 810 is further configured to divide the second avatar image into N sub-avatar regions, where N is a positive integer; for each sub-avatar region, to count the proportion of pixels in the sub-avatar region that satisfy the first grayscale condition in the sub-avatar region, and to obtain the region grayscale features corresponding to each sub-avatar region; and to determine the global grayscale features of the second avatar image based on the region grayscale features corresponding to each sub-avatar region.
[0149] Thus, by dividing the second sub-headshot image into N sub-headshot regions, and using the grayscale features of each sub-headshot region, the global grayscale features of the second headshot image are determined. This preserves the spatial location information of each pixel in the second headshot image, retaining local structure and features, rather than directly counting all pixels in the entire second headshot image. Because performing global statistics on the second headshot image would lose the spatial distribution information of the pixels, the solution in this application can improve the robustness of the features, thereby improving the detection accuracy of group headshots.
[0150] Optionally, the processor 810 is further configured to obtain the minimum side length of the second avatar image; determine the grid density for dividing the second avatar image based on the minimum side length, wherein the grid density is proportional to the minimum side length; and divide the second avatar image according to the grid density to obtain N sub-avatar regions.
[0151] Thus, by determining the number of sub-avatar regions to be divided into the second avatar image based on the minimum side length of the second avatar image, instead of dividing all avatar images into the same number of sub-avatar regions, the problem of inaccurate avatar image division caused by dividing all avatar images into the same number of sub-avatar regions is avoided. The method of this application embodiment improves the accuracy of avatar image division, thereby improving the accuracy of group avatar processing.
[0152] Optionally, the processor 810 is further configured to, for each sub-headshot region, offset the sub-headshot region inward along the edge of the sub-headshot region by a first number of pixels to obtain a target sub-headshot region; and for each target sub-headshot region, calculate the proportion of pixels in the target sub-headshot region that satisfy the first grayscale condition in the target sub-headshot region to obtain the region grayscale features corresponding to each target sub-headshot region.
[0153] Thus, for each sub-headshot region, the target sub-headshot region is obtained by shifting the sub-headshot region inward by a first number of pixels along its edge. Then, the proportion of pixels in the target sub-headshot region that meet the first grayscale condition is counted to obtain the regional grayscale features corresponding to each target sub-headshot region. This avoids edge distortion of the sub-headshot region, which affects the statistics of pixels in the sub-headshot region and improves the statistical accuracy of the regional grayscale features of the sub-headshot region.
[0154] Optionally, the processor 810 is further configured to, when a number of pixels in the first sub-headshot region are occluded (greater than a second threshold), acquire pixels in at least one second sub-headshot region adjacent to the first sub-headshot region, wherein the N sub-headshot regions include the first sub-headshot region and the at least one second sub-headshot region; respectively calculate the proportion of pixels in the at least one second sub-headshot region that meet the first grayscale condition in the at least one sub-headshot region to obtain the first region grayscale features corresponding to the at least one second sub-headshot region; calculate the proportion of pixels in the first sub-headshot region that meet the first grayscale condition in the first sub-headshot region to obtain the second region grayscale features corresponding to the first sub-headshot region; and compensate the second region grayscale features based on the first region grayscale features of the at least one second sub-headshot region to obtain the region grayscale features corresponding to the first sub-headshot region.
[0155] Thus, if more than a second threshold pixel is occluded in the first sub-headshot region, the grayscale features of the second region of the first sub-headshot region can be compensated based on the grayscale features of the first region of at least one second sub-headshot region adjacent to the first sub-headshot region. This allows the grayscale features of the region corresponding to the first sub-headshot region to be obtained. This avoids errors in determining the grayscale features of the first sub-headshot region due to pixel occlusion, which would affect the accuracy of subsequent group headshot processing and improve the accuracy of determining the grayscale features of the region corresponding to the first sub-headshot region.
[0156] Optionally, the first color space includes the HSV color space, and the first grayscale condition includes: the saturation channel value is less than or equal to the saturation threshold, and the brightness channel value is less than or equal to the brightness threshold, wherein the saturation threshold and the brightness threshold are determined based on the size information of the first avatar image.
[0157] Optionally, the processor 810 is further configured to perform weighted fusion of the grayscale features of the regions corresponding to each sub-head portrait region and the position weights pre-assigned to each sub-head portrait region to obtain the global grayscale features of the second head portrait image.
[0158] Thus, by weighting and fusing the grayscale features corresponding to each sub-headshot region with the pre-assigned positional weights for each sub-headshot region, the global grayscale features of the second headshot image can be obtained. This avoids using the grayscale features of a single sub-headshot region as the global grayscale features of the second headshot image, which would result in the global grayscale features of the second headshot image being interfered with by local noise or irrelevant information. It also avoids using the average of the grayscale features of each sub-headshot region as the global grayscale features of the second headshot image, which ignores the distribution of grayscale features in the image, leading to inaccurate global grayscale features. The solution in this embodiment retains global information while introducing key spatial distribution priors, improving the accuracy of determining the global grayscale features of the second headshot image.
[0159] Optionally, the processor 810 is further configured to obtain size information of the first avatar image, the size information including the minimum side length of the first avatar image; and determine the first threshold based on the minimum side length and a pre-set correspondence between the minimum side length and a grayscale feature threshold.
[0160] In this way, the first threshold is determined based on the size information of the first headshot image and the correspondence between the pre-set minimum side length and the grayscale feature threshold, instead of using the same grayscale feature threshold for all headshot images, thus improving the detection accuracy of each headshot image.
[0161] Optionally, the processor 810 is further configured to, when it is determined that the first session entry has an unread mark, obtain unread messages in the chat interface of the first session entry; process the unread messages to generate a message digest corresponding to the unread messages.
[0162] Therefore, if the first chat entry is confirmed to have an unread flag, the system retrieves the unread messages from the chat interface of that first chat entry. This avoids blindly entering the chat interface of the first chat entry, which could lead to failure in retrieving unread messages if there are no unread messages, thus wasting runtime resources. Furthermore, by processing the unread messages in the chat interface of the first chat entry, a message summary can be generated for each unread message. This allows users to promptly understand the content of unread messages in the group, improving the efficiency of viewing unread messages.
[0163] Optionally, the processor 810 is further configured to, upon determining that authorization information from a user has been received, acquire the main interface of a first application, the main interface including at least one session entry, the at least one session entry including the first session entry; and crop the avatar image of the first session entry to obtain a first avatar image of the first session entry.
[0164] Thus, after confirming that the user's authorization information has been received, the main interface of the first application is then captured, thereby ensuring the security of the user's privacy data in the first application. In addition, by cropping the avatar image of the first session entry, the first avatar image of the first session entry can be obtained. In this way, only the avatar image of the first session entry is obtained, without obtaining the message text in the first session entry, thus avoiding adding noise to the group avatar processing and improving the accuracy and efficiency of the group avatar processing.
[0165] It should be understood that, in this embodiment, the input unit 804 may include a graphics processing unit (GPU) 8041 and a microphone 8042. The GPU 8041 processes image data of still images or videos obtained by an image capture device (such as a color camera) in video capture mode or image capture mode. The display unit 806 may include a display panel 8061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 807 includes at least one of a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include a touch detection device and a touch controller. Other input devices 8072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0166] The memory 809 can be used to store software programs and various data. The memory 809 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 809 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 809 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0167] Processor 810 may include one or more processing units; optionally, processor 810 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 810.
[0168] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described group avatar processing method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0169] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0170] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described group avatar processing method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0171] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0172] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the group avatar processing method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0173] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0174] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0175] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A group head portrait processing method, characterized by, The method comprises: obtaining a first avatar image of a first session item in a first application program; converting the first avatar image to a first color space to obtain a second avatar image; determining a global gray scale feature of the second avatar image according to pixel points in the second avatar image; in a case where the global gray scale feature is greater than or equal to a first threshold value, determining that the first avatar image is a group avatar.
2. The method of claim 1, wherein, The method comprises: dividing the second avatar image to obtain N sub-avatar regions, N being a positive integer; for each sub-avatar region, counting a proportion of pixel points satisfying a first gray scale condition in the sub-avatar region to obtain a region gray scale feature corresponding to each sub-avatar region respectively; determining the global gray scale feature of the second avatar image based on the region gray scale feature corresponding to each sub-avatar region respectively.
3. The method of claim 2, wherein, The method comprises: obtaining a minimum side length of the second avatar image; determining a grid density for dividing the second avatar image according to the minimum side length; dividing the second avatar image according to the grid density to obtain N sub-avatar regions.
4. The method of claim 2, wherein, The method further comprises: for each sub-avatar region, offsetting the sub-avatar region inward by a first number of pixel points along an edge of the sub-avatar region to obtain a target sub-avatar region; The method comprises: for each target sub-avatar region, counting a proportion of pixel points satisfying a first gray scale condition in the target sub-avatar region to obtain a region gray scale feature corresponding to each target sub-avatar region respectively.
5. The method of claim 2, wherein, The method comprises: in a case where there are pixel points greater than a second threshold value being occluded in a first sub-avatar region, obtaining pixel points of at least one second sub-avatar region adjacent to the first sub-avatar region, the N sub-avatar regions comprising the first sub-avatar region and the at least one second sub-avatar region; counting a proportion of pixel points satisfying a first gray scale condition in the at least one second sub-avatar region to obtain a first region gray scale feature corresponding to the at least one second sub-avatar region respectively; counting a proportion of pixel points satisfying a first gray scale condition in the first sub-avatar region to obtain a second region gray scale feature corresponding to the first sub-avatar region; According to the first area gray scale feature of each of the at least one second sub-avatar area, the second area gray scale feature is compensated to obtain an area gray scale feature corresponding to the first sub-avatar area.
6. The method of claim 2, wherein, The first color space comprises an HSV color space, and the first gray scale condition comprises: a saturation channel value being less than or equal to a saturation threshold value, and a lightness channel value being less than or equal to a lightness threshold value, the saturation threshold value and the lightness threshold value being determined based on size information of the first avatar image.
7. The method of claim 2, wherein, The global gray scale feature of the first avatar image is determined based on the area gray scale feature corresponding to each sub-avatar area, comprising: The area gray scale feature corresponding to each sub-avatar area and a position weight pre-assigned to each sub-avatar area are weighted and fused to obtain the global gray scale feature of the first avatar image.
8. The method of claim 1, wherein, Before determining that the first avatar image is a group avatar in a case where the global gray scale feature is greater than or equal to a first threshold value, the method further comprises: Obtaining size information of the first avatar image, the size information comprising a minimum side length of the first avatar image; According to the minimum side length, the first threshold value is determined.
9. The method of claim 1, wherein, After determining that the first avatar image is a group avatar, the method further comprises: In a case where it is determined that the first session item has an unread mark, obtaining an unread message in a chat interface of the first session item; Processing the unread message to generate a message digest corresponding to the unread message.
10. The method of claim 1, wherein, The first avatar image of the first session item in the first application program is obtained, comprising: In a case where it is determined that authorization information of a user is received, a main interface of the first application program is collected, the main interface comprising at least one session item, the at least one session item comprising the first session item; The avatar image of the first session item is cropped to obtain the first avatar image of the first session item.
11. A group head portrait processing apparatus, characterized by comprising: The device comprises: An obtaining module for obtaining a first avatar image of a first session item in a first application program; A conversion module for converting the first avatar image to a first color space to obtain a second avatar image; A first determining module for determining a global gray scale feature of the second avatar image according to pixel points in the second avatar image; A second determining module for determining that the first avatar image is a group avatar in a case where the global gray scale feature is greater than or equal to a first threshold value.
12. An electronic device, comprising: A processor and a memory, the memory storing programs or instructions executable on the processor, the programs or instructions being executed by the processor to implement the steps of the group avatar processing method according to any one of claims 1-10.
13. A readable storage medium, characterized by, The readable storage medium stores programs or instructions, the programs or instructions being executed by the processor to implement the steps of the group avatar processing method according to any one of claims 1-10.