CN109242814A - Commodity image processing method, device and electronic equipment - Google Patents
Commodity image processing method, device and electronic equipment Download PDFInfo
- Publication number
- CN109242814A CN109242814A CN201811085198.2A CN201811085198A CN109242814A CN 109242814 A CN109242814 A CN 109242814A CN 201811085198 A CN201811085198 A CN 201811085198A CN 109242814 A CN109242814 A CN 109242814A
- Authority
- CN
- China
- Prior art keywords
- commodity
- image
- frame
- fusion
- images
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration using two or more images, e.g. averaging or subtraction
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/194—Segmentation; Edge detection involving foreground-background segmentation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20212—Image combination
- G06T2207/20221—Image fusion; Image merging
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
本发明实施例提供了一种商品图像处理方法、装置及电子设备,所述方法包括:获取商品图像和多帧动效图;将每一帧动效图与商品图像进行像素融合,获得商品动效图像,多帧商品动效图组成商品动效视频,播放商品动效视频。通过将商品图和动效图进行像素融合获得商品动效图像,操作动作少实时性好,不同的动画效果根据不同的动效图获得,灵活性强,多帧商品动效图组成商品动效视频,通过播放商品动效视频实现呈现商品图像动效画面,维护成本低。
Embodiments of the present invention provide a commodity image processing method, device, and electronic device. The method includes: acquiring a commodity image and multiple frames of dynamic effect pictures; pixel fusion of each frame of dynamic effect pictures and commodity images to obtain commodity dynamic effects effect images, and multiple frames of product animation images form a product animation video, and play the product animation video. Commodity dynamic image is obtained by pixel fusion of commodity map and dynamic effect map, which has less operation actions and good real-time performance. Different animation effects are obtained according to different dynamic effect maps, which is highly flexible. Multi-frame commodity dynamic effect maps form product dynamic effects Video, by playing the animation video of the commodity, the animation image of the commodity image can be displayed, and the maintenance cost is low.
Description
技术领域technical field
本发明涉及图像处理技术领域,尤其涉及一种商品图像处理方法、装置及电子设备。The present invention relates to the technical field of image processing, and in particular, to a commodity image processing method, device and electronic device.
背景技术Background technique
场景橱窗广告和客户端广告一般由媒体负责创意渲染。传统的客户端的商品图的动效画面是通过解析flash来实现的,然而采用这种方法实现商品图像动效画面,实时性差,灵活性差,维护成本高。For scene window advertisements and client-side advertisements, the media is generally responsible for creative rendering. The traditional dynamic effect picture of the product image of the client is realized by parsing the flash. However, using this method to realize the dynamic effect picture of the product image has poor real-time performance, poor flexibility and high maintenance cost.
发明内容SUMMARY OF THE INVENTION
鉴于上述问题,本发明实施例提供了一种商品图像处理方法、装置及电子设备,用于解决现有技术中商品图像动效画面维护成本高,实时性差的技术问题。In view of the above problems, embodiments of the present invention provide a commodity image processing method, device, and electronic device, which are used to solve the technical problems of high maintenance cost and poor real-time performance of commodity image dynamic effect pictures in the prior art.
第一方面,本发明实施例提供了一种商品图像处理方法,所述方法包括:In a first aspect, an embodiment of the present invention provides a commodity image processing method, the method comprising:
获取png格式的商品图像和动效图,其中,所述动效图包含多帧静态图;Obtain a product image and a dynamic effect image in png format, wherein the dynamic effect image includes multiple frames of static images;
根据所述多帧静态图的排序,依次将每帧静态图与所述png格式的商品图像进行像素融合,获得排序的多帧商品融合图;According to the sorting of the multi-frame static images, pixel fusion is performed on each frame of the static image and the commodity image in the png format in turn to obtain a sorted multi-frame commodity fusion image;
将所述排序的多帧商品融合图按照排序组合,得到商品动效图。Combining the sorted multi-frame commodity fusion pictures according to the ordering to obtain a commodity dynamic effect picture.
可选的,所述方法还包括:Optionally, the method further includes:
获取商品图像;Get product images;
判断所述商品图像是否是png格式的商品图像;Determine whether the commodity image is a commodity image in png format;
当将所述商品图像不是png格式的商品图像时,将所述商品图像转换成png格式的商品图像。When the commodity image is not a commodity image in png format, the commodity image is converted into a commodity image in png format.
可选的,根据所述多帧静态图的排序,依次将每帧静态图与所述png格式的商品图像进行像素融合,获得排序的多帧商品融合图,包括:Optionally, according to the sorting of the multi-frame static images, perform pixel fusion of each frame of the static image and the commodity image in the png format in sequence to obtain a sorted multi-frame commodity fusion image, including:
在依次将每帧静态图与所述png格式的商品图像进行像素融合时,针对每帧静态图,获取该帧静态图中每个像素和所述png格式的商品图像中对应像素之间的映射关系;When performing pixel fusion of each frame of static image and the commodity image in png format in turn, for each frame of static image, obtain the mapping between each pixel in the static image of the frame and the corresponding pixel in the commodity image in png format relation;
根据所述映射关系,将所述png格式的商品图像中每个像素的像素值替换成该帧静态图中每个像素点的像素值,获得多帧排序的png格式的商品融合图。According to the mapping relationship, the pixel value of each pixel in the png format commodity image is replaced with the pixel value of each pixel point in the static image of the frame, and a multi-frame sorted png format commodity fusion map is obtained.
可选的,所述将所述排序的多帧商品融合图合成商品动效图,包括:Optionally, synthesizing the sorted multi-frame commodity fusion pictures into a commodity motion picture, including:
对所述多帧商品融合图按照排序进行gif编码,得到gif格式的商品动效图。GIF encoding is performed on the multi-frame commodity fusion pictures according to the sequence, so as to obtain a commodity dynamic effect picture in gif format.
可选的,所述方法还包括:Optionally, the method also includes:
将所述排序的多帧商品融合图进行像素去重操作,获得背景图像和多张前景图像;Perform a pixel deduplication operation on the sorted multi-frame commodity fusion images to obtain a background image and a plurality of foreground images;
将所述背景图像和所述多张前景图像进行存储。The background image and the plurality of foreground images are stored.
可选的,所述将所述排序的多帧商品融合图进行像素去重操作,获得背景图像和多帧前景图像,包括:Optionally, performing a pixel deduplication operation on the sorted multi-frame commodity fusion images to obtain a background image and a multi-frame foreground image, including:
将所述排序的多帧商品融合图中的首帧商品融合图作为背景图像;Using the first frame of the commodity fusion diagram in the sorted multi-frame commodity fusion diagram as a background image;
将所述排序的多帧商品融合图中的第N帧所述商品融合图与所述背景图像进行背景差运算,获得前景图像,其中,N≥2,多帧商品融合图对应获得多帧前景图像。Perform a background difference operation on the Nth frame of the commodity fusion map in the sorted multi-frame commodity fusion map and the background image to obtain a foreground image, where N≥2, the multi-frame commodity fusion map correspondingly obtains multi-frame foregrounds image.
可选的,所述方法还包括:按照设定速度播放所述商品动效图。Optionally, the method further includes: playing the dynamic effect image of the commodity at a set speed.
第二方面,本发明实施例提供了一种商品图像处理装置,所述装置包括:In a second aspect, an embodiment of the present invention provides a commodity image processing device, the device comprising:
获取图像模块,用于获取png格式的商品图像和动效图,其中,所述动效图包含多帧静态图;an image acquisition module for acquiring commodity images and dynamic effect images in png format, wherein the dynamic effect images include multiple frames of static images;
融合模块,用于根据所述多帧静态图的排序,依次将每帧静态图与所述png格式的商品图像进行像素融合,获得排序的多帧商品融合图;a fusion module, configured to perform pixel fusion of each frame of static image and the commodity image in png format in turn according to the sorting of the multi-frame static images to obtain a sorted multi-frame commodity fusion image;
生成商品动效图模块,用于将所述排序的多帧商品融合图按照排序组合,得到商品动效图。A commodity dynamic effect map generation module is used for combining the sorted multi-frame commodity fusion maps in order to obtain a commodity dynamic effect map.
可选的,所述装置还包括:Optionally, the device further includes:
获取商品图像模块,用于获取商品图像;Get the product image module, which is used to obtain the product image;
判断模块,用于判断所述商品图像是否是png格式的商品图像;a judging module for judging whether the commodity image is a commodity image in png format;
转换图像模块,用于当将所述商品图像不是png格式的商品图像时,将所述商品图像转换成png格式的商品图像。The image conversion module is configured to convert the product image into a png format product image when the product image is not a png format product image.
可选的,所述融合模块包括:Optionally, the fusion module includes:
获取映射关系单元,用于在依次将每帧静态图与所述png格式的商品图像进行像素融合时,针对每帧静态图,获取该帧静态图中每个像素和所述png格式的商品图像中对应像素之间的映射关系;Obtaining a mapping relationship unit for obtaining each pixel in the static image of the frame and the commodity image in the png format for each frame of the static image when pixel fusion is performed on the static image of each frame and the commodity image in the png format in turn. The mapping relationship between the corresponding pixels in ;
像素融合单元,用于根据所述映射关系,将所述png格式的商品图像中每个像素的像素值替换成该帧静态图中每个像素点的像素值,获得多帧排序的png格式的商品融合图。The pixel fusion unit is used to replace the pixel value of each pixel in the commodity image in the png format with the pixel value of each pixel in the static image of the frame according to the mapping relationship, and obtain a multi-frame sorted png format. Commodity Fusion Chart.
可选的,所述生成商品动效图模块用于:Optionally, the generating product dynamic effect map module is used for:
对所述多帧商品融合图按照排序进行gif编码,得到gif格式的商品动效图。GIF encoding is performed on the multi-frame commodity fusion pictures according to the sequence, so as to obtain a commodity dynamic effect picture in gif format.
可选的,所述装置还包括:Optionally, the device also includes:
像素去重模块,用于将所述排序的多帧商品融合图进行像素去重操作,获得背景图像和多张前景图像;a pixel deduplication module for performing pixel deduplication operation on the sorted multi-frame commodity fusion images to obtain a background image and a plurality of foreground images;
存储模块,用于将所述背景图像和所述多张前景图像进行存储。A storage module, configured to store the background image and the plurality of foreground images.
可选的,所述像素去重模块包括:Optionally, the pixel deduplication module includes:
确定背景图像单元,用于将所述排序的多帧商品融合图中的首帧商品融合图作为背景图像;Determining a background image unit for taking the first frame of the commodity fusion map in the sorted multi-frame commodity fusion map as a background image;
像素去重单元,用于将所述排序的多帧商品融合图中的第N帧所述商品融合图与所述背景图像进行背景差运算,获得前景图像,其中,N≥2,多帧商品融合图对应获得多帧前景图像。The pixel deduplication unit is used to perform a background difference operation on the Nth frame of the commodity fusion map in the sorted multi-frame commodity fusion map and the background image to obtain a foreground image, where N≥2, multi-frame commodity The fusion map corresponds to obtaining multiple frames of foreground images.
可选的,所装置还包括:Optionally, the device further includes:
播放模块,用于按照设定速度播放所述商品动效图。The playing module is used for playing the dynamic effect picture of the product according to the set speed.
第三方面,本发明实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述商品图像处理方法的步骤。In a third aspect, an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the steps of the above commodity image processing method.
第四方面,本发明实施例提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述商品图像处理方法的步骤。In a fourth aspect, an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, the processor implements the above commodity image processing when executing the program steps of the method.
本申请实施例中提供的技术方案,至少具有如下技术效果或优点:The technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
本发明实施例提供了一种商品图像处理方法、装置及电子设备,所述方法包括:获取商品图像和多帧动效图;将每一帧动效图与商品图像进行像素融合,获得商品动效图像,多帧商品动效图组成商品动效视频,播放商品动效视频。通过将商品图和动效图进行像素融合获得商品动效图像,操作动作少实时性好,不同的动画效果根据不同的动效图获得,灵活性强,多帧商品动效图组成商品动效视频,通过播放商品动效视频实现呈现商品图像动效画面,维护成本低。Embodiments of the present invention provide a commodity image processing method, device, and electronic device. The method includes: acquiring a commodity image and multiple frames of dynamic effect images; pixel fusion of each frame of dynamic effect images and the commodity image to obtain the commodity dynamic image. effect images, and multiple frames of product animation images form a product animation video, and play the product animation video. Commodity dynamic image is obtained by pixel fusion of commodity map and dynamic effect map, which has less operation actions and good real-time performance. Different animation effects are obtained according to different dynamic effect maps, with strong flexibility. Multi-frame commodity dynamic effect maps form product dynamic effects. Video, by playing the animation video of the commodity, the animation image of the commodity image can be displayed, and the maintenance cost is low.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention, in order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand , the following specific embodiments of the present invention are given.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are for the purpose of illustrating preferred embodiments only and are not to be considered limiting of the invention. Also, the same components are denoted by the same reference numerals throughout the drawings. In the attached image:
图1示出了一种商品图像处理方法流程示意图。FIG. 1 shows a schematic flowchart of a method for processing images of commodities.
图2示出了本发明实施例提供的一种商品图像处理装置200的方框结构示意图。FIG. 2 shows a schematic block diagram of a product image processing apparatus 200 according to an embodiment of the present invention.
图3示出了融合模块220的方框结构示意图。FIG. 3 shows a schematic block diagram of the fusion module 220 .
图4示出了像素去重模块270的方框结构示意图;FIG. 4 shows a block diagram of the pixel deduplication module 270;
图5示出了电子设备的结构示意图。FIG. 5 shows a schematic structural diagram of an electronic device.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be more thoroughly understood, and will fully convey the scope of the present disclosure to those skilled in the art.
本发明实施例提供了一种商品图像处理方法,请参阅图1,图1示出了一种商品图像处理方法流程示意图。所述方法包括:An embodiment of the present invention provides a commodity image processing method. Please refer to FIG. 1 , which shows a schematic flowchart of a commodity image processing method. The method includes:
步骤S100:获取png格式的商品图像和动效图,其中,所述动效图包含多帧静态图;Step S100: obtaining a commodity image and a dynamic effect image in png format, wherein the dynamic effect image includes multiple frames of static images;
在本发明实施例中,所述动效图是gif格式的动效图,动效图的动效画面由多帧静态图排序构成。通过将多张静态图按照排序依次播放,则可实现动效图的动效画面。动效图包含了商品图像需要呈现的动画元素。在本发明实施例中,动效图可以是实时生成的,也可以是预先生成动效图,存储在动效图库中,获取动效图的方式可以是从动效图库中获取动效图,也可以获取数据接口传输过来的动效图,或者从网页上获取动效图。作为一种实施方式,商品图像处理方法还包括:获取商品图像,判断所述商品图像是否是png格式的商品图像;当将所述商品图像不是png格式的商品图像时,将所述商品图像转换成png格式的商品图像。In the embodiment of the present invention, the dynamic effect map is a dynamic effect map in gif format, and the dynamic effect picture of the dynamic effect map is composed of multiple frames of static images sorted. By playing a plurality of static images in sequence, the dynamic effect picture of the dynamic effect image can be realized. Motion graphics contain the animation elements that the product image needs to render. In this embodiment of the present invention, the dynamic effect map may be generated in real time, or may be generated in advance, and stored in the dynamic effect gallery. It is also possible to obtain the dynamic effect map transmitted by the data interface, or obtain the dynamic effect map from the web page. As an embodiment, the commodity image processing method further includes: acquiring a commodity image, judging whether the commodity image is a commodity image in png format; when the commodity image is not a commodity image in png format, converting the commodity image Product images in png format.
可选的,获取商品图像包括:监听下载商品图像的请求,当监听到下载商品图像的请求时,获取与所述请求对应的商品图像。在本发明实施例中,商品图像可以是从网页上获取的,也可以是从数据库中获取的。Optionally, acquiring the commodity image includes: monitoring a request for downloading the commodity image, and when the request for downloading the commodity image is intercepted, acquiring the commodity image corresponding to the request. In this embodiment of the present invention, the product image may be acquired from a web page, or may be acquired from a database.
步骤S200:根据所述多帧静态图的排序,依次将每帧静态图与所述png格式的商品图像进行像素融合,获得排序的多帧商品融合图;Step S200: According to the sorting of the multi-frame static images, perform pixel fusion of each frame of the static image and the commodity image in the png format in turn, to obtain a sorted multi-frame commodity fusion image;
在本发明实施例中,静态图与png格式的商品图进行像素融合,然而,商品图像的格式有可能是jpg格式或者是其他格式的,则需要将这些非png格式的商品图像转换成png格式的商品图像,其中,非png格式的商品图像包括jpg格式的商品图像的商品图像以及其他格式的商品图像。获得的商品图像是png格式的商品图像,保证了静态图与png格式的商品图能够顺利进行像素融合。In the embodiment of the present invention, pixel fusion is performed between the static image and the commodity image in png format. However, the format of the commodity image may be in jpg format or in other formats, and these commodity images in non-png format need to be converted into png format , where the non-png format commodity images include commodity images in jpg format and commodity images in other formats. The obtained product image is the product image in png format, which ensures smooth pixel fusion between the static image and the product image in png format.
每帧静态图与png格式的商品图像进行像素融合,对应得到一帧商品融合图,多帧静态图按照排序与png格式的商品图像进行像素融合,对应获得排序的多帧商品融合图。Each frame of static image is pixel-fused with the commodity image in png format, and a corresponding frame of commodity fusion image is obtained.
例如,需要对一张包含有手机图像的png格式的商品图像做动效,比如在这个png格式的商品图像上的手机图像周围添加云朵移动、风吹树叶等动效,则需要获取包含有云朵移动、风吹树叶等动画元素的动效图,也就是包含多帧排序的包含有云朵图像、树叶图像的静态图,其中,每相邻两帧静态图中的云朵图像、树叶图像的位置是不同的,将这些静态图按照排序,依次与png格式的商品图像上手机图像的周围区域进行融合,得到多帧包含有手机图像和云朵图像以及树叶图像的商品融合图,这样,每相邻两帧商品融合图中的云朵图像、树叶图像的位置也是不同的,那么根据设定的速度按照排序播放多帧包含有手机图像和云朵图像以及树叶图像的商品融合图,即可呈现商品图像的动效。For example, if you need to perform animation effects on a product image in png format containing a mobile phone image, for example, adding dynamic effects such as clouds moving, wind blowing leaves, etc. The dynamic effect map of animation elements such as moving, wind blowing leaves, etc., that is, a static image containing cloud images and leaf images sorted by multiple frames. The position of the cloud image and leaf image in each two adjacent static images is Differently, these static images are sorted and fused with the surrounding area of the mobile phone image on the commodity image in png format, and multiple frames of commodity fusion images containing mobile phone images, cloud images and leaf images are obtained. The positions of cloud images and leaf images are also different in the frame product fusion image. Then, according to the set speed, play multiple frames of product fusion images including mobile phone images, cloud images and leaf images in order to present the dynamic image of the product. effect.
作为一种实施方式,根据所述多帧静态图的排序,依次将每帧静态图与所述png格式的商品图像进行像素融合,获得排序的多帧商品融合图,具体的实施方式是:在依次将每帧静态图与所述png格式的商品图像进行像素融合时,针对每帧静态图,首先获取该帧静态图中每个像素和所述png格式的商品图像中对应像素之间的映射关系,然后根据所述映射关系,将所述png格式的商品图像中每个像素的像素值替换成该帧静态图中每个像素点的像素值,获得多帧排序的png格式的商品融合图。例如,多帧排序的静态图中包含树叶图像,每相邻两帧静态图中的树叶图像的位置不同,png格式的商品图像中包含手机图像,需要在png格式的商品图像中包含的手机图像的右上角区域做风吹树叶动效,则则在手机图像的右上角选择一块与静态图的尺寸成一定比例的区域,例如这个区域与静态图的尺寸比例是1:1,这个区域中的每个像素点与静态图中的每个像素点一一对应,按照这个一一对应关系,将这个区域中每个像素点的像素值替换成与其对应的静态图中的像素点的像素值,例如,手机图像的右上角区域需要做动效的区域中的像素点(x,y)的像素值是I(x,y)=150,在首帧静态图中与像素点(x,y)对应的像素点(u,v)的像素值是I(u,v)=130,则将手机图像的右上角区域需要做动效的区域中的像素点(x,y)的像素值替换成I(u,v)=130,即I(x,y)=I(u,v)=130,如此,将手机图像的右上角区域需要做动效的区域中的像素点的像素值全部替换成首帧静态图中的像素点的像素值,即完成了png格式的商品图像与首帧静态图的融合,得到首帧png格式的商品融合图。手机图像的右上角区域需要做动效的区域中的像素点(x,y)在第二帧静态图中与像素点(x,y)对应的像素点(u+1,v+2)的像素值是I(u+1,v+2)=160,则将手机图像的右上角区域需要做动效的区域中的像素点(x,y)的像素值替换成I(u+1,v+2)=160,即I(x,y)=I(u+1,v+2)=160,将手机图像的右上角区域需要做动效的区域中的像素点的像素值全部替换成第二帧静态图中的像素点的像素值,即完成了png格式的商品图像与第二帧静态图的融合,得到第二帧png格式的商品融合图。这样,直到完成第K帧静态图与png格式的商品图像融合,得到K帧png格式的商品融合图,即完成了每帧静态图与png格式的商品图像进行像素融合,获得排序的K帧商品融合图,其中,动效图中包含K帧静态图。例如png格式的商品图像中需要做动效的区域与静态图的尺寸比例是1:h,其中,h是正整数,h≥2,那么需要做像素压缩,具体的实现方式是:将静态图进行分割,得到J个分割区域,其中,png格式的商品图像中需要做动效的区域中的像素点的数量是J,png格式的商品图像中需要做动效的区域中的J个像素点与J个分割区域一一对应,获取每个分割区域的平均像素值,将png格式中的像素点的像素值替换成与该像素点语音的分割区域的平均像素值。如此,可以准确地将每帧静态图中的细节映射到png格式的商品图像中,商品图像需要做动画的区域可以有一个或者多个,可以根据png格式的商品图像需要做动画的区域,选择静态图中的像素映射到该区域中,也可以灵活地选择在不同帧、不同区域做不同的动效,具体的,在不同帧的不同区域选择需要做的动效细节对应的静态图,将该区域中每个像素的像素值替换成该帧静态图中每个像素点的像素值。As an embodiment, according to the sorting of the multi-frame static images, pixel fusion of each frame of the static image and the commodity image in png format is performed in turn to obtain a sorted multi-frame commodity fusion image. The specific implementation is: in When performing pixel fusion of each frame of static image and the commodity image in png format in turn, for each frame of static image, first obtain the mapping between each pixel in the static image of the frame and the corresponding pixel in the commodity image in png format Then, according to the mapping relationship, replace the pixel value of each pixel in the commodity image in png format with the pixel value of each pixel in the static image of the frame to obtain a multi-frame sorted commodity fusion map in png format . For example, a static image sorted by multiple frames contains leaf images, and the positions of the leaf images in each two adjacent frames of static images are different. A product image in png format contains a mobile phone image, and the mobile phone image contained in the product image in png format is required. In the upper right corner of the mobile phone image to make the wind blowing leaves dynamic effect, then select an area in the upper right corner of the mobile phone image that is proportional to the size of the static image. For example, the size ratio of this area to the static image is 1:1. Each pixel corresponds to each pixel in the static image one-to-one. According to this one-to-one correspondence, replace the pixel value of each pixel in this area with the pixel value of the corresponding pixel in the static image. For example, the pixel value of the pixel point (x, y) in the area that needs to be animated in the upper right corner of the mobile phone image is I(x, y) = 150, which is the same as the pixel point (x, y) in the first static image. The pixel value of the corresponding pixel point (u, v) is I(u, v) = 130, then replace the pixel value of the pixel point (x, y) in the area where the upper right corner of the mobile phone image needs to be animated with I(u,v)=130, that is, I(x,y)=I(u,v)=130, in this way, replace all the pixel values of the pixels in the area that needs to be animated in the upper right corner of the mobile phone image The pixel value of the pixel point in the first frame of static image is completed, that is, the fusion of the product image in png format and the first frame of static image is completed, and the first frame of the product fusion image in png format is obtained. The pixels (x, y) in the upper right corner of the mobile phone image that need to be animated are the pixels (u+1, v+2) corresponding to the pixels (x, y) in the static image of the second frame. If the pixel value is I(u+1,v+2)=160, then replace the pixel value of the pixel (x,y) in the area where the upper right corner of the mobile phone image needs to be animated with I(u+1, v+2)=160, i.e. I(x,y)=I(u+1,v+2)=160, replace all the pixel values of the pixels in the area where the upper right corner of the mobile phone image needs to be animated The pixel value of the pixel point in the second frame of static image is completed, that is, the fusion of the product image in png format and the second frame of static image is completed, and the second frame of the product fusion image in png format is obtained. In this way, until the K-th frame of static image is fused with the commodity image in png format, the K-frame commodity fusion image in png format is obtained, that is, the pixel fusion of each frame of static image and the commodity image in png format is completed, and the sorted K frames of commodities are obtained. Fusion map, in which the dynamic effect map contains K frames of static images. For example, the size ratio of the area that needs to be animated and the static image in the product image in png format is 1:h, where h is a positive integer and h≥2, then pixel compression needs to be done. The specific implementation method is: compress the static image Divide to obtain J divided areas, among which, the number of pixels in the area that needs to be animated in the commodity image in png format is J, and the J pixels in the area that needs to be animated in the commodity image in png format are the same as The J segmented regions are in one-to-one correspondence, obtain the average pixel value of each segmented region, and replace the pixel value of the pixel point in the png format with the average pixel value of the segmented region of the speech of the pixel point. In this way, the details in each frame of the static image can be accurately mapped to the commodity image in png format. There can be one or more areas of the commodity image that need to be animated. You can select the area that needs to be animated according to the commodity image in png format. The pixels in the static image are mapped to this area, and you can flexibly choose to do different animations in different frames and areas. The pixel value of each pixel in the area is replaced with the pixel value of each pixel in the static image of the frame.
步骤S300:将所述排序的多帧商品融合图按照排序组合,得到商品动效图。Step S300: Combining the sorted multi-frame commodity fusion pictures according to the ordering to obtain a commodity dynamic effect picture.
在本发明实施例中,将所述排序的多帧商品融合图合成商品动效图的具体实施方式可以是,对所述多帧商品融合图按照排序进行gif编码,得到gif格式的商品动效图。如此,即可得到具有动效画面的gif格式的商品动效图。按照设定速度播放所述商品动效图,则可以实现商品图像的动画效果。例如,可以设置速度为0.2秒每帧的速度循坏播放gif格式的商品动效图,则可以实现持续呈现商品动效图的动效画面。In the embodiment of the present invention, the specific implementation of synthesizing the sorted multi-frame commodity fusion diagram into a commodity dynamic effect diagram may be as follows: GIF encoding is performed on the multi-frame commodity fusion diagram according to the sorting, so as to obtain the commodity dynamic effect in gif format. picture. In this way, the dynamic effect picture of the product in the gif format with the dynamic effect picture can be obtained. The animation effect of the commodity image can be realized by playing the commodity dynamic effect image at the set speed. For example, the speed of each frame can be set to 0.2 seconds to play the dynamic effect picture of the product in gif format in a loop, so that the dynamic effect picture of the dynamic effect picture of the product can be continuously presented.
为了节约内存以及加快商品图像处理速度,本发明实施例提供的一种商品图像处理方法还包括将所述排序的多帧商品融合图进行像素去重操作,获得背景图像和多张前景图像;将所述背景图像和所述多张前景图像进行存储。将所述排序的多帧商品融合图进行像素去重操作,获得背景图像和多帧前景图像的实施方式有多种,作为第一种实施方式是:将所述排序的多帧商品融合图中的首帧商品融合图作为背景图像;将所述排序的多帧商品融合图中的第N帧所述商品融合图与所述背景图像进行背景差运算,获得前景图像,其中,N≥2,多帧商品融合图对应获得多帧前景图像。具体的,将排序的多帧商品融合图中的首帧商品融合图作为背景图像,然后将排序的多帧商品融合图中的第二帧商品融合图与背景图像进行背景差运算,得到第一帧前景图像,将排序的多帧商品融合图中的第三帧商品融合图与背景图像进行背景差运算,得到第二帧前景图像,将排序的多帧商品融合图中的第四帧商品融合图与背景图像进行背景差运算,得到第三帧前景图像,如此,直到将第K帧商品融合图与背景图像进行背景差运算,得到第K-1帧前景图像。In order to save memory and speed up commodity image processing, a commodity image processing method provided by an embodiment of the present invention further includes performing pixel deduplication on the sorted multi-frame commodity fusion images to obtain a background image and multiple foreground images; The background image and the plurality of foreground images are stored. There are various implementations of performing pixel deduplication on the sorted multi-frame commodity fusion image to obtain the background image and multi-frame foreground image. As a first implementation, the sorted multi-frame commodity fusion image is The first frame of the commodity fusion map is used as the background image; the Nth frame of the commodity fusion map in the sorted multi-frame commodity fusion map and the background image are subjected to a background difference operation to obtain a foreground image, where N≥2, The multi-frame commodity fusion map correspondingly obtains multi-frame foreground images. Specifically, the first frame of the commodity fusion map in the sorted multi-frame commodity fusion map is used as the background image, and then the background difference operation is performed on the second frame of the commodity fusion map in the sorted multi-frame commodity fusion map and the background image to obtain the first frame foreground image, perform background difference operation on the third frame of commodity fusion image in the sorted multi-frame commodity fusion image and the background image, obtain the second frame of foreground image, and fuse the fourth frame of commodity in the sorted multi-frame commodity fusion image The background difference operation is performed between the image and the background image to obtain the third frame of foreground image, and so on, until the Kth frame of the commodity fusion image and the background image are subjected to the background difference operation, and the K-1th frame of the foreground image is obtained.
作为第二种实施方式,将商品融合图进行分离,得到多帧排序的静态图和png格式的商品图像,以png格式的商品图像作为背景图像,将多帧排序的静态图之间进行背景差法运算,得到多帧排序的前景图像。例如,一个风吹树叶的动效图包括多帧含有树叶图像的静态图,其中,每帧静态图中树叶图像的位置不同,按照排序依次将多帧静含有树叶图像的静态图与png格式的商品图像进行融合,得到多帧商品融合图,这样,背景图像就是动效图的首帧静态图与png格式的商品图像融合得到的商品融合图,前景图像就是第N帧静态图与首帧静态图进行背景差运算得到的。如此,只需要存储首帧商品融合图以及多帧前景图像,节约内存。作为一种实施方式,当需要播放动效的商品图像时,可以实时获取前景图像和携带了商品图像的信息和首帧静态图的信息的背景图像,例如携带商品图像的手机图像和首帧静态图的树叶图像的背景图像和携带了树叶图像的前景图像,将背景图像与前景图像进行融合,可以实现动效画面的实时生成,获取速度快,计算量小,实时性好。As a second embodiment, the product fusion images are separated to obtain a multi-frame sorted static image and a png format product image, and the png format product image is used as the background image, and the background difference between the multiple frame sorted static images is performed. method to obtain a foreground image sorted by multiple frames. For example, a dynamic picture of leaves blowing in the wind includes multiple frames of static pictures containing leaf images, wherein the positions of the leaf images in each frame of static pictures are different. Commodity images are fused to obtain a multi-frame commodity fusion map. In this way, the background image is the commodity fusion map obtained by merging the first static image of the dynamic effect map and the png format commodity image, and the foreground image is the Nth frame static image and the first frame static image. The figure is obtained by background difference operation. In this way, it is only necessary to store the first frame of the commodity fusion image and multiple frames of foreground images to save memory. As an embodiment, when a product image with dynamic effects needs to be played, the foreground image and the background image carrying the information of the product image and the information of the first frame of static image can be acquired in real time, such as a mobile phone image carrying the product image and the first frame of static image. The background image of the leaf image in the figure and the foreground image carrying the leaf image, the background image and the foreground image can be fused, which can realize the real-time generation of the dynamic effect picture, and the acquisition speed is fast, the calculation amount is small, and the real-time performance is good.
通过采用以上方案,通过将商品图和动效图进行像素融合获得商品动效图像,操作动作少实时性好,不同的动画效果根据不同的动效图获得,灵活性强,多帧商品动效图组成商品动效视频,通过播放商品动效视频实现呈现商品图像动效画面,维护成本低。By adopting the above scheme, the product dynamic effect image is obtained by pixel fusion of the product map and the dynamic effect map, the operation action is less and the real-time performance is good, and different animation effects are obtained according to different dynamic effect maps, with strong flexibility and multi-frame product dynamic effects The pictures form a product animation video, and the product image animation screen is displayed by playing the product animation video, and the maintenance cost is low.
基于同样的发明构思,本发明还提供了一商品图像处理装置200。请参阅图2,图2示出了本发明实施例提供的一种商品图像处理装置200的方框结构示意图。在本发明实施例中,商品图像处理装置200包括:Based on the same inventive concept, the present invention also provides a commodity image processing apparatus 200 . Referring to FIG. 2 , FIG. 2 shows a schematic block diagram of a product image processing apparatus 200 according to an embodiment of the present invention. In this embodiment of the present invention, the commodity image processing apparatus 200 includes:
获取图像模块210,用于获取png格式的商品图像和动效图,其中,所述动效图包含多帧静态图;an image acquisition module 210, configured to acquire a commodity image and a dynamic effect image in png format, wherein the dynamic effect image includes multiple frames of static images;
融合模块220,用于根据所述多帧静态图的排序,依次将每帧静态图与所述png格式的商品图像进行像素融合,获得排序的多帧商品融合图;The fusion module 220 is configured to perform pixel fusion of each frame of static image and the commodity image in png format according to the sorting of the multi-frame static images, to obtain a sorted multi-frame commodity fusion image;
生成商品动效图模块230,用于将所述排序的多帧商品融合图按照排序组合,得到商品动效图;generating a commodity dynamic effect map module 230, configured to combine the sorted multi-frame commodity fusion maps according to the ordering to obtain a commodity dynamic effect map;
按照设定速度播放所述商品动效图;以及,Play the product animation at a set speed; and,
获取商品图像模块240,用于获取商品图像;a commodity image acquisition module 240, used for acquiring commodity images;
判断模块250,用于判断所述商品图像是否是png格式的商品图像;A judgment module 250, configured to judge whether the commodity image is a commodity image in png format;
转换图像模块260,用于当将所述商品图像不是png格式的商品图像时,将所述商品图像转换成png格式的商品图像;an image conversion module 260, configured to convert the commodity image into a commodity image in png format when the commodity image is not a commodity image in png format;
像素去重模块270,用于将所述排序的多帧商品融合图进行像素去重操作,获得背景图像和多张前景图像;a pixel deduplication module 270, configured to perform a pixel deduplication operation on the sorted multi-frame commodity fusion images to obtain a background image and a plurality of foreground images;
存储模块280,用于将所述背景图像和所述多张前景图像进行存储;a storage module 280, configured to store the background image and the plurality of foreground images;
播放模块290,用于按照设定速度播放所述商品动效图;Playing module 290, configured to play the dynamic effect picture of the product according to the set speed;
其中,获取图像模块210、融合模块220、生成商品动效图模块230、获取商品图像模块240、判断模块250、转换图像模块260、像素去重模块270、存储模块280和播放模块290之间通过总线连接。其中,Among them, the image acquisition module 210, the fusion module 220, the commodity dynamic effect map generation module 230, the commodity image acquisition module 240, the judgment module 250, the conversion image module 260, the pixel deduplication module 270, the storage module 280 and the playback module 290 pass through bus connection. in,
融合模块220包括:The fusion module 220 includes:
获取映射关系单元221,用于在依次将每帧静态图与所述png格式的商品图像进行像素融合时,针对每帧静态图,获取该帧静态图中每个像素和所述png格式的商品图像中对应像素之间的映射关系;Obtaining the mapping relationship unit 221 is used to obtain each pixel in the static image of the frame and the commodity in the png format for each frame of the static image when performing pixel fusion of each frame of the static image and the commodity image in the png format in turn. The mapping relationship between corresponding pixels in the image;
像素融合单元222,用于根据所述映射关系,将所述png格式的商品图像中每个像素的像素值替换成该帧静态图中每个像素点的像素值,获得多帧排序的png格式的商品融合图。The pixel fusion unit 222 is configured to replace the pixel value of each pixel in the commodity image in the png format with the pixel value of each pixel in the static image of the frame according to the mapping relationship, and obtain a png format sorted by multiple frames Commodity Fusion Chart.
请参阅图3,图3示出了融合模块220的方框结构示意图,获取映射关系单元221与像素融合单元222连接。Please refer to FIG. 3 . FIG. 3 shows a schematic block diagram of the structure of the fusion module 220 , and the mapping relationship acquisition unit 221 is connected to the pixel fusion unit 222 .
生成商品动效图模块230用于:The generating commodity dynamic effect map module 230 is used for:
对所述多帧商品融合图按照排序进行gif编码,得到gif格式的商品动效图。GIF encoding is performed on the multi-frame commodity fusion pictures according to the sequence, so as to obtain a commodity dynamic effect picture in gif format.
像素去重模块270包括:The pixel deduplication module 270 includes:
确定背景图像单元271,用于将所述排序的多帧商品融合图中的首帧商品融合图作为背景图像;Determining a background image unit 271, used for taking the first frame of the commodity fusion diagram in the sorted multi-frame commodity fusion diagram as a background image;
像素去重单元272,用于将所述排序的多帧商品融合图中的第N帧所述商品融合图与所述背景图像进行背景差运算,获得前景图像,其中,N≥2,多帧商品融合图对应获得多帧前景图像。The pixel deduplication unit 272 is configured to perform a background difference operation on the N-th frame of the commodity fusion image in the sorted multi-frame commodity fusion image and the background image to obtain a foreground image, where N≥2, a multi-frame image is obtained. Commodity fusion map correspondingly obtains multiple frames of foreground images.
请参阅图4,图4示出了像素去重模块270的方框结构示意图,确定背景图像单元271与像素去重单元272连接。Please refer to FIG. 4 . FIG. 4 shows a block diagram of the pixel de-duplication module 270 , and it is determined that the background image unit 271 is connected to the pixel de-duplication unit 272 .
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the above-mentioned embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be described in detail here.
本发明实施例还提供了一种电子设备,如图5所示,包括存储器504、处理器502及存储在存储器504上并可在处理器502上运行的计算机程序,所述处理器502执行所述程序时实现前文所述商品图像处理方法的任一方法的步骤。An embodiment of the present invention also provides an electronic device, as shown in FIG. 5 , including a memory 504, a processor 502, and a computer program stored in the memory 504 and running on the processor 502, the processor 502 executing the When the program is described, the steps of any one of the aforementioned commodity image processing methods are implemented.
其中,在图5中,总线架构(用总线500来代表),总线500可以包括任意数量的互联的总线和桥,总线500将包括由处理器502代表的一个或多个处理器和存储器504代表的存储器的各种电路链接在一起。总线500还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口505在总线500和接收器501和发送器503之间提供接口。接收器501和发送器503可以是同一个元件,即收发机,提供用于在传输介质上与各种其他装置通信的单元。处理器502负责管理总线500和通常的处理,而存储器504可以被用于存储处理器502在执行操作时所使用的数据。5, the bus architecture (represented by bus 500), the bus 500 may include any number of interconnected buses and bridges, the bus 500 will include one or more processors represented by processor 502 and memory 504 The various circuits of the memory are linked together. The bus 500 may also link together various other circuits, such as peripherals, voltage regulators, and power management circuits, etc., which are well known in the art and, therefore, will not be described further herein. Bus interface 505 provides an interface between bus 500 and receiver 501 and transmitter 503 . Receiver 501 and transmitter 503 may be the same element, a transceiver, providing a means for communicating with various other devices over a transmission medium. The processor 502 is responsible for managing the bus 500 and general processing, while the memory 504 may be used to store data used by the processor 502 in performing operations.
本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现前文所述商品图像处理方法的任一方法的步骤。Embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, implements the steps of any one of the aforementioned commodity image processing methods.
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. It should be understood that various programming languages may be used to implement the inventions described herein, and that the descriptions of specific languages above are intended to disclose the best mode for carrying out the invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. It will be understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it is to be understood that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or its description. This disclosure, however, should not be construed as reflecting an intention that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art will understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. The modules or units or components in the embodiments may be combined into one module or unit or component, and further they may be divided into multiple sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method so disclosed may be employed in any combination, unless at least some of such features and/or procedures or elements are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, it will be understood by those skilled in the art that although some of the embodiments herein include certain features, but not others, included in other embodiments, that combinations of features of the different embodiments are intended to be within the scope of the present invention And form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的网关、代理服务器、系统中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载获得,或者在载体信号上提供,或者以任何其他形式提供。Various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all of the gateways, proxy servers, and systems according to embodiments of the present invention. The present invention can also be implemented as apparatus or apparatus programs (eg, computer programs and computer program products) for performing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such signals may be downloaded from Internet sites, or provided on carrier signals, or in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-described embodiments illustrate rather than limit the invention, and that alternative embodiments may be devised by those skilled in the art without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names.
以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention shall be included in the within the protection scope of the present invention.
本发明提供了,A1.一种商品图像处理方法,所述方法包括:The present invention provides, A1. a commodity image processing method, the method comprises:
获取png格式的商品图像和动效图,其中,所述动效图包含多帧静态图;Obtain a product image and a dynamic effect image in png format, wherein the dynamic effect image includes multiple frames of static images;
根据所述多帧静态图的排序,依次将每帧静态图与所述png格式的商品图像进行像素融合,获得排序的多帧商品融合图;According to the sorting of the multi-frame static images, pixel fusion is performed on each frame of the static image and the commodity image in the png format in turn to obtain a sorted multi-frame commodity fusion image;
将所述排序的多帧商品融合图按照排序组合,得到商品动效图。Combining the sorted multi-frame commodity fusion pictures according to the ordering to obtain a commodity dynamic effect picture.
A2.所述方法还包括:A2. The method further includes:
获取商品图像;Get product images;
判断所述商品图像是否是png格式的商品图像;Determine whether the commodity image is a commodity image in png format;
当将所述商品图像不是png格式的商品图像时,将所述商品图像转换成png格式的商品图像。When the commodity image is not a commodity image in png format, the commodity image is converted into a commodity image in png format.
A3.根据所述多帧静态图的排序,依次将每帧静态图与所述png格式的商品图像进行像素融合,获得排序的多帧商品融合图,包括:A3. According to the sorting of the multi-frame static images, perform pixel fusion of each frame of the static image and the commodity image in the png format in turn to obtain a sorted multi-frame commodity fusion image, including:
在依次将每帧静态图与所述png格式的商品图像进行像素融合时,针对每帧静态图,获取该帧静态图中每个像素和所述png格式的商品图像中对应像素之间的映射关系;When performing pixel fusion of each frame of static image and the commodity image in png format in sequence, for each frame of static image, obtain the mapping between each pixel in the static image of the frame and the corresponding pixel in the commodity image in png format relation;
根据所述映射关系,将所述png格式的商品图像中每个像素的像素值替换成该帧静态图中每个像素点的像素值,获得多帧排序的png格式的商品融合图。According to the mapping relationship, the pixel value of each pixel in the commodity image in png format is replaced with the pixel value of each pixel in the static image of the frame to obtain a commodity fusion map in png format sorted by multiple frames.
A4.所述将所述排序的多帧商品融合图合成商品动效图,包括:A4. The described sequenced multi-frame commodity fusion pictures are synthesized into commodity motion pictures, including:
对所述多帧商品融合图按照排序进行gif编码,得到gif格式的商品动效图。GIF encoding is performed on the multi-frame commodity fusion pictures according to the sequence, so as to obtain a commodity dynamic effect picture in gif format.
A5.所述方法还包括:A5. the method also includes:
将所述排序的多帧商品融合图进行像素去重操作,获得背景图像和多张前景图像;Perform a pixel deduplication operation on the sorted multi-frame commodity fusion images to obtain a background image and a plurality of foreground images;
将所述背景图像和所述多张前景图像进行存储。The background image and the plurality of foreground images are stored.
A6.所述将所述排序的多帧商品融合图进行像素去重操作,获得背景图像和多帧前景图像,包括:A6. Perform pixel deduplication operation on the sorted multi-frame commodity fusion images to obtain background images and multi-frame foreground images, including:
将所述排序的多帧商品融合图中的首帧商品融合图作为背景图像;Using the first frame of the commodity fusion diagram in the sorted multi-frame commodity fusion diagram as a background image;
将所述排序的多帧商品融合图中的第N帧所述商品融合图与所述背景图像进行背景差运算,获得前景图像,其中,N≥2,多帧商品融合图对应获得多帧前景图像。Perform a background difference operation on the Nth frame of the commodity fusion map in the sorted multi-frame commodity fusion map and the background image to obtain a foreground image, where N≥2, the multi-frame commodity fusion map correspondingly obtains multi-frame foregrounds image.
A7.所述方法还包括:按照设定速度播放所述商品动效图。A7. The method further includes: playing the dynamic effect picture of the product at a set speed.
B8.一种商品图像处理装置,所述装置包括:B8. A commodity image processing device, the device comprising:
获取图像模块,用于获取png格式的商品图像和动效图,其中,所述动效图包含多帧静态图;an image acquisition module for acquiring commodity images and dynamic effect images in png format, wherein the dynamic effect images include multiple frames of static images;
融合模块,用于根据所述多帧静态图的排序,依次将每帧静态图与所述png格式的商品图像进行像素融合,获得排序的多帧商品融合图;a fusion module, configured to perform pixel fusion of each frame of static image and the commodity image in png format in turn according to the sorting of the multi-frame static images to obtain a sorted multi-frame commodity fusion image;
生成商品动效图模块,用于将所述排序的多帧商品融合图按照排序组合,得到商品动效图。A commodity dynamic effect map generation module is used for combining the sorted multi-frame commodity fusion maps in order to obtain a commodity dynamic effect map.
B9.所述装置还包括:B9. The device also includes:
获取商品图像模块,用于获取商品图像;Get the product image module, which is used to obtain the product image;
判断模块,用于判断所述商品图像是否是png格式的商品图像;a judging module for judging whether the commodity image is a commodity image in png format;
转换图像模块,用于当将所述商品图像不是png格式的商品图像时,将所述商品图像转换成png格式的商品图像。The image conversion module is configured to convert the product image into a png format product image when the product image is not a png format product image.
B10.所述融合模块包括:B10. The fusion module includes:
获取映射关系单元,用于在依次将每帧静态图与所述png格式的商品图像进行像素融合时,针对每帧静态图,获取该帧静态图中每个像素和所述png格式的商品图像中对应像素之间的映射关系;Obtaining a mapping relationship unit for obtaining each pixel in the static image of the frame and the commodity image in the png format for each frame of the static image when pixel fusion is performed on the static image of each frame and the commodity image in the png format in turn. The mapping relationship between the corresponding pixels in ;
像素融合单元,用于根据所述映射关系,将所述png格式的商品图像中每个像素的像素值替换成该帧静态图中每个像素点的像素值,获得多帧排序的png格式的商品融合图。The pixel fusion unit is used to replace the pixel value of each pixel in the commodity image in the png format with the pixel value of each pixel in the static image of the frame according to the mapping relationship, and obtain a multi-frame sorted png format. Commodity Fusion Chart.
B11.所述生成商品动效图模块用于:B11. The module for generating dynamic effect map of commodities is used for:
对所述多帧商品融合图按照排序进行gif编码,得到gif格式的商品动效图。GIF encoding is performed on the multi-frame commodity fusion pictures according to the sequence, so as to obtain a commodity dynamic effect picture in gif format.
B12.所述装置还包括:B12. The device also includes:
像素去重模块,用于将所述排序的多帧商品融合图进行像素去重操作,获得背景图像和多张前景图像;a pixel deduplication module for performing pixel deduplication operation on the sorted multi-frame commodity fusion images to obtain a background image and a plurality of foreground images;
存储模块,用于将所述背景图像和所述多张前景图像进行存储。A storage module, configured to store the background image and the plurality of foreground images.
B13.所述像素去重模块包括:B13. The pixel deduplication module includes:
确定背景图像单元,用于将所述排序的多帧商品融合图中的首帧商品融合图作为背景图像;Determining a background image unit for taking the first frame of the commodity fusion map in the sorted multi-frame commodity fusion map as a background image;
像素去重单元,用于将所述排序的多帧商品融合图中的第N帧所述商品融合图与所述背景图像进行背景差运算,获得前景图像,其中,N≥2,多帧商品融合图对应获得多帧前景图像。The pixel deduplication unit is used to perform a background difference operation on the Nth frame of the commodity fusion map in the sorted multi-frame commodity fusion map and the background image to obtain a foreground image, where N≥2, multi-frame commodity The fusion map corresponds to obtaining multiple frames of foreground images.
B14.所装置还包括:B14. The device also includes:
播放模块,用于按照设定速度播放所述商品动效图。The playing module is used for playing the dynamic effect picture of the product according to the set speed.
C15.一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现权利要求A1-A7任一项所述方法的步骤。C15. A computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the steps of the method of any one of claims A1-A7.
D16.一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现权利要求A1-A7任一项所述方法的步骤。D16. An electronic device, comprising a memory, a processor and a computer program stored on the memory and running on the processor, when the processor executes the program, the method of any one of claims A1-A7 is implemented step.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201811085198.2A CN109242814A (en) | 2018-09-18 | 2018-09-18 | Commodity image processing method, device and electronic equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201811085198.2A CN109242814A (en) | 2018-09-18 | 2018-09-18 | Commodity image processing method, device and electronic equipment |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN109242814A true CN109242814A (en) | 2019-01-18 |
Family
ID=65058729
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201811085198.2A Pending CN109242814A (en) | 2018-09-18 | 2018-09-18 | Commodity image processing method, device and electronic equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN109242814A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111369469A (en) * | 2020-03-10 | 2020-07-03 | 北京爱笔科技有限公司 | Image processing method and device and electronic equipment |
| US20230138495A1 (en) * | 2020-06-29 | 2023-05-04 | Vivo Mobile Communication Co., Ltd. | Image photographing method and electronic device |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080181507A1 (en) * | 2007-01-29 | 2008-07-31 | Intellivision Technologies Corp. | Image manipulation for videos and still images |
| CN102411791A (en) * | 2010-09-19 | 2012-04-11 | 三星电子(中国)研发中心 | A method and device for dynamicizing still images |
| CN106385591A (en) * | 2016-10-17 | 2017-02-08 | 腾讯科技(上海)有限公司 | Video processing method and video processing device |
| US20170372498A1 (en) * | 2016-06-27 | 2017-12-28 | Xiaoyi Technology Co., Ltd. | Automatic image synthesis method |
| CN107948543A (en) * | 2017-11-16 | 2018-04-20 | 北京奇虎科技有限公司 | A kind of special video effect processing method and processing device |
| CN108495058A (en) * | 2018-01-30 | 2018-09-04 | 光锐恒宇(北京)科技有限公司 | Image processing method, device and computer readable storage medium |
-
2018
- 2018-09-18 CN CN201811085198.2A patent/CN109242814A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080181507A1 (en) * | 2007-01-29 | 2008-07-31 | Intellivision Technologies Corp. | Image manipulation for videos and still images |
| CN102411791A (en) * | 2010-09-19 | 2012-04-11 | 三星电子(中国)研发中心 | A method and device for dynamicizing still images |
| US20170372498A1 (en) * | 2016-06-27 | 2017-12-28 | Xiaoyi Technology Co., Ltd. | Automatic image synthesis method |
| CN106385591A (en) * | 2016-10-17 | 2017-02-08 | 腾讯科技(上海)有限公司 | Video processing method and video processing device |
| CN107948543A (en) * | 2017-11-16 | 2018-04-20 | 北京奇虎科技有限公司 | A kind of special video effect processing method and processing device |
| CN108495058A (en) * | 2018-01-30 | 2018-09-04 | 光锐恒宇(北京)科技有限公司 | Image processing method, device and computer readable storage medium |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111369469A (en) * | 2020-03-10 | 2020-07-03 | 北京爱笔科技有限公司 | Image processing method and device and electronic equipment |
| CN111369469B (en) * | 2020-03-10 | 2024-01-12 | 北京爱笔科技有限公司 | Image processing method and device and electronic equipment |
| US20230138495A1 (en) * | 2020-06-29 | 2023-05-04 | Vivo Mobile Communication Co., Ltd. | Image photographing method and electronic device |
| US12289518B2 (en) * | 2020-06-29 | 2025-04-29 | Vivo Mobile Communication Co., Ltd. | Image photographing method and electronic device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN113946402B (en) | Cloud mobile phone acceleration method, system, equipment and storage medium based on rendering separation | |
| CN110070896B (en) | Image processing method, device and hardware device | |
| CN108235116B (en) | Feature propagation method and apparatus, electronic device, and medium | |
| US12333694B2 (en) | Image processing method and apparatus | |
| CN112868224A (en) | Techniques to capture and edit dynamic depth images | |
| TW201730841A (en) | Image data processing system and associated methods for processing panorama images and image blending using the same | |
| CN110968962B (en) | Method and system for three-dimensional display on mobile terminal or large screen based on cloud rendering | |
| CN115396645A (en) | Immersion media data processing method, device, equipment and storage medium | |
| WO2023207379A1 (en) | Image processing method and apparatus, device and storage medium | |
| CN111696034B (en) | Image processing methods, devices and electronic equipment | |
| WO2022213801A1 (en) | Video processing method, apparatus, and device | |
| CN114170085B (en) | Space-time super-resolution real-time reconstruction method and system | |
| CN109242814A (en) | Commodity image processing method, device and electronic equipment | |
| CN111008934B (en) | Scene construction method, device, equipment and storage medium | |
| CN114820660B (en) | Image processing method, device, electronic device, storage medium and program product | |
| US12107908B2 (en) | Media file encapsulating method, media file decapsulating method, and related devices | |
| US20250071252A1 (en) | Methods and system of multiview video rendering, preparing a multiview cache, and real-time multiview video conversion | |
| US11570227B2 (en) | Set up and distribution of immersive media to heterogenous client end-points | |
| CN113194265B (en) | Street view video generation method, device, electronic device and storage medium | |
| CN107491934B (en) | 3D interview system based on virtual reality | |
| CN113160377A (en) | Method, apparatus, device and storage medium for processing image | |
| CN108985275A (en) | The display method for tracing and device of augmented reality equipment and electronic equipment | |
| CN113723162A (en) | Method, system and storage medium for object identification | |
| WO2023226504A1 (en) | Media data processing methods and apparatuses, device, and readable storage medium | |
| WO2023169003A1 (en) | Point cloud media decoding method and apparatus and point cloud media coding method and apparatus |
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 | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190118 |
|
| RJ01 | Rejection of invention patent application after publication |