CN114399425B - Image processing method, video processing method, device, equipment and medium - Google Patents
Image processing method, video processing method, device, equipment and medium Download PDFInfo
- Publication number
- CN114399425B CN114399425B CN202111592448.3A CN202111592448A CN114399425B CN 114399425 B CN114399425 B CN 114399425B CN 202111592448 A CN202111592448 A CN 202111592448A CN 114399425 B CN114399425 B CN 114399425B
- Authority
- CN
- China
- Prior art keywords
- color data
- image
- color
- light beam
- initial
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/04—Context-preserving transformations, e.g. by using an importance map
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
Description
技术领域Technical Field
本公开实施例涉及图像处理技术领域,尤其涉及一种图像处理方法、视频处理方法、装置、设备及介质。The embodiments of the present disclosure relate to the field of image processing technology, and in particular to an image processing method, a video processing method, an apparatus, a device, and a medium.
背景技术Background technique
随着对图像和视频展示的需求,对图像或视频中的图像帧添加特效成为常用的处理方式。但是目前的特效处理方式仍存在种类少,不足以满足用户需求的情况。With the demand for image and video display, adding special effects to image or video frames has become a common processing method. However, the current special effect processing methods are still limited in variety and insufficient to meet user needs.
发明内容Summary of the invention
本公开实施例提供了一种图像处理方法、视频处理方法、装置、设备及介质,以实现在图像基础上添加投影光束效果。The embodiments of the present disclosure provide an image processing method, a video processing method, an apparatus, a device and a medium to achieve adding a projection beam effect on an image.
第一方面,本公开实施例提供了一种图像处理方法,包括:In a first aspect, an embodiment of the present disclosure provides an image processing method, including:
获取初始图像,提取所述初始图像中的至少一组颜色数据;Acquire an initial image, and extract at least one set of color data from the initial image;
基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束;Form corresponding light beams respectively based on any set of color data in the at least one set of color data;
对所述光束进行叠加,形成所述初始图像对应的光束效果图;superimposing the light beams to form a light beam effect diagram corresponding to the initial image;
将所述光束效果图叠加至所述初始图像中,形成光束效果图像。The light beam effect diagram is superimposed on the initial image to form a light beam effect image.
第二方面,本公开实施例还提供了一种视频处理方法,包括:In a second aspect, the present disclosure also provides a video processing method, including:
获取待投影的视频数据,将所述视频数据的色调调整为投影色调;Acquire video data to be projected, and adjust the tone of the video data to the projection tone;
对于所述色调调整后的视频数据中的图像帧,提取所述图像帧中的至少一组颜色数据,基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束,对所述光束进行叠加,形成所述图像帧对应的光束效果图,将所述光束效果图叠加至所述图像帧中,得到特效视频数据。For the image frame in the hue-adjusted video data, at least one group of color data in the image frame is extracted, corresponding light beams are formed based on any one group of color data in the at least one group of color data, the light beams are superimposed to form a light beam effect diagram corresponding to the image frame, and the light beam effect diagram is superimposed on the image frame to obtain special effect video data.
第三方面,本公开实施例还提供了一种图像处理装置,包括:In a third aspect, the present disclosure also provides an image processing device, including:
颜色数据提取模块,用于获取初始图像,提取所述初始图像中的至少一组颜色数据;A color data extraction module, used to obtain an initial image and extract at least one set of color data from the initial image;
光束生成模块,基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束;A light beam generating module, which forms corresponding light beams based on any one of the at least one set of color data;
光束效果生成模块,用于对所述光束进行叠加,形成所述初始图像对应的光束效果图;A beam effect generating module, used for superimposing the beams to form a beam effect diagram corresponding to the initial image;
光束效果图像生成模块,用于将所述光束效果图叠加至所述初始图像中,形成光束效果图像。The beam effect image generating module is used for superimposing the beam effect diagram onto the initial image to form a beam effect image.
第四方面,本公开实施例还提供了一种视频处理装置,包括:In a fourth aspect, the present disclosure also provides a video processing device, including:
视频数据获取模块,用于获取待投影的视频数据;A video data acquisition module, used to acquire video data to be projected;
色调调整模块,用于将所述视频数据的色调调整为投影色调;A tone adjustment module, used for adjusting the tone of the video data to a projection tone;
视频处理模块,用于对于所述色调调整后的视频数据中的图像帧,提取所述图像帧中的至少一组颜色数据,基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束,对所述光束进行叠加,形成所述图像帧对应的光束效果图,将所述光束效果图叠加至所述图像帧中,得到特效视频数据。A video processing module is used to extract at least one set of color data from an image frame in the hue-adjusted video data, form corresponding light beams based on any one set of color data in the at least one set of color data, superimpose the light beams to form a light beam effect diagram corresponding to the image frame, and superimpose the light beam effect diagram onto the image frame to obtain special effect video data.
第五方面,本公开实施例还提供了一种电子设备,所述电子设备包括:In a fifth aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
一个或多个处理器;one or more processors;
存储装置,用于存储一个或多个程序,a storage device for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如本公开实施例任一所述的图像处理方法或者视频处理方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method or video processing method as described in any one of the embodiments of the present disclosure.
第六方面,本公开实施例还提供了一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如本公开实施例任一所述的图像处理方法或者视频处理方法。In a sixth aspect, the embodiments of the present disclosure further provide a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the image processing method or video processing method as described in any one of the embodiments of the present disclosure.
本公开实施例的技术方案,通过在获取初始图像中提取至少一组颜色数据,基于每一组颜色数据,形成对应的光束,将对各组颜色数据生成的光束进行叠加,形成初始图像对应的光束效果图,将光束效果图中的光束为模拟全息投影的虚拟光源发射的光束,将所述光束效果图叠加至所述初始图像中,形成光束效果图像。通过在图像中添加模拟的光束,实现了在图像中添加投影模拟特效。The technical solution of the disclosed embodiment is to extract at least one set of color data from the initial image, form a corresponding light beam based on each set of color data, superimpose the light beams generated for each set of color data to form a light beam effect diagram corresponding to the initial image, and superimpose the light beam effect diagram onto the initial image to form a light beam effect image. By adding a simulated light beam to the image, a projection simulation special effect is added to the image.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。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.
图1为本公开实施例所提供的一种图像处理方法流程示意图;FIG1 is a schematic diagram of a flow chart of an image processing method provided by an embodiment of the present disclosure;
图2是本公开实施例提供的一种初始光束的示意图;FIG2 is a schematic diagram of an initial light beam provided by an embodiment of the present disclosure;
图3是本公开实施例提供的一种聚拢光束的示意图;FIG3 is a schematic diagram of a focused light beam provided by an embodiment of the present disclosure;
图4是本公开实施例提供的一种目标光束的示意图;FIG4 is a schematic diagram of a target light beam provided by an embodiment of the present disclosure;
图5是本公开实施例提供的初始图像的光束效果示意图;FIG5 is a schematic diagram of a light beam effect of an initial image provided by an embodiment of the present disclosure;
图6为本公开实施例所提供的一种视频处理方法流程示意图;FIG6 is a schematic flow chart of a video processing method provided by an embodiment of the present disclosure;
图7是本公开实施例提供的一种透明模板的示意图;FIG7 is a schematic diagram of a transparent template provided by an embodiment of the present disclosure;
图8是本公开实施例所提供的一种图像处理装置的结构示意图;FIG8 is a schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure;
图9是本公开实施例所提供的一种视频处理装置的结构示意图;FIG9 is a schematic diagram of the structure of a video processing device provided by an embodiment of the present disclosure;
图10为本公开实施例所提供的一种电子设备结构示意图。FIG. 10 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and/or in parallel. In addition, the method embodiments may include additional steps and/or omit the steps shown. The scope of the present disclosure is not limited in this respect.
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
图1为本公开实施例所提供的一种图像处理方法流程示意图,本公开实施例适应于在图像或视频中设置模拟全息投影的光束效果的情况,该方法可以由本公开实施例提供的图像处理装置来执行,该图像处理装置可以通过软件和/或硬件的形式实现,可选的,通过电子设备来实现,该电子设备可以是移动终端或PC端等。如图1,本实施例的方法包括:FIG1 is a flow chart of an image processing method provided by an embodiment of the present disclosure. The embodiment of the present disclosure is suitable for setting a beam effect of simulated holographic projection in an image or video. The method can be executed by an image processing device provided by an embodiment of the present disclosure. The image processing device can be implemented in the form of software and/or hardware. Optionally, it can be implemented by an electronic device, which can be a mobile terminal or a PC. As shown in FIG1, the method of this embodiment includes:
S110、获取初始图像,提取所述初始图像中的至少一组颜色数据。S110: Acquire an initial image, and extract at least one set of color data from the initial image.
S120、基于至少一组颜色数据中的任一组颜色数据分别形成对应的光束。S120, forming corresponding light beams based on any one set of color data in at least one set of color data.
S130、对所述光束进行叠加,形成所述初始图像对应的光束效果图。S130, superimposing the light beams to form a light beam effect diagram corresponding to the initial image.
S140、将所述光束效果图叠加至所述初始图像中,形成光束效果图像。S140, superimposing the light beam effect diagram onto the initial image to form a light beam effect image.
本实施例中,初始图像为进行处理的图像,对该初始图像增加全息投影的模拟光束效果,以得到模拟全息投影的效果图像。该图像可以是实时采集的图像,也可以是导入的图像。在一些实施例中,该初始图像为视频中的局部图像帧或者全部图像帧,示例性的,可以是对视频中的每一帧图像增加全息投影的模拟光束效果,以得到模拟全息投影的效果视频。在一些实施例中,初始图像为摄像装置实时采集的图像帧,以直播为例,在直播过程中,实时采集图像帧,对采集的局部图像帧或者全部图像帧分别添加光束效果,示例性的,可以对直播中的每一帧图像增加全息投影的模拟光束效果,以得到模拟全息投影的效果直播数据流。示例性的,在直播设备的显示界面中,可以是配置有特效处理控件,在监测到特效处理控件被选择的情况下,对采集的各图像设置光束效果。In this embodiment, the initial image is the image to be processed, and the simulated beam effect of holographic projection is added to the initial image to obtain the effect image of simulated holographic projection. The image can be an image collected in real time or an imported image. In some embodiments, the initial image is a partial image frame or all image frames in the video. For example, the simulated beam effect of holographic projection can be added to each frame of the video to obtain the effect video of simulated holographic projection. In some embodiments, the initial image is an image frame collected in real time by the camera device. Taking live broadcast as an example, during the live broadcast process, the image frame is collected in real time, and the beam effect is added to the collected partial image frame or all image frames respectively. For example, the simulated beam effect of holographic projection can be added to each frame of the live broadcast to obtain the effect live data stream of simulated holographic projection. For example, in the display interface of the live broadcast device, a special effect processing control can be configured. When the special effect processing control is detected to be selected, the beam effect is set for each collected image.
本实施例中的光束效果基于初始图像中的颜色数据生成,相应的,不同初始图像对应的光束效果不同,实现光束效果随图像的变化而变化,提高了光束效果的随机性和灵活性,避免了固定光束效果导致的模拟效果差的情况。The light beam effect in this embodiment is generated based on the color data in the initial image. Accordingly, different initial images correspond to different light beam effects, so that the light beam effect changes with the image, thereby improving the randomness and flexibility of the light beam effect and avoiding the poor simulation effect caused by a fixed light beam effect.
从初始图像中提取至少一组颜色数据,该至少一组颜色数据中的任一组颜色数据可用于生成一模拟光束。在一些实施例中,可以是提取初始图像中的像素行中的颜色数据作为一组颜色数据,该像素行可以是初始图像中任一位置处的像素行,可随机确定,多个像素行不重叠。At least one set of color data is extracted from the initial image, and any set of color data in the at least one set of color data can be used to generate a simulated light beam. In some embodiments, color data in a pixel row in the initial image can be extracted as a set of color data, and the pixel row can be a pixel row at any position in the initial image, which can be randomly determined, and multiple pixel rows do not overlap.
在一些实施例中,可以是提取初始图像中的任一像素列中的颜色数据作为一组颜色数据,该像素列可以是初始图像中的任一像素列,可随机确定,多个像素列不重叠。In some embodiments, color data in any pixel column in the initial image may be extracted as a set of color data. The pixel column may be any pixel column in the initial image and may be randomly determined. Multiple pixel columns do not overlap.
在一些实施例中,可以是提取初始图像中任一提取线上像素点的颜色数据作为一组颜色数据,其中,提取线可以是初始图像中任一角度的直线,该提取线可以是水平提取线、垂直提取线或者任一倾角的斜线。In some embodiments, the color data of the pixel points on any extraction line in the initial image can be extracted as a set of color data, wherein the extraction line can be a straight line at any angle in the initial image, and the extraction line can be a horizontal extraction line, a vertical extraction line, or a slanted line at any inclination angle.
在一些实施例中,可以是多组颜色数据用于生成多个光束,对颜色数据的组数不进行限定,可根据用户需求设置。示例性的,颜色数据的组数可以是预先设置的,还可以是根据交互界面的输入控件采集用户输入的参数,该参数可以包括颜色数据的组数,其中,输入控件可以是输入框、数据选择滑块或者数据增加/减少控件等,对此不作限定,具有数据输入功能即可。In some embodiments, multiple groups of color data may be used to generate multiple light beams, and the number of groups of color data is not limited and can be set according to user needs. Exemplarily, the number of groups of color data may be pre-set, or may be a parameter input by a user according to an input control of an interactive interface, and the parameter may include the number of groups of color data, wherein the input control may be an input box, a data selection slider, or a data increase/decrease control, etc., and is not limited thereto, as long as it has a data input function.
其中,颜色数据可以是基于初始图像中随机确定的像素行、像素列、提取线的一种或多种形式提取的,其中,任一组颜色数据的提取方式可随机确定。可选的,对于同一初始图像中的多组颜色数据可以是基于一种提取方式确定,还可以是基于不同的提取方式确定。在一些实施例中,可根据交互界面的虚拟控件采集用户输入的提取方式,其中,提取方式包括像素行提取、像素列提取、随机线提取、混合提取等。The color data may be extracted based on one or more forms of randomly determined pixel rows, pixel columns, and extraction lines in the initial image, wherein the extraction method of any set of color data may be randomly determined. Optionally, multiple sets of color data in the same initial image may be determined based on one extraction method or different extraction methods. In some embodiments, the extraction method of user input may be collected based on the virtual controls of the interactive interface, wherein the extraction methods include pixel row extraction, pixel column extraction, random line extraction, mixed extraction, and the like.
在一些实施例中,提取所述初始图像中的至少一组颜色数据可以是在交互界面上检测用户输入的颜色提取操作,基于颜色提取操作得到对应的颜色数据。其中,颜色提取操作可以是滑动触控操作,提取滑动触控操作对应的滑动轨迹上的颜色数据,将连续滑动轨迹上的颜色数据作为一组颜色数据,或者,采集滑动轨迹上的颜色数据,将采集的颜色数据基于预设数量进行分组,划分得到多组颜色数据。颜色提取操作还可以是行/列选择触控操作,即颜色提取操作为点击操作,确定颜色提取操作对应的位置点,将该位置点所在的像素行或像素列所对应的颜色数据确定为一组颜色数据。In some embodiments, extracting at least one set of color data in the initial image may be detecting a color extraction operation input by a user on an interactive interface, and obtaining corresponding color data based on the color extraction operation. The color extraction operation may be a sliding touch operation, extracting color data on a sliding track corresponding to the sliding touch operation, and taking the color data on a continuous sliding track as a set of color data, or collecting color data on a sliding track, grouping the collected color data based on a preset number, and dividing to obtain multiple sets of color data. The color extraction operation may also be a row/column selection touch operation, that is, the color extraction operation is a click operation, determining a position point corresponding to the color extraction operation, and determining the color data corresponding to the pixel row or pixel column where the position point is located as a set of color data.
需要说明的是,若初始图像属于视频中的图像帧,或者直播视频流中的图像帧,可基于上述设置对视频/视频流中的全部图像,或者初始图像的时间戳之后的各图像进行同样的设置。It should be noted that if the initial image belongs to an image frame in a video or an image frame in a live video stream, the same settings can be performed on all images in the video/video stream or on images after the timestamp of the initial image based on the above settings.
本实施例中,通过在交互界面上设置交互控件,以实现用户与电子设备的交互,实现根据用户的设置生成对应的光束效果,提高光束效果在生成过程中的交互性。In this embodiment, an interactive control is provided on the interactive interface to enable interaction between the user and the electronic device, thereby generating a corresponding light beam effect according to the user's settings, thereby improving the interactivity of the light beam effect during the generation process.
在一些实施例中,在获取初始图像之后,还包括:从所述初始图像中分割得到光束参考对象,基于分割得到的光束参考对象与预设背景形成光束参考图像。其中,光束参考对象可以是初始图像中进行全息投影的模拟对象,例如,光束参考对象可以包括但不限于人物、动物等。光束参考对象可以是用户指定的,还可以是自动识别到的,示例性的,以光束参考对象为人物为例,对于每一初始图像,识别初始图像中的人像,对人像进行自动识别以及人像分割,得到分割后的光束参考对象。示例性的,光束参考对象还可以是特定的人物,可根据预设的人物信息在初始图像中进行识别,在初始图像中包括特定的人物时,进行光束参考对象的分割。将分割得到的光束参考对象添加预设背景,形成光束参考图像,其中,预设背景可以是单色背景,例如白色背景或者黑色背景等,通过单色背景替换初始图像中的背景,减少原背景的颜色干扰。In some embodiments, after acquiring the initial image, the method further includes: segmenting the initial image to obtain a beam reference object, and forming a beam reference image based on the segmented beam reference object and a preset background. The beam reference object may be a simulated object for holographic projection in the initial image. For example, the beam reference object may include but is not limited to a person, an animal, etc. The beam reference object may be specified by the user or automatically identified. For example, taking the beam reference object as a person, for each initial image, the portrait in the initial image is identified, and the portrait is automatically identified and segmented to obtain the segmented beam reference object. For example, the beam reference object may also be a specific person, which may be identified in the initial image according to preset person information. When the initial image includes a specific person, the beam reference object is segmented. The segmented beam reference object is added with a preset background to form a beam reference image, wherein the preset background may be a monochrome background, such as a white background or a black background, etc. The background in the initial image is replaced by the monochrome background to reduce the color interference of the original background.
相应的,所述提取所述初始图像中的至少一组颜色数据,包括:提取所述光束参考图像中的至少一组颜色数据。其中,在光束参考图像中提取各组颜色数据的方式与上述实施例中在初始图像中提取颜色数据的方式相同,此处不再赘述。Correspondingly, extracting at least one set of color data from the initial image includes: extracting at least one set of color data from the light beam reference image. The method of extracting each set of color data from the light beam reference image is the same as the method of extracting color data from the initial image in the above embodiment, and will not be repeated here.
在一些实施例中,所述至少一组颜色数据为初始图像或光束参考图像中提取线上的颜色数据,所述提取线为所述初始图像或所述光束参考图像中的像素行或像素列。通过提取线提取颜色数据,提高同一组颜色数据中颜色的变化度,避免颜色单一的情况,以提高光束的颜色效果。In some embodiments, the at least one set of color data is color data of an extraction line in the initial image or the light beam reference image, and the extraction line is a pixel row or pixel column in the initial image or the light beam reference image. The color data is extracted by extracting the extraction line, and the color variation in the same set of color data is improved to avoid the situation of a single color, so as to improve the color effect of the light beam.
对于每一组颜色数据进行处理,以得到对应的光束。可选的,基于至少一组颜色数据中的任一组颜色数据分别形成对应的光束,包括:对于至少一组颜色数据中的任一组颜色数据,分别基于颜色数据中的各颜色值形成一颜色线,形成所述颜色数据对应的初始光束;基于虚拟光源对所述初始光束进行聚拢,并对聚拢后的光束进行分束提取,得到所述颜色数据对应的目标光束。Each set of color data is processed to obtain a corresponding light beam. Optionally, corresponding light beams are formed based on any set of color data in at least one set of color data, including: for any set of color data in at least one set of color data, a color line is formed based on each color value in the color data to form an initial light beam corresponding to the color data; the initial light beam is gathered based on a virtual light source, and the gathered light beam is split and extracted to obtain a target light beam corresponding to the color data.
颜色线的方向,根据全息投影的模拟投影方向确定,示例性的,模拟投影方向为从下到上,或从上到下,则颜色线的方向为竖直方向,模拟投影方向为从左到右,或从右到左,则颜色线的方向为水平方向。本实施例中,各组颜色数据基于诸如像素行/像素列等的提取线提取得到,根据提取线上各像素点的位置,对对应的颜色数据进行排序,基于各颜色数据的位置关系,形成相同位置关系的多个颜色线,各颜色数据对应的颜色线形成初始光束,例如,以基于像素行提取颜色数据为例,将像素行上第一像素点的颜色数据(例如数据a)形成第一颜色线,该颜色线可以是数值颜色线,即第一像素列,该像素列上各像素点的颜色数据相同(即数据a),以像素行上第二像素点的颜色数据(例如数据b)形成第二颜色线,即第二像素列,并以此类推,得到初始光束。示例性的,参见图2,图2是本公开实施例提供的一种初始光束的示意图。The direction of the color line is determined according to the simulated projection direction of the holographic projection. For example, if the simulated projection direction is from bottom to top or from top to bottom, the direction of the color line is vertical. If the simulated projection direction is from left to right or from right to left, the direction of the color line is horizontal. In this embodiment, each group of color data is extracted based on an extraction line such as a pixel row/pixel column, and the corresponding color data is sorted according to the position of each pixel point on the extraction line. Based on the positional relationship of each color data, multiple color lines with the same positional relationship are formed, and the color lines corresponding to each color data form an initial light beam. For example, taking the extraction of color data based on a pixel row as an example, the color data of the first pixel point on the pixel row (for example, data a) forms a first color line, which can be a numerical color line, that is, a first pixel column, and the color data of each pixel point on the pixel column is the same (that is, data a), and the color data of the second pixel point on the pixel row (for example, data b) forms a second color line, that is, a second pixel column, and so on, to obtain an initial light beam. For example, see Figure 2, which is a schematic diagram of an initial light beam provided in an embodiment of the present disclosure.
为了模拟全息投影的光束效果,对初始光束进行聚拢处理,以模拟虚拟光源对发射光束的效果。可选的,基于虚拟光源的设置位置进行聚拢处理,其中虚拟光源的设置位置可以是预先设置的,还可以是根据全息投影的模拟投影方向确定。以模拟投影方向为从下到上为例,虚拟光源的设置位置可以是初始光束的底部中心位置,以模拟投影方向为从上到下为例,虚拟光源的设置位置可以是初始光束的顶部中心位置。In order to simulate the beam effect of holographic projection, the initial beam is focused to simulate the effect of the virtual light source on the emitted beam. Optionally, the focusing is performed based on the setting position of the virtual light source, where the setting position of the virtual light source can be pre-set or determined according to the simulated projection direction of the holographic projection. Taking the simulated projection direction from bottom to top as an example, the setting position of the virtual light source can be the bottom center position of the initial beam, and taking the simulated projection direction from top to bottom as an example, the setting position of the virtual light source can be the top center position of the initial beam.
可选的,基于虚拟光源对所述初始光束进行聚拢,包括:基于所述虚拟光源确定聚拢光束的光束范围,在所述初始光束中提取所述光束范围内的颜色数据,得到聚拢光束。参见图2,图2中包括初始光束和背景,本实施例中的聚拢处理,针对初始光束,在聚拢过程中,剔除背景,避免背景的干扰。Optionally, focusing the initial light beam based on the virtual light source includes: determining a beam range of the focused light beam based on the virtual light source, extracting color data within the beam range from the initial light beam, and obtaining the focused light beam. Referring to FIG2 , FIG2 includes the initial light beam and the background. In the focusing process in this embodiment, for the initial light beam, the background is eliminated during the focusing process to avoid background interference.
聚拢光束的光束范围为以聚拢光束的位置为顶点,初始光束的宽度为底边宽度的三角范围,示例性的,参见图3,图3是本公开实施例提供的一种聚拢光束的示意图,其中,图3中光束顶点的位置为虚拟光源的设置位置。其中,聚拢光束的光束范围外的各像素点设置为背景颜色,聚拢光束的光束范围内的各像素点的颜色数据,基于初始光束中对应像素点的颜色数据确定,具体的,对于聚拢光束的光束范围内的任一像素点,基于该像素点的像素坐标,在初始光束中提取该像素坐标对应的颜色数据,基于提取的颜色数据对应设置聚拢光束的光束范围内的像素点,以形成聚拢光束。The beam range of the focused light beam is a triangular range with the position of the focused light beam as the vertex and the width of the initial light beam as the base width. For example, see FIG3 , which is a schematic diagram of a focused light beam provided in an embodiment of the present disclosure, wherein the position of the beam vertex in FIG3 is the setting position of the virtual light source. Among them, each pixel point outside the beam range of the focused light beam is set as a background color, and the color data of each pixel point within the beam range of the focused light beam is determined based on the color data of the corresponding pixel point in the initial light beam. Specifically, for any pixel point within the beam range of the focused light beam, based on the pixel coordinates of the pixel point, the color data corresponding to the pixel coordinates is extracted in the initial light beam, and the pixel point within the beam range of the focused light beam is set accordingly based on the extracted color data to form a focused light beam.
聚拢光束为三角形光束,不符合投影效果,为了提高全息投影的模拟真实性,对聚拢光束进行分束处理,将聚拢光束划分为多个子光束,在多个子光束中提取有辨识度的子光束,形成目标光束。The converged light beam is a triangular light beam, which does not meet the projection effect. In order to improve the simulation authenticity of the holographic projection, the converged light beam is split into multiple sub-beams, and recognizable sub-beams are extracted from the multiple sub-beams to form a target beam.
可选的,对聚拢后的光束进行分束提取,得到所述颜色数据对应的目标光束,包括:在光束的宽度方向上,基于预设步长确定聚拢光束中相邻光束的颜色差值;基于所述颜色差值在所述聚拢光束提取目标分束,以形成目标光束。以图3中的聚类光束为例,该聚拢光束的图像可以是设置在UV坐标下,其模拟投影方向为从下到上,即在y方向上投影,相应的,光束的宽度方向为x方向。基于预设步长将聚拢光束划分为多个子光束,其中,基于预设步长在聚拢光束的最宽边上进行子光束的划分,以提供光束划分的精度。预设步长可以是预先设置的,也可根据用户需求进行调节,例如,在交互界面可以是设置有步长调节控件,以获取用户输入的步长参数。示例性的,在UV坐标下,预设步长可以是0.05。Optionally, the focused light beam is split and extracted to obtain a target light beam corresponding to the color data, including: determining the color difference between adjacent light beams in the focused light beam based on a preset step size in the width direction of the light beam; extracting a target split beam in the focused light beam based on the color difference to form a target light beam. Taking the clustered light beam in FIG3 as an example, the image of the focused light beam can be set under the UV coordinate, and its simulated projection direction is from bottom to top, that is, projected in the y direction, and correspondingly, the width direction of the light beam is the x direction. The focused light beam is divided into a plurality of sub-beams based on a preset step size, wherein the sub-beams are divided on the widest side of the focused light beam based on the preset step size to provide the accuracy of the light beam division. The preset step size can be pre-set or adjusted according to user needs. For example, a step size adjustment control can be provided in the interactive interface to obtain the step size parameter input by the user. Exemplarily, under the UV coordinate, the preset step size can be 0.05.
获取划分后各子光束的颜色数据,其中,子光束的颜色数据可以是该子光束的中心颜色线的颜色数据,还可以是子光束中各颜色线的颜色均值,对此不作限定。确定相邻子光束的颜色差值,可以是将颜色差值与判断阈值进行比对,以确定子光束的辨识度,进一步确定是否保留该子光束。通过舍弃颜色变化小、辨识度差的子光束,以得到有辨识度的目标光束。Obtain color data of each sub-beam after division, wherein the color data of the sub-beam may be the color data of the central color line of the sub-beam, or may be the color average of each color line in the sub-beam, without limitation. Determine the color difference of adjacent sub-beams, which may be to compare the color difference with a judgment threshold to determine the recognition of the sub-beam, and further determine whether to retain the sub-beam. By discarding sub-beams with small color changes and poor recognition, a recognizable target beam is obtained.
在一些实施例中,基于所述颜色差值在所述聚拢光束提取目标分束可以是:对于聚拢光束中的任一子光束,确定当前子光束与第一相邻子光束的第一颜色差值,以及当前子光束与第二相邻子光束的第二颜色差值,将第一颜色差值与第二颜色差值的差值和,与预设阈值进行比对。在差值和大于或等于该预设阈值的情况下,表明颜色变化大,保留当前子光束,在差值和小于该预设阈值的情况下,表明颜色变化小,舍弃当前子光束。其中,预设阈值可以是根据用户需求设置,在一些实施例中,该预设阈值可以是0.5-0.9的范围内,例如可以是0.6。In some embodiments, extracting a target beam in the converged beam based on the color difference may be: for any sub-beam in the converged beam, determining the first color difference between the current sub-beam and the first adjacent sub-beam, and the second color difference between the current sub-beam and the second adjacent sub-beam, and comparing the sum of the difference between the first color difference and the second color difference with a preset threshold. When the sum of the difference is greater than or equal to the preset threshold, it indicates that the color change is large, and the current sub-beam is retained. When the sum of the difference is less than the preset threshold, it indicates that the color change is small, and the current sub-beam is discarded. The preset threshold may be set according to user needs. In some embodiments, the preset threshold may be in the range of 0.5-0.9, for example, 0.6.
示例性的,参见图4,图4是本公开实施例提供的一种目标光束的示意图。该目标光束为基于提取的一组颜色数据生成的。对于每一组颜色数据可形成诸如图4的目标光束,将多个目标光束进行叠加,以得到初始图像的光束效果图,其中,基于各目标光束的虚拟光源进行光束叠加,即将各光束的虚拟光源位置叠加在同一位置,形成光束效果图。将该光束效果图添加到初始图像中,例如可以是剔除光束效果图的背景,将提取的光束叠加在初始图像中。可选的,基于初始图像中全息投影模拟对象,将提取的光束进行叠加。具体的,根据初始图像中投影模拟位置,确定光束对应虚拟光源的位置,基于该虚拟光源的位置叠加提取的光束。例如,可以是基于模拟投影方向和投影模拟位置确定光束对应虚拟光源的位置,以模拟投影方向为从下到上为例,光束对应虚拟光源的位置为全息投影模拟对象所在位置的底部。以模拟投影方向为从上到下为例,光束对应虚拟光源的位置为全息投影模拟对象所在位置的顶部。Exemplarily, see FIG. 4, which is a schematic diagram of a target beam provided by an embodiment of the present disclosure. The target beam is generated based on a set of extracted color data. For each set of color data, a target beam such as FIG. 4 can be formed, and multiple target beams are superimposed to obtain a beam effect diagram of the initial image, wherein beam superposition is performed based on the virtual light source of each target beam, that is, the virtual light source position of each beam is superimposed at the same position to form a beam effect diagram. The beam effect diagram is added to the initial image, for example, the background of the beam effect diagram can be removed, and the extracted beam is superimposed in the initial image. Optionally, the extracted beam is superimposed based on the holographic projection simulation object in the initial image. Specifically, according to the projection simulation position in the initial image, the position of the virtual light source corresponding to the beam is determined, and the extracted beam is superimposed based on the position of the virtual light source. For example, the position of the virtual light source corresponding to the beam can be determined based on the simulated projection direction and the simulated projection position. Taking the simulated projection direction from bottom to top as an example, the position of the virtual light source corresponding to the beam is the bottom of the position of the holographic projection simulation object. Taking the simulated projection direction from top to bottom as an example, the position of the virtual light source corresponding to the beam is the top of the position of the holographic projection simulation object.
在一些实施例中,将所述光束效果图叠加至所述初始图像中,形成光束效果图像还可以是:将光束效果图添加到光束参考图像中,形成对光束参考对象进行全息投影模拟的模拟图像。In some embodiments, superimposing the beam effect diagram onto the initial image to form the beam effect image may also be: adding the beam effect diagram to the beam reference image to form a simulated image of a holographic projection simulation of the beam reference object.
在上述实施例的基础上,在基于任一组颜色数据分别形成对应的光束之后,在叠加在初始图像之前,所述方法还包括:对光束进行透明度的设置,例如可以是对生成的每一光束均进行透明度设置,还可以是对局部光束进行透明度设置。其中,所述透明度沿所述光束的投影方向依次增大。由于光在空间中传播的过程中,存在光的消散,因此,在投影方向上,光的颜色变化逐渐变淡。为了提高全息投影的模拟效果,对得到光束进行透明度的设置,以模拟光束在空间中的变化。光束的透明度可以是在0-100%的范围内,透明度的数值越大,透明度越高。On the basis of the above embodiment, after corresponding light beams are formed based on any set of color data, before being superimposed on the initial image, the method further includes: setting the transparency of the light beam, for example, the transparency of each generated light beam can be set, or the transparency of a local light beam can be set. Wherein, the transparency increases successively along the projection direction of the light beam. Since light dissipates during the propagation of light in space, the color change of light gradually fades in the projection direction. In order to improve the simulation effect of holographic projection, the transparency of the obtained light beam is set to simulate the change of the light beam in space. The transparency of the light beam can be in the range of 0-100%, and the larger the transparency value, the higher the transparency.
本实施例中,设置光束的透明度为沿所述光束的投影方向依次增大,即在虚拟光源位置处的光束透明度为0,在光束末端的透明度可以是100%,并在投影方向上透明度均匀变化。示例性的,参见图5,图5是本公开实施例提供的初始图像的光束效果示意图。图5中包括叠加的多个光束,以及对叠加后的光束设置的透明度。将图5中的光束添加在初始图像中,实现在图像中模拟全息投影技术的效果。In this embodiment, the transparency of the light beam is set to increase successively along the projection direction of the light beam, that is, the transparency of the light beam at the virtual light source position is 0, the transparency at the end of the light beam can be 100%, and the transparency changes uniformly in the projection direction. For example, see Figure 5, which is a schematic diagram of the light beam effect of the initial image provided by the embodiment of the present disclosure. Figure 5 includes multiple superimposed light beams and the transparency set for the superimposed light beams. The light beam in Figure 5 is added to the initial image to achieve the effect of simulating the holographic projection technology in the image.
对于包括多个初始图像的视频,或者,直播过程中实时采集的视频流,基于上述方式,依次确定每一图像对应的光束效果,将光束效果分别添加到对应的图像中,得到投影效果的模拟视频或模拟视频流。For a video including multiple initial images, or a video stream collected in real time during a live broadcast, based on the above method, the light beam effect corresponding to each image is determined in turn, and the light beam effect is added to the corresponding image to obtain a simulated video or simulated video stream of the projection effect.
本实施例提供的技术方案,通过在获取初始图像中提取至少一组颜色数据,基于每一组颜色数据,形成对应的光束,将对一组或多组的颜色数据生成的光束进行叠加,形成初始图像对应的光束效果图,将光束效果图中的光束为模拟全息投影的虚拟光源发射的光束,将所述光束效果图叠加至所述初始图像中,形成光束效果图像。通过在图像中添加模拟的光束,实现了在图像中模拟投影效果。The technical solution provided in this embodiment is to extract at least one set of color data from the initial image, form a corresponding light beam based on each set of color data, superimpose the light beams generated for one or more sets of color data to form a light beam effect diagram corresponding to the initial image, and superimpose the light beam effect diagram onto the initial image to form a light beam effect image. By adding a simulated light beam to the image, a projection effect is simulated in the image.
在上述实施例的基础上,本公开还提供了一种视频处理方法,参见图6,图6为本公开实施例所提供的一种视频处理方法流程示意图,本公开实施例适通过对视频增加全息投影的光束效果来模拟全息投影的情况,该方法可以由本公开实施例提供的视频处理装置来执行,该视频处理装置可以通过软件和/或硬件的形式实现,可选的,通过电子设备来实现,该电子设备可以是移动终端或PC端等。On the basis of the above embodiments, the present disclosure further provides a video processing method, see Figure 6, which is a flow chart of a video processing method provided by an embodiment of the present disclosure. The embodiment of the present disclosure is suitable for simulating the situation of holographic projection by adding a beam effect of holographic projection to the video. The method can be executed by the video processing device provided by the embodiment of the present disclosure. The video processing device can be implemented in the form of software and/or hardware, and optionally, it can be implemented by an electronic device, which can be a mobile terminal or a PC, etc.
S210、获取待投影的视频数据,将所述视频数据的色调调整为投影色调。S210, obtaining video data to be projected, and adjusting the tone of the video data to the projection tone.
S220、对于所述色调调整后的视频数据中的图像帧,提取所述图像帧中的至少一组颜色数据,基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束,对所述光束进行叠加,形成所述图像帧对应的光束效果图,将所述光束效果图叠加至所述图像帧中,得到特效视频数据。S220. For an image frame in the hue-adjusted video data, extract at least one group of color data in the image frame, form corresponding light beams based on any one group of color data in the at least one group of color data, superimpose the light beams to form a light beam effect diagram corresponding to the image frame, and superimpose the light beam effect diagram onto the image frame to obtain special effect video data.
经过全息投影技术形成的虚拟图像的色调不同于图像的标准色调,为了提高全息投影的模拟真实性,将视频数据的色调调整为投影色调。The hue of the virtual image formed by holographic projection technology is different from the standard hue of the image. In order to improve the simulation authenticity of the holographic projection, the hue of the video data is adjusted to the projection hue.
本实施例中,预先设置有投影色调与标准色调的转换关系,将视频数据中各帧图像中像素点的颜色数据基于上述转换关系进行色调转换,得到满足投影色调的视频数据,以提高全息投影的模拟真实性。In this embodiment, a conversion relationship between the projection tone and the standard tone is preset, and the color data of the pixel points in each frame image in the video data is converted based on the above conversion relationship to obtain video data that meets the projection tone, so as to improve the simulation authenticity of the holographic projection.
需要说明的是,投影色调可以是固定的一种,还可以是根据投影场景不同而设置多个投影色调。相应的,投影色调与标准色调的转换关系可随着投影色调的变化而变化,实现满足任何投影色调的数据转换,例如可预先存储多种投影色调与标准色调的转换关系,便于被调用。It should be noted that the projection color tone can be a fixed one, or multiple projection colors can be set according to different projection scenes. Correspondingly, the conversion relationship between the projection color tone and the standard color tone can change with the change of the projection color tone, so as to achieve data conversion that satisfies any projection color tone. For example, the conversion relationship between multiple projection colors and standard colors can be pre-stored for easy calling.
在一些实施例中,投影色调包括蓝色调。可选的,所述将所述视频数据的色调调整为投影色调,包括:根据当前色调下通道颜色数据与所述蓝色调中通道颜色数据的转换关系,将视频数据中图像帧的颜色数据转换为蓝色调对应的颜色数据。In some embodiments, the projection hue includes a blue hue. Optionally, adjusting the hue of the video data to the projection hue includes: converting the color data of the image frame in the video data into color data corresponding to the blue hue according to a conversion relationship between the channel color data in the current hue and the channel color data in the blue hue.
视频数据中图像帧可以是RGB图像,图像帧中像素点的颜色数据可以是(R,G,B,A),其中,R、G、B分别为红绿蓝三通道的数据,A为像素点的透明度。该图像的色调为标准色调,将图像转换至蓝色调下的图像。示例性的,当前色调与蓝色调的颜色数据转换关系可以是:The image frame in the video data may be an RGB image, and the color data of the pixel in the image frame may be (R, G, B, A), where R, G, B are the data of the three channels of red, green and blue, respectively, and A is the transparency of the pixel. The hue of the image is a standard hue, and the image is converted to an image in a blue hue. Exemplarily, the color data conversion relationship between the current hue and the blue hue may be:
T.r=E.r/2.5T.r=E.r/2.5
T.g=E.g/2.5T.g=E.g/2.5
T.b=(E.r+E.g+E.b)/3.0T.b=(E.r+E.g+E.b)/3.0
T.a=E.aT.a=E.a
其中,E.r、E.g、E.b和E.a分别为当前色调下的红绿蓝三通道的数据以及透明度数据,T.r、T.g、T.b和T.a分别为蓝色调下的红绿蓝三通道的数据以及透明度数据。Among them, E.r, E.g, E.b and E.a are the data of the red, green and blue channels and the transparency data under the current hue respectively, and T.r, T.g, T.b and T.a are the data of the red, green and blue channels and the transparency data under the blue hue respectively.
由于模拟投影时存在一定的抖动,为了提高模拟的真实性,在上述实施例的基础上,在将所述视频数据的色调调整为投影色调之前,所述方法还包括:对所述视频数据进行随机抖动处理。示例性的,对于任一帧图像生成一抖动参数,基于抖动参数更新图像的颜色数据,示例性的,将抖动参数累加到原颜色数据中。其中,基于不同图像的时间戳生成随机抖动参数,以增加抖动参数的随机性。Since there is a certain amount of jitter during simulated projection, in order to improve the authenticity of the simulation, based on the above embodiment, before adjusting the tone of the video data to the projection tone, the method further includes: performing random jitter processing on the video data. Exemplarily, a jitter parameter is generated for any frame image, and the color data of the image is updated based on the jitter parameter. Exemplarily, the jitter parameter is accumulated to the original color data. Among them, the random jitter parameter is generated based on the timestamps of different images to increase the randomness of the jitter parameter.
在一些实施例中,还可以是对视频数据所在的坐标系进行随机抖动处理,生成各时刻的抖动参数,基于抖动参数更新坐标系,并在更新后的坐标系中提取颜色数据,实现对视频数据设置抖动。In some embodiments, the coordinate system where the video data is located may be randomly jittered to generate jitter parameters at each moment, the coordinate system may be updated based on the jitter parameters, and color data may be extracted from the updated coordinate system to achieve jitter setting for the video data.
对色调转换后的视频中的各帧图像添加投影光束效果,该投影光束效果可以是基于上述实施例中提供的图像处理方法生成的。例如将视频数据中每一帧图像作为初始图像,提取所述初始图像中的至少一组颜色数据,基于至少一组颜色数据中的任一组颜色数据分别形成对应的光束,对生成的局部或全部的光束进行叠加,形成所述初始图像对应的光束效果图,将所述光束效果图叠加至对应的初始图像中,形成光束效果图像,各帧添加光束效果图像形成模拟投影的视频数据,即处理后的特效视频数据。A projection beam effect is added to each frame image in the video after the tone conversion, and the projection beam effect can be generated based on the image processing method provided in the above embodiment. For example, each frame image in the video data is used as the initial image, at least one set of color data in the initial image is extracted, and corresponding light beams are respectively formed based on any set of color data in at least one set of color data, and the generated partial or all light beams are superimposed to form a light beam effect diagram corresponding to the initial image, and the light beam effect diagram is superimposed on the corresponding initial image to form a light beam effect image, and each frame is added with a light beam effect image to form simulated projection video data, that is, processed special effect video data.
在一些实施例中,基于增强现实的方式展示所述特效视频数据,在展示空间中形成虚拟影像,该虚拟影像具有投影色调,以及投影模拟光束,实现了基于增强现实技术实现对全息投影技术的效果模拟。In some embodiments, the special effects video data is displayed in an augmented reality manner to form a virtual image in the display space. The virtual image has a projection color tone and a projection simulation light beam, thereby realizing the effect simulation of the holographic projection technology based on the augmented reality technology.
在一些实施例中,在获取视频数据之后,还可以是提取视频数据中各帧图像中的人像,即剔除各帧图像中的背景,替换为单色背景,例如黑色、白色背景或者透明背景等。对替换背景后的视频数据执行上述投影效果的模拟处理,在对特效视频数据进行展示过程中,可模拟对视频数据中人物的全息投影,避免了视频数据中背景数据的干扰。In some embodiments, after acquiring the video data, the portraits in each frame of the video data may be extracted, that is, the background in each frame is removed and replaced with a monochrome background, such as a black, white background, or a transparent background. The above-mentioned projection effect simulation processing is performed on the video data after the background is replaced. In the process of displaying the special effect video data, the holographic projection of the characters in the video data can be simulated, avoiding the interference of the background data in the video data.
本实施例提供的技术方案,通过对视频数据调整为全息投影的投影色调,并在各图像中添加模拟全息投影的光束效果,实现了基于视频数据的全息投影的模拟。The technical solution provided in this embodiment realizes the simulation of holographic projection based on video data by adjusting the video data to the projection tone of holographic projection and adding the light beam effect of simulated holographic projection to each image.
在上述实施例的基础上,本公开还提供的一种视频处理方法的优选实例。获取待处理的视频数据,由于模拟投影时存在一定的抖动,使用时间参数T得到随机抖动数据N,其中N很小,将随机抖动数据N叠加到UV坐标上,即fuv=(uv.x+N.x,uv.y+N.y),在该UV坐标上采集图像的颜色数据,导致存在一定的抖动,提高模拟的真实性。On the basis of the above embodiments, the present disclosure also provides a preferred example of a video processing method. The video data to be processed is obtained. Since there is a certain jitter during the simulation projection, the random jitter data N is obtained using the time parameter T, where N is very small. The random jitter data N is superimposed on the UV coordinate, that is, fuv = (uv.x + N.x, uv.y + N.y). The color data of the image is collected on the UV coordinate, resulting in a certain jitter, thereby improving the authenticity of the simulation.
将视频数据的色调转换为蓝色调,即通过T.r=E.r/2.5,T.g=E.g/2.5,T.b=(E.r+E.g+E.b)/3.0以及T.a=E.a的转换公式实现加大蓝色通道的比重,从而将图像转换为蓝色调。The hue of the video data is converted into a blue tone, that is, the proportion of the blue channel is increased through the conversion formulas of T.r=E.r/2.5, T.g=E.g/2.5, T.b=(E.r+E.g+E.b)/3.0 and T.a=E.a, thereby converting the image into a blue tone.
在各帧图像中添加光束效果。对于视频数据中的每一帧图像,通过抠图提取图像中的投影对象,例如图像中的人像,并将人像的背景设置为黑色。在材质渲染的着色器里面,使用UV坐标去采样图像中的颜色信息,即图像中每个像素的坐标为(x,y),比如:uv=(0.5,0.5),则使用这个uv采样的到的颜色数据,颜色数值类型是(R,G,B,A),分别代表红、绿、蓝、透明度通道,每个通道的数值范围是都是0~1。Add a beam effect to each frame. For each frame in the video data, extract the projection object in the image by cutting out the image, such as the portrait in the image, and set the background of the portrait to black. In the shader of material rendering, use UV coordinates to sample the color information in the image, that is, the coordinates of each pixel in the image are (x, y), for example: uv = (0.5, 0.5), then use this uv to sample the color data, the color value type is (R, G, B, A), representing the red, green, blue, and transparency channels respectively, and the value range of each channel is 0 to 1.
选取y=y0上的像素颜色(即一组颜色数据),替换掉y方向上的所有颜色,形成竖直方向的一束一束的条状(即初始光束),参见图2。设定光束的光源点在P(0.5,0),将初始光束进行变换,聚拢到p点,得到聚拢光束,参见图3。将图3中光束,一束一束光分开形成子光束,做x方向的像素比较,像素值差比较大的子光束保留,像素值差比较小的子光束则抛弃。具体的,对于当前的uv=(p,q)位置,采样的像素为Q0,取uv=(p+0.05,q)采样像素为Q1,取uv=(p-0.05,q)采样像素为Q2,得到差值L10=Q1-Q0,L21=Q2-Q1,得到差值和D=L10+L21,如果D<0.6,则说明这里颜色变化比较小,抛弃,反之则保留,得到目标光束,参见图4。Select the pixel color on y=y0 (i.e. a set of color data), replace all the colors in the y direction, and form a bunch of strips in the vertical direction (i.e. the initial beam), see Figure 2. Set the light source point of the beam to P (0.5, 0), transform the initial beam, and gather it to point p to obtain a concentrated beam, see Figure 3. Separate the beams in Figure 3 into sub-beams, and compare the pixels in the x direction. The sub-beams with larger pixel value differences are retained, and the sub-beams with smaller pixel value differences are discarded. Specifically, for the current uv=(p,q) position, the sampled pixel is Q0, the sampled pixel of uv=(p+0.05,q) is Q1, the sampled pixel of uv=(p-0.05,q) is Q2, and the difference L10=Q1-Q0, L21=Q2-Q1 are obtained, and the difference sum D=L10+L21 is obtained. If D<0.6, it means that the color change here is relatively small and it is discarded. Otherwise, it is retained to obtain the target light beam, see Figure 4.
光束发射以后会随着距离发生渐变弱化,通过预设的透明度控制光束的强弱。设置透明模板M,示例性的参见图7,图7是本公开实施例提供的一种透明模板的示意图。图7中透明度值A1,越白说明透明度越高,越黑则透明度低,图7中投影方向为从下到上,沿投影防线,透明度逐渐增大。将透明模板M中的透明度和得到的目标光束叠加,完成一组光束效果。基于多个y0对应的颜色数据分别形成对应的光束效果,将多个光束效果进行叠加,形成光束效果图像,参见图5。After the light beam is emitted, it will gradually weaken with the distance, and the intensity of the light beam is controlled by the preset transparency. Set a transparent template M, see Figure 7 for an example, Figure 7 is a schematic diagram of a transparent template provided by an embodiment of the present disclosure. The transparency value A1 in Figure 7, the whiter the higher the transparency, the darker the lower the transparency. The projection direction in Figure 7 is from bottom to top, and the transparency gradually increases along the projection line. The transparency in the transparent template M and the obtained target light beam are superimposed to complete a set of light beam effects. Based on the color data corresponding to multiple y0, corresponding light beam effects are respectively formed, and multiple light beam effects are superimposed to form a light beam effect image, see Figure 5.
将每一帧图像对应的光束效果图像中的光束效果添加中对应的图像中,形成特效视频数据。将特效视频数据放入到AR场景下进行展示,可实现在AR场景下和视频数据中的人对话等互动。The beam effect in the beam effect image corresponding to each frame of the image is added to the corresponding image to form special effect video data. The special effect video data is placed in the AR scene for display, and interactions such as conversations with people in the video data can be achieved in the AR scene.
图8是本公开实施例所提供的一种图像处理装置的结构示意图。如图8所示,所述装置包括:FIG8 is a schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure. As shown in FIG8 , the device includes:
颜色数据提取模块310,用于获取初始图像,提取所述初始图像中的至少一组颜色数据;A color data extraction module 310 is used to obtain an initial image and extract at least one set of color data from the initial image;
光束生成模块320,基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束;A light beam generating module 320, which forms corresponding light beams based on any one of the at least one set of color data;
光束效果生成模块330,用于对所述光束进行叠加,形成所述初始图像对应的光束效果图;A beam effect generating module 330, configured to superimpose the beams to form a beam effect diagram corresponding to the initial image;
光束效果图像生成模块340,用于将所述光束效果图叠加至所述初始图像中,形成光束效果图像。The beam effect image generating module 340 is used to superimpose the beam effect diagram onto the initial image to form a beam effect image.
在上述实施例的基础上,该装置还包括:Based on the above embodiment, the device further includes:
光束参考图像生成模块,用于在获取初始图像之后,从所述初始图像中分割得到光束参考对象,基于分割得到的光束参考对象与预设背景形成光束参考图像;A beam reference image generation module, configured to segment a beam reference object from the initial image after acquiring the initial image, and form a beam reference image based on the segmented beam reference object and a preset background;
颜色数据提取模块310用于:提取所述光束参考图像中的至少一组颜色数据。The color data extraction module 310 is used to extract at least one set of color data from the light beam reference image.
在上述实施例的基础上,所述至少一组颜色数据为所述初始图像或所述光束参考图像中提取线上的颜色数据,所述提取线为所述初始图像或所述光束参考图像中的像素行或像素列。Based on the above embodiment, the at least one set of color data is color data of an extracted line in the initial image or the light beam reference image, and the extracted line is a pixel row or pixel column in the initial image or the light beam reference image.
在上述实施例的基础上,光束生成模块320包括:Based on the above embodiment, the light beam generating module 320 includes:
初始光束形成单元,用于所述至少一组颜色数据中的对于任一组颜色数据,分别基于颜色数据中的各颜色值形成一颜色线,形成所述颜色数据对应的初始光束;An initial light beam forming unit, configured to form a color line based on each color value in the color data for any one of the at least one set of color data, so as to form an initial light beam corresponding to the color data;
光束聚拢单元,用于基于虚拟光源对所述初始光束进行聚拢;A beam focusing unit, used for focusing the initial light beam based on a virtual light source;
目标光束生成单元,用于对聚拢后的光束进行分束提取,得到所述颜色数据对应的目标光束。The target light beam generating unit is used to perform splitting extraction on the focused light beam to obtain a target light beam corresponding to the color data.
可选的,光束聚拢单元用于:Optionally, a beam focusing unit is used to:
基于所述虚拟光源确定聚拢光束的光束范围,在所述初始光束中提取所述光束范围内的颜色数据,得到聚拢光束。The beam range of the converged light beam is determined based on the virtual light source, and color data within the beam range is extracted from the initial light beam to obtain the converged light beam.
可选的,目标光束生成单元用于:Optionally, the target beam generating unit is used to:
在光束的宽度方向上,基于预设步长确定聚拢光束中相邻光束的颜色差值;In the width direction of the light beam, determining the color difference between adjacent light beams in the converged light beam based on a preset step size;
基于所述颜色差值在所述聚拢光束提取目标分束,以形成目标光束。A target beamlet is extracted from the converged beam based on the color difference to form a target beam.
在上述实施例的基础上,该装置还包括:Based on the above embodiment, the device further includes:
透明度设置模块,用于在基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束之后,对光束进行透明度的设置,其中,所述透明度沿所述光束的投影方向依次增大。The transparency setting module is used to set the transparency of the light beam after forming a corresponding light beam based on any one of the at least one set of color data, wherein the transparency increases sequentially along the projection direction of the light beam.
在上述实施例的基础上,所述初始图像为视频中的图像帧,或者,所述初始图像为摄像装置实时采集的图像帧;Based on the above embodiment, the initial image is an image frame in a video, or the initial image is an image frame captured in real time by a camera device;
相应的,所述视频中的图像帧分别添加光束效果形成光束效果视频,或者,实时采集的图像帧分别添加光束效果形成实时光束效果视频流。Correspondingly, the image frames in the video are respectively added with beam effects to form a beam effect video, or the image frames collected in real time are respectively added with beam effects to form a real-time beam effect video stream.
本公开实施例所提供的装置可执行本公开任意实施例所提供的方法,具备执行方法相应的功能模块和有益效果。The device provided by the embodiments of the present disclosure can execute the method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
值得注意的是,上述装置所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本公开实施例的保护范围。It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
图9是本公开实施例所提供的一种视频处理装置的结构示意图。如图9所示,所述装置包括:FIG9 is a schematic diagram of the structure of a video processing device provided by an embodiment of the present disclosure. As shown in FIG9 , the device includes:
视频数据获取模块410,用于获取待投影的视频数据;The video data acquisition module 410 is used to acquire the video data to be projected;
色调调整模块420,用于将所述视频数据的色调调整为投影色调;A tone adjustment module 420, configured to adjust the tone of the video data to a projection tone;
视频处理模块430,用于对于所述色调调整后的视频数据中的图像帧,提取所述图像帧中的至少一组颜色数据,基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束,对所述光束进行叠加,形成所述图像帧对应的光束效果图,将所述光束效果图叠加至所述图像帧中,得到特效视频数据。The video processing module 430 is used to extract at least one group of color data from the image frame in the video data after the tone adjustment, form corresponding light beams based on any one group of color data in the at least one group of color data, superimpose the light beams to form a light beam effect diagram corresponding to the image frame, and superimpose the light beam effect diagram into the image frame to obtain special effect video data.
在上述实施例的基础上,该装置还包括:Based on the above embodiment, the device further includes:
抖动处理模块,用于在将所述视频数据的色调调整为投影色调之前,对所述视频数据进行随机抖动处理。The dithering processing module is used to perform random dithering processing on the video data before adjusting the tone of the video data to the projection tone.
在上述实施例的基础上,投影色调包括蓝色调;Based on the above embodiment, the projection color tone includes a blue tone;
色调调整模块420用于:根据当前色调下通道颜色数据与所述蓝色调中通道颜色数据的转换关系,将视频数据中图像帧的颜色数据转换为蓝色调对应的颜色数据。The hue adjustment module 420 is used to convert the color data of the image frame in the video data into color data corresponding to the blue hue according to the conversion relationship between the channel color data in the current hue and the channel color data in the blue hue.
在上述实施例的基础上,该装置还包括:Based on the above embodiment, the device further includes:
特效视频数据展示模块,用于基于增强现实的方式展示所述特效视频数据。The special effect video data display module is used to display the special effect video data based on augmented reality.
本公开实施例所提供的装置可执行本公开任意实施例所提供的方法,具备执行方法相应的功能模块和有益效果。The device provided by the embodiments of the present disclosure can execute the method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
值得注意的是,上述装置所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本公开实施例的保护范围。It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
下面参考图10,其示出了适于用来实现本公开实施例的电子设备(例如图10中的终端设备或服务器)400的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图10示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。Reference is made to FIG10, which shows a schematic diagram of the structure of an electronic device (e.g., a terminal device or server in FIG10) 400 suitable for implementing an embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (e.g., vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. The electronic device shown in FIG10 is only an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
如图10所示,电子设备400可以包括处理装置(例如中央处理器、图形处理器等)401,其可以根据存储在只读存储器(ROM)402中的程序或者从存储装置408加载到随机访问存储器(RAM)403中的程序而执行各种适当的动作和处理。在RAM403中,还存储有电子设备400操作所需的各种程序和数据。处理装置401、ROM 402以及RAM 403通过总线404彼此相连。输入/输出(I/O)接口405也连接至总线404。As shown in FIG10 , the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to the bus 404.
通常,以下装置可以连接至I/O接口405:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置406;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置407;包括例如磁带、硬盘等的存储装置408;以及通信装置409。通信装置409可以允许电子设备400与其他设备进行无线或有线通信以交换数据。虽然图10示出了具有各种装置的电子设备400,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。Typically, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 408 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 409. The communication device 409 may allow the electronic device 400 to communicate wirelessly or wired with other devices to exchange data. Although FIG. 10 shows an electronic device 400 with various devices, it should be understood that it is not required to implement or have all the devices shown. More or fewer devices may be implemented or have alternatively.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置409从网络上被下载和安装,或者从存储装置408被安装,或者从ROM402被安装。在该计算机程序被处理装置401执行时,执行本公开实施例的方法中限定的上述功能。In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
本公开实施例提供的电子设备与上述实施例提供的图像处理方法或视频处理方法属于同一发明构思,未在本实施例中详尽描述的技术细节可参见上述实施例,并且本实施例与上述实施例具有相同的有益效果。The electronic device provided in the embodiment of the present disclosure and the image processing method or video processing method provided in the above-mentioned embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to the above-mentioned embodiment, and this embodiment has the same beneficial effects as the above-mentioned embodiment.
本公开实施例提供了一种计算机存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述实施例所提供的图像处理方法或视频处理方法。An embodiment of the present disclosure provides a computer storage medium on which a computer program is stored. When the program is executed by a processor, the image processing method or video processing method provided in the above embodiment is implemented.
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText TransferProtocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
获取初始图像,提取所述初始图像中的至少一组颜色数据;Acquire an initial image, and extract at least one set of color data from the initial image;
基于任一组颜色数据分别形成对应的光束;Based on any set of color data, corresponding light beams are formed respectively;
对各所述光束进行叠加,形成所述初始图像对应的光束效果图;Superimposing the light beams to form a light beam effect diagram corresponding to the initial image;
将所述光束效果图叠加至所述初始图像中,形成光束效果图像。The light beam effect diagram is superimposed on the initial image to form a light beam effect image.
或者,or,
获取待投影的视频数据,将所述视频数据的色调调整为投影色调;Acquire video data to be projected, and adjust the tone of the video data to the projection tone;
对所述色调调整后的视频数据中的各帧图像设置投影光束效果,形成特效视频数据。A projection beam effect is set for each frame image in the tone-adjusted video data to form special effect video data.
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and/or flow chart, and the combination of the square boxes in the block diagram and/or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元/模块的名称在某种情况下并不构成对该单元本身的限定。The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit/module does not, in some cases, constitute a limitation on the unit itself.
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
根据本公开的一个或多个实施例,【示例一】提供了一种图像处理方法,该方法包括:According to one or more embodiments of the present disclosure, [Example 1] provides an image processing method, the method comprising:
获取初始图像,提取所述初始图像中的至少一组颜色数据;Acquire an initial image, and extract at least one set of color data from the initial image;
基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束;Form corresponding light beams respectively based on any set of color data in the at least one set of color data;
对所述光束进行叠加,形成所述初始图像对应的光束效果图;superimposing the light beams to form a light beam effect diagram corresponding to the initial image;
将所述光束效果图叠加至所述初始图像中,形成光束效果图像。The light beam effect diagram is superimposed on the initial image to form a light beam effect image.
根据本公开的一个或多个实施例,【示例二】提供了一种图像处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 2] provides an image processing method, further comprising:
在获取初始图像之后,还包括:从所述初始图像中分割得到光束参考对象,基于分割得到的光束参考对象与预设背景形成光束参考图像;After acquiring the initial image, the method further includes: segmenting the initial image to obtain a beam reference object, and forming a beam reference image based on the segmented beam reference object and a preset background;
所述提取所述初始图像中的至少一组颜色数据,包括:提取所述光束参考图像中的至少一组颜色数据。The extracting at least one set of color data from the initial image includes: extracting at least one set of color data from the light beam reference image.
根据本公开的一个或多个实施例,【示例三】提供了一种图像处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 3] provides an image processing method, further comprising:
所述至少一组颜色数据为所述初始图像或上述光束参考图像中提取线上的颜色数据,所述提取线为所述初始图像或所述光束参考图像中的像素行或像素列。The at least one set of color data is color data of an extracted line in the initial image or the light beam reference image, and the extracted line is a pixel row or a pixel column in the initial image or the light beam reference image.
根据本公开的一个或多个实施例,【示例四】提供了一种图像处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 4] provides an image processing method, further comprising:
所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束,包括:对于所述至少一组颜色数据中的任一组颜色数据,基于颜色数据中的颜色值形成一颜色线,形成所述颜色数据对应的初始光束;基于虚拟光源对所述初始光束进行聚拢,并对聚拢后的光束进行分束提取,得到所述颜色数据对应的目标光束。Any one of the at least one set of color data forms a corresponding light beam, including: for any one of the at least one set of color data, a color line is formed based on the color value in the color data to form an initial light beam corresponding to the color data; based on a virtual light source, the initial light beam is gathered, and the gathered light beam is split and extracted to obtain a target light beam corresponding to the color data.
根据本公开的一个或多个实施例,【示例五】提供了一种图像处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 5] provides an image processing method, further comprising:
所述基于虚拟光源对所述初始光束进行聚拢,包括:基于所述虚拟光源确定聚拢光束的光束范围,在所述初始光束中提取所述光束范围内的颜色数据,得到聚拢光束。The focusing of the initial light beam based on the virtual light source includes: determining a beam range of the focused light beam based on the virtual light source, extracting color data within the beam range from the initial light beam, and obtaining the focused light beam.
根据本公开的一个或多个实施例,【示例六】提供了一种图像处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 6] provides an image processing method, further comprising:
对聚拢后的光束进行分束提取,得到所述颜色数据对应的目标光束,包括:在光束的宽度方向上,基于预设步长确定聚拢光束中相邻光束的颜色差值;基于所述颜色差值在所述聚拢光束提取目标分束,以形成目标光束。The focused light beam is split and extracted to obtain a target light beam corresponding to the color data, including: determining the color difference between adjacent light beams in the focused light beam based on a preset step size in the width direction of the light beam; and extracting a target split beam in the focused light beam based on the color difference to form a target light beam.
根据本公开的一个或多个实施例,【示例七】提供了一种图像处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 7] provides an image processing method, further comprising:
在基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束之后,所述方法还包括:对光束进行透明度的设置,其中,所述透明度沿所述光束的投影方向依次增大。After forming corresponding light beams based on any one of the at least one set of color data, the method further includes: setting the transparency of the light beam, wherein the transparency increases sequentially along the projection direction of the light beam.
根据本公开的一个或多个实施例,【示例八】提供了一种图像处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 8] provides an image processing method, further comprising:
所述初始图像为视频中的图像帧,或者,所述初始图像为摄像装置实时采集的帧图像;The initial image is an image frame in a video, or the initial image is a frame image captured in real time by a camera device;
所述视频中的图像帧分别添加光束效果形成光束效果视频,或者,实时采集的图像帧分别添加光束效果形成实时光束效果视频流。The image frames in the video are respectively added with beam effects to form a beam effect video, or the image frames collected in real time are respectively added with beam effects to form a real-time beam effect video stream.
根据本公开的一个或多个实施例,【示例九】提供了一种视频处理方法,包括:According to one or more embodiments of the present disclosure, [Example 9] provides a video processing method, including:
获取待投影的视频数据,将所述视频数据的色调调整为投影色调;Acquire video data to be projected, and adjust the tone of the video data to the projection tone;
对于所述色调调整后的视频数据中的图像帧,提取所述图像帧中的至少一组颜色数据,基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束,对所述光束进行叠加,形成所述图像帧对应的光束效果图,将所述光束效果图叠加至所述图像帧中,得到特效视频数据。For the image frame in the hue-adjusted video data, at least one group of color data in the image frame is extracted, corresponding light beams are formed based on any one group of color data in the at least one group of color data, the light beams are superimposed to form a light beam effect diagram corresponding to the image frame, and the light beam effect diagram is superimposed on the image frame to obtain special effect video data.
根据本公开的一个或多个实施例,【示例十】提供了一种视频处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 10] provides a video processing method, further comprising:
在将所述视频数据的色调调整为投影色调之前,所述方法还包括:对所述视频数据进行随机抖动处理。Before adjusting the tone of the video data to the projection tone, the method further includes: performing random dithering processing on the video data.
根据本公开的一个或多个实施例,【示例十一】提供了一种视频处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 11] provides a video processing method, further comprising:
所述投影色调包括蓝色调;The projection hue includes a blue hue;
所述将所述视频数据的色调调整为投影色调,包括:根据当前色调下通道颜色数据与所述蓝色调中通道颜色数据的转换关系,将视频数据中图像帧的颜色数据转换为蓝色调对应的颜色数据。The adjusting the hue of the video data to the projection hue includes: converting the color data of the image frame in the video data into color data corresponding to the blue hue according to the conversion relationship between the channel color data in the current hue and the channel color data in the blue hue.
根据本公开的一个或多个实施例,【示例十二】提供了一种视频处理方法,还包括:According to one or more embodiments of the present disclosure, [Example 12] provides a video processing method, further comprising:
所述方法还包括:基于增强现实的方式展示所述特效视频数据。The method also includes: displaying the special effect video data in an augmented reality manner.
根据本公开的一个或多个实施例,【示例十三】提供了一种图像处理装置,该装置包括:According to one or more embodiments of the present disclosure, [Example 13] provides an image processing device, the device comprising:
颜色数据提取模块,用于获取初始图像,提取所述初始图像中的至少一组颜色数据;A color data extraction module, used to obtain an initial image and extract at least one set of color data from the initial image;
光束生成模块,基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束;A light beam generating module, which forms corresponding light beams based on any one of the at least one set of color data;
光束效果生成模块,用于对所述光束进行叠加,形成所述初始图像对应的光束效果图;A beam effect generating module, used for superimposing the beams to form a beam effect diagram corresponding to the initial image;
光束效果图像生成模块,用于将所述光束效果图叠加至所述初始图像中,形成光束效果图像。The beam effect image generating module is used for superimposing the beam effect diagram onto the initial image to form a beam effect image.
根据本公开的一个或多个实施例,【示例十四】提供了一种视频处理装置,该装置包括:According to one or more embodiments of the present disclosure, [Example 14] provides a video processing device, the device comprising:
视频数据获取模块,用于获取待投影的视频数据;A video data acquisition module, used to acquire video data to be projected;
色调调整模块,用于将所述视频数据的色调调整为投影色调;A tone adjustment module, used for adjusting the tone of the video data to a projection tone;
视频处理模块,用于对于所述色调调整后的视频数据中的图像帧,提取所述图像帧中的至少一组颜色数据,基于所述至少一组颜色数据中的任一组颜色数据分别形成对应的光束,对所述光束进行叠加,形成所述图像帧对应的光束效果图,将所述光束效果图叠加至所述图像帧中,得到特效视频数据。A video processing module is used to extract at least one set of color data from an image frame in the hue-adjusted video data, form corresponding light beams based on any one set of color data in the at least one set of color data, superimpose the light beams to form a light beam effect diagram corresponding to the image frame, and superimpose the light beam effect diagram onto the image frame to obtain special effect video data.
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。Although the subject matter has been described in language specific to structural features and/or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims (15)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111592448.3A CN114399425B (en) | 2021-12-23 | 2021-12-23 | Image processing method, video processing method, device, equipment and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111592448.3A CN114399425B (en) | 2021-12-23 | 2021-12-23 | Image processing method, video processing method, device, equipment and medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN114399425A CN114399425A (en) | 2022-04-26 |
| CN114399425B true CN114399425B (en) | 2024-08-06 |
Family
ID=81226895
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111592448.3A Active CN114399425B (en) | 2021-12-23 | 2021-12-23 | Image processing method, video processing method, device, equipment and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114399425B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116188322A (en) * | 2023-03-09 | 2023-05-30 | 网易(杭州)网络有限公司 | Image processing method, device, computer readable storage medium and computer equipment |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107743263A (en) * | 2017-09-20 | 2018-02-27 | 北京奇虎科技有限公司 | Video data real-time processing method and device, computing equipment |
| CN112138378A (en) * | 2020-09-22 | 2020-12-29 | 网易(杭州)网络有限公司 | Method, device and equipment for realizing flashing effect in 2D game and storage medium |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP5937128B2 (en) * | 2014-03-17 | 2016-06-22 | 富士フイルム株式会社 | Augmented reality providing system, method and program |
| CN110503725B (en) * | 2019-08-27 | 2023-07-14 | 百度在线网络技术(北京)有限公司 | Image processing method, device, electronic equipment and computer readable storage medium |
| CN113132795A (en) * | 2019-12-30 | 2021-07-16 | 北京字节跳动网络技术有限公司 | Image processing method and device |
| CN111260766B (en) * | 2020-01-17 | 2024-03-15 | 网易(杭州)网络有限公司 | Virtual light source processing method, device, medium and electronic equipment |
| CN112241714B (en) * | 2020-10-22 | 2024-04-26 | 北京字跳网络技术有限公司 | Method, device, readable medium and electronic device for identifying a designated area in an image |
| CN112562056B (en) * | 2020-12-03 | 2024-11-22 | 广州博冠信息科技有限公司 | Control method, device, medium and equipment for virtual lighting in virtual studio |
-
2021
- 2021-12-23 CN CN202111592448.3A patent/CN114399425B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107743263A (en) * | 2017-09-20 | 2018-02-27 | 北京奇虎科技有限公司 | Video data real-time processing method and device, computing equipment |
| CN112138378A (en) * | 2020-09-22 | 2020-12-29 | 网易(杭州)网络有限公司 | Method, device and equipment for realizing flashing effect in 2D game and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN114399425A (en) | 2022-04-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN113742025B (en) | Page generation method, device, equipment and storage medium | |
| CN112241714B (en) | Method, device, readable medium and electronic device for identifying a designated area in an image | |
| WO2022166872A1 (en) | Special-effect display method and apparatus, and device and medium | |
| CN112101305A (en) | Multi-path image processing method and device and electronic equipment | |
| WO2023125374A1 (en) | Image processing method and apparatus, electronic device, and storage medium | |
| CN114332323B (en) | Particle effect rendering method, device, equipment and medium | |
| CN111833459B (en) | Image processing method, device, electronic device and storage medium | |
| WO2023160513A1 (en) | Rendering method and apparatus for 3d material, and device and storage medium | |
| CN114245028B (en) | Image display method and device, electronic equipment and storage medium | |
| US20250329086A1 (en) | Image processing method and apparatus, electronic device and storage medium | |
| WO2023040749A1 (en) | Image processing method and apparatus, electronic device, and storage medium | |
| CN114422698A (en) | Video generation method, device, equipment and storage medium | |
| WO2024037556A1 (en) | Image processing method and apparatus, and device and storage medium | |
| CN114399425B (en) | Image processing method, video processing method, device, equipment and medium | |
| WO2023071707A1 (en) | Video image processing method and apparatus, electronic device, and storage medium | |
| WO2025118949A1 (en) | Special effect processing method and apparatus, and electronic device and storage medium | |
| CN114742934A (en) | Image rendering method, apparatus, readable medium and electronic device | |
| CN116527993A (en) | Video processing method, apparatus, electronic device, storage medium and program product | |
| CN110636331B (en) | Method and apparatus for processing video | |
| WO2025087392A1 (en) | Multimedia data processing method and apparatus, and electronic device and storage medium | |
| WO2024131652A1 (en) | Special effect processing method and apparatus, and electronic device and storage medium | |
| WO2024094158A1 (en) | Special effect processing method and apparatus, device, and storage medium | |
| WO2025056031A1 (en) | Video processing method and apparatus, device, computer-readable storage medium, and product | |
| CN110555799A (en) | Method and apparatus for processing video | |
| WO2024255620A1 (en) | Image processing method and apparatus, and device, medium and program product |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |