Portrait processing method and related device

By performing portrait segmentation and difference calculation on the smart TV client, only the difference data of image frames is transmitted, which solves the problem of slow transmission speed of portrait data on smart TVs, improves portrait synthesis efficiency and user experience, and reduces system costs.

CN118695022APending Publication Date: 2024-09-24HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410888695.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

Smart TV portrait data transmission speed is slow, resulting in low portrait synthesis efficiency and affecting user experience.

Method used

Establish a communication connection between the client and the TV, generate the first portrait data of the image frame through portrait segmentation, calculate the difference data with the previous frame data, and only transmit the difference data to the TV for composite display and update storage.

Benefits of technology

The data transmission speed and portrait synthesis efficiency are improved, latency is reduced, user experience is enhanced, system costs are reduced, and resources are effectively utilized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118695022A
    Figure CN118695022A
Patent Text Reader

Abstract

The invention discloses a portrait processing method and a related device, relates to the technical field of software, and is applied to a terminal, and communication connection is established between the terminal and a television terminal. Comprising the following steps: acquiring a current image frame, and generating first portrait data of the current image frame through portrait segmentation; under the condition that the current image frame is not the first frame, calling stored second portrait data of the previous image frame, and calculating difference data of the first portrait data and the second portrait data; and updating the second portrait data with the first portrait data for storage, and sending the difference data to the television end, so that the television end synthesizes and displays the first portrait data based on the difference data and the stored second portrait data, and the television end updates the second portrait data with the first portrait data for storage. According to the invention, the data transmission speed and the portrait synthesis efficiency can be effectively improved, and compared with portrait synthesis rendering carried out through a server at a television end, the method has great advantages in the aspects of real-time performance and low delay.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software technology, and in particular to a portrait processing method and related devices. Background Art

[0002] Smart TV is a new type of TV product that combines advanced hardware technology, Internet connectivity, an open operating system and rich application support. It aims to provide users with comprehensive, intelligent and personalized home entertainment and information services that go beyond the traditional TV viewing experience.

[0003] Currently, users can use their mobile phones to experience motion sensing games, live broadcasts and other applications on TV. When users experience this, they need to use their mobile phones to take real-time portraits and upload them to the TV, and then transmit them to the TV for synthesis and display. Since the data volume of the portrait data package is large, the transmission speed is slow, which makes the TV portrait synthesis efficiency low, easily causing TV freezes and affecting the user experience. Summary of the invention

[0004] In view of the above problems, the present application provides a portrait processing method and related devices to achieve the purpose of improving data transmission speed and portrait synthesis efficiency. The specific scheme is as follows:

[0005] In a first aspect, the present application provides a portrait processing method, which is applied to a client, the client has established a communication connection with a TV, and the portrait processing method includes:

[0006] Acquire a current image frame, and generate first portrait data of the current image frame by portrait segmentation;

[0007] In the case that the current image frame is not the first frame, retrieving the second portrait data of the last image frame that has been stored, and calculating the difference data between the first portrait data and the second portrait data;

[0008] The second portrait data is updated with the first portrait data for storage, and the difference data is sent to the television end, so that the television end synthesizes and displays the first portrait data based on the difference data and the stored second portrait data, and also enables the television end to update the second portrait data with the first portrait data for storage.

[0009] In a possible implementation, acquiring the current image frame includes:

[0010] Control the camera to start, and capture the video stream shot by the camera;

[0011] An image frame at a current moment is extracted from the video stream as the current image frame.

[0012] In a possible implementation, the generating the first portrait data of the current image frame by portrait segmentation includes:

[0013] Performing portrait recognition on the current image frame to obtain portrait recognition results of pixel points in the current image frame;

[0014] Segmenting a portrait area in the current image frame according to a portrait recognition result of the pixel point;

[0015] Determine the transparency of the pixel point based on the portrait area, and the transparency of the pixel point is 0 when the pixel point is outside the portrait area;

