Adaptive mixing for real-time and mobile video post-processing

By identifying key frames in the video data stream and using alpha blending technology to blend with the overlay image of the area of ​​interest, the problem of real-time mixing of video content on mobile devices in the existing technology is solved, achieving efficient and real-time video content processing, and improving User experience.

CN118661192APending Publication Date: 2024-09-17INNOPEAK TECHNOLOGY INC
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202280091110.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-02-17
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

Existing technology is difficult to mix regions of interest in video content in real time on mobile devices, and cannot effectively mix two static images at the pixel level, resulting in poor user experience.

Method used

By identifying key frames in the video data stream, obtain the overlay image and use alpha blending technology to blend it with the area of ​​interest, use the fragment shader in the OpenGL pipeline for rendering, and adaptively define the alpha channel value to achieve efficient, real-time Mixed content.

Benefits of technology

It achieves efficient and real-time content mixing in video content, improves user experience, and provides natural visual effects and context-sensitive mixed video content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118661192A
    Figure CN118661192A
Patent Text Reader

Abstract

The invention relates to real-time modification of video content. The electronic device obtains a first image including a region of interest displaying an object, and detects the object in the region of interest of the first image. The region of interest has a plurality of object pixels corresponding to the object. The first image includes a foreground portion filled with a plurality of object pixels and a background different from each pixel of the foreground portion. The overlay image corresponds to an image of the region of interest. A transparency level is generated for each pixel of a subset of superimposed images corresponding to a subset of the first image adjacent to the foreground portion. The electronic device renders the first image with the overlay image integrated on the region of interest based on the transparency level of each pixel of the subset of the overlay image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates generally to data processing technology, including but not limited to methods, systems, and non-transitory computer-readable media for modifying a region of interest of video content in real time. Background Art

[0002] Alpha blending is the process of mixing two images using the alpha channel value of each pixel in the two images to generate a single fused image. Each alpha channel value is typically between 0 and 1 or between 0 and 255, indicating the transparency level of the corresponding pixel. The maximum alpha channel value means that the corresponding pixel is completely opaque, while the minimum alpha channel value means that the corresponding pixel is completely transparent. Existing alpha blending schemes apply a constant alpha channel value to all pixels in one of the two images, or gradually reduce the alpha channel value as the distance from the image edge increases. Based on these alpha channel values, a blending operation is used to blend two static images at the pixel level. For example, an alpha value mask is applied to combine the images. Alternatively, an alpha projection is applied to remap the image colors and project the foreground image on top of the background image. Existing alpha blending schemes focus on completely projecting a static image with a predefined alpha channel onto another static image and are not suitable for blending video content or blending partial areas of two images on mobile devices in real time. It would be beneficial to have a video blending mechanism for efficiently and effectively blending video content in a region of interest within the video content. Summary of the Invention

[0003] Various embodiments of the present application relate to real-time rendering of video content having one or more regions of interest blended with related images using a lightweight image rendering engine. Specifically, regions of interest are identified in selected keyframes of a video data stream, and for each region of interest, an overlaid image is obtained and blended with the corresponding region of interest using alpha blending. The overlaid image has the same objects as the region of interest, but presents them with improved image quality. When the overlaid image is blended with the region of interest, the alpha blending preserves the objects with improved image quality while revealing information about the background of the region of interest from the overlaid image. This makes the content blending visually natural, provides context associated with the blended video content, and thereby enhances the user experience. In some embodiments, an alpha channel value is adaptively defined based on the pixel distance to the foreground of each region of interest and is passed to a fragment shader in an Open Graphics Library (OpenGL) pipeline to render the blended video content. Through these methods, content blending can be efficiently and timely implemented for each individual image frame of the video data stream, thereby providing a real-time user experience for viewing the blended video content.

[0004] In one aspect, a method is implemented in an electronic device for rendering an image with a modified region of interest. The method includes obtaining a first image including a region of interest displaying an object and detecting the object in the region of interest of the first image. The region of interest has a plurality of object pixels corresponding to the object. The first image includes a foreground portion populated by the plurality of object pixels and a background that is different from each pixel in the foreground portion. The method also includes obtaining an overlay image corresponding to the region of interest; generating a transparency level for at least each pixel of a subset of the overlay image, the subset of the overlay image corresponding to a subset of the first image adjacent to the foreground portion; and rendering the first image together with the overlay image integrated over the region of interest based on the transparency level of each pixel in the subset of the overlay image. In some embodiments, the overlay image is generated from a second image captured earlier than the first image. The first image is rendered with a first latency from the time the first image is obtained, and the first latency is less than a real-time rendering latency threshold. In some embodiments, a plurality of consecutive images are obtained for video content. The method is performed for each image in the subset of images. Each image in the subset of images is rendered with a corresponding latency less than the real-time rendering latency threshold, thereby creating a real-time content mix for the video content.

[0005] In some embodiments, the region of interest is a text region, and the object includes first text content in a first language, the first text content displayed on and filling a foreground portion of the text region. The method further includes rendering second text content in a second language on the first image rendered together with the overlay image integrated with the region of interest. The second text content in the second language is translated from the first text content in the first language.

[0006] In another aspect, some embodiments include an electronic device comprising one or more processors and a memory having stored thereon instructions that, when executed by the one or more processors, cause the processors to perform any of the above methods.

[0007] In yet another aspect, some embodiments include a non-transitory computer-readable storage medium having stored thereon instructions that, when executed by one or more processors, cause the processors to perform any of the methods described above.

[0008] These exemplary embodiments and implementations are not intended to limit or define the present disclosure, but are intended to provide examples to help understand the present disclosure. More embodiments are discussed in the detailed description and further explanations are provided. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] For a better understanding of the various embodiments described, reference should be made to the following detailed description taken in conjunction with the following drawings, wherein like reference numerals refer to corresponding parts throughout.

[0010] Figure 1 is an example data processing environment having one or more servers communicatively coupled to one or more client devices in accordance with some embodiments.

[0011] Figure 2 is a block diagram of an electronic system according to some embodiments.

[0012] Figure 3 is a block diagram of a real-time video rendering system that renders video content with modified regions of interest, according to some embodiments.

[0013] Figure 4 is a flow chart of a process for determining a transparency level for pixels of an overlaid image used to modify a region of interest of an image, according to some embodiments.

[0014] Figures 5A to 5F They are respectively the region of interest of the original image, the text pixel mask, the inverse text mask, the distance transformed mask, the alpha channel value map of the overlay image, and the overlay image according to some embodiments.

[0015] Figures 6A to 6Cis a map of alpha channel values ​​of an overlay image with three different alpha channel setting parameters according to some embodiments.

[0016] 7A to 7C A diagram illustrating the effect of an alpha channel value map of an overlaid image on rendering translated text, according to some embodiments.

[0017] Figure 8 is a flow chart of a method for rendering an image having one or more regions of interest, according to some embodiments.

[0018] Like reference numerals refer to corresponding parts throughout the several views of the drawings. DETAILED DESCRIPTION

[0019] Reference will now be made in detail to specific embodiments, examples of which are illustrated in the accompanying drawings. In the following detailed description, numerous non-limiting specific details are set forth to facilitate an understanding of the subject matter presented herein. However, it will be apparent to those skilled in the art that various alternatives may be employed without departing from the scope of the claims, and that the subject matter presented herein may be practiced without these specific details. For example, it will be apparent to those skilled in the art that the subject matter presented herein may be implemented on many types of electronic systems having digital video capabilities.

[0020] Figure 11 is an example data processing environment 100 having one or more servers 102 communicatively coupled to one or more client devices 104, according to some embodiments. The one or more client devices 104 may be, for example, a desktop computer 104A, a tablet computer 104B, a mobile phone 104C, or a smart multi-sensory connected home device (e.g., a depth camera, a visible light camera). In some implementations, one or more client devices 104 include a head-mounted display 104D for rendering extended reality content. Each client device 104 may collect data or user input, execute a user application, and present output on its user interface. The collected data or user input may be processed locally on the client device 104 (e.g., for training and / or for prediction) and / or remotely by the server 102. The one or more servers 102 provide system data (e.g., boot files, operating system images, and user applications) to the client devices 104 and, in some embodiments, process data and user input received from the client devices 104 when the user application is executed on the client device 104. In some embodiments, data processing environment 100 also includes a storage device 106 for storing data related to server 102, client device 104, and applications executing on client device 104. For example, storage device 106 may store video content (including visual content and audio content), still visual content, and / or inertial sensor data.

[0021] One or more servers 102 can communicate real-time data with client devices 104 that are remote from each other or remote from one or more servers 102. In addition, in some embodiments, one or more servers 102 can perform data processing tasks that cannot or would not be preferably completed locally by the client device 104. For example, the client device 104 includes a game console (e.g., formed by a head-mounted display 104D) that executes an interactive online game application. The game console receives user instructions and sends them along with user data to the game server 102. The game server 102 generates a video data stream based on the user instructions and user data, and provides the video data stream for display on the game console and other client devices participating in the same game session with the game console.

[0022] One or more servers 102, one or more client devices 104, and storage devices 106 are communicatively coupled to each other via one or more communication networks 108, which are media used to provide communication links between these devices and connected computers within data processing environment 100. One or more communication networks 108 can include connections such as wired connections, wireless communication links, or fiber optic cables. Examples of one or more communication networks 108 include a local area network (LAN), a wide area network (WAN) such as the Internet, or a combination thereof. The one or more communication networks 108 are optionally implemented using any known network protocol, including various wired or wireless protocols, such as Ethernet, universal serial bus (USB), FireWire, long term evolution (LTE), global system for mobile communications (GSM), enhanced data GSM environment (EDGE), code division multiple access (CDMA), time division multiple access (TDMA), Bluetooth, Wi-Fi, voice over Internet protocol (VoIP), Wi-MAX, or any other suitable communication protocol. Connection to the one or more communication networks 108 can be established directly (e.g., using a 3G / 4G connection to a wireless carrier), or through a network interface 110 (e.g., a router, switch, gateway, hub, or smart dedicated whole-home control node), or through any combination thereof. Thus, one or more communication networks 108 may represent the Internet, a global collection of networks and gateways that communicate with each other using the Transmission Control Protocol / Internet Protocol (TCP / IP) suite of protocols. At the heart of the Internet lies a backbone of high-speed data communication lines between major nodes or host computers, including thousands of commercial, government, educational, and other electronic systems that route data and messages.

[0023] The head-mounted display 104D (also referred to as AR glasses 104D) includes one or more cameras (e.g., a visible light camera, a depth camera), a microphone, a speaker, one or more inertial sensors (e.g., a gyroscope, an accelerometer), and a display. The camera and microphone are used to capture video and audio data from the scene in which the AR glasses 104D are located, while the one or more inertial sensors are used to capture inertial sensor data. In some cases, the camera captures gestures of the user wearing the AR glasses 104D. In some cases, the microphone records ambient sounds, including the user's voice commands. In some cases, both video or still visual data captured by the visible light camera and inertial sensor data measured by the one or more inertial sensors are used to determine and predict the device pose. The video, still image, audio, or inertial sensor data captured by the AR glasses 104D is processed by the AR glasses 104D, the server 102, or both to identify the device pose. Alternatively, in some embodiments, both depth data (e.g., a depth map and confidence map) captured by the depth camera and inertial sensor data measured by the one or more inertial sensors are used to determine and predict the device pose. The depth data and inertial sensor data captured by the AR glasses 104D are processed by the AR glasses 104D, the server 102, or both to identify a device pose. This device pose is used to control the AR glasses 104D themselves or to interact with an application (e.g., a gaming application) executed by the AR glasses 104D. In some embodiments, the display of the AR glasses 104D displays a user interface, and the identified or predicted device pose is used to interact with user-selectable display items on the user interface or to render virtual objects with high fidelity.

[0024] In some embodiments, SLAM technology is applied to the data processing environment 100 to process video data, still image data, or depth data captured by the AR glasses 104D along with inertial sensor data. The device pose is identified and predicted, and the scene in which the AR glasses 104D are located is mapped and updated. Alternatively, the SLAM technology may be implemented independently by the AR glasses 104D, or jointly by the server 102 and the AR glasses 104D.

[0025] Figure 2is a block diagram of an electronic system 200 according to some embodiments. The electronic system 200 includes a server 102, a client device 104, a storage device 106, or a combination thereof. Examples of the electronic system 200 include a mobile phone 104C or AR glasses 104D. The electronic system 200 typically includes one or more processing units 202, one or more network interfaces 204, a memory 206, and one or more communication buses 208 for interconnecting these components (sometimes referred to as a chipset). The processing unit 202 includes at least one central processing unit (CPU) and / or at least one graphics processing unit (GPU). The electronic system 200 includes one or more input devices 210 to facilitate user input, such as a keyboard, a mouse, a voice command input unit or microphone, a touch screen display, a touch-sensitive input pad, a gesture capture camera, or other input buttons or controls. In addition, in some embodiments, the client device 104 of the electronic system 200 uses a microphone for voice recognition and a camera 260 for gesture recognition to supplement or replace the keyboard. In some embodiments, the client device 104 includes one or more cameras (e.g., RGB cameras), scanners, or optical sensor units for capturing images of, for example, a graphical serial code printed on the electronic device. The electronic system 200 also includes one or more output devices 212 capable of presenting a user interface and displaying content, including one or more speakers and / or one or more visual displays.

[0026] Optionally, the client device 104 includes a location detection device, such as a GPS (Global Positioning System) or other geolocation receiver, for determining the location of the client device 104. Optionally, the client device 104 includes an inertial measurement unit (IMU) 280 that integrates sensor data captured by multi-axis inertial sensors to provide an estimate of the position and orientation of the client device 104 in space. Examples of the one or more inertial sensors of the IMU 280 include, but are not limited to, a gyroscope, an accelerometer, a magnetometer, and an inclinometer.

