WO2016197705A1 - 一种图像处理方法和装置 - Google Patents

一种图像处理方法和装置 Download PDF

Info

Publication number
WO2016197705A1
WO2016197705A1 PCT/CN2016/079787 CN2016079787W WO2016197705A1 WO 2016197705 A1 WO2016197705 A1 WO 2016197705A1 CN 2016079787 W CN2016079787 W CN 2016079787W WO 2016197705 A1 WO2016197705 A1 WO 2016197705A1
Authority
WO
WIPO (PCT)
Prior art keywords
color
frame image
image
pixel
quantization
Prior art date
Application number
PCT/CN2016/079787
Other languages
English (en)
French (fr)
Inventor
陆平
马利庄
刘明
朱恒亮
贾霞
谢畅
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016197705A1 publication Critical patent/WO2016197705A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding

Definitions

  • This document relates to, but is not limited to, the field of image processing technology, and more particularly to an image processing method and apparatus.
  • the present invention provides an image processing method and apparatus capable of ensuring a visually approximate lossless visual experience while ensuring that the image has a high compression ratio.
  • An embodiment of the present invention provides an image processing method, including:
  • the number of colors k required to compress the frame image is determined, the color value of each pixel of the frame image is mapped into the color quantization space, and the frame image is mapped according to the number of colors k required to compress the frame image.
  • the color quantization space is divided into k subspaces;
  • the frame image is subjected to color quantization processing according to the divided color quantization space corresponding to each frame image.
  • the color to which the frame image is mapped according to the number of colors k required to compress the frame image is divided into k subspaces, including:
  • the color quantization space to which the frame image is mapped is divided into k subspaces based on the minimum quantization quantization principle based on the number of colors k required to compress the frame image.
  • the color quantization space to which the frame image is mapped according to the number of colors k required to compress the frame image is divided into k subspaces according to a minimum quantization error principle, including:
  • step b) For the subspace with a large rear-end difference, use the same method as in step a) to cut the subspace, generate two small subspaces, and calculate the pixel dot matrix mapped to each small subspace.
  • the mean and variance of the color values looking for a plane such that the sum of the variances of the color values of the dot matrix of the two small subspaces formed after cutting is minimal;
  • performing color quantization processing on the frame image according to the split color quantization space corresponding to each frame image including:
  • the color value of the pixel of each frame image is replaced with the normalized color value of the color quantization subspace to which the pixel is mapped.
  • determining the number of colors required to compress the frame image includes: performing clustering processing on color values of pixel points of the frame image, and grouping pixel points whose color distance values are smaller than a threshold value into one class, each class corresponding to A representative color; the number k of representative colors corresponding to the frame image is used as the number of colors required for the frame image.
  • the color value of the pixel points of the frame image is clustered, including:
  • step b) for the reference point found in step a), find in the image that the color distance is less than the threshold a pixel, the pixel is marked with the color of the reference point;
  • mapping the color values of each pixel of the frame image into the color quantization space includes:
  • a color value of each pixel of the frame image is mapped into the three-dimensional color quantization space.
  • the method further includes:
  • a partial color table of each frame image is rewritten, and a correspondence relationship between an index of the normalized color value of the color quantization subspace of the frame image and a color value is recorded therein.
  • the image is a static image interchange format GIF image or a dynamic GIF image.
  • An embodiment of the present invention provides an image processing apparatus, including:
  • An image input module configured to read each frame of an image
  • a color quantization processing module is configured to determine, for each frame image, a quantity k of colors required to compress the frame image, and map a color value of each pixel of the frame image into a color quantization space, according to a color required to compress the frame image
  • the quantity k is divided into k subspaces by the color quantization space to which the frame image is mapped; the frame image is color quantized according to the divided color quantization space corresponding to each frame image.
  • the color quantization processing module is configured to be divided into k subspaces by using a color quantization space to which the frame image is mapped according to the number of colors k required to compress the frame image in the following manner:
  • the color quantization space to which the frame image is mapped is divided into k subspaces based on the minimum quantization quantization principle based on the number of colors k required to compress the frame image.
  • the color quantization processing module is configured to adopt the following method based on the minimum quantization error
  • the principle divides the color quantization space to which the frame image is mapped according to the number of colors k required to compress the frame image into k subspaces:
  • step b) For the subspace with a large rear-end difference, use the same method as in step a) to cut the subspace, generate two small subspaces, and calculate the pixel dot matrix mapped to each small subspace.
  • the mean and variance of the color values looking for a plane such that the sum of the variances of the color values of the dot matrix of the two small subspaces formed after cutting is minimal;
  • the color quantization processing module is configured to perform color quantization processing on the frame image according to the split color quantization space corresponding to each frame image in the following manner:
  • the color value of the pixel of each frame image is replaced with the normalized color value of the color quantization subspace to which the pixel is mapped.
  • the color quantization processing module is configured to determine, according to the following manner, the number of colors required to compress the frame image: clustering color values of pixel points of the frame image, and collecting pixels with color distance values smaller than a threshold value For one class, each class corresponds to a representative color; the number k of representative colors corresponding to the frame image is taken as the number of colors required for the frame image.
  • the color quantization processing module is configured to cluster the color values of the pixel points of the frame image in the following manner:
  • step b) for the reference point found in step a), finding a pixel point whose color distance is less than a threshold value in the image, and marking the pixel point with the color of the reference point;
  • the color quantization processing module is configured to map the color values of the pixels of the frame image into the color quantization space in the following manner:
  • a color value of each pixel of the frame image is mapped into the three-dimensional color quantization space.
  • the device further includes:
  • the image output module is configured to, after performing color quantization processing on the frame image according to the color quantization space corresponding to the split image corresponding to each frame image, assign an index to the normalized color value of the color quantization subspace corresponding to each frame image; A local color table of each frame image is written, in which the correspondence between the index of the normalized color value of the color quantization subspace of the frame image and the color value is recorded.
  • the image is a static image interchange format GIF image or a dynamic GIF image.
  • the embodiment of the invention further provides a computer readable storage medium storing computer executable instructions, which are implemented when executed by a processor.
  • an image processing method and apparatus can ensure a visually approximate lossless visual experience while ensuring a high compression ratio of an image, and a large number of colors in the original image.
  • the image of the gradation area is determined by the adaptive algorithm to determine the color quantization space of each frame image, and the image can be appropriately compressed to avoid the distortion of the image caused by the compression rate being too high, and the image is not adaptive to the original image without a large number of color gradation regions.
  • the algorithm determines the color quantization space of each frame image, which can improve the compression ratio. In terms of picture quality, there is basically no difference between the compressed picture and the original picture.
  • FIG. 1 is a flowchart of an image processing method according to an embodiment of the present invention.
  • FIG. 2 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present invention.
  • an embodiment of the present invention provides an image processing method, where the method includes:
  • S20 Determine, for each frame image, a quantity k of colors required to compress the frame image, and map a color value of each pixel of the frame image into a color quantization space, and select the frame according to the number of colors required to compress the frame image.
  • the color quantization space to which the image is mapped is divided into k subspaces;
  • the image is a GIF (Graphics Interchange Format) image
  • the GIF image is: static GIF or dynamic GIF.
  • reading each frame of the image includes:
  • the global color table of the image can also be read
  • the color value of the pixel point can be represented by a triple of three color components, such as: ⁇ red (R), green (G), and blue (B) ⁇ ;
  • the value range of any color component value is: 0 to 255;
  • determining the number of colors required to compress the frame image includes:
  • the color value of the pixel points of the frame image is clustered, including:
  • step b) for the reference point found in step a), finding a pixel point whose color distance is less than a threshold value in the image, and marking the pixel point with the color of the reference point;
  • L(c, c') is the color distance between the two pixel points
  • R c , G c , B c and R c ', G c ' , B c ' respectively represent the values of the three color components of the two pixel points
  • mapping the color values of each pixel of the frame image into the color quantization space includes:
  • the color quantization space to which the frame image is mapped according to the number of colors k required to compress the frame image is divided into k subspaces, including:
  • the color quantization space to which the frame image is mapped according to the number of colors k required to compress the frame image is divided into k subspaces;
  • the color quantization space to which the frame image is mapped according to the number of colors k required to compress the frame image is divided into k subspaces, including:
  • step b) For the subspace with a large rear-end difference, use the same method as in step a) to cut the subspace, generate two small subspaces, and calculate the pixel dot matrix mapped to each small subspace.
  • the mean and variance of the color values looking for a plane such that the sum of the variances of the color values of the dot matrix of the two small subspaces formed after cutting is minimal;
  • any space is newly generated by two spatial partitions (the first space and the second space), n pixels are mapped into the first space, and m pixels are mapped into the second space, and any pixel is mapped.
  • the color value of point i is represented by a triple of three color components (R i , G i , B i );
  • the spatially-divided position that minimizes the sum of the variances of the color values of the pixel points of the first space and the second space is the final result of the spatial segmentation.
  • performing color quantization processing on the frame image according to the split color quantization space corresponding to each frame image including:
  • the method further includes:
  • a partial color table of each frame image is rewritten, and a correspondence relationship between an index of the normalized color value of the color quantization subspace of the frame image and a color value is recorded therein.
  • an embodiment of the present invention provides an image processing apparatus, including:
  • An image input module configured to read each frame of an image
  • a color quantization processing module is configured to determine, for each frame image, a quantity k of colors required to compress the frame image, and map a color value of each pixel of the frame image into a color quantization space, according to a color required to compress the frame image
  • the quantity k is divided into k sub-spaces by the color quantization space to which the frame image is mapped; the color quantization processing is performed on the frame image according to the divided color quantization space corresponding to each frame image;
  • the image is a static image interchange format GIF image or a dynamic GIF image;
  • reading each frame of the image includes:
  • the global color table of the image can also be read
  • the color value of the pixel point can be represented by a triple of three color components, such as: ⁇ red (R), green (G), and blue (B) ⁇ ;
  • the value range of any color component value is: 0 to 255;
  • the color quantization processing module is configured to determine the number of colors required to compress the frame image in the following manner: clustering the color values of the pixel points of the frame image, and setting the color distance value to a pixel value smaller than the threshold value. Converging into one class, each class corresponds to a representative color; the number k of representative colors corresponding to the frame image is used as the number of colors required for the frame image.
  • the color quantization processing module is configured to cluster the color values of the pixel points of the frame image in the following manner:
  • step b) for the reference point found in step a), finding a pixel point whose color distance is less than a threshold value in the image, and marking the pixel point with the color of the reference point;
  • the color quantization processing module is configured to map the color values of the pixels of the frame image into the color quantization space in the following manner:
  • the color quantization processing module is configured to be divided into k subspaces by using a color quantization space to which the frame image is mapped according to the number of colors k required to compress the frame image in the following manner:
  • the color quantization space to which the frame image is mapped according to the number of colors k required to compress the frame image is divided into k subspaces;
  • the color quantization processing module is configured to be divided into k subspaces according to the principle of minimizing quantization error in the following manner, according to the color quantity k required to compress the frame image to be mapped to the color quantization space:
  • step b) For the subspace with a large rear-end difference, use the same method as in step a) to cut the subspace, generate two small subspaces, and calculate the pixel dot matrix mapped to each small subspace.
  • the mean and variance of the color values looking for a plane such that the sum of the variances of the color values of the dot matrix of the two small subspaces formed after cutting is minimal;
  • the color quantization processing module is configured to perform color quantization processing on the frame image according to the split color quantization space corresponding to each frame image in the following manner:
  • the device further includes:
  • the image output module is configured to, after performing color quantization processing on the frame image according to the color quantization space corresponding to the split image corresponding to each frame image, assign an index to the normalized color value of the color quantization subspace corresponding to each frame image; A local color table of each frame image is written, in which the correspondence between the index of the normalized color value of the color quantization subspace of the frame image and the color value is recorded.
  • the image processing method and device provided by the above embodiments can ensure the visually approximate lossless visual experience of the user while ensuring that the image has a high compression ratio, and the image with a large number of color gradation regions in the original image is
  • the adaptive algorithm determines the color quantization space of each frame image, and can appropriately compress the image to avoid the distortion of the image caused by the excessive compression rate.
  • the image of each frame is determined according to an adaptive algorithm.
  • the color quantization space can increase the compression ratio. In terms of picture quality, there is basically no difference between the compressed picture and the original picture.
  • each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. Instructions to achieve their corresponding functions. This application is not limited to any specific combination of hardware and software.
  • the technical solution provided by the embodiment of the present invention can ensure that the image has a high compression ratio while ensuring a visually approximate lossless visual experience of the user.
  • each method is determined according to an adaptive algorithm.
  • the color quantization space of one frame of image can properly compress the image to avoid distortion of the image due to excessive compression ratio.
  • the color quantization space of each frame image is determined according to an adaptive algorithm. It can improve the compression ratio. In terms of picture quality, there is basically no difference between the compressed image and the original image.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Color Television Systems (AREA)