[0016] Obtaining the RGB value and position value of the pixel in the current image frame;

[0017] Determine the color value of the pixel point by using the transparency and RGB value of the pixel point, and the color value of the pixel point is 0 when the pixel point is outside the portrait area;

[0018] The first portrait data is formed by the position value and color value of the pixel point.

[0019] In a possible implementation, the calculating difference data between the first portrait data and the second portrait data includes:

[0020] Traversing a first pixel point in the first portrait data and a second pixel point in the second portrait data, wherein the first pixel point has the same position value as the second pixel point;

[0021] Calculating a difference between a color value of the first pixel and a color value of the second pixel;

[0022] If the difference is greater than a preset threshold, the position value and the color value of the first pixel are used as the difference data.

[0023] In a possible implementation, the portrait processing method further includes:

[0024] In the case where the current image frame is the first frame, the first portrait data is stored, and the first portrait data is sent to the television end, so that the television end stores the first portrait data.

[0025] A second aspect of the present application provides a portrait processing system, which includes a client and a TV end, and the client executes the portrait processing method described in any one of claims 1 to 5.

[0026] A third aspect of the present application provides a portrait processing device, which is applied to a client, the client has established a communication connection with a TV, and the portrait processing device includes:

[0027] A portrait segmentation module, used to obtain a current image frame and generate first portrait data of the current image frame by portrait segmentation;

[0028] a difference calculation module, configured to retrieve the second portrait data of the last image frame that has been stored, and calculate the difference data between the first portrait data and the second portrait data, when the current image frame is not the first frame;

[0029] A data transmission module is used to update the second portrait data with the first portrait data for storage, and send the difference data to the television end, so that the television end synthesizes and displays the first portrait data based on the difference data and the stored second portrait data, and also enables the television end to update the second portrait data with the first portrait data for storage.

[0030] A fourth aspect of the present application provides a computer program product, comprising computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the portrait processing method of the first aspect or any implementation of the first aspect.

[0031] A fifth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0032] The memory is used to store computer programs;

[0033] The processor is used to execute the computer program so that the electronic device can implement the portrait processing method of the first aspect or any implementation manner of the first aspect.

[0034] In a sixth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the portrait processing method in the first aspect or any implementation method of the first aspect.

[0035] By means of the above technical solution, the present application provides a portrait processing method and related devices, which are applied to a client, and a communication connection has been established between the client and the TV. Specifically, the current image frame is obtained, and the first portrait data of the current image frame is generated by portrait segmentation; when the current image frame is not the first frame, the second portrait data of the stored previous image frame is retrieved, and the difference data between the first portrait data and the second portrait data is calculated; the second portrait data is updated with the first portrait data for storage, and the difference data is sent to the TV, so that the TV synthesizes and displays the first portrait data based on the difference data and the stored second portrait data, and also enables the TV to update the second portrait data with the first portrait data for storage.

[0036] In this application, the client can perform portrait segmentation on the image frame, and process it to obtain the minimum difference data between the image frame and the previous image frame, and transmit it to the TV end, which merges and displays the difference data. Only a small amount of difference data needs to be transmitted to achieve portrait synthesis on the TV end, which can effectively improve the data transmission speed and portrait synthesis efficiency. Compared with the TV end performing portrait synthesis rendering through the server, it has great advantages in real-time and low latency.

[0037] This application can greatly enrich the TV viewing experience, enhance the user's sense of participation and fun, and meet the needs of modern families for diversified and personalized entertainment. In addition, by using the user's existing electronic devices (such as smartphones) as portrait acquisition devices, there is no need to purchase additional dedicated hardware, which reduces the overall cost of the system and achieves effective use of resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0039] Figure 1 A system structure diagram of a portrait processing system provided in an embodiment of the present application;

[0040] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0041] Figure 3 A method flow chart of a portrait processing method provided in an embodiment of the present application;

[0042] Figure 4 A partial method flow chart of a portrait processing method provided in an embodiment of the present application;

[0043] Figure 5 A flowchart of another part of a portrait processing method provided in an embodiment of the present application;

[0044] Figure 6 A flowchart of another part of a portrait processing method provided in an embodiment of the present application;

[0045] Figure 7 A schematic diagram of the structure of a portrait processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0047] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0048] The terms "first", "second" etc. in the specification of the application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable in appropriate circumstances, and this is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0049] See also Figure 1 , Figure 1 This is a system structure diagram of the portrait processing system provided in the embodiment of the present application. Figure 1 As shown, the portrait processing system includes a client 100 and a TV terminal 200. Take the Android client as an example for explanation:

[0050] The Android client is a mobile application designed for the Android operating system, distributed in .apk format, and provides an interface and functions that conform to the characteristics of Android devices and user habits. It uses the Android SDK's API to access device hardware, system services, and interact with other applications to ensure that system resources are effectively used within the user's permission, while taking into account the compatibility of different Android versions, so that users can install and use it on electronic devices such as smartphones and tablets.

[0051] The client 100 can be installed on one or more electronic devices. For example, in a multiplayer experience game, multiple electronic devices can have different characters to interact with the TV end 200. Each electronic device 100 implements the portrait processing method provided in the embodiment of the present application by installing the client 100.

[0052] In practical applications, the electronic device may be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiments of the present application do not impose any restrictions on this.

[0053] See also Figure 2 , Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 2 The electronic device may include a radio frequency unit 210, a memory 220, an input unit 230, a display unit 240, a camera 250 (optional), an audio circuit 260 (optional), a speaker 261 (optional), a microphone 262 (optional), an earphone jack 263 (optional), a processor 270, an external interface 280, a power supply 290 and other components. Those skilled in the art will appreciate that Figure 2 These are merely examples of electronic devices and do not constitute limitations on the electronic device or multi-function device, which may include more or fewer components than those shown in the figure, or a combination of certain components, or different components.

[0054] The input unit 230 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the portable multifunctional device. Specifically, the input unit 230 may include a touch screen 231 (optional) and / or other input devices 232. The touch screen 231 can collect user touch operations on or near it (such as operations performed by the user using fingers, joints, stylus, or any other suitable object on or near the touch screen), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 270, and can receive and execute commands sent by the processor 270; the touch signal at least includes touch point coordinate information.

[0055] The touch screen 231 may provide an input interface and an output interface between the electronic device and the user. In addition, the touch screen may be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch screen 231, the input unit 230 may also include other input devices. Specifically, other input devices 232 may include, but are not limited to, one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0056] Among them, the input device 232 can receive input data and the like.

[0057] The display unit 240 can be used to display information input by the user or information provided to the user, various menus of the electronic device, interactive interfaces, file display and / or playback of any multimedia file. In the embodiment of the present application, the display unit 240 can be used to display the interface of the portrait processing, the processing results, etc.

[0058] The memory 220 can be used to store instructions and data. The memory 220 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 270 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.

[0059] The processor 270 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing instructions stored in the memory 220 and calling data stored in the memory 220, it executes various functions of the electronic device and processes data, thereby controlling the electronic device as a whole. Optionally, the processor 270 may include one or more processing units; preferably, the processor 270 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 270. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 270 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 220, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.

[0060] Among them, the memory 220 can be used to store software codes related to the portrait processing method, the processor 270 can execute the steps of the portrait processing method, and can also schedule other units (such as the above-mentioned input unit 230 and display unit 240) to achieve corresponding functions.

[0061] The radio frequency unit 210 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 270 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 210 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.

[0062] In the embodiment of the present application, the radio frequency unit 210 can send data to the TV terminal 200. It should be understood that the radio frequency unit 210 is optional and can be replaced by other communication interfaces, such as a network port.