[0027] Memory 206 includes high-speed random access memory, such as DRAM, SRAM, DDR RAM, or other random access solid-state memory devices, and optionally includes non-volatile memory, such as one or more magnetic disk storage devices, one or more optical disk storage devices, one or more flash memory devices, or one or more other non-volatile solid-state storage devices. Optionally, memory 206 includes one or more storage devices remote from one or more processing units 202. Memory 206, or optionally non-volatile memory within memory 206, includes non-transitory computer-readable storage media. In some embodiments, memory 206 or the non-transitory computer-readable storage media of memory 206 stores the following programs, modules, and data structures, or a subset or superset thereof: Operating system 214, including processes for handling various basic system services and for performing hardware-related tasks; A network communication module 216 for connecting each server 102 or client device 104 to other devices (e.g., a server 102, a client device 104, or a storage device 106) via one or more (wired or wireless) network interfaces 204 and one or more communication networks 108, such as the Internet, other wide area networks, local area networks, metropolitan area networks, and the like; A user interface module 218 for enabling presentation of information (e.g., graphical user interfaces of applications 224, widgets, websites and their pages, and / or games, audio and / or video content, text, etc.) at each client device 104 via one or more output devices 212 (e.g., displays, speakers, etc.); An input processing module 220 for detecting one or more user inputs or interactions from one of the one or more input devices 210 and interpreting the detected inputs or interactions; A web browser module 222 for navigating, requesting (e.g., via HTTP), and displaying websites and their web pages, including a web interface for logging into a user account associated with the client device 104 or another electronic device, for controlling the client or electronic device when associated with a user account, and for editing and viewing settings and data associated with the user account; One or more user applications 224 executed by the electronic system 200 (e.g., a game, a social networking application, a smart home application, an extended reality application, and / or other web-based or non-web applications for controlling another electronic device and viewing data captured by such a device); a data processing module 228 for processing the content data using the data processing model 262 to identify information contained in the content data, match the content data with other data, categorize the content data, or synthesize related content data, wherein in some embodiments, the data processing module 228 is associated with one of the user applications 224 to process the content data in response to user instructions received from the user application 224; a pose determination and prediction module 230 for determining and predicting a pose of the client device 104 (e.g., the AR glasses 104D) based on images captured by the camera 260 and / or sensor data captured by the IMU 280 , wherein in some embodiments, the pose is determined and predicted jointly by the pose determination and prediction module 230 and the data processing module 228 , and in some embodiments, the pose determination and prediction module 230 includes a visual-inertial SLAM module 232 for mapping a scene in which the client device 104 is located and identifying the pose of the client device 104 within the scene; A content rendering module 234 for rendering video content with one or more modified regions of interest in real time; as well as One or more databases 240 for storing at least one or more of the following data: o Device settings 242, including common device settings (e.g., service tier, device model, storage capacity, processing power, communication capabilities, etc.) for one or more servers 102 or client devices 104; o User account information 244 for one or more user applications 224, such as username, security questions, account history data, user preferences, and predefined account settings; o Network parameters 246 of one or more communication networks 108, such as IP address, subnet mask, default gateway, DNS server and host name; o Data processing model 248 for processing content data (e.g., video data, visual data, audio data); as well as o Content data and results 250 obtained by and output to the client device 104 of the electronic system 200, respectively, include video content having one or more regions of interest integrated with an overlay image using alpha blending.

[0028] Optionally, one or more databases 240 are stored in one of the server 102, client device 104, and storage device 106 of electronic system 200. Optionally, one or more databases 240 are distributed across more than one of the server 102, client device 104, and storage device 106 of electronic system 200. In some embodiments, more than one copy of the above data is stored in different devices, for example, two copies of data processing model 248 are stored in server 102 and storage device 106, respectively.

[0029] Each element in the above-mentioned identified element can be stored in one or more of the memory devices mentioned previously, and corresponds to the instruction set for performing the above-mentioned functions. The above-mentioned identified module or program (that is, instruction set) do not need to be implemented as independent software program, process, module or data structure, and therefore each subset of these modules can be combined or otherwise rearranged in various embodiments. In certain embodiments, memory 206 optionally stores the above-mentioned identified module and the subset of data structure. In addition, memory 206 optionally stores additional modules and data structure not described above.

[0030] Figure 3 FIG3 is a block diagram of a real-time video rendering system 300 for rendering video content 302 with modified regions of interest 304, according to some embodiments. The video rendering system 300 includes at least an object detector 306, a post-processing module 308, and a rendering module 310. The video rendering system 300 receives video content 302 comprising a plurality of consecutive image frames. At least a subset of the images is processed by the video rendering system 300. For example, the subset of images includes a first image 312 having one or more regions of interest 304, each of which displays a corresponding object. The object detector 306 receives the first image 312 and detects one or more objects enclosed in one or more bounding boxes. Each bounding box defines a corresponding region of interest 304 in which the corresponding object is displayed. In a real-time translation application, each object optionally corresponds to a continuous line or block of text, a phrase (e.g., "Doctor's Office"), a word (e.g., "Goes" and "Disney"), or a letter ("G"). Optionally, the real-time translation application has object recognition rules to define whether each object is preferably defined as a line of text, a block of text, a phrase, a word, or a letter.

[0031] Each object's region of interest 304 includes a plurality of object pixels 314 corresponding to the corresponding object. A first image 312 containing the region of interest 304 includes a foreground portion that is populated by the plurality of object pixels 314 and corresponds to the corresponding object. Furthermore, the first image 312 includes a background that is distinct from each pixel in the foreground portion. For a region of interest 304 containing an English word, the plurality of object pixels 314 and the foreground portion correspond to the black pixels forming each English letter in the region of interest 304.

[0032] The post-processing module 308 receives a bounding box defining the region of interest 304 in the first image 312 and obtains an overlay image 330. In some embodiments, the overlay image 330 has the same size as the region of interest 304 of the first image 312. Alternatively, in some embodiments, the overlay image 330 has a different size (e.g., larger, smaller) than the region of interest 304 of the first image 312. The post-processing module 308 extracts (316) a plurality of object pixels 314 of the object that fill a foreground portion of the first image 312. A subset of the first image 312 is adjacent to the foreground portion. The post-processing module 308 generates (318) a transparency level 320 for at least each pixel of the subset of the overlay image 330 that corresponds to the subset of the first image 312, e.g., corresponding to Figure 5C The post-processing module 308 processes (322) the overlay image 330 or the first image 312 for subsequent image rendering. In some embodiments, the post-processing unit 318 performs semantic analysis or inpainting analysis based on the plurality of object pixels 314 of the first image 312 to provide the overlay image 330. In one example, the plurality of object pixels 314 corresponds to first text content in a first language, and the post-processing unit 318 determines second text content 324 in a second language and modifies the overlay image 330. Alternatively, if the overlay image 330 is cropped from an earlier image, the post-processing unit 318 may modify the overlay image 330, for example, by changing the foreground color to black so that it can be merged with the background of the first image 312. Alternatively, the foreground color of the overlay image 330 may be changed to a color opposite to the background color of the first image 312 to improve the visual effect of the overlay image 330 after it is integrated onto the region of interest 304 of the first image 312.

[0033] The rendering module 310 obtains an overlay image 330, receives a transparency level 320 for each pixel of a subset of the overlay image 330, and renders the overlay image on the region of interest 304 of the first image 312 based on the transparency level 320. In some embodiments, the overlay image 330 is cropped from an earlier keyframe. In addition, in some cases, the cropped region of the earlier keyframe is adjusted to provide the overlay image 330. In some embodiments, the rendering module 310 is implemented in a GPU and applies an OpenGL pipeline. The transparency level 320 includes an alpha channel value 320. Based on the alpha channel value 320 for each pixel of the subset of the overlay image 330, the rendering module 310 sets and normalizes (326) the alpha channel value 320 of the subset of the overlay image 330 in a fragment shader. The rendering module 310 also renders 328 the first image 312 together with the post-processed overlay image 330 using the normalized alpha channel value 320, thereby forming a rendered first image 312′ based on alpha blending in the real-time video rendering system 300. In other words, the first image 330 is inpainted with the overlay image 330 on the region of interest 304. The foreground portion corresponding to the plurality of object pixels of the overlay image 330 is preserved and surrounded by partially transparent pixels, while the background of the region of interest 304 of the first image 312 is exposed through the overlay image 330.