Abstract

本文公开了一种图像处理方法,该方法包括:读取图像的每一帧;对每一帧图像,确定压缩该帧图像需要的颜色数量k,将该帧图像的各像素点的颜色值映射到颜色量化空间中,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间;根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理。

Description

一种图像处理方法和装置 技术领域
本文涉及但不限于图像处理技术领域,尤其涉及的是一种图像处理方法和装置。
背景技术
随着网络技术的发展,电脑、智能终端等各种应用中图像所占比例不断增大,尤其移动互联网呈现井喷式发展,网络通信中图像的传输与运用已经变得越来越频繁,同时用户对图像的清晰度的要求也越来越高。这使得图像在网络传输中所占比重不断增长,且图像所占有的存储空间也不断增大。
为了能有效地减少硬件存储以及网络传输带宽等方面的负担,同时不影响用户的客户体验,需要研究新的图像压缩算法。
发明内容
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
本文提供一种图像处理方法和装置,能够在保证图像具有较高的压缩率的同时还保证用户视觉上近似无损的视觉体验。
本发明实施例提供了一种图像处理方法,该方法包括:
读取图像的每一帧;
对每一帧图像,确定压缩该帧图像需要的颜色数量k,将该帧图像的各像素点的颜色值映射到颜色量化空间中,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间;
根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理。
可选地,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色 量化空间剖分为k个子空间,包括:
基于量化误差最小原则根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间。
可选地,所述基于量化误差最小原则根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间,包括:
a)使用一个垂直于任一坐标轴的平面来切割所述颜色量化空间,获得两个子空间,计算映射到每一个子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个子空间的像素点点阵的颜色值方差的和最小;
b)对切割后方差较大的子空间,使用与步骤a)中相同的方法对该子空间进行切割,生成两个小的子空间,计算映射到每一个小的子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个小的子空间的像素点点阵的颜色值方差的和最小;
c)如果切割次数小于k-1次,则重复执行步骤b);
d)将映射到每一个切割后的子空间的像素点点阵的颜色值均值作为该子空间的标准化颜色值。
可选地,根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理,包括:
将每一帧图像的像素点的颜色值替换为该像素点映射到的颜色量化子空间的标准化颜色值。
可选地,确定压缩该帧图像需要的颜色数量,包括:对该帧图像的像素点的颜色值进行聚类处理,将颜色距离值小于阈值的像素点聚为一类,每一类对应于一种代表色;将该帧图像对应的代表色的数量k作为该帧图像需要的颜色数量。
可选地,对该帧图像的像素点的颜色值进行聚类处理,包括:
a)找出图像中与周围像素点颜色距离最大且未被标记的像素点,将该像素点作为参考点,保留所述参考点的颜色;
b)对于步骤a)中找出的参考点,在图像中找出与之颜色距离小于阈值的 像素点,用所述参考点的颜色对该像素点进行标记;
c)对图像中未被标记的像素点重复步骤a)和b),直至图像中所有的像素点都被标记;
d)统计用于标记像素点的颜色种类k,所述k作为该帧图像需要的颜色数量。
可选地,将该帧图像的各像素点的颜色值映射到颜色量化空间中,包括:
建立三维颜色量化空间,所述三维颜色量化空间的每一个坐标轴分别对应于一个颜色分量;
将该帧图像的每一个像素点的颜色值映射到所述三维颜色量化空间中。
可选地,在根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理后,还包括:
为每一帧图像对应的颜色量化子空间的标准化颜色值分配索引;
重写每一帧图像的局部颜色表,在其中记录该帧图像的颜色量化子空间的标准化颜色值的索引和颜色值的对应关系。
可选地,所述图像为静态图像互换格式GIF图像或动态GIF图像。
本发明实施例提供了一种图像处理装置,包括:
图像输入模块,设置为读取图像的每一帧;
颜色量化处理模块,设置为对每一帧图像,确定压缩该帧图像需要的颜色数量k,将该帧图像的各像素点的颜色值映射到颜色量化空间中,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间;根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理。
可选地,颜色量化处理模块,是设置为采用以下方式根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间:
基于量化误差最小原则根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间。
可选地,颜色量化处理模块,是设置为采用以下方式基于量化误差最小 原则根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间:
a)使用一个垂直于任一坐标轴的平面来切割所述颜色量化空间,获得两个子空间,计算映射到每一个子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个子空间的像素点点阵的颜色值方差的和最小;
b)对切割后方差较大的子空间,使用与步骤a)中相同的方法对该子空间进行切割,生成两个小的子空间,计算映射到每一个小的子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个小的子空间的像素点点阵的颜色值方差的和最小;
c)如果切割次数小于k-1次,则重复执行步骤b);
d)将映射到每一个切割后的子空间的像素点点阵的颜色值均值作为该子空间的标准化颜色值。
可选地,颜色量化处理模块,是设置为采用以下方式根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理:
将每一帧图像的像素点的颜色值替换为该像素点映射到的颜色量化子空间的标准化颜色值。
可选地,颜色量化处理模块,是设置为采用以下方式确定压缩该帧图像需要的颜色数量:对该帧图像的像素点的颜色值进行聚类处理,将颜色距离值小于阈值的像素点聚为一类,每一类对应于一种代表色;将该帧图像对应的代表色的数量k作为该帧图像需要的颜色数量。
可选地,颜色量化处理模块,是设置为采用以下方式对该帧图像的像素点的颜色值进行聚类处理:
a)找出图像中与周围像素点颜色距离最大且未被标记的像素点,将该像素点作为参考点,保留所述参考点的颜色;
b)对于步骤a)中找出的参考点,在图像中找出与之颜色距离小于阈值的像素点,用所述参考点的颜色对该像素点进行标记;
c)对图像中未被标记的像素点重复步骤a)和b),直至图像中所有的像素 点都被标记;
d)统计用于标记像素点的颜色种类k,所述k作为该帧图像需要的颜色数量。
可选地,颜色量化处理模块,是设置为采用以下方式将该帧图像的各像素点的颜色值映射到颜色量化空间中:
建立三维颜色量化空间,所述三维颜色量化空间的每一个坐标轴分别对应于一个颜色分量;
将该帧图像的每一个像素点的颜色值映射到所述三维颜色量化空间中。
可选地,所述装置还包括:
图像输出模块,设置为在根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理后,为每一帧图像对应的颜色量化子空间的标准化颜色值分配索引;重写每一帧图像的局部颜色表,在其中记录该帧图像的颜色量化子空间的标准化颜色值的索引和颜色值的对应关系。
可选地,所述图像为静态图像互换格式GIF图像或动态GIF图像。
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被处理器执行时实现上述方法。
与相关技术相比,本发明实施例提供的一种图像处理方法和装置,能够在保证图像具有较高的压缩率的同时还保证用户视觉上近似无损的视觉体验,对于原图中有大量颜色渐变区域的图片,根据自适应算法确定每一帧图像的颜色量化空间,可以对图片进行适当压缩,避免压缩率过高导致图片失真,对于原图中没有大量颜色渐变区域的图片,根据自适应算法确定每一帧图像的颜色量化空间,能够提高压缩率,在图片质量方面,压缩后图片和原图基本上没有任何区别。
在阅读并理解了附图和详细描述后,可以明白其他方面。
附图概述
图1为本发明实施例的一种图像处理方法的流程图。
图2为本发明实施例的一种图像处理装置的结构示意图。
本发明的实施方式
下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。
如图1所示,本发明实施例提供了一种图像处理方法,该方法包括:
S10,读取图像的每一帧;
S20,对每一帧图像,确定压缩该帧图像需要的颜色数量k,将该帧图像的各像素点的颜色值映射到颜色量化空间中,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间;
S30,根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理;
可选地,所述图像为GIF(Graphics Interchange Format,图像互换格式)图像;
其中,GIF图像为:静态GIF或动态GIF。
可选地,读取图像的每一帧,包括:
读取每一帧图像的局部颜色表和各像素点的颜色索引,确定每一帧图像的各像素点的颜色值;
其中,对于GIF图像,还可以读取图像的全局颜色表;
其中,像素点的颜色值可以用三个颜色分量的三元组来表示,比如:{红(R)、绿(G)和蓝(B)};
其中,任一颜色分量值的取值范围为:0~255;
可选地,确定压缩该帧图像需要的颜色数量,包括:
对该帧图像的像素点的颜色值进行聚类处理,将颜色距离值小于阈值的像素点聚为一类,每一类对应于一种代表色;将该帧图像对应的代表色的数量k作为该帧图像需要的颜色数量。
可选地,对该帧图像的像素点的颜色值进行聚类处理,包括:
a)找出图像中与周围像素点颜色距离最大且未被标记的像素点,将该像素点作为参考点,保留所述参考点的颜色;
b)对于步骤a)中找出的参考点,在图像中找出与之颜色距离小于阈值的像素点,用所述参考点的颜色对该像素点进行标记;
c)对图像中未被标记的像素点重复步骤a)和b),直至图像中所有的像素点都被标记;
d)统计用于标记像素点的颜色种类k,所述k作为该帧图像需要的颜色数量;
其中,两个像素点之间的颜色距离计算方法如下:
Figure PCTCN2016079787-appb-000001
其中,c和c'表示图像中的两个像素点,L(c,c')是这两个像素点之间的颜色距离,Rc、Gc、Bc和Rc'、Gc'、Bc'分别表示两个像素点的三个颜色分量的值;
可选地,将该帧图像的各像素点的颜色值映射到颜色量化空间中,包括:
a)建立三维颜色量化空间,所述三维颜色量化空间的每一个坐标轴分别对应于一个颜色分量;
b)将该帧图像的每一个像素点的颜色值映射到所述三维颜色量化空间中;
其中,任一坐标轴的最小刻度为t;其中,t=2n,n为非负整数,n=0,1,2,3,4,…
可选地,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间,包括:
基于量化误差最小原则,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间;
其中,基于量化误差最小原则,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间,包括:
a)使用一个垂直于任一坐标轴的平面来切割所述颜色量化空间,获得两个子空间,计算映射到每一个子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个子空间的像素点点阵的颜色值方差的和最小;
b)对切割后方差较大的子空间,使用与步骤a)中相同的方法对该子空间进行切割,生成两个小的子空间,计算映射到每一个小的子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个小的子空间的像素点点阵的颜色值方差的和最小;
c)如果切割次数小于k-1次,则重复执行步骤b);
d)将映射到每一个切割后的子空间的像素点点阵的颜色值均值作为该子空间的标准化颜色值;
其中,假设任意一次空间剖分新生成两个空间(第一空间和第二空间),有n个像素点映射到第一空间中,有m个像素点映射到第二空间中,任意一个像素点i的颜色值用三个颜色分量的三元组(Ri,Gi,Bi)来表示;
则第一空间中像素点点阵的颜色值的均值E1和方差
Figure PCTCN2016079787-appb-000002
如下:
Figure PCTCN2016079787-appb-000003
Figure PCTCN2016079787-appb-000004
则第二空间中像素点点阵的颜色值的均值E2和方差
Figure PCTCN2016079787-appb-000005
如下:
Figure PCTCN2016079787-appb-000006
Figure PCTCN2016079787-appb-000007
则使得第一空间和第二空间的像素点点阵的颜色值方差之和最小的空间剖分位置即为此次空间剖分的最终结果。
可选地,根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理,包括:
将每一帧图像的像素点的颜色值替换为该像素点映射到的颜色量化子空间的标准化颜色值;
可选地,在根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理后,还包括:
为每一帧图像对应的颜色量化子空间的标准化颜色值分配索引;
重写每一帧图像的局部颜色表,在其中记录该帧图像的颜色量化子空间的标准化颜色值的索引和颜色值的对应关系。
如图2所示,本发明实施例提供了一种图像处理装置,包括:
图像输入模块,设置为读取图像的每一帧;
颜色量化处理模块,设置为对每一帧图像,确定压缩该帧图像需要的颜色数量k,将该帧图像的各像素点的颜色值映射到颜色量化空间中,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间;根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理;
可选地,所述图像为静态图像互换格式GIF图像或动态GIF图像;
可选地,读取图像的每一帧,包括:
读取每一帧图像的局部颜色表和各像素点的颜色索引,确定每一帧图像 的各像素点的颜色值;
其中,对于GIF图像,还可以读取图像的全局颜色表;
其中,像素点的颜色值可以用三个颜色分量的三元组来表示,比如:{红(R)、绿(G)和蓝(B)};
其中,任一颜色分量值的取值范围为:0~255;
可选地,颜色量化处理模块,是设置为采用以下方式确定压缩该帧图像需要的颜色数量k:对该帧图像的像素点的颜色值进行聚类处理,将颜色距离值小于阈值的像素点聚为一类,每一类对应于一种代表色;将该帧图像对应的代表色的数量k作为该帧图像需要的颜色数量。
可选地,颜色量化处理模块,是设置为采用以下方式对该帧图像的像素点的颜色值进行聚类处理:
a)找出图像中与周围像素点颜色距离最大且未被标记的像素点,将该像素点作为参考点,保留所述参考点的颜色;
b)对于步骤a)中找出的参考点,在图像中找出与之颜色距离小于阈值的像素点,用所述参考点的颜色对该像素点进行标记;
c)对图像中未被标记的像素点重复步骤a)和b),直至图像中所有的像素点都被标记;
d)统计用于标记像素点的颜色种类k,所述k作为该帧图像需要的颜色数量;
可选地,颜色量化处理模块,是设置为采用以下方式将该帧图像的各像素点的颜色值映射到颜色量化空间中:
a)建立三维颜色量化空间,所述三维颜色量化空间的每一个坐标轴分别对应于一个颜色分量;
b)将该帧图像的每一个像素点的颜色值映射到所述三维颜色量化空间中;
其中,任一坐标轴的最小刻度为t;其中,t=2n,n为非负整数,n=0,1,2,3,4,…
可选地,颜色量化处理模块,是设置为采用以下方式根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间:
基于量化误差最小原则,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间;
其中,颜色量化处理模块,是设置为采用以下方式基于量化误差最小原则,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间:
a)使用一个垂直于任一坐标轴的平面来切割所述颜色量化空间,获得两个子空间,计算映射到每一个子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个子空间的像素点点阵的颜色值方差的和最小;
b)对切割后方差较大的子空间,使用与步骤a)中相同的方法对该子空间进行切割,生成两个小的子空间,计算映射到每一个小的子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个小的子空间的像素点点阵的颜色值方差的和最小;
c)如果切割次数小于k-1次,则重复执行步骤b);
d)将映射到每一个切割后的子空间的像素点点阵的颜色值均值作为该子空间的标准化颜色值;
可选地,颜色量化处理模块,是设置为采用以下方式根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理:
将每一帧图像的像素点的颜色值替换为该像素点映射到的颜色量化子空间的标准化颜色值;
可选地,所述装置还包括:
图像输出模块,设置为在根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理后,为每一帧图像对应的颜色量化子空间的标准化颜色值分配索引;重写每一帧图像的局部颜色表,在其中记录该帧图像的颜色量化子空间的标准化颜色值的索引和颜色值的对应关系。
上述实施例提供的一种图片处理方法和装置,能够在保证图像具有较高的压缩率的同时还保证用户视觉上近似无损的视觉体验,对于原图中有大量颜色渐变区域的图片,根据自适应算法确定每一帧图像的颜色量化空间,可以对图片进行适当压缩,避免压缩率过高导致图片失真,对于原图中没有大量颜色渐变区域的图片,根据自适应算法确定每一帧图像的颜色量化空间,能够提高压缩率,在图片质量方面,压缩后图片和原图基本上没有任何区别。
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件(例如处理器)完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,例如通过集成电路来实现其相应功能,也可以采用软件功能模块的形式实现,例如通过处理器执行存储于存储器中的程序指令来实现其相应功能。本申请不限制于任何特定形式的硬件和软件的结合。
需要说明的是,本申请还可有其他多种实施例,在不背离本申请精神及其实质的情况下,熟悉本领域的技术人员可根据本申请作出各种相应的改变和变形,但这些相应的改变和变形都应属于本申请所附的权利要求的保护范围。
工业实用性
本发明实施例提供的技术方案,能够在保证图像具有较高的压缩率的同时还保证用户视觉上近似无损的视觉体验,对于原图中有大量颜色渐变区域的图片,根据自适应算法确定每一帧图像的颜色量化空间,可以对图片进行适当压缩,避免压缩率过高导致图片失真,对于原图中没有大量颜色渐变区域的图片,根据自适应算法确定每一帧图像的颜色量化空间,能够提高压缩率,在图片质量方面,压缩后图片和原图基本上没有任何区别。

Claims (18)

  1. 一种图像处理方法,该方法包括:
    读取图像的每一帧;
    对每一帧图像,确定压缩该帧图像需要的颜色数量k,将该帧图像的各像素点的颜色值映射到颜色量化空间中,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间;
    根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理。
  2. 如权利要求1所述的方法,其中:
    根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间,包括:
    基于量化误差最小原则根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间。
  3. 如权利要求2所述的方法,其中:
    所述基于量化误差最小原则根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间,包括:
    a)使用一个垂直于任一坐标轴的平面来切割所述颜色量化空间,获得两个子空间,计算映射到每一个子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个子空间的像素点点阵的颜色值方差的和最小;
    b)对切割后方差较大的子空间,使用与步骤a)中相同的方法对该子空间进行切割,生成两个小的子空间,计算映射到每一个小的子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个小的子空间的像素点点阵的颜色值方差的和最小;
    c)如果切割次数小于k-1次,则重复执行步骤b);
    d)将映射到每一个切割后的子空间的像素点点阵的颜色值均值作为该子 空间的标准化颜色值。
  4. 如权利要求3所述的方法,其中:
    根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理,包括:
    将每一帧图像的像素点的颜色值替换为该像素点映射到的颜色量化子空间的标准化颜色值。
  5. 如权利要求1-4中任一项所述的方法,其中:
    确定压缩该帧图像需要的颜色数量,包括:对该帧图像的像素点的颜色值进行聚类处理,将颜色距离值小于阈值的像素点聚为一类,每一类对应于一种代表色;将该帧图像对应的代表色的数量k作为该帧图像需要的颜色数量。
  6. 如权利要求5所述的方法,其中:
    对该帧图像的像素点的颜色值进行聚类处理,包括:
    a)找出图像中与周围像素点颜色距离最大且未被标记的像素点,将该像素点作为参考点,保留所述参考点的颜色;
    b)对于步骤a)中找出的参考点,在图像中找出与之颜色距离小于阈值的像素点,用所述参考点的颜色对该像素点进行标记;
    c)对图像中未被标记的像素点重复步骤a)和b),直至图像中所有的像素点都被标记;
    d)统计用于标记像素点的颜色种类k,所述k作为该帧图像需要的颜色数量。
  7. 如权利要求1或2或3或4所述的方法,其中:
    将该帧图像的各像素点的颜色值映射到颜色量化空间中,包括:
    建立三维颜色量化空间,所述三维颜色量化空间的每一个坐标轴分别对应于一个颜色分量;
    将该帧图像的每一个像素点的颜色值映射到所述三维颜色量化空间中。
  8. 如权利要求1或2或3或4所述的方法,其中:
    在根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理后,还包括:
    为每一帧图像对应的颜色量化子空间的标准化颜色值分配索引;
    重写每一帧图像的局部颜色表,在其中记录该帧图像的颜色量化子空间的标准化颜色值的索引和颜色值的对应关系。
  9. 如权利要求1或2或3或4所述的方法,其中:
    所述图像为静态图像互换格式GIF图像或动态GIF图像。
  10. 一种图像处理装置,包括:
    图像输入模块,设置为读取图像的每一帧;
    颜色量化处理模块,设置为对每一帧图像,确定压缩该帧图像需要的颜色数量k,将该帧图像的各像素点的颜色值映射到颜色量化空间中,根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间;根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理。
  11. 如权利要求10所述的装置,其中:
    颜色量化处理模块,是设置为采用以下方式根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间:
    基于量化误差最小原则根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间。
  12. 如权利要求11所述的装置,其中:
    颜色量化处理模块,是设置为采用以下方式基于量化误差最小原则根据压缩该帧图像需要的颜色数量k将该帧图像映射到的颜色量化空间剖分为k个子空间:
    a)使用一个垂直于任一坐标轴的平面来切割所述颜色量化空间,获得两个子空间,计算映射到每一个子空间中的像素点点阵的颜色值均值和方差, 寻找一个平面,使得切割后形成的两个子空间的像素点点阵的颜色值方差的和最小;
    b)对切割后方差较大的子空间,使用与步骤a)中相同的方法对该子空间进行切割,生成两个小的子空间,计算映射到每一个小的子空间中的像素点点阵的颜色值均值和方差,寻找一个平面,使得切割后形成的两个小的子空间的像素点点阵的颜色值方差的和最小;
    c)如果切割次数小于k-1次,则重复执行步骤b);
    d)将映射到每一个切割后的子空间的像素点点阵的颜色值均值作为该子空间的标准化颜色值。
  13. 如权利要求12所述的装置,其中:
    颜色量化处理模块,是设置为采用以下方式根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理:
    将每一帧图像的像素点的颜色值替换为该像素点映射到的颜色量化子空间的标准化颜色值。
  14. 如权利要求10-13中任一项所述的装置,其中:
    颜色量化处理模块,是设置为采用以下方式确定压缩该帧图像需要的颜色数量:对该帧图像的像素点的颜色值进行聚类处理,将颜色距离值小于阈值的像素点聚为一类,每一类对应于一种代表色;将该帧图像对应的代表色的数量k作为该帧图像需要的颜色数量。
  15. 如权利要求14所述的装置,其中:
    颜色量化处理模块,是设置为采用以下方式对该帧图像的像素点的颜色值进行聚类处理:
    a)找出图像中与周围像素点颜色距离最大且未被标记的像素点,将该像素点作为参考点,保留所述参考点的颜色;
    b)对于步骤a)中找出的参考点,在图像中找出与之颜色距离小于阈值的像素点,用所述参考点的颜色对该像素点进行标记;
    c)对图像中未被标记的像素点重复步骤a)和b),直至图像中所有的像素点都被标记;
    d)统计用于标记像素点的颜色种类k,所述k作为该帧图像需要的颜色数量。
  16. 如权利要求10或11或12或13所述的装置,其中:
    颜色量化处理模块,是设置为采用以下方式将该帧图像的各像素点的颜色值映射到颜色量化空间中:
    建立三维颜色量化空间,所述三维颜色量化空间的每一个坐标轴分别对应于一个颜色分量;
    将该帧图像的每一个像素点的颜色值映射到所述三维颜色量化空间中。
  17. 如权利要求10或11或12或13所述的装置,其中:
    所述装置还包括:
    图像输出模块,设置为在根据每一帧图像对应的剖分后的颜色量化空间对该帧图像进行颜色量化处理后,为每一帧图像对应的颜色量化子空间的标准化颜色值分配索引;重写每一帧图像的局部颜色表,在其中记录该帧图像的颜色量化子空间的标准化颜色值的索引和颜色值的对应关系。
  18. 如权利要求10或11或12或13所述的装置,其中:
    所述图像为静态图像互换格式GIF图像或动态GIF图像。