[0063] The electronic device also includes a power source 290 (such as a battery) for supplying power to various components. Preferably, the power source can be logically connected to the processor 270 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.

[0064] The electronic device also includes an external interface 280, which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the electronic device to communicate with other devices, or may be used to connect a charger to charge the electronic device.

[0065] Although not shown, the electronic device may also include a flash, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which will not be described in detail here. Some or all of the methods described below may be applied to Figure 2 In the electronic device shown.

[0066] In order to solve the problem that the transmission speed of the portrait data packet from the terminal to the TV end is slow and the portrait synthesis efficiency is low at the current stage, the present application embodiment provides a portrait processing method. The portrait processing method of the present application embodiment is described in detail below with reference to the accompanying drawings.

[0067] See also Figure 3 , Figure 3 1 is a flowchart of a method for portrait processing provided in an embodiment of the present application. The portrait processing method is applied to a client 100, and a communication connection has been established between the client 100 and the TV terminal 200. Figure 3 As shown, a portrait processing method provided in an embodiment of the present application may include steps S301 to S303, and these steps are described in detail below.

[0068] S301, acquiring a current image frame, and generating first portrait data of the current image frame by portrait segmentation.

[0069] In the embodiment of the present application, the current image frame is the image frame to be processed, and the portrait area of ​​the current image frame can be segmented based on the portrait recognition and segmentation technology to obtain the portrait data corresponding to the current image frame, that is, the first portrait data. The first portrait data includes the position and color value of each pixel in the current image frame, and the color value is in ARGB_8888 format.

[0070] It should be noted that portrait recognition and segmentation technology is a computer vision method that combines image segmentation and face recognition to accurately extract portraits from complex backgrounds and confirm their identities. This technology involves steps such as preprocessing, face positioning, fine segmentation, feature extraction and comparison, and has a wide range of applications.

[0071] ARGB_8888 is an image color mode or pixel format used to represent the color and transparency information of each pixel. ARGB is the abbreviation of the first letters of the four words Alpha (transparency), Red (red), Green (green), and Blue (blue), and "8888" means that each color component (Alpha, Red, Green, Blue) is stored using 8 bits (i.e. 1 byte).

[0072] Taking a mobile phone as an example, after the user opens the mobile client and establishes a communication connection with the TV, the user can capture the real-time image through the camera. Figure 4 , Figure 4 This is a partial method flow chart of a portrait processing method provided in an embodiment of the present application. Figure 4 As shown, "obtaining the current image frame" in step S301 may include steps S3011 to S3012, and these steps are described in detail below.

[0073] S3011, control the camera to start, and capture the video stream shot by the camera.

[0074] In the embodiment of the present application, in response to user operation, the camera is controlled to turn on and the camera is used to shoot real-time images. For this, the video stream shot by the camera is captured.

[0075] S3012, extracting the image frame at the current moment from the video stream as the current image frame.

[0076] In the embodiment of the present application, for the captured video stream, the image frame at the current moment can be continuously extracted therefrom as the current image frame.

[0077] See also Figure 5 , Figure 5 This is another partial method flow chart of a portrait processing method provided in an embodiment of the present application. Figure 4 As shown, in step S301, "generating first portrait data of the current image frame by portrait segmentation" may include steps S3013 to S3018, and these steps are described in detail below.

[0078] S3013, performing portrait recognition on the current image frame to obtain portrait recognition results of pixel points in the current image frame.

[0079] S3014, segmenting the portrait area in the current image frame according to the portrait recognition result of the pixel points.

[0080] S3015, determining the transparency of the pixel point based on the portrait area, and the transparency is 0 when the pixel point is outside the portrait area.

[0081] S3016, obtaining the RGB value and position value of the pixel in the current image frame.

[0082] S3017, determining the color value of the pixel point using the transparency and RGB value of the pixel point, and the color value of the pixel point is 0 when the pixel point is outside the portrait area.