[0034] A plurality of consecutive images are obtained for video content 302, and video rendering system 300 uses alpha blending to render each image in a subset of images, including first image 312. After the rendered first image 312' is merged with the remaining images in the plurality of consecutive images, an overlay image 330 is integrated onto the rendered first image 312' and seamlessly merged into video content 302'. Each image in the subset of images is rendered with a corresponding latency less than a real-time rendering latency threshold, thereby providing a real-time and seamless user experience for viewing video content 302'. Overlay image 330 can help improve image quality and enhance the user experience of the plurality of consecutive images when the image quality in a corresponding region of interest is limited.

[0035] In some embodiments, the overlay image 330 is generated from a second image (also referred to as a keyframe) that is captured earlier than the first image 312. The first image 312' is rendered with a first latency from the time the first image 312 is obtained, and the first latency is less than a real-time rendering latency threshold that sets a limit that is detectable by the user for impairing the user experience. Additionally, in some embodiments, the overlay image 330 is applied to render a plurality of subsequent images, each of which is obtained after the second image and has a corresponding region of interest 304 that satisfies a content mixing rule associated with the overlay image 330. In some embodiments, the overlay image 330 generated from the second image is applied to content mixing until a predetermined duration (e.g., 0.5 seconds) has elapsed since the second image was captured or until a scene change is detected, in accordance with the content mixing rule.

[0036] The post-processing module 308 implements a keyframe selection scheme to identify the second image (i.e., the keyframe) and inpaint the first image 312. In other words, the overlay image 330 is generated and updated from a selected keyframe, for example, every other frame, every three, four, or ten consecutive frames. In some embodiments, the same overlay image 330 is applied to inpaint multiple subsequent first images until the overlay image 330 is updated based on the next keyframe. Optionally, the first image 312 immediately follows the second image or is separated from the second image by one or more image frames. The latency of rendering each first image 312 is less than a real-time rendering latency threshold, thereby providing a real-time content mixing experience for the user.

[0037] In cases where repairing content takes time, insufficient keyframes may be selected for generating overlay image 330, and the frame rate used to render the first image may also be reduced. In some embodiments, the frame rate of video content 302' is reduced, and overlay image 330 is applied to repair the selected first image, for example, every other frame until the overlay image is updated based on the next keyframe. Alternatively, in some embodiments, the frame rate of video content 302' is reduced. Overlay image 330 is applied to repair a single first image, and the repaired first image is displayed together with overlay image 330 until overlay image 330 is updated based on the next keyframe and applied to repair the corresponding first image 312. In these embodiments, the frame rate is reduced to a level that does not compromise the real-time content mixing experience during the rendering of first image 312.

[0038] In various embodiments of the present application, the inpainting operation includes alpha blending, whereby an overlay image 330 generated from a second image (i.e., a keyframe) is rendered partially transparent to partially expose the region of interest 304 of the first image 312 and preserve some contextual information about the region of interest 304 of the first image 312 in the rendered video content 302'. As the overlay image 330 replaces the region of interest 304 of the first image 312, the alpha blending eliminates the sharp edge between the background of the first image 312 and the overlay image 330. The post-processing module 308 uses the CPU to determine a transparency level (e.g., alpha channel value) for each pixel of a subset of the overlay image 330. In some embodiments, an object pixel mask is applied to identify the subset of the overlay image 330. Conversely, the rendering module 310 renders the 2D augmented reality object corresponding to the region of interest on the GPU. Specifically, the rendering module 310 renders the first image 312 as the background and the overlay image 330 in the foreground, thereby enabling the OpenGL ES pipeline to blend and render images with different pixel-based transparency levels. An alpha channel of the RGBA texture image is created and passed to the fragment shader, and the alpha channel value is optionally normalized between 0 and 1 or between 0 and 255. The OpenGL ES pipeline automatically sets the source color during blending of the overlay image 330 and the region of interest 304 of the first image 312.

[0039] In some embodiments, the object in region of interest 304 includes a first object, and first image 312 also includes a second object that is distinct and physically separate from the first object. A bounding box is identified for the second object, defining a second region of interest 304' in first image 312. Optionally, second region of interest 304' includes a plurality of second-object pixels corresponding to the second object. First image 312 includes a second foreground portion populated by the plurality of second-object pixels. The background of first image 312 is distinct from each pixel corresponding to the first and second foreground portions. A second overlay image 330' corresponds to second region of interest 304'. Optionally, second overlay image 330' has a size greater than, less than, or equal to that of second region of interest 304'. A transparency level is generated for each pixel of a subset of second overlay image 330' corresponding to a second subset of first image 312 adjacent to the second foreground portion. Based on the transparency level of each pixel of the subset of second overlay image 330', first image 312 is rendered together with second overlay image 330' integrated over second region of interest 304'.

[0040] Figure 44 is a flow chart of a process 400 for determining a transparency level 320 for pixels of an overlay image 330 for modifying a region of interest 304 of an image (e.g., a first image 312) in accordance with some embodiments. The transparency level 320 includes an alpha channel value. The first image 312 includes the region of interest 304 displaying an object. The object is detected in the region of interest 304 of the first image 312. The region of interest 304 has a plurality of object pixels corresponding to the object. The first image 312 includes a foreground portion populated by the plurality of object pixels and a background that is different from each pixel of the foreground portion. For example, the plurality of object pixels are Figure 3 Black text pixels in the region of interest 304 of the first image 312 in FIG. These black text pixels form a foreground portion, while non-black, non-text pixels inside and outside the region of interest 304 form a background. A transparency level is generated for at least each pixel of a subset of the first image adjacent to the foreground portion. Optionally, an overlay image 330 has the same dimensions as the region of interest and includes the same objects. In some embodiments, the overlay image 330 has better image quality than the region of interest. Based on the transparency level of each pixel of the subset of the first image 312, the first image 312′ is rendered together with the overlay image 330 integrated over the region of interest 304.

[0041] After identifying the bounding box defining the region of interest 304, a text pixel mask 402 is identified based on a plurality of object pixels corresponding to the object in the region of interest 304. In one example, the text pixel mask 402 has a white foreground corresponding to the plurality of object pixels corresponding to the object in the region of interest 304, and a black background, each pixel of which does not belong to the plurality of object pixels. The plurality of object pixels correspond to the object in the region of interest 304. The text pixel mask 402 is a binary mask that is used to segment the object from the background of the first image 312. Specifically, the text pixel mask 402 is identified using a binarization method based on a computer vision algorithm. The text pixel mask 402 unifies the foreground object into white pixels and the background into black pixels, and is used as a mask for a post-processing algorithm.

[0042] The text pixel mask 402 is further inverted into an inverse text mask 404, e.g., having a black foreground corresponding to a plurality of object pixels and a white background where each pixel does not belong to the plurality of object pixels, the plurality of object pixels corresponding to the object in the region of interest 304. A distance transform operation is applied to the inverse text mask 404 to obtain a distance transformed mask 406. In the distance transform operation, the alpha channel value of each pixel is used to set the transparency level 320 based on the pixel distance from each pixel in the background of the first image 312 to the boundary of the foreground portion filled by the plurality of object pixels of the object. The farther the pixel is from the object, the more opaque the pixel is in the foreground (i.e., in the overlay image 330). In one example, the pixel distance is calculated for a subset of the background of the first image 312, which is marked as white pixels in the inverse text mask 404.