PCT/CN2016/079787 2015-06-09 2016-04-20 一种图像处理方法和装置 WO2016197705A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510314143.4 2015-06-09
CN201510314143.4A CN106296757A (zh) 2015-06-09 2015-06-09 一种图像处理方法和装置

Publications (1)

Publication Number Publication Date
WO2016197705A1 true WO2016197705A1 (zh) 2016-12-15

Family

ID=57503033

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/079787 WO2016197705A1 (zh) 2015-06-09 2016-04-20 一种图像处理方法和装置

Country Status (2)

Country Link
CN (1) CN106296757A (zh)
WO (1) WO2016197705A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110580691A (zh) * 2019-09-09 2019-12-17 京东方科技集团股份有限公司 图像的动态处理方法、装置、设备及计算机可读存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783776B (zh) * 2019-01-22 2023-04-07 北京数科网维技术有限责任公司 一种适用于文本文档的生成式图像压缩方法及装置
CN111787386A (zh) * 2020-06-01 2020-10-16 深圳市战音科技有限公司 动画压缩、显示方法、设备、动画处理***及存储介质
CN113538220A (zh) * 2021-07-16 2021-10-22 北京天马时空网络技术有限公司 一种渐变半透明图片的处理方法及装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101065779A (zh) * 2004-04-21 2007-10-31 喷流数据有限公司 彩色图像编码的方法、***和软件产品
CN102129693A (zh) * 2011-03-15 2011-07-20 清华大学 基于色彩直方图和全局对比度的图像视觉显著性计算方法
CN103065153A (zh) * 2012-12-17 2013-04-24 西南科技大学 一种基于色彩量化和聚类的视频关键帧提取方法

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100484244C (zh) * 2007-06-04 2009-04-29 北京派瑞根科技开发有限公司 一种基于像素统计特征和视觉特征的图像编解码处理方法
CN103366178B (zh) * 2012-03-30 2017-12-29 北京百度网讯科技有限公司 一种用于对目标图像进行颜色分类的方法与设备
CN102842032B (zh) * 2012-07-18 2015-07-22 郑州金惠计算机***工程有限公司 基于多模式组合策略的移动互联网色情图像识别方法
CN102881026B (zh) * 2012-08-15 2015-01-07 大连理工大学 一种具有透明度信息的图像的调色板装置与生成方法
CN104281849B (zh) * 2013-07-03 2017-09-19 广州盖特软件有限公司 一种布料图像颜色特征提取方法
CN104063562B (zh) * 2014-07-14 2017-03-22 南京大学 一种基于色彩聚类的乱针绣铺底绣稿生成方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101065779A (zh) * 2004-04-21 2007-10-31 喷流数据有限公司 彩色图像编码的方法、***和软件产品
CN102129693A (zh) * 2011-03-15 2011-07-20 清华大学 基于色彩直方图和全局对比度的图像视觉显著性计算方法
CN103065153A (zh) * 2012-12-17 2013-04-24 西南科技大学 一种基于色彩量化和聚类的视频关键帧提取方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110580691A (zh) * 2019-09-09 2019-12-17 京东方科技集团股份有限公司 图像的动态处理方法、装置、设备及计算机可读存储介质