[0083] S3018, constructing first portrait data using the position values ​​and color values ​​of the pixel points.

[0084] Continuing to use the example of a mobile phone as an electronic device, the client of the mobile phone can integrate relevant SDKs such as machine learning to have the ability to segment portraits. The client creates an instance of a portrait segmentor to segment the portrait area. The current image frame extracted from the video stream is input to the portrait segmentor, which performs segmentation processing to obtain the portrait segmentation result in the current image frame.

[0085] It should be noted that SDK (Software Development Kit) is a collection of pre-packaged software components, libraries, tools, documents, sample codes, API (Application Programming Interface) definitions and other resources, designed to help developers easily and efficiently build, test, debug and deploy applications for specific platforms, frameworks, operating systems, programming languages ​​or services.

[0086] Specifically, based on machine learning, portrait recognition can be performed on the current image frame to obtain a portrait recognition result of each pixel in the current image frame, and the portrait recognition result is the probability that the pixel belongs to a portrait.

[0087] It should be noted that Machine Learning (ML) is a branch of Artificial Intelligence (AI) that focuses on studying and building algorithms and statistical models that can automatically learn, infer, and improve from data. Through these models, computer systems can identify patterns, make decisions, or complete specific tasks by analyzing given input data without explicit programming.

[0088] Furthermore, after obtaining the portrait recognition results of each pixel in the current image frame, the pixel points belonging to the portrait in the current image frame can be determined by setting a threshold, and the portrait area can be determined according to the positions of the determined pixel points, and then the portrait area in the current image frame can be obtained by segmentation.

[0089] Further, for each pixel in the current image frame, the transparency of the pixel is determined by determining whether the position of the pixel is located in the portrait area. Specifically, if the position of the pixel is located in the portrait area, the transparency of the pixel can be determined to be non-zero. Conversely, if the position of the pixel is located outside the portrait area, the transparency of the pixel can be set to 0. The RGB value and position value of the pixel are obtained. Specifically, if the position of the pixel is located in the portrait area, the color value can be determined based on the GRB value of the pixel. Conversely, if the position of the pixel is located outside the portrait area, the color value of the pixel can be set to 0.

[0090] Therefore, each pixel point in the current image frame has a corresponding position value and color value, and the position value and color value of each pixel point are recorded in a Bitmap type, so as to obtain the first portrait data.

[0091] Bitmap is a common way to represent image data, storing and processing image information in the form of a two-dimensional array of pixels. Each pixel represents a point on the image, containing the values ​​of the three primary color components of red, green, and blue (RGB mode) or other color modes (such as grayscale, CMYK), as well as possible transparency information (such as Alpha channel).

[0092] S302: When the current image frame is not the first frame, retrieve the second portrait data of the previous image frame that has been stored, and calculate the difference data between the first portrait data and the second portrait data.

[0093] In the embodiment of the present application, when the current image frame is the first frame, the first portrait data can be stored and sent to the TV end so that the TV end stores the first portrait data.

[0094] That is to say, when the current image frame is the image frame sent to the TV end for the first time, for the complete portrait data of the current image frame (i.e., the first portrait data), while a copy of the first portrait data is stored locally, the first portrait data can be sent to the TV end, and the TV end stores a copy of the first portrait data.

[0095] When the current image frame is not the first frame sent to the TV for the first time, the portrait data of the stored previous image frame, that is, the second portrait data, can be retrieved. The second portrait data includes the position and color value of each pixel in the previous image frame, and the color value is in ARGB_8888 format.

[0096] For the first portrait data and the second portrait data, pixel-level difference calculation may be performed between the two to obtain minimum image difference data.

[0097] See also Figure 6 , Figure 6 This is another partial method flow chart of a portrait processing method provided in an embodiment of the present application. Figure 6 As shown, the step of "calculating the difference data between the first portrait data and the second portrait data" in step S302 may include steps S3021 to S3022, and these steps are described in detail below.

[0098] S3021, traverse a first pixel point in the first portrait data and a second pixel point in the second portrait data, where the position value of the first pixel point is the same as the position value of the second pixel point.

[0099] S3022: Calculate the difference between the color value of the first pixel and the color value of the second pixel.

[0100] S3023: If the difference is greater than a preset threshold, the position value and color value of the first pixel are used as difference data.

[0101] In the embodiment of the present application, the first portrait data and the second portrait data are traversed according to the positions of the pixels, and the position value of the first pixel in the traversed first portrait data is the same as the position value of the second pixel in the second portrait data.

[0102] For the first pixel and the second pixel, the difference between the color values ​​of the two can be calculated. If the difference is greater than a preset threshold, it means that the first pixel and the second pixel are different pixels. At this time, the position value and color value of the first pixel can be recorded as the difference pixel.

[0103] Finally, after traversing all the pixels in the first portrait data and the second portrait data, the position values ​​and color values ​​of all the recorded first pixels can be used as difference data, grouped and merged, and represented in the form of a byte array. The byte array is a string structure. Compared with the data packet that transmits the entire image in the existing solution, the amount of data will be much reduced.

[0104] It should be noted that a byte array is a data structure that consists of a series of consecutive bytes (usually 8-bit binary numbers). In computer programming, byte arrays are mainly used to store and process binary data.

[0105] S303, updating the second portrait data with the first portrait data for storage, and sending the difference data to the television end, so that the television end synthesizes and displays the first portrait data based on the difference data and the stored second portrait data, and also enables the television end to update the second portrait data with the first portrait data for storage.

[0106] In the embodiment of the present application, the copy of the first portrait data is updated and saved, and the difference data is sent to the TV end through the communication connection with the TV end, so that the TV end synthesizes and displays the first portrait data based on the difference data and the saved copy of the second portrait data, and updates and saves the copy of the first portrait data locally. In this way, the TV end can restore the complete image and perform superimposed rendering with the TV content.

[0107] Specifically, the TV end can obtain the position value and color value of the difference pixel by processing the difference data, and replace the color value of the pixel with the same position value as the difference pixel in the locally saved second pixel data with the color value of the difference pixel, so as to restore the first pixel data, and convert the first pixel data back into a Bitmap image in ARGB_8888 format with transparency information, and overlay the video or image played on the TV end, which can be set to the specified position for synthesis. Obviously, in this way, the portrait will be synthesized in real time and displayed on the TV end.

[0108] That is to say, for the TV end, if it is the first time to receive, it means that the currently received is the complete portrait data (i.e., the first portrait data), and the first portrait data can be directly overlaid and rendered with the TV content, and a copy of the complete portrait data can be saved. If it is not the first time to receive, it means that the currently received is the difference data, which is merged with the copy of the complete portrait data of the previous image frame (i.e., the first portrait data) saved locally, and after obtaining the latest complete portrait data, it is merged with the TV content for display, and the latest complete portrait data is updated and saved.

[0109] In addition, the client and the TV can establish a message transmission channel between them through the local area network, including but not limited to message channels of different network protocols such as websocket, webrtc, udp, etc. Based on the message transmission channel, the client sends the data in the client's customized format to the TV through image format encoding.

[0110] It should be noted that a local area network (LAN) is a communication network that connects multiple computers, printers, servers, network devices, and other intelligent devices within a limited geographical area (usually within a few meters to a few kilometers). A LAN provides users with a closed, dedicated communication environment that enables these devices to share resources, exchange data, work together, and achieve efficient and secure information exchange.

[0111] Image format encoding refers to the process of converting image data into a binary stream of a specific format for storage, transmission, and parsing. Different image formats use their own encoding methods to encapsulate and compress image information, which determines the image compression efficiency, file size, fidelity, and compatibility in different platforms and applications.