[0043] In some embodiments, a distance transform mask 406 identifies a subset of the background of the first image 312, the subset of the background of the first image 312 being selected based on a pixel distance of each pixel in the subset. Each pixel in the subset is selected based on determining that the pixel distance of the corresponding pixel from the boundary of the foreground portion is within a range (e.g., between 3 and 10 pixels, between 0 and 15 pixels). The distribution of the distance transform is adjusted (408) within the range. The distance transform mask 406 is normalized (410) to 0-255. An alpha channel value 320 is set (412) for a subset of the overlay image 330 corresponding to the subset of the background of the first image 312. When the overlay image 330 is integrated over the region of interest 304 of the first image, the subset of the overlay image 330 is aligned with the subset of the background of the first image 312, and the alpha channel value 320 allows the subset of the overlay image 330 to be partially transparent and allows the subset of the background of the first image 312 to be visible. In these ways, the overlay image 330 replaces the region of interest 304 , thereby enhancing the image quality of the region of interest 304 while preserving some contextual information of the first image 312 .

[0044] In some embodiments, alpha channel values ​​320 are set for pixels of the overlay image 330 that are outside the subset of the overlay image 330, pixels of the foreground portion of the first image 312, pixels in a subset of the background of the first image 312, and / or background pixels of the first image 312 that are outside the subset of the background of the first image 312. The alpha channel values ​​of the overlay image 330 and the first image 312 correspond to the alpha channels of the overlay image 330 and the first image 312, respectively, and are combined (412) during the process of combining the overlay image 330 and the first image 312. In addition, a 2D AR object (e.g., a translation of content in a certain language, an avatar) is rendered (414) on the resulting first image 312' based on the alpha channel values, and the resulting first image 312' has the overlay image 330 integrated on the region of interest 304 of the first image 312. Optionally, the 2D AR object is also rendered on the overlay image 330.