Also Published As

Publication number Publication date
CN106296757A (zh) 2017-01-04

Similar Documents

Publication Publication Date Title
US9697416B2 (en) Object detection using cascaded convolutional neural networks
CN110348294B (zh) Pdf文档中图表的定位方法、装置及计算机设备
JP5996013B2 (ja) 立体画像の視差マップ推定のための方法,装置及びコンピュータプログラム製品
WO2016197705A1 (zh) 一种图像处理方法和装置
CN110363753B (zh) 图像质量评估方法、装置及电子设备
CN109977952B (zh) 基于局部最大值的候选目标检测方法
CN112069339A (zh) 背景图片处理及搜索结果展示方法、装置、设备和介质
CN110597900B (zh) 一种gdb数据实时按需生成矢量切片的方法
US20210306389A1 (en) Method for separating local and remote content in a camera-projector based collaborative system
US10540811B2 (en) Radial gradient module
CN111918065A (zh) 一种信息压缩/解压缩方法及装置
CN111179370B (zh) 一种图片生成方法、装置、电子设备及存储介质
CN115984856A (zh) 文档图像矫正模型的训练方法、文档图像的矫正方法
US8824778B2 (en) Systems and methods for depth map generation
CN109272526B (zh) 图像处理方法、***及电子设备
US8908964B2 (en) Color correction for digital images
CN109615620B (zh) 图像压缩度识别方法、装置、设备及计算机可读存储介质
CN113469147B (zh) 答题卡识别方法、装置、电子设备以及存储介质
CN109615668B (zh) 基于分量的数字图像同步
US9959672B2 (en) Color-based dynamic sub-division to generate 3D mesh
CN113516697A (zh) 图像配准的方法、装置、电子设备及计算机可读存储介质
CN109685861B (zh) 图片压缩方法、装置、设备及计算机可读存储介质
US20160309061A1 (en) Computer product, image processing method, display method, image processing apparatus, and information processing apparatus
US10354125B2 (en) Photograph processing method and system
CN115953597B (zh) 图像处理方法、装置、设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16806603

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16806603

Country of ref document: EP

Kind code of ref document: A1