[0112] A network protocol is a set of rules, standards or conventions that define the format, meaning, order and response actions for sending and receiving information or network events between different computers or communication devices in a network. These protocols ensure effective communication between different network nodes, even if they may use different hardware, operating systems or application software. Network protocols are organized according to functions and levels to form the so-called network protocol stack, in which each layer of protocols provides services for the upper layer and interacts with peer entities at the same layer to jointly maintain the order and reliability of network communications.

[0113] UI Rendering is an important concept in computer graphics and user interface design. It refers to the process of converting interface elements, layouts, texts, images, animations and other information into visual graphic representations and presenting them on monitors or other output devices.

[0114] Through the above description, the portrait processing method provided by the embodiment of the present application connects the client and the TV end, uses the client to perform real-time portrait acquisition and segmentation, and through image differentiation processing, only transmits a small amount of image difference data to the TV end, merges and processes the difference data on the TV end, and restores it to complete portrait data, and then overlays and renders it with the playback content, solving the problem of too large a portrait data body and slow transmission rate. The present application can greatly enrich the TV viewing experience, enhance the user's sense of participation and fun, and meet the needs of modern families for diversified and personalized entertainment. In addition, by using the user's existing electronic devices (such as smart phones) as portrait acquisition devices, there is no need to purchase additional dedicated hardware, which reduces the overall cost of the system and achieves effective use of resources.

[0115] A portrait processing method provided by an embodiment of the present application is introduced above, and a device for executing the portrait processing method will be introduced below.

[0116] See also Figure 7 , Figure 7 The structure diagram of a portrait processing device provided in an embodiment of the present application is shown in FIG. The portrait processing device is applied to a client, and a communication connection has been established between the client and the TV terminal, such as Figure 7 As shown, the portrait processing device includes:

[0117] A portrait segmentation module 10 is used to obtain a current image frame and generate first portrait data of the current image frame by portrait segmentation;

[0118] The difference calculation module 20 is used to retrieve the second portrait data of the previous image frame that has been stored, and calculate the difference data between the first portrait data and the second portrait data when the current image frame is not the first frame;

[0119] The data transmission module 30 is used to update the second portrait data with the first portrait data for storage, and send the difference data to the TV end, so that the TV end synthesizes and displays the first portrait data based on the difference data and the stored second portrait data, and also enables the TV end to update the second portrait data with the first portrait data for storage.

[0120] In a possible implementation, the portrait segmentation module 10 for acquiring the current image frame is specifically used to:

[0121] Control the camera to start, capture the video stream shot by the camera; extract the image frame at the current moment from the video stream as the current image frame.

[0122] In a possible implementation, the portrait segmentation module 10 for generating first portrait data of the current image frame by portrait segmentation is specifically configured to:

[0123] Perform portrait recognition on the current image frame to obtain portrait recognition results of pixels in the current image frame; segment the portrait area in the current image frame according to the portrait recognition results of the pixels; determine the transparency of the pixels based on the portrait area, and the transparency is 0 when the pixels are outside the portrait area; obtain the RGB value and position value of the pixels in the current image frame; determine the color value of the pixels using the transparency and RGB value of the pixels, and the color value is 0 when the pixels are outside the portrait area; and form the first portrait data with the position value and color value of the pixels.

[0124] In a possible implementation, the difference calculation module 20 for calculating the difference data between the first portrait data and the second portrait data is specifically used to:

[0125] Traverse a first pixel point in the first portrait data and a second pixel point in the second portrait data, where the position value of the first pixel point is the same as that of the second pixel point; calculate the difference between the color value of the first pixel point and the color value of the second pixel point; if the difference is greater than a preset threshold, use the position value and color value of the first pixel point as difference data.

[0126] In a possible implementation, the data transmission module 30 is further configured to:

[0127] When the current image frame is the first frame, the first portrait data is stored and sent to the television end, so that the television end stores the first portrait data.