[0045] Figures 5A to 5F The present invention relates to a region of interest 304 of an original image 312, a text pixel mask 402, an inverse text mask 404, a distance transform mask 406, an alpha channel value map of an overlay image 330, and the overlay image 330, according to some embodiments. A real-time translation application is executed to translate first text content in a first language displayed in the region of interest 304 into second text content in a second language. The region of interest 304 of the original image 312 is enhanced using the overlay image 330 based on alpha blending, such that the second text content in the second language is displayed on the region of interest 304 with enhanced visual effects. The region of interest 304 is a text region, and an object includes the first text content in the first language, which is displayed on and fills the foreground portion 502 of the text region. The overlay image 330 is rendered on the region of interest 304 based on the alpha channel value map. The second text content in the second language is translated from the first text content in the first language and rendered on the region of interest 304, which is enhanced by the overlay image 330 using the alpha channel value map. The real-time translation application sequentially detects the text region, applies a repair method to combine the overlay image 330 and the region of interest 304, and renders the second text content as a 2D AR object overlaid with the first image 312 (e.g., in the 7A to 7C Applying the alpha channel seamlessly blends the edges of the overlay image 330 outside the inpainted text region with the subset 506 of the background of the first image 312 and provides a context-rich visual effect.

[0046] A text pixel mask 402 is identified based on a plurality of object pixels corresponding to an object (i.e., first text content) in the region of interest 304. In one example, the text pixel mask 402 has a white foreground portion 502 corresponding to the plurality of object pixels corresponding to the object in the region of interest 304 and a black background 504, each pixel of which does not belong to the plurality of object pixels. The plurality of object pixels correspond to the object in the region of interest 304. The text pixel mask 402 is further inverted into an inverse text mask 404, e.g., having a black foreground portion 502 corresponding to the plurality of object pixels in the region of interest 304 and a white background 504, each pixel of which does not belong to the plurality of object pixels. A distance transform operation is applied to the inverse text mask 404 to obtain a distance transformed mask 406. In the distance transform operation, the alpha channel value of each pixel is used to set the transparency level 320 based on the pixel distance from each pixel in the background of the first image 312 to the boundary of the foreground portion 502. In some embodiments, the distance transformed mask 406 identifies a subset 506 of the background of the first image 312, the subset of the background of the first image 312 being selected based on a pixel distance of each pixel in the subset 506. Each pixel in the subset 506 is selected based on determining that a pixel distance of the corresponding pixel from a nearest boundary of the foreground portion 502 is within a pixel range (e.g., between 3 and 10 pixels, between 0 and 15 pixels).

[0047] See also Figure 5D The result of the distance transform includes a grayscale image or mask 406, which optionally has the same size as the region of interest 304 of the first image 312. The gray level of each pixel in the foreground portion 502 is set to 1 (i.e., indicating "opaque"). Each pixel in the subset 506 of the region of interest is outside of and adjacent to the foreground portion 502 and has a corresponding gray level that varies based on the pixel distance from the corresponding pixel to the nearest boundary. In some embodiments, the pixel distance is the Euclidean distance between each pixel in the subset 506 and the nearest boundary of the foreground portion 502.

[0048] See also Figure 5E ,based on Figure 5DThe result of the distance transformation shown in defines the alpha channel value 320 of the superimposed image 330, and the alpha channel value 320 represents the adjacency relationship between the pixel-level weighted graph and calculates the weight between two pixel vertices through the distance matrix. The alpha channel value is defined by the weight of the pixel vertex. In some embodiments, the Euclidean distance is normalized and the alpha channel value is also normalized (for example, normalized to 0 to 255). For example, the Min-Max normalization method is applied to rescale the range of the Euclidean distance from the range of the pixel distance to the range of [0,1], as shown below: dist'=(dist-dist_min) / (dist_max-dist_min) Wherein, dist and dist' are the Euclidean distance and the normalized pixel distance, respectively, and dist_min and dist_max are the minimum Euclidean distance and the maximum Euclidean distance of pixels in the subset 506 of the background of the first image 312. Alternatively, in some embodiments, dist_max and dist_min are predefined constants.

[0049] After normalization, the alpha channel value of the overlay image 330 is set based on the normalized pixel distance of each pixel, for example, to a range of 0 to 255 or 0 to 1. Figure 5F For a first subset 502' of the overlay image 330 corresponding to the foreground portion 502 of the first image 312, the corresponding alpha channel value is set to be completely opaque (i.e., set to equal 0 for the range [0, 1] or set to equal 255 for the range [0, 255]). When the overlay image 330 is used to inpaint the region of interest 304 of the first image 312, the object pixels of the overlay image 330 are displayed and saved. For a second subset 504' of the overlay image 330 corresponding to a portion of the background 504 different from the subset 506 of the first image 312, the corresponding alpha channel value is completely transparent (i.e., equal to 0). For a third subset 506' of the overlay image 330 corresponding to the subset 506 of the first image 312, the corresponding alpha channel value of each pixel varies as the pixel distance of the corresponding pixel from the nearest pixel on the boundary of the foreground portion 502 of the first image 312 increases. The corresponding alpha channel value of each pixel changes from completely opaque to completely transparent as the pixel distance from the nearest pixel on the boundary of the foreground portion 502 of the first image 312 increases. In other words, for each pixel in the subset 506 of the first image 312, the alpha channel value of the corresponding pixel in the overlay image 330 is interpolated between two transparency limits based on the pixel distance of the corresponding pixel in the subset 506 of the first image 312. Optionally, the interpolation is linear or non-linear.

[0050] Figures 6A to 6C is a map of alpha channel values ​​of the overlay image 330 with three different alpha channel setting parameters (eg, dist_min and dist_max), according to some embodiments, 7A to 7C 3 shows the effect of the alpha channel value map of the overlay image 330 on the rendering of the translated text according to some embodiments. Figure 6A , the alpha channel setting parameters include a first pixel distance dist_min and a second pixel distance dist_max, dist_min and dist_max are equal to 0 pixels and 10 pixels, respectively. For the subset of the overlay image 330 corresponding to the subset 506 of the first image 312, as the pixel distance of the corresponding pixel from the nearest pixel on the boundary of the foreground portion 502 of the first image 312 increases from 0 pixels to 10 pixels, the corresponding alpha channel value of each pixel changes from a minimum alpha value to a maximum alpha value (e.g., from 0 to 1, from 0 to 255). See Figure 7A , based on Figure 6A , an overlay image 330 is rendered on the region of interest 304. Given this alpha channel value, the first text content in the first language (i.e., "Goes") can be seen through the overlay image 330. Given that the transparency level of pixels near the boundary of the foreground portion 502 gradually decreases, the edges of the letters of the first text content appear blurred. In addition, given this definition of the alpha channel value 320, a portion of the pixels near the top edge of the overlay image 330 is transparent, exposing the dark background of the first image 312. When the second text content in the second language (i.e., "Goes") is further rendered on the overlay image 330, the top portion 702 of the second text content in the second language (i.e., "Goes") is lost in the background of the first image 312.

[0051] See also Figure 6B , the first pixel distance dist_min and the second pixel distance dist_max are equal to 0 pixels and 15 pixels, respectively. For the subset of the overlay image 330 corresponding to the subset 506 of the first image 312, as the pixel distance of the corresponding pixel from the nearest pixel on the boundary of the foreground portion 502 of the first image 312 increases from 0 pixels to 15 pixels, the corresponding alpha channel value of each pixel changes from the minimum alpha value to the maximum alpha value (e.g., from 0 to 1, from 0 to 255). See Figure 7B , based on Figure 6B, an overlay image 330 is rendered on the region of interest 304. Given the alpha channel value defined in , the first text content (i.e., "Goes") in the first language can be seen through the overlay image 330. Given the gradually decreasing transparency level of pixels near the boundary of the foreground portion 502, the edges of the letters of the first text content appear blurred. Figure 6B The alpha channel setting parameters in help increase the area of ​​the overlay image 330 where the transparency level 320 varies, and reduce the transparency near the top edge of the overlay image 330, thereby exposing a portion of pixels of the dark background of the first image 312. When the second text content is further rendered on the overlay image 330 (i.e., "removed"), the top 712 of the second text content is not completely lost in the background 504 of the first image 312, i.e., the readability of the second text content in the second language has been enhanced. In addition, with Figure 6A compared to, Figure 6B The alpha channel setting parameters in further enhance the readability of the second text content in the second language by removing details in the foreground portion 502 of the first image 312 .

[0052] In some embodiments, the subset 506 of the first image 312 corresponds to a region of the overlay image 330 where the transparency level 320 varies, however, the subset 506 of the first image 312 is not immediately adjacent to the foreground portion 502 of the first image 312 that includes the plurality of object pixels forming the first text content. Figure 6C , the first pixel distance dist_min and the second pixel distance dist_max are equal to 3 pixels and 10 pixels, respectively. For the subset of the overlay image 330 corresponding to the subset 506 of the first image 312, as the pixel distance of the corresponding pixel from the nearest pixel on the boundary of the foreground portion 502 of the first image 312 increases from 3 pixels to 10 pixels, the corresponding alpha channel value of each pixel changes from the minimum alpha value to the maximum alpha value (e.g., from 0 to 1, from 0 to 255). Therefore, Figure 7C The first text content shows Figure 7A The first text content has clearer edges, Figure 7A The first text content shows Figure 7B The first text content has a clearer edge. Figure 7C , based on Figure 6C , an overlay image 330 is rendered on the region of interest 304. Given the alpha channel value defined in , the first text content (i.e., "Goes") in the first language can be seen through the overlay image 330. Given the gradually decreasing transparency level of pixels near the boundary of the foreground portion 502, the edges of the letters of the first text content appear blurred. Figure 6Acompared to, Figure 6C The alpha channel setting parameters in do not change the transparent portion of pixels near the top edge of the overlay image 330, which exposes the dark background of the first image 312. When the second text content is further rendered on the overlay image 330, the top portion 722 of the second text content (i.e., "gone") is still lost in the background of the first image 312.

[0053] See also Figure 6C and Figure 7C , the first pixel distance dist_min is greater than 0. Each pixel in the pixel set is in the background of the first image 312 and has a pixel distance to the nearest pixel on the boundary of the foreground portion 502 of the first image 312. Since the pixel distance is less than the first pixel distance dist_min, the subset of the overlay image 330 corresponding to the pixel set is set to be fully opaque (i.e., set to equal 1 for the range [0, 1] or set to equal 255 for the range [1, 255]). In other words, the foreground portion 502 of the first image 312 is magnified by the first pixel distance dist_min, for example, each pixel at the boundary of the foreground portion 502 of the first image 312 is magnified by 3 pixels. Figure 6A compared to, Figure 6C The alpha channel setting parameters in remove details in the foreground portion 502 of the first image 312, thereby enhancing the readability of the second text content in the second language.

[0054] Figure 8 312 is a flowchart of a method 800 for rendering an image 312 with one or more regions of interest 304 according to some embodiments. In some embodiments, the method is applied to AR glasses 104D, a robotic system, a vehicle, or a mobile phone. For convenience, the method 800 is described as being implemented by an electronic device (e.g., a client device 104), for example, by the content rendering module 234 of the client device 104. In one example, the method 800 is applied to simultaneously render virtual content and real content in an extended reality (e.g., VR, AR). The method 800 is optionally governed by instructions stored in a non-transitory computer-readable storage medium and executed by one or more processors of an electronic system. Figure 8 Each operation shown in may correspond to a program stored in a computer memory or a non-transitory computer-readable storage medium (e.g., Figure 2The computer-readable storage medium may include instructions stored in the memory 206 of the electronic system 200. The computer-readable storage medium may include a magnetic or optical disk storage device, a solid-state storage device such as flash memory, or other non-volatile memory device. The instructions stored on the computer-readable storage medium may include one or more of the following: source code, assembly language code, object code, or other instruction formats interpreted by one or more processors. Some operations in method 800 may be combined and / or the order of some operations may be changed.

[0055] The electronic device obtains (802) a first image 312 including a region of interest 304 showing an object, and detects (804) an object in the region of interest 304 of the first image 312. In some embodiments, the region of interest 304 is rectangular and is used to loosely surround the object. The region of interest 304 has (806) a plurality of object pixels corresponding to the object, and the first image 312 includes (808) a foreground portion 502 filled with the plurality of object pixels and a background 504 that is different from each pixel of the foreground portion 502. The electronic device obtains (810) an overlay image 330 corresponding to the region of interest 304. The overlay image 330 has a size that is optionally larger than, smaller than, or equal to the size of the region of interest 304. The electronic device generates (812) a transparency level for each pixel of a subset of the overlay image 330, the subset of the overlay image 330 corresponding to the subset 506 of the first image 312 adjacent to the foreground portion 502, and the electronic device renders (814) the first image 312 together with the overlay image 330 integrated over the region of interest 304 based on the transparency level of each pixel of the subset of the overlay image 330.

[0056] In some embodiments, the region of interest 304 is (816) a text region, and the object includes first text content in a first language, the first text content displayed on and filling the foreground portion 502 of the text region. The electronic device renders (818) second text content in a second language on the first image rendered together with the overlay image integrated with the region of interest. The second text content in the second language is translated from the first text content in the first language.

[0057] In some embodiments, after detecting the object in the region of interest 304 of the first image 312, the electronic device identifies a subset 506 of the first image 312 in the background of the first image 312, the subset 506 of the first image 312 having a pixel distance measured from the nearest pixel on the boundary of the foreground portion 502. The pixel distance is greater than a first pixel distance (e.g., dist_min) and less than a second pixel distance (e.g., dist_max). For each pixel of the subset of the overlay image 330 corresponding to the subset 506 of the first image 312, the electronic device sets a transparency level for the pixel of the subset of the overlay image 330 to gradually increase with the pixel distance from the corresponding pixel in the subset 506 of the first image 312. Furthermore, in some embodiments, for each pixel of the subset 506 of the first image 312, the corresponding pixel of the overlay image 330 is at least partially transparent, and a combination of the corresponding pixel of the subset 506 of the first image 312 and the corresponding pixel of the overlay image 330 is displayed in place of the corresponding pixel of the subset 506 of the first image 312.

[0058] Additionally, in some embodiments, for each pixel of the subset of the overlaid image 330 corresponding to the subset 506 of the first image 312, a transparency level of the pixel of the subset of the overlaid image 330 increases with a pixel distance from the corresponding pixel in the subset 506 of the first image 312 based on a linear or non-linear predefined correlation. In some embodiments, for each pixel of the subset of the overlaid image 330 corresponding to the subset 506 of the first image 312, the transparency level of the pixel of the subset of the overlaid image 330 gradually increases from a low transparency limit to a high transparency limit, for example, from 0 to 1, or from 0 to 255, with a pixel distance from the corresponding pixel in the subset 506 of the first image 312.

[0059] In some embodiments, pixels of subset 506 of first image 312 are located in a background, and the background further includes a set of remaining background pixels 504, each remaining background pixel in the set of remaining background pixels 504 being different from subset 506 of first image 312. For each pixel of foreground portion 502 in region of interest 304, the electronic device sets the transparency level of the corresponding pixel of the subset of overlay image 330 corresponding to foreground portion 502 to a low transparency limit. For each first remaining background pixel, the electronic device sets the transparency level of the corresponding pixel of the subset of overlay image 330 corresponding to the first remaining background pixel 504 to a high transparency limit. The pixel distance of each first remaining background pixel is greater than a second pixel distance. Additionally, in some embodiments, the first pixel distance is greater than zero. For each second remaining background pixel having a pixel distance less than the first pixel distance, the electronic device sets the transparency level of the corresponding pixel of the subset of overlay image 330 corresponding to the second remaining background pixel to a low transparency limit.

[0060] In some embodiments, for each pixel of the foreground portion 502 in the region of interest 304, the corresponding pixel of the overlay image 330 is rendered opaque, and the corresponding pixel of the foreground portion 502 is completely replaced with the corresponding pixel of the overlay image 330. Furthermore, in some embodiments, for each remaining background pixel of the first image 312, the corresponding pixel of the overlay image 330 is rendered fully transparent and used to fully expose the corresponding remaining background pixel of the first image 312. Additionally, for each remaining background pixel of the first image 312, the corresponding pixel of the overlay image 330 is rendered partially transparent and used to display a combination of the corresponding remaining background pixel of the first image 312 and the corresponding pixel of the overlay image 330.

[0061] In some embodiments, the transparency level of each pixel of the subset of overlay image 330 corresponding to subset 506 of first image 312 is represented by a corresponding value of the alpha channel of the corresponding pixel. The first image 312 is rendered by applying the OpenGL pipeline to render the first image 312 as a background image and the overlay image 330 as a foreground image based on the transparency level of at least each pixel of the subset of overlay image 330. Furthermore, in some embodiments, the electronic device passes the corresponding value of the alpha channel of at least each pixel of the subset of overlay image 330 to the fragment shader and normalizes the corresponding value of the alpha channel of at least each pixel of the subset of overlay image 330, for example, to between 0 and 1.

[0062] See also Figure 3 In some embodiments, the object in the region of interest 304 includes a first object, and the first image 312 also includes a second object that is distinct from and physically separate from the first object. A bounding box is identified for the second object, the bounding box defining a second region of interest 304' in the first image 312. Optionally, the second region of interest 304' has a plurality of second-object pixels corresponding to the second object. The first image 312 includes a second foreground portion populated by the plurality of second-object pixels. The background of the first image 312 is distinct from each pixel corresponding to the first and second-object foreground portions. A second overlay image 330' corresponds to the second region of interest 304'. Optionally, the second overlay image 330 has a size that is greater than, less than, or equal to that of the second region of interest 304'. A transparency level is generated for each pixel of a subset of the second overlay image 330', the subset corresponding to the second subset 506 of the first image 312 adjacent to the second foreground portion. Based on the transparency level for each pixel of the subset of the second overlay image 330', the first image 312 is rendered together with the second overlay image 330' located on the second region of interest 304'.

[0063] In some embodiments, overlay image 330 is generated from a second image captured earlier than first image 312. First image 312 is rendered with a first latency from the time the first image 312 is obtained, and the first latency is less than a real-time rendering latency threshold. In some embodiments, a plurality of consecutive images are obtained for video content 302, and the method is performed for each image in a subset of images. Each image in the subset of images is rendered with a corresponding latency less than the real-time rendering latency threshold.

[0064] It should be understood that the Figure 8 The particular order of operations in is merely exemplary and is not intended to indicate that the order described is the only order in which the operations may be performed. A person of ordinary skill in the art will recognize various ways of rendering an image with an overlay image as described herein. In addition, it should be noted that the above description of Figures 4 to 7B The details of the other processes described above also apply in a similar manner to Figure 8 The method 800 is described. For the sake of brevity, these details are not repeated here.

[0065] Compared to many existing solutions to this problem, method 800 for rendering an overlay image 330 using a region of interest 304 of a first image requires a limited amount of computing resources. This improvement is achieved using at least one keyframe selection scheme and / or an OpenGL pipeline. The keyframe selection scheme allows the application of overlay images derived from the same keyframe to render multiple image frames, thereby avoiding wasting resources on image processing of the same region of interest 304 in different image frames. The OpenGL pipeline has fragment shaders and executes on the GPU, which ensures image rendering speed and achieves real-time visual effects. In this way, method 800 can be implemented on powerful electronic devices (e.g., servers, desktop computers) as well as on mobile devices that typically have limited resources. In addition, the overlay image is rendered seamlessly with the first image, and the overlay image corresponds to a latency below a real-time rendering latency threshold. In some embodiments, in an augmented reality (AR) application, the overlay image provides AR content, and the AR content is seamlessly blended into the real scene captured by the first image. In some embodiments, method 800 is implemented in a dedicated content rendering application. Alternatively, in some embodiments, method 800 is implemented in a user application that focuses on other user applications, such as a gaming application, a social media application, a drone application, a real-time translation application, an AR application, a short video application, a mobile shopping application, and a mobile payment application.

[0066] The terms used in the description of the various embodiments described herein are only for the purpose of describing specific embodiments, and are not intended to limit. As used in the description of the various embodiments described and the appended claims, the singular "one", "one", and "the" are intended to also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. It should also be understood that when used in this specification, the terms "include" and / or "comprising" indicate the existence of stated features, integers, steps, operations, elements and / or components, but do not exclude the existence or addition of one or more other features, integers, steps, operations, elements, components and / or their groups. In addition, it should be understood that although the terms "first", "second", etc. can be used to describe various elements in this article, these elements should not be limited by these terms. These terms are only used to distinguish an element from another element.

[0067] As used herein, the term “if” is optionally interpreted to mean “when” or “at” or “in response to determining” or “in response to detecting” or “according to a determination of…”, depending on the context. Similarly, the phrase “if it is determined” or “if [stated condition or event] is detected” is optionally interpreted to mean “upon the determination” or “in response to determining” or “upon detecting [stated condition or event]” or “in response to detecting [stated condition or event]” or “according to a determination of detecting [stated condition or event]”, depending on the context.

[0068] For purposes of illustration, the foregoing description has been described with reference to specific embodiments. However, the above illustrative discussion is not intended to be exhaustive or to limit the claims to the precise forms disclosed. Many modifications and variations are possible in light of the above teachings. The embodiments were chosen and described in order to best explain the principles of operation and practical application, thereby enabling those skilled in the art to practice the invention.

[0069] Although the various figures show multiple logical stages in a particular order, stages that are not dependent on the order can be reordered, and other stages can be combined or removed. Although some reordering or other groupings are specifically mentioned, other orderings and groupings will be obvious to those of ordinary skill in the art, and thus the orderings and groupings presented herein are not an exhaustive list of alternatives. Furthermore, it should be appreciated that the stages can be implemented in hardware, firmware, software, or any combination thereof.

Claims

1. A method implemented in an electronic device, include: obtaining a first image including a region of interest of a display object; detecting the object in the region of interest of the first image, the region of interest having a plurality of object pixels corresponding to the object, the first image including a foreground portion filled with the plurality of object pixels and a background different from each pixel of the foreground portion; obtaining a superimposed image corresponding to the region of interest; generating a transparency level for each pixel of a subset of the overlay image, the subset of the overlay image corresponding to a subset of the first image adjacent to the foreground portion; as well as The first image is rendered with the overlay image integrated over the region of interest based on the transparency level of each pixel of the subset of the overlay image.

2. The method according to claim 1, in, The region of interest is a text region, and the object includes first text content in a first language, the first text content is displayed on the foreground portion of the text region and fills the foreground portion of the text region, the method further comprising: Second text content in a second language is rendered on the first image rendered together with the overlay image integrated on the region of interest, wherein the second text content in the second language is translated from the first text content in the first language.

3. The method according to claim 1 or 2, generating the transparency level for each pixel of the subset of the superimposed image. include: After detecting the object in the region of interest of the first image, identifying the subset of the first image in the background of the first image, the subset of the first image having a pixel distance measured from a nearest pixel on a boundary of the foreground portion that is greater than a first pixel distance and less than a second pixel distance; as well as For each pixel of the subset of the overlay image corresponding to the subset of the first image, a transparency level of the pixel of the subset of the overlay image is set to gradually increase with the pixel distance from the corresponding pixel in the subset of the first image.

4. The method according to claim 3, in, For each pixel of the subset of the first image, the corresponding pixel of the overlay image is at least partially transparent, and a combination of the corresponding pixel of the subset of the first image and the corresponding pixel of the overlay image is displayed instead of the corresponding pixel of the subset of the first image.

5. The method according to claim 3 or 4, in, For each pixel of the subset of the overlay image corresponding to the subset of the first image, the transparency level of the pixel of the subset of the overlay image increases with the pixel distance of the corresponding pixel in the subset of the first image based on a linear or non-linear predefined correlation.

6. The method according to any one of claims 3 to 5, in, For each pixel of the subset of the overlay image corresponding to the subset of the first image, the transparency level of the pixel of the subset of the overlay image gradually increases from a low transparency limit to a high transparency limit along with the pixel distance of the corresponding pixel in the subset of the first image.

7. The method according to any one of claims 3 to 6, in, The pixels of the subset of the first image are located in the background, and the background also includes a set of remaining background pixels, each remaining background pixel in the set of remaining background pixels is different from the subset of the first image, and further includes: For each pixel of the foreground portion in the region of interest, setting the transparency level of the corresponding pixel of the subset of the overlay image corresponding to the foreground portion to the low transparency limit; and For each first remaining background pixel, the transparency level of the corresponding pixel of the subset of the superimposed image corresponding to the first remaining background pixel is set to the high transparency limit, wherein the pixel distance of each first remaining background pixel is greater than the second pixel distance.

8. The method according to any one of the preceding claims, in, For each pixel of the foreground portion in the region of interest, the corresponding pixel of the overlay image is rendered opaque, and the corresponding pixel of the foreground portion is completely replaced by the corresponding pixel of the overlay image.

9. The method according to claim 7, in, For each remaining background pixel of the first image, the corresponding pixel of the overlay image is rendered fully transparent and used to fully expose the corresponding remaining background pixel of the first image.

10. The method according to claim 7, in, For each remaining background pixel of the first image, the corresponding pixel of the overlay image is rendered partially transparent and used to display a combination of the respective remaining background pixel of the first image and the corresponding pixel of the overlay image.

11. The method according to any one of the preceding claims, in, The region of interest is rectangular and is used to loosely surround the object.

12. The method according to any one of the preceding claims, in: The transparency level of each pixel of the subset of the overlay image corresponding to the subset of the first image is represented by a corresponding value of an alpha channel of the corresponding pixel; as well as Rendering the first image together with the overlay image integrated on the region of interest further comprises: An OpenGL pipeline is applied to render the first image as a background image and the overlay image as a foreground image based on the transparency level of at least each pixel of the subset of the overlay image.

13. The method according to claim 12, in, Applying the OpenGL pipeline also includes: passing a corresponding value of the alpha channel of at least each pixel of the subset of the overlay image to a fragment shader; and The corresponding value of the alpha channel of at least each pixel of the subset of the overlay image is normalized.

14. The method according to any one of the preceding claims, in, The object includes a first object, and the first image also includes a second object that is different from and physically separated from the first object, the method further comprising: detecting a second region of interest in the first image, the second region of interest having a plurality of second object pixels corresponding to the second object, the first image including a second foreground portion filled with the plurality of second object pixels, the background of the first image being different from each pixel of the foreground portion corresponding to the first object and the second object; obtaining a second superimposed image corresponding to the second region of interest; and A transparency level is generated for each pixel of a subset of the second overlay image, the subset of the second overlay image corresponding to a second subset of the first image adjacent to the second foreground portion, wherein the first image is rendered together with the second overlay image located in the second region of interest based on the transparency level for each pixel of the subset of the second overlay image.

15. The method according to any one of the preceding claims, in: The overlay image is generated from a second image captured earlier than the first image; and The first image is rendered with a first delay from obtaining the first image, and the first delay is less than a real-time rendering delay threshold.

16. A method according to any one of the preceding claims, in: A plurality of consecutive images are obtained for the video content, and the method is performed on each image in a subset of the images; and Each image in the subset of images is rendered with a corresponding latency that is less than a real-time rendering latency threshold.

17. An electronic device, include: one or more processors; as well as A memory having instructions stored thereon, which, when executed by the one or more processors, cause the processor to perform the method according to any one of claims 1-16.

18. A non-transitory computer readable medium having instructions stored thereon, which when executed by one or more processors cause the one or more processors to perform the method according to any one of claims 1-16.

Citation Information

Patent Citations

  • Video matting based on foreground-background constraint propagation

    CN102388391A

  • Image synthesis method and device

    CN107958449A

  • Image processing method and electronic equipment

    CN110675420A

  • Shooting method and electronic equipment

    CN112887583A

  • Reducing interference of an overlay with underlying content

    US20160066024A1