[0128] It should be noted that the detailed functions of each module in the embodiment of the present application can be found in the corresponding disclosed part of the above-mentioned portrait processing method embodiment, and will not be repeated here.

[0129] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any portrait processing method provided in the embodiment of the present application.

[0130] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any portrait processing method provided in the embodiment of the present application.

[0131] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0132] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0133] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0134] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A portrait processing method, characterized in that: The portrait processing method is applied to a client, the client has established a communication connection with a TV, and the portrait processing method includes: Acquire a current image frame, and generate first portrait data of the current image frame by portrait segmentation; In the case that the current image frame is not the first frame, retrieving the second portrait data of the last image frame that has been stored, and calculating the difference data between the first portrait data and the second portrait data; The second portrait data is updated with the first portrait data for storage, and the difference data is sent to the television end, so that the television end synthesizes and displays the first portrait data based on the difference data and the stored second portrait data, and also enables the television end to update the second portrait data with the first portrait data for storage.

2. The portrait processing method according to claim 1, characterized in that: The obtaining of the current image frame comprises: Control the camera to start, and capture the video stream shot by the camera; An image frame at a current moment is extracted from the video stream as the current image frame.

3. The portrait processing method according to claim 1, characterized in that: The step of generating first portrait data of the current image frame by portrait segmentation includes: Performing portrait recognition on the current image frame to obtain portrait recognition results of pixel points in the current image frame; Segmenting a portrait area in the current image frame according to a portrait recognition result of the pixel point; Determine the transparency of the pixel point based on the portrait area, and the transparency of the pixel point is 0 when the pixel point is outside the portrait area; Obtaining the RGB value and position value of the pixel in the current image frame; Determine the color value of the pixel point by using the transparency and RGB value of the pixel point, and the color value of the pixel point is 0 when the pixel point is outside the portrait area; The first portrait data is formed by the position value and color value of the pixel point.

4. The portrait processing method according to claim 3, characterized in that: The calculating difference data between the first portrait data and the second portrait data includes: Traversing a first pixel point in the first portrait data and a second pixel point in the second portrait data, wherein the first pixel point has the same position value as the second pixel point; Calculating a difference between a color value of the first pixel and a color value of the second pixel; If the difference is greater than a preset threshold, the position value and the color value of the first pixel are used as the difference data.

5. The portrait processing method according to claim 1, characterized in that: The portrait processing method further includes: In the case where the current image frame is the first frame, the first portrait data is stored, and the first portrait data is sent to the television end, so that the television end stores the first portrait data.

6. A portrait processing system, characterized in that: The portrait processing system includes a client and a TV end, and the client executes the portrait processing method described in any one of claims 1 to 5.

7. A portrait processing device, characterized in that: The portrait processing device is applied to a client, the client has established a communication connection with a TV, and the portrait processing device includes: A portrait segmentation module, used to obtain a current image frame and generate first portrait data of the current image frame by portrait segmentation; a difference calculation module, configured to retrieve the second portrait data of the last image frame that has been stored, and calculate the difference data between the first portrait data and the second portrait data, when the current image frame is not the first frame; A data transmission module is used to update the second portrait data with the first portrait data for storage, and send the difference data to the television end, so that the television end synthesizes and displays the first portrait data based on the difference data and the stored second portrait data, and also enables the television end to update the second portrait data with the first portrait data for storage.

8. A computer program product, characterized in that It comprises computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the portrait processing method as claimed in any one of claims 1 to 5.

9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the portrait processing method as described in any one of claims 1 to 5.

10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the portrait processing method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Video transmission method, intelligent mobile terminal and device having storage function

    CN107241563A

  • Image processing method and device, electronic equipment and storage medium

    CN112308866A

  • Portrait recognition method and device, storage medium and electronic equipment

    CN115131845A

  • Display device and portrait segmentation processing method

    CN115205531A

  • Image processing apparatus, image processing method and program

    JP2012060384A