WO2016119667A1 - 图像处理方法及装置 - Google Patents

图像处理方法及装置 Download PDF

Info

Publication number
WO2016119667A1
WO2016119667A1 PCT/CN2016/072040 CN2016072040W WO2016119667A1 WO 2016119667 A1 WO2016119667 A1 WO 2016119667A1 CN 2016072040 W CN2016072040 W CN 2016072040W WO 2016119667 A1 WO2016119667 A1 WO 2016119667A1
Authority
WO
WIPO (PCT)
Prior art keywords
component
pixel
group
pixels
groups
Prior art date
Application number
PCT/CN2016/072040
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
Priority claimed from CN201610045646.0A external-priority patent/CN105828079B/zh
Application filed by 同济大学, 中兴通讯股份有限公司 filed Critical 同济大学
Priority to EP21176363.6A priority Critical patent/EP3893191A1/en
Priority to EP16742729.3A priority patent/EP3252706A4/en
Publication of WO2016119667A1 publication Critical patent/WO2016119667A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals

Definitions

  • the present invention relates to the field of digital video compression coding and decoding systems, and in particular to an image processing method and apparatus.
  • the natural form of a digital video signal of an image is a sequence of images.
  • a frame of image is usually a rectangular area composed of several pixels, and a digital video signal is a sequence of video images composed of tens of frames to thousands of frames of images, sometimes simply referred to as a video sequence or sequence.
  • Encoding a digital video signal encodes a frame by frame image. At any one time, the image of the frame being encoded is referred to as the current encoded image.
  • decoding a compressed video stream of a digital video signal (referred to as a bitstream, also referred to as a bitstream) is decoding a stream of one frame by one image.
  • the image of the frame being decoded is referred to as the current decoded image.
  • the current encoded image or the currently decoded image is collectively referred to as the current image.
  • encoding a video image sequence is to encode one CU for each coding unit of each frame image, that is, CU.
  • the CU being coded is referred to as the current coded CU.
  • decoding the code stream of a video image sequence is also decoding one CU for each CU of each frame image, and finally reconstructing the entire video image sequence.
  • the CU being decoded is referred to as the currently decoded CU.
  • the current coding CU or the current decoding CU is collectively referred to as the current CU.
  • each CU in one frame of image can be different, some are 8 ⁇ 8, some are 64 ⁇ 64, etc. .
  • LCUs Large Coding Units
  • N N ⁇ N pixels
  • CTU Coding Tree Unit
  • One of the LCUs is composed of three 32 ⁇ 32 pixel CUs and four 16 ⁇ 16 pixel CUs, so that seven CUs in a tree structure constitute one CTU.
  • the other LCU is composed of two 32 ⁇ 32 pixel CUs, three 16 ⁇ 16 pixel CUs, and 20 8 ⁇ 8 pixel CUs.
  • Such 25 CUs in a tree structure constitute another CTU.
  • Encoding one frame of image is to sequentially encode one CU in one CTU.
  • LCU is synonymous with CTU.
  • the CU can also be further divided into sub-areas.
  • the sub-areas include, but are not limited to, a prediction unit (PU), a transform unit (TU), and an asymmetric partition (AMP).
  • PU prediction unit
  • TU transform unit
  • AMP asymmetric partition
  • a color pixel is usually composed of three components.
  • the two most commonly used pixel color formats are the GBR color format consisting of a green component, a blue component, and a red component, and a YUV color consisting of a luma component and two chroma components.
  • the format commonly known as the YUV color format, actually includes multiple color formats, such as the YCbCr color format. Therefore, when encoding a CU, a CU can be divided into three component planes (G plane, B plane, R plane or Y plane, U plane, V plane), and the three component planes are respectively coded; The three component bundles of one pixel are combined into one 3-tuple, and the CUs composed of these 3-tuples are encoded as a whole.
  • the arrangement of the former pixel and its components is called the planar format of the image (and its CU), and the arrangement of the latter pixel and its components is called the stacked format of the image (and its CU). Format).
  • the GBR color format and the YUV color format of the pixel are both 3-component representation formats of the pixel.
  • the value of a pixel can also be represented by the index of the palette.
  • the palette space stores the value or approximate value of the three components of the pixel that needs to be represented.
  • the address of the palette is called the index of the pixel stored in this address.
  • An index can represent one component of a pixel, and an index can also represent three components of a pixel.
  • the palette can be one or more. In the case of multiple palettes, a complete index is actually composed of the palette number and the index of the numbered palette.
  • the index representation format of a pixel is to represent this pixel with an index.
  • the index representation format of a pixel is also referred to as an indexed color or a pseudo color representation format of a pixel in the prior art, or is often referred to directly as an indexed pixel or a pseudo pixel (pseudo pixel). ) or pixel index or index. Indexes are sometimes referred to as indices.
  • the representation of a pixel in its index representation format is also referred to as indexing or indexing.
  • CMYK presentation formats Other commonly used prior art pixel representation formats include CMYK presentation formats and grayscale representation formats.
  • the YUV color format can be subdivided into several seed formats according to whether the chroma component is downsampled: a YUV 4:4:4 pixel color format consisting of 1 Y component, 1 U component, and 1 V component.
  • the left and right adjacent pixels are composed of 2 Y components, 1 U component, and 1 V component in a YUV 4:2:2 pixel color format; the left and right adjacent 4 pixels arranged in a 2 ⁇ 2 spatial position are composed of YUV4:2:0 pixel color format consisting of 4 Y components, 1 U component, and 1 V component.
  • a component is generally represented by a number of 8 to 16 bits.
  • the YUV4:2:2 pixel color format and the YUV4:2:0 pixel color format are all downsampled for the YUV4:4:4 pixel color format.
  • a pixel component is also referred to as a pixel sample or simply as a sample.
  • the most basic element when encoding or decoding can be one pixel, one pixel component, or one pixel index (ie, index pixel).
  • a pixel or a pixel component or an index pixel, which is the most basic element of encoding or decoding, is collectively referred to as a pixel sample, sometimes referred to as a pixel value, or simply as a sample.
  • a coding block or a decoding block is an area composed of a plurality of pixel values.
  • the shape of the codec block may be a rectangle, a square, a parallelogram, a trapezoid, a polygon, a circle, an ellipse, and the like.
  • a rectangle also includes a rectangle whose width or height is one pixel value that degenerates into a line (ie, a line segment or a line shape).
  • each codec block may have a different shape and size.
  • some or all of the codec blocks may overlap each other, or all codec blocks may not overlap each other.
  • a codec block may be composed of "pixels”, or may be composed of “components of pixels”, or may be composed of "index pixels”, or may be composed of a mixture of the three, or any of the three. Mixed composition.
  • a codec block refers to an area in which encoding or decoding is performed in a frame image, including but not limited to at least one of the following: a maximum coding unit LCU, a coding tree unit CTU, and a coding unit CU. a sub-region of the CU, a prediction unit PU, and a transform unit TU.
  • Existing video image compression techniques include: prediction mode (including but not limited to intra prediction and inter prediction) and copy mode (including but not limited to block copy, index copy, micro block copy, strip copy, string copy, rectangle copy , point copy).
  • copy is the optimal matching pixel that the copy encoder searches for. Therefore, from the perspective of the encoder, the copy mode is also called the matching mode (including but not limited to block matching, index matching, microblock matching, bar matching, string matching, rectangle matching, point matching).
  • a palette is generated and constructed from the pixels of the current codec block (referred to as the current block), and some or all of the pixels of the current block are converted into a tone.
  • Swatch pixels which are converted to an index of palette pixels, and then search for and copy pixels (or equivalent pixel indices) in the converted pixels (or equivalently in the pixel index).
  • the present invention provides an image processing method and apparatus to solve at least the problem of the related art that cannot convert any pixel other than the current block into a palette pixel of the current block.
  • an image processing method comprising at least the step of converting an arbitrary pixel into a palette pixel, wherein the conversion method comprises at least the steps of: palette pixels (or equivalently, pixels) Indexing is divided into K groups according to a predetermined rule; for any pixel, determining that the arbitrary pixels are classified into one of the K groups, the group is regarded as an optimal group; and determining, in the optimal group, the arbitrary pixels are converted into One of the palette pixels in the optimal group, the palette pixel being the optimal palette pixel.
  • the palette pixels are divided into K groups according to characteristics of predetermined pixel values; for any pixel samples, the conversion manner includes at least the following steps: according to the predetermined pixels a characteristic of the value and a value of the arbitrary pixel sample, the arbitrary pixel sample is classified into one of the K groups, the group is regarded as an optimal group; and the arbitrary pixel sample is calculated and the most Determining a distance between some or all of the palette pixel samples in the optimal group, determining a palette pixel value that is optimal for the distance, and determining the determined palette pixel value as the arbitrary pixel sample value The palette of pixel values.
  • the distance is an error between pixels.
  • the predetermined pixel value is characterized by a numerical magnitude of the three components of the pixel.
  • the first component, the second component, and the third component are respectively a Y component, a U component, and a V component; or, the first component, the second component, and the third component a component, which is a Y component, a V component, and a U component, respectively; or, the first component, the second component, and the third component are a G component, a B component, and an R component, respectively; or Number component, the second component, the third component, respectively, the number of different values among the three components is the most a large component, the number of different values among the three components is the second component, and the number of different values among the three components is the smallest component; or, the first component, the second component, the third component, They are the components with the smallest number of different values among the three components, and the number of different values among the three components is the second component, and the number of different values among the three components is the largest component.
  • the component when grouping a group into a next level, if the number of different values in the component corresponding to the level in the group is 1, then dividing the component into one group is no longer subdivided, and the next level is still There is only one group, otherwise (ie, the number of different values is greater than 1), the component is divided into 2 groups of the next level.
  • the component when grouping a group into a next level, if the number of different values in the component corresponding to the layer in the group is N, the component is grouped into N groups.
  • the method further includes: if the arbitrary pixels cannot be classified into any one of the K groups Grouping, the input pixels are classified into an empty group; after the arbitrary pixels are classified into the empty group, the optimal palette pixels are set to the arbitrary pixels themselves or empty pixels or default values.
  • the arbitrary pixel comprises an input pixel of the input.
  • an image processing method comprising: determining a corresponding pixel in a palette pixel corresponding to an input input pixel, wherein the input pixel includes the palette pixel a pixel; converting the input pixel into the corresponding pixel in the palette pixel.
  • determining the corresponding pixel in the palette pixel corresponding to the input pixel comprises: dividing the palette pixel into K groups, wherein K is a positive integer; determining that the input pixel is a group into which the K group belongs; determining the corresponding pixel in a group into which the input pixel belongs.
  • dividing the palette pixels into K groups comprises: dividing the palette pixels into K groups according to characteristics of input pixel samples; determining that the input pixels are classified in the K group The group includes: determining, according to a characteristic of the input pixel sample and the input pixel sample, a group into which the input pixel belongs in the K group; determining the in the group into which the input pixel belongs Corresponding pixels include: determining a difference between samples of the input pixel and some or all of the palette pixels in the group into which the input pixel belongs; determining a minimum difference from the input pixel The swatch pixels are the corresponding pixels.
  • dividing the palette pixels into K groups according to characteristics of the input pixel samples comprises: dividing the palette pixels into K groups according to characteristics of numerical magnitudes of components of the pixels.
  • the method includes at least one of the following: the first component is any one of a Y component, a U component, and a V component, or is any one of a G component, a B component, and an R component;
  • the second component is any component other than the first component of the Y component, the U component, and the V component, or any component other than the first component of the G component, the B component, and the R component;
  • the third component It is a component other than the first component and the second component of the Y component, the U component, and the V component, or a component other than the first component and the second component of the G component, the B component, and the R component.
  • the method includes one of: the first component, the second component, and the third component, respectively a Y component, a U component, and a V component; the first component, the second component a component, the third component, respectively a Y component, a V component, a U component; the first component, the second component, and the third component, respectively, a G component, a B component, and an R component;
  • the first component, the second component, and the third component are the components with the largest number of different values among the three components, and the number of different values among the three components is the second component, and the three components are different.
  • the number of values is the smallest component; the first component, the second component, and the third component are respectively the components with the smallest number of different values among the three components, and the number of different values among the three components is The second component, the number of different values among the three components is the largest component; wherein the three components are the G component, the B component, the R component, or the three components are the G component, the B component, and the R component.
  • the subdivision into several groups in the next level is determined according to the number of different values in the components corresponding to the hierarchy in the group.
  • the component when grouping a group into a next level, if the number of different values in the component corresponding to the layer in the group is 1, the component is grouped into one group in the next level; otherwise, the group is Divided into two or more groups in the next level.
  • the component when grouping a group into a next level, if the number of different values in the component corresponding to the layer in the group is N, the component is grouped into N next levels.
  • the method further includes: if the input pixels cannot be classified into any one of the K groups, classifying the input pixels An empty group; after the input pixel is classified into the empty group, the palette pixel corresponding to the input pixel is set as the input pixel itself or an empty pixel or a default value.
  • an image processing apparatus comprising: a determination module configured to determine a corresponding pixel in a palette pixel corresponding to an input input pixel, wherein the input pixel comprises the toning a pixel other than the plate pixel; a conversion module configured to convert the input pixel into the corresponding pixel in the palette pixel.
  • a corresponding pixel corresponding to an input input pixel in a palette pixel is determined, wherein the input pixel includes a pixel other than the palette pixel; and the input pixel is converted into the color The corresponding pixel in the panel pixel.
  • the invention solves the problem that the pixel in the related art cannot convert any pixel other than the current block into the palette pixel of the current block, thereby achieving the realization of converting any pixel other than the current block into the palette pixel of the current block.
  • the purpose is to improve the effect of compression efficiency.
  • FIG. 1 is a schematic diagram of a conversion method according to an embodiment of the present invention.
  • FIG. 2 is a schematic flow chart of a conversion mode according to an embodiment of the present invention.
  • FIG. 3 is a flow chart of an image processing method according to an embodiment of the present invention.
  • FIG. 4 is a block diagram showing the structure of an image processing apparatus according to an embodiment of the present invention.
  • the main technical feature in the embodiment of the present invention is that when any pixel (the arbitrary pixel includes an input input pixel) is converted into a palette pixel, the palette pixel is first divided into several groups, and then, for an arbitrary pixel, Determining which group the arbitrary pixels belong to, and determining which of the palette pixels in the group is determined in the determined group.
  • the palette pixel may be first divided into a plurality of first hierarchical groups, and then some or all of the first hierarchical groups may be grouped into It is subdivided into several second-level groups in one step, and so on, and finally into several L-level groups.
  • first determine which of the first hierarchical groups the arbitrary pixels belong to determine which second hierarchical group the arbitrary pixels belong to, and so on, and finally determine which of the Lths the arbitrary pixels belong to.
  • Hierarchical group it is determined in the determined Lth hierarchical group which of the palette pixels of the set are converted into any of the pixels.
  • the palette pixels (represented by black solid dots in FIG. 1) may be first divided into groups according to one component of the pixel (FIG. 1). Two groups are drawn in the middle, and each group (two groups are drawn in Fig. 1) is subdivided into groups according to another component of the pixel (two groups are drawn in Fig. 1). For an arbitrary pixel (indicated by a hollow dot in Figure 1), it is first determined which group it belongs to, and then which of the palette pixels in the group is determined in the determined group.
  • FIG. 2 is a schematic flowchart of a conversion mode according to an embodiment of the present invention. As shown in FIG. 2, the conversion manner in the embodiment includes at least the following steps:
  • the palette pixels (or equivalently, the pixel index) are divided into K groups according to the characteristics of the predetermined pixel values; for an arbitrary pixel sample, the conversion method includes at least the following steps:
  • the distance in Embodiment 1 is an error between pixels.
  • the feature of the predetermined pixel value in Embodiment 1 is a feature of the numerical magnitude of the three components of the pixel.
  • the first component in the fourth embodiment, the second component, and the third component are respectively a Y component, a U component, and a V component;
  • the component of the first component, the component of the second component, and the component of the third component are respectively a Y component, a V component, and a U component;
  • the component of the first component, the component of the second component, and the component of the third component are respectively a G component, a B component, and an R component;
  • the first component, the second component, and the third component are respectively components in which the number of different values among the three components is the largest (denoted as N1), and the number of different values among the three components is the second.
  • the component (denoted as N2), the number of different values among the three components is the smallest (denoted as N3) component, that is, N1 ⁇ N2 ⁇ N3.
  • a palette has the following 8 pixels, of which 3 components from left to right are the Y component, the U component, and the V component:
  • the first component, the second component, and the third component are respectively components in which the number of different values among the three components is the smallest (denoted as N1), and the number of different values among the three components is the second.
  • the component (denoted as N2), the number of different values among the three components is the largest (denoted as N3) component, that is, N1 ⁇ N2 ⁇ N3.
  • the subdivided into several groups is determined according to the number of different values in the components corresponding to the hierarchy in the group.
  • the seventh embodiment when grouping a group into a next level, if the number of different values in the component corresponding to the layer in the group is 1, the group is divided into one group, that is, no further subdivision, the next level There is still only one group, otherwise (ie, the number of different values is greater than 1), the component is divided into 2 groups of the next level.
  • the grouping of the first layer is performed in the 0th layer group (i.e., the palette)
  • the number of different values in the U component is 8, so the 0th layer component is 8
  • the 1-layer group has pixels ⁇ P0, P1, P2, P3 ⁇ and ⁇ P4, P5, P6, P7 ⁇ .
  • the two first layer groups are each divided into two second layer groups. There are pixels ⁇ P0, P2 ⁇ , ⁇ P1, P3 ⁇ , ⁇ P4, P5 ⁇ , ⁇ P6, P7 ⁇ .
  • the number of different values in the V component of one group is 2, so the one second layer component is divided into two third layer groups, and the other three groups are The number of different values in the V component is 1, so the three second layer groups are no longer subdivided, and each has only one third layer group, and there are five third layer groups in total, each having a pixel ⁇ P0 ⁇ , ⁇ P2 ⁇ , ⁇ P1, P3 ⁇ , ⁇ P4, P5 ⁇ , ⁇ P6, P7 ⁇ .
  • the components are grouped into N groups.
  • the two first layer groups are respectively divided into one second layer group and four second layer groups.
  • the second layer group has pixels ⁇ P0 ⁇ , ⁇ P2 ⁇ , ⁇ P1, P3, P4 ⁇ , ⁇ P5 ⁇ , ⁇ P6, P7 ⁇ .
  • the number of different values in the U component is 1, 1, 3, 1, 2, respectively, so the five second layer groups are respectively divided into 1, 1, 3, 1, 2 tier 3 groups, a total of 8 tier 3 groups, with pixels ⁇ P0 ⁇ , ⁇ P2 ⁇ , ⁇ P1 ⁇ , ⁇ P3 ⁇ , ⁇ P4 ⁇ , ⁇ P5 ⁇ , ⁇ P6 ⁇ , ⁇ P7 ⁇ .
  • the optimal group corresponding to the pixel is set as an empty group. That is, the arbitrary pixels cannot be classified into any one group, and thus cannot be converted into palette pixels.
  • the optimal palette pixel is set as the pixel itself or the empty pixel or the default value, wherein the empty pixel indicates that the pixel in the empty group cannot be converted into the color. Board pixels.
  • FIG. 3 is a flowchart of an image processing method according to an embodiment of the present invention. As shown in FIG. 3, the process includes the following steps:
  • Step S302 determining a corresponding pixel in the palette pixel corresponding to the input input pixel, wherein the input pixel includes a pixel other than the palette pixel;
  • Step S304 converting the input pixel into the corresponding pixel in the palette pixel.
  • the input pixels other than the palette pixels can also be converted into pixels in the palette pixels, thereby effectively increasing the compression ratio of the image.
  • the invention solves the problem that the pixel in the related art cannot convert any pixel other than the current block into the palette pixel of the current block, thereby achieving the realization of converting any pixel other than the current block into the palette pixel of the current block.
  • the purpose is to improve the effect of compression efficiency.
  • the palette pixels when determining corresponding pixels corresponding to the input pixels, may be grouped, including: dividing the palette pixels into K groups, where K is a positive integer; Determining the group into which the input pixels belong in the K group; determining the corresponding pixel in the group into which the input pixel belongs.
  • dividing the palette pixel into the K group comprises: dividing the palette pixel into K groups according to characteristics of the input pixel samples; determining that the input pixels are classified in the K group
  • the group includes: determining, according to the characteristics of the input pixel sample and the input pixel sample, the group into which the input pixel belongs in the K group (eg, selecting a feature that differs from the input pixel sample by less than a predetermined value)
  • the group in which the pixels are located is a group into which the input pixels belong; determining the corresponding pixels in the group into which the input pixels belong includes: determining some or all of the palettes in the group into which the input pixels and the input pixels belong The difference between the samples between the pixels; determining that a palette pixel having the smallest difference from the input pixel is the corresponding pixel.
  • dividing the palette pixels into K groups according to the characteristics of the input pixel samples includes: The feature of the numerical magnitude of the component divides the above palette pixels into K groups. For example, the values of the components of the pixels may be grouped in descending order, or the values of the components of the pixels may be grouped in ascending order, and the number of pixels in each group may be set to be similar, that is, two groups. The difference between the numbers is less than a predetermined threshold.
  • one or more groupings may be performed according to the components of the pixels.
  • the coloring is performed according to the characteristics of the numerical values of the components of the pixels.
  • the division of the panel pixels into the K group includes: dividing the palette pixels into K groups according to the numerical value of the one component of the components of the pixels (ie, grouping the palette pixels only once);
  • the palette pixels are divided into L groups according to the numerical value of the one component in the components of the pixel, wherein the L groups are the first layer group, L is a positive integer; and the second component in the component according to the pixel
  • the numerical value divides the pixels of the xth group in the first layer group into M (x) groups, wherein the pixels of the xth group in the first layer group are divided into groups as the second layer group.
  • K M(1)+M(2)+...+M(x) (ie, toning according to the first component
  • the panel pixels are divided into groups first, and then the grouped group is further divided according to the second component, that is, the palette pixels are grouped twice;
  • the pixels of the palette are divided into one group according to the numerical value of the one component of the components of the pixel, wherein the I group is a first layer group, and I is a positive integer; according to the components of the pixel
  • the above method further includes at least one of the following:
  • the first component is any one of the Y component, the U component, and the V component, or any one of the G component, the B component, and the R component;
  • the second component is any component other than the first component of the Y component, the U component, and the V component, or any component other than the first component of the G component, the B component, and the R component;
  • the third component is a component other than the first component and the second component of the Y component, the U component, and the V component, or a component other than the first component and the second component of the G component, the B component, and the R component.
  • the above method comprises one of the following:
  • the first component, the second component, and the third component are the Y component, the U component, and the V component, respectively;
  • the first component, the second component, and the third component are the Y component, the V component, and the U component;
  • the first component, the second component, and the third component are the G component, the B component, and the R component, respectively;
  • the first component, the second component, and the third component are the components with the largest number of different values among the three components, and the number of different values among the three components is the second component, and the number of different values among the three components is the smallest.
  • the first component, the second component, and the third component are the components with the smallest number of different values among the three components, and the number of different values among the three components is the second component, and the number of different values among the three components is the largest.
  • the three components are the G component, the B component, and the R component, or the three components are the G component, the B component, and the R component.
  • the component when grouping a group into a next level, if the number of different values in the component corresponding to the layer in the group is 1, the component is grouped into one group in the next level. Otherwise, the component is divided into two or more groups in the next level.
  • the component when grouping a group into a next level, if the number of different values in the component corresponding to the layer in the group is N, then the component is grouped into N next levels. .
  • the method further comprises: if the input pixels cannot be classified into any one of the K groups (for example, the input pixels and the color palette) The pixels in the panel pixel have a large difference), and the input pixel is classified into an empty group; after the input pixel is classified into the empty group, the tone corresponding to the input pixel is adjusted
  • the swatch pixels are set to the above input pixels themselves or to empty pixels or default values.
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present invention which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • module may implement a combination of software and/or hardware of a predetermined function.
  • apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
  • FIG. 4 is a block diagram showing the structure of an image processing apparatus according to an embodiment of the present invention. As shown in FIG. 4, the apparatus includes a determining module 42 and a converting module 44, which will be described below.
  • the determining module 42 is configured to determine a corresponding pixel in the palette pixel corresponding to the input input pixel, wherein the input pixel includes a pixel other than the palette pixel; and the conversion module 44 is connected to the determining module 42 and configured to The above input pixels are converted into corresponding pixels in the palette pixels.
  • the following operations may be performed: grouping the palette pixels, including: dividing the palette pixel into K groups Where K is a positive integer; determining the group into which the input pixels are grouped in the K group; determining the corresponding pixel in the group into which the input pixel belongs.
  • the following operations may be performed: dividing the palette pixels into K groups according to the characteristics of the input pixel samples; determining input The group into which the pixels belong in the K group includes: determining a group into which the input pixels are classified in the K group according to the characteristics of the input pixel samples and the input pixel samples (for example, selecting and The group of pixels in which the characteristics of the input pixel samples differ by less than the predetermined value is the group into which the input pixels belong; determining the corresponding pixels in the group into which the input pixels belong includes: determining that the input pixels and the input pixels are included The difference between the samples of some or all of the palette pixels in the group; determining that a palette pixel having the smallest difference from the input pixel is the corresponding pixel.
  • the determining module 42 may group the palette pixels in a plurality of manners.
  • the determining module 42 may perform one or more groupings according to the components of the pixels when grouping the palette pixels. In this embodiment, according to the numerical value of the components of the pixels.
  • the feature dividing the palette pixels into K groups includes: dividing the palette pixels into K groups according to the numerical value of the one component of the components of the above pixels (ie, only grouping the palette pixels once);
  • the palette pixels are divided into L groups according to the numerical value of the one component in the components of the pixel, wherein the L groups are the first layer group, L is a positive integer; and the second component in the component according to the pixel
  • the numerical value divides the pixels of the xth group in the first layer group into M (x) groups, wherein the pixels of the xth group in the first layer group are divided into groups as the second layer group.
  • K M(1)+M(2)+...+M(x) (ie, toning according to the first component
  • the panel pixels are divided into groups first, and then the grouped group is further divided according to the second component, that is, the palette pixels are grouped twice;
  • the pixels of the palette are divided into one group according to the numerical value of the one component of the components of the pixel, wherein the I group is a first layer group, and I is a positive integer; according to the components of the pixel
  • At least one of the following is included:
  • the first component is any one of the Y component, the U component, and the V component, or any one of the G component, the B component, and the R component;
  • the second component is any component other than the first component of the Y component, the U component, and the V component, or any component other than the first component of the G component, the B component, and the R component;
  • the third component is a component other than the first component and the second component of the Y component, the U component, and the V component, or a component other than the first component and the second component of the G component, the B component, and the R component.
  • the first component, the second component, and the third component are the Y component, the U component, and the V component, respectively;
  • the first component, the second component, and the third component are the Y component, the V component, and the U component;
  • the first component, the second component, and the third component are the G component, the B component, and the R component, respectively;
  • the first component, the second component, and the third component are the components with the largest number of different values among the three components, and the number of different values among the three components is the second component, and the number of different values among the three components is the smallest.
  • the first component, the second component, and the third component are the components with the smallest number of different values among the three components, and the number of different values among the three components is the second component, and the number of different values among the three components is the largest.
  • the three components are the G component, the B component, and the R component, or the three components are the G component, the B component, and the R component.
  • the component when grouping a group into a next level, if the number of different values in the component corresponding to the layer in the group is 1, the component is grouped into one group in the next level. Otherwise, the component is divided into two or more groups in the next level.
  • the component when grouping a group into a next level, if the number of different values in the component corresponding to the layer in the group is N, then the component is grouped into N next levels. .
  • the image processing apparatus further includes a processing module configured to, after dividing the palette pixels into K groups, if the input pixels cannot be classified into any one of the K groups (eg, The input pixel is greatly different from the pixel in the palette pixel, and the input pixel is classified into an empty group; after the input pixel is classified into the empty group, the color matching corresponding to the input pixel is performed.
  • the board pixels are set to the above input pixels themselves or to empty pixels or default values.
  • each of the above modules may be implemented by software or hardware.
  • the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the modules are located in multiple In the processor.
  • Embodiments of the present invention also provide a storage medium.
  • the foregoing storage medium may be configured to store program code for performing the following steps:
  • the foregoing storage medium may include, but is not limited to, a USB flash drive, a Read-Only Memory (ROM), and a Random Access Memory (RAM).
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • the processor performs the operation steps in the foregoing method embodiments according to the stored program code in the storage medium.
  • modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • an image processing method and apparatus provided by an embodiment of the present invention have the following beneficial effects: solving the problem of the related art that cannot convert any pixel other than the current block into a palette pixel of the current block. Further, the object of converting the arbitrary pixels other than the current block into the palette pixels of the current block is achieved, and the effect of the compression efficiency is improved.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

本发明提供了一种图像处理方法及装置,其中,该方法包括:确定调色板像素中与输入的输入像素对应的对应像素,其中,所述输入像素包括所述调色板像素之外的像素;将所述输入像素转换成所述调色板像素中的所述对应像素。通过本发明,解决了相关技术中存在的无法将当前块之外的任意像素转换为当前块的调色板像素的问题,进而达到了实现将当前块之外的任意像素转换成当前块的调色板像素的目的,提高了压缩效率的效果。

Description

图像处理方法及装置 技术领域
本发明涉及数字视频压缩编码及解码系统领域,具体而言,涉及一种图像处理方法及装置。
背景技术
随着电视机和显示器进入超高清(4K)和特超高清(8K)的分辨率,以及以远程桌面为典型表现形式的新一代云计算与信息处理模式及平台的发展和普及,对视频图像数据压缩的需求也走向更高分辨率和包含摄像机摄取图像和计算机屏幕图像的复合图像。对视频图像进行超高压缩比和极高质量的数据压缩成为必不可少的技术。
充分利用4K/8K图像和计算机屏幕图像的特点,对视频图像进行超高效率的压缩,也是正在制定中的最新国际视频压缩标准高效率视频编码(High Efficiency Video Coding,简称为HEVC)和其他若干国际标准、国内标准、行业标准的一个主要目标。
图像的数字视频信号的自然形式是图像的序列。一帧图像通常是由若干像素组成的矩形区域,而数字视频信号就是由几十帧至成千上万帧图像组成的视频图像序列,有时也简称为视频序列或序列。对数字视频信号进行编码就是对一帧一帧图像进行编码。在任一时刻,正在编码中的那一帧图像称为当前编码图像。同样,对数字视频信号的压缩后的视频码流(简称码流也称为比特流)进行解码就是对一帧一帧图像的码流进行解码。在任一时刻,正在解码中的那一帧图像称为当前解码图像。当前编码图像或当前解码图像都统称为当前图像。
在几乎所有视频图像编码的国际标准如MPEG(运动图像专家组,Motion Picture Experts Group,简称为)-1/2/4,H.264/AVC(先进视频编码,Advanced Video Codec)以及高效率视频编码(High Efficiency Video Coding,简称为HEVC)中,对一帧图像进行编码(以及相应的解码)时,把一帧图像划分成若干块M×M像素的子图像,称为编码块(从解码的角度也就是解码块,统称为编解码块)或“编码单元(Coding Unit,简称为CU)”,以CU为基本编码单位,对子图像一块一块进行编码。常用的M的大小是4,8,16,32,64。因此,对一个视频图像序列进行编码就是对各帧图像的各个编码单元即CU依次一个一个CU进行编码。在任一时刻,正在编码中的CU称为当前编码CU。同样,对一个视频图像序列的码流进行解码也是对各帧图像的各个CU依次一个一个CU进行解码,最终重构出整个视频图像序列。在任一时刻,正在解码中的CU称为当前解码CU。当前编码CU或当前解码CU统称为当前CU。
为适应一帧图像内各部分图像内容与性质的不同,有针对性地进行最有效的编码,一帧图像内各CU的大小可以是不同的,有的是8×8,有的是64×64,等等。为了使不同大小的CU能够无缝拼接起来,一帧图像总是先划分成大小完全相同具有N×N像素的“最大编码单元(Largest Coding Unit,简称为LCU)”,然后每个LCU再进一步划分成树状结构的多个大小不 一定相同的CU。因此,LCU也称为“编码树单元(Coding Tree Unit,简称为CTU)”。例如,一帧图像先划分成大小完全相同的64×64像素的LCU(N=64)。其中某个LCU由3个32×32像素的CU和4个16×16像素的CU构成,这样7个成树状结构的CU构成一个CTU。而另一个LCU由2个32×32像素的CU、3个16×16像素的CU和20个8×8像素的CU构成。这样25个成树状结构的CU构成另一个CTU。对一帧图像进行编码,就是依次对一个一个CTU中的一个一个CU进行编码。在HEVC国际标准中,LCU与CTU是同义词。
CU也可以再进一步被划分成若干子区域。子区域包括但不限于预测单元(Prediction Unit,简称为PU),变换单元(Transform Unit,简称为TU),不对称划分(AMP)的区域。
一个彩色像素通常由3个分量(component)组成。最常用的两种像素色彩格式(pixel color format)是由绿色分量、蓝色分量、红色分量组成的GBR色彩格式和由一个亮度(luma)分量及两个色度(chroma)分量组成的YUV色彩格式,通称为YUV的色彩格式实际包括多种色彩格式,如YCbCr色彩格式。因此,对一个CU进行编码时,可以把一个CU分成3个分量平面(G平面、B平面、R平面或Y平面、U平面、V平面),对3个分量平面分别进行编码;也可以把一个像素的3个分量捆绑组合成一个3元组,对由这些3元组组成的CU整体进行编码。前一种像素及其分量的排列方式称为图像(及其CU)的平面格式(planar format),而后一种像素及其分量的排列方式称为图像(及其CU)的叠包格式(packed format)。像素的GBR色彩格式和YUV色彩格式都是像素的3分量表现格式。
除了像素的3分量表现格式,像素的另一种常用的现有技术的表现格式是调色板索引表现格式。在调色板索引表现格式中,一个像素的数值也可以用调色板的索引来表现。调色板空间中存储了需要被表现的像素的3个分量的数值或近似数值,调色板的地址被称为这个地址中存储的像素的索引。一个索引可以表现像素的一个分量,一个索引也可以表现像素的3个分量。调色板可以是一个,也可以是多个。在多个调色板的情形,一个完整的索引实际上由调色板编号和该编号的调色板的索引两部分组成。像素的索引表现格式就是用索引来表现这个像素。像素的索引表现格式在现有技术中也被称为像素的索引颜色(indexed color)或仿颜色(pseudo color)表现格式,或者常常被直接称为索引像素(indexed pixel)或仿像素(pseudo pixel)或像素索引或索引。索引有时也被称为指数。把像素用其索引表现格式来表现也称为索引化或指数化。
其他的常用的现有技术的像素表现格式包括CMYK表现格式和灰度表现格式。
YUV色彩格式又可根据是否对色度分量进行下采样再细分成若干种子格式:1个像素由1个Y分量、1个U分量、1个V分量组成的YUV4:4:4像素色彩格式;左右相邻的2个像素由2个Y分量、1个U分量、1个V分量组成的YUV4:2:2像素色彩格式;左右上下相邻按2×2空间位置排列的4个像素由4个Y分量、1个U分量、1个V分量组成的YUV4:2:0像素色彩格式。一个分量一般用1个8~16比特的数字来表示。YUV4:2:2像素色彩格式和YUV4:2:0像素色彩格式都是对YUV4:4:4像素色彩格式施行色度分量的下采样得到。一个像素分量也称为一个像素样值(pixel sample)或简单地称为一个样值(sample)。
编码或解码时的最基本元素可以是一个像素,也可以是一个像素分量,也可以是一个像素索引(即索引像素)。作为编码或解码的最基本元素的一个像素或一个像素分量或一个索引像素统称为一个像素样值,有时也通称为一个像素值,或简单地称为一个样值。
在本发明和本发明专利申请中,“像素样值”、“像素值”、“样值”、“索引像素”、“像素索引”是同义词,根据上下文,可以明确是表示“像素”还是表示“一个像素分量”还是表示“索引像素”或者同时表示三者之任一。如果从上下文不能明确,那么就是同时表示三者之任一。
在本发明和本发明专利申请中,编码块或解码块(统称为编解码块)是由若干像素值组成的一个区域。编解码块的形状可以是矩形、正方形、平行四边形、梯形、多边形、圆形、椭圆形及其他各种形状。矩形也包括宽度或高度为一个像素值的退化为线(即线段或线形)的矩形。一帧图像中,各个编解码块可以具有各不相同的形状和大小。一帧图像中,某些或全部编解码块可以有互相重叠部分,也可以所有编解码块都互不重叠。一个编解码块,可以由“像素”组成,也可以由“像素的分量”组成,也可以由“索引像素”组成,也可以由这3者混合组成,也可以由这3者中之任意2种混合组成。从视频图像编码或解码的角度,编解码块是指一帧图像中对其施行编码或解码的一个区域,包括但不限于以下至少一种:最大编码单元LCU、编码树单元CTU、编码单元CU、CU的子区域、预测单元PU、变换单元TU。
现有的视频图像压缩技术包括:预测方式(包括但不限于帧内预测和帧间预测)和复制方式(包括但不限于块复制、索引复制、微块复制、条复制、串复制、矩形复制、点复制)。这里“复制”是复制编码器搜索到的最优匹配像素。因此,从编码器的角度,复制方式也称为匹配方式(包括但不限于块匹配、索引匹配、微块匹配、条匹配、串匹配、矩形匹配、点匹配)。
现有使用调色板和像素索引的复制方式的一个重要特征是从当前编解码块(简称为当前块)的像素中产生和构造一个调色板,把当前块的部分或全部像素转换为调色板像素,即转换为调色板像素的索引,然后在转换后的像素(或等价地在像素索引)中搜索和复制像素(或等价的像素索引)。
现有使用调色板和像素索引的复制方式,仅在当前块中进行搜索和复制,压缩效率较低。而要把调色板和像素索引的复制方式的搜索和复制的范围扩展到当前块之外以提高压缩效率,首先要解决如何把当前块之外的任意像素转换为当前块的调色板像素的问题。
因此,必须寻求低复杂度又高效的转换方式,把任意像素转换为调色板像素,以提高压缩效果。
发明内容
本发明提供了一种图像处理方法及装置,以至少解决相关技术中存在的无法将当前块之外的任意像素转换为当前块的调色板像素的问题。
根据本发明的一个方面,提供了一种图像处理方法,至少包括将任意像素转换为调色板像素的步骤,其中,转换方式至少包括如下步骤:将调色板像素(或等价地,像素索引)根据预定的规则分成K组;对任意像素,确定所述任意像素归入所述K组之一,将该组作为最优组;在所述最优组中确定所述任意像素转换成所述最优组中的调色板像素之一,将该调色板像素作为最优调色板像素。
可选地,把所述调色板像素(或等价地,像素索引)根据预定的像素数值的特征分成K组;对任意像素样值,转换方式至少包括下列步骤:根据所述预定的像素数值的特征和所述任意像素样值的数值,将所述任意像素样值归入所述K组中的一组,将该组作为最优组;计算所述任意像素样值与所述最优组中的部分或全部调色板像素样值之间的距离,确定一个所述距离最优的调色板像素样值,将确定的调色板像素样值作为所述任意像素样值对应的调色板像素样值。
可选地,所述距离是像素之间的误差。
可选地,所述预定的像素数值的特征是像素的3个分量的数值大小的特征。
可选地,根据所述3个分量的数值大小的特征对所述调色板像素(或等价地,像素索引)进行分组的方式如下:根据像素的一号分量的数值大小(从大到小)把所述调色板(称为第0层组)的像素分成I个组(都称为第1层组),I个组中的像素数目(或等价地,像素索引数目)尽量接近;对I个第1层组中的每一个组,根据像素的二号分量的数值大小(从大到小)把该第1层组(记为第i组,i=1,2,3,……,I)的像素分成J(i)个组(都称为第2层组),J(i)个组中的像素数目(或等价地,像素索引数目)尽量接近;这样,所述调色板像素(或等价地,像素索引)被分成J=J(1)+J(2)+J(3)+……+J(I)个第2层组;对这J个第2层组中的每一个组,根据像素的三号分量的数值大小(从大到小)把该组(记为第j组,j=1,2,3,……,J)的像素分成K(j)个组(都称为第3层组),K(j)个组中的像素数目(或等价地,像素索引数目)尽量接近;这样,所述调色板像素(或等价地,像素索引)最终被分成K=K(1)+K(2)+K(3)+……+K(J)个第3层组;所述一号分量,所述二号分量,所述三号分量,分别与所述第1层组,所述第2层组,所述第3层组相对应,即根据所述一号分量,所述二号分量,所述三号分量,分别产生所述第1层组,所述第2层组,所述第3层组。
可选地,所述I、J(i)、K(j)具有下列规则之一:规则1:所有J(i)都相等于J0,因而J=I×J0;规则2:所有K(j)都相等于K0,因而K=J×K0;规则3:所有J(i)都相等于J0并且所有K(j)都相等于K0,因而J=I×J0并且K=I×J0×K0;规则4:I=2,所有J(i)都相等于2并且所有K(j)都相等于2,因而J=4并且K=8;规则5:I=4,所有J(i)都相等于4并且所有K(j)都相等于2,因而J=16并且K=32。
可选地,所述一号分量,所述二号分量,所述三号分量,分别是Y分量,U分量,V分量;或者,所述一号分量,所述二号分量,所述三号分量,分别是Y分量,V分量,U分量;或者,所述一号分量,所述二号分量,所述三号分量,分别是G分量,B分量,R分量;或者,所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最 大的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最小的分量;或者,所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最小的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最大的分量。
可选地,对一个组进行下一层次的分组时,根据该组中与层次对应的分量中不同数值的数目来确定细分成几个组。
可选地,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为1,则把该组分成1个组即不再细分,下一层次仍然只有一个组,否则(即不同数值的数目大于1),则把该组分成2个下一层次的组。
可选地,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为N,则把该组分成N个组。
可选地,在将调色板像素(或等价地,像素索引)根据预定的规则分成K组之后,所述方法还包括:如果所述任意像素不能归入所述K组中的任何一组,将所述输入像素归入空组;在将所述任意像素归入所述空组后,将所述最优调色板像素设置为所述任意像素本身或空像素或默认值。
可选地,所述任意像素包括输入的输入像素。
根据本发明的另一方面,还提供了一种图像处理方法,包括:确定调色板像素中与输入的输入像素对应的对应像素,其中,所述输入像素包括所述调色板像素之外的像素;将所述输入像素转换成所述调色板像素中的所述对应像素。
可选地,确定所述调色板像素中与所述输入像素对应的所述对应像素包括:将所述调色板像素分为K组,其中,K为正整数;确定所述输入像素在所述K组中所归入的组;在所述输入像素所归入的组中确定所述对应像素。
可选地,将所述调色板像素分为K组包括:根据输入像素样值的特征将所述调色板像素分成K组;确定所述输入像素在所述K组中所归入的组包括:根据所述输入像素样值的特征和所述输入像素样值确定所述输入像素在所述K组中所归入的组;在所述输入像素所归入的组中确定所述对应像素包括:确定所述输入像素与所述输入像素所归入的组中的部分或全部调色板像素之间的样值的差值;确定一个与所述输入像素的差值最小的调色板像素为所述对应像素。
可选地,根据输入像素样值的特征将所述调色板像素分成K组包括:根据像素的分量的数值大小的特征将所述调色板像素分成K组。
可选地,根据所述像素的分量的数值大小的特征将所述调色板像素分成K组包括:根据所述像素的分量中的一号分量的数值大小把所述调色板像素分成K个组;或者,根据所述像素的分量中的一号分量的数值大小把所述调色板像素分成L个组,其中,所述L个组作为第 1层组,L为正整数;根据所述像素的分量中的二号分量的数值大小将所述第1层组中的第x个组的像素分成M(x)个组,其中,所述第1层组中的第x个组的像素所分成的组作为第2层组,x=1,2,3,……,I,M(x)为正整数,K=M(1)+M(2)+……+M(x);或者,根据所述像素的分量中的一号分量的数值大小把所述调色板的像素分成I个组,其中,所述I个组作为第1层组,I为正整数;根据所述像素的分量中的二号分量的数值大小将所述第1层组中的第i个组的像素分成J(i)个组,其中,i=1,2,3,……,I,J(i)为正整数,所述第1层组中的第i个组的像素所分成的组作为第2层组,所述调色板像素被分成J=J(1)+J(2)+J(3)+……+J(I)个第2层组;根据所述像素的分量中的三号分量的数值大小将所述第2层组中的第j个组的的像素分成K(j)个组,其中,j=1,2,3,……,J,K(j)为正整数,所述第2层组中的第j个组的像素所分成的组作为第3层组,所述调色板像素被分成K=K(1)+K(2)+K(3)+……+K(J)个第3层组。
可选地,所述方法包括以下至少之一:所述K个组中的各组像素的数目彼此之间相差小于第四预定阈值;所述L个组中的各组像素的数目彼此之间相差小于第五预定阈值;所述M(x)个组中的各组像素的数目彼此之间相差小于第六预定阈值;所述I个组中的各组像素数目彼此之间相差小于第一预定阈值;所述J(i)个组中的各组像素数目彼此之间相差小于第二预定阈值;所述K(j)个组中的各组像素数目彼此之间相差小于第三预定阈值;I=2,所有J(i)都等于2并且所有K(j)都等于2,J=4并且K=8;I=4,所有J(i)都等于4并且所有K(j)都等于2,J=16并且K=32。
可选地,所述方法包括以下至少之一:所述一号分量为Y分量,U分量,V分量中的任一个分量,或者为G分量,B分量,R分量中的任一个分量;所述二号分量为Y分量,U分量,V分量中除一号分量外的任一个分量,或者为G分量,B分量,R分量中除一号分量外的任一个分量;所述三号分量为Y分量,U分量,V分量中除一号分量和二号分量外的分量,或者为G分量,B分量,R分量中除一号分量和二号分量外的分量。
可选地,所述方法包括以下之一:所述一号分量,所述二号分量,所述三号分量,分别是Y分量,U分量,V分量;所述一号分量,所述二号分量,所述三号分量,分别是Y分量,V分量,U分量;所述一号分量,所述二号分量,所述三号分量,分别是G分量,B分量,R分量;所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最大的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最小的分量;所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最小的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最大的分量;其中,所述3个分量为G分量,B分量,R分量,或者所述3个分量为G分量,B分量,R分量。
可选地,对一个组进行下一层次的分组时,根据该组中与层次对应的分量中不同数值的数目来确定细分成下一层次中的几个组。
可选地,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为1,则把该组分成1个下一层次中的组;否则把该组分成2个以上下一层次中的组。
可选地,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为N,则把该组分成N个下一层次中的组。
可选地,在将所述调色板像素分为K组之后,所述方法还包括:如果所述输入像素不能归入所述K组中的任何一组,则将所述输入像素归入空组;在将所述输入像素归入所述空组后,将所述输入像素对应的调色板像素设置为所述输入像素本身或空像素或默认值。
根据本发明的另一方面,提供了一种图像处理装置,包括:确定模块,设置为确定调色板像素中与输入的输入像素对应的对应像素,其中,所述输入像素包括所述调色板像素之外的像素;转换模块,设置为将所述输入像素转换成所述调色板像素中的所述对应像素。
通过本发明,采用确定调色板像素中与输入的输入像素对应的对应像素,其中,所述输入像素包括所述调色板像素之外的像素;将所述输入像素转换成所述调色板像素中的所述对应像素。解决了相关技术中存在的无法将当前块之外的任意像素转换为当前块的调色板像素的问题,进而达到了实现将当前块之外的任意像素转换成当前块的调色板像素的目的,提高了压缩效率的效果。
附图说明
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1是根据本发明实施例的转换方式的示意图;
图2是根据本发明实施例的转换方式的流程示意图;
图3是根据本发明实施例的图像处理方法的流程图;
图4是根据本发明实施例的图像处理装置的结构框图。
具体实施方式
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
本发明实施例中的主要技术特征是在把任意像素(该任意像素包括输入的输入像素)转换为调色板像素时,首先将调色板像素分成若干组,然后,对一个任意像素,先确定所述任意像素归入哪一组,再在确定的那一组中确定所述任意像素转换成该组中的哪一个调色板像素。
可选地,可以首先将调色板像素分成若干个第1层次组,再将部分或全部第1层次组进 一步细分成若干个第2层次组,依此类推,最后细分成若干个第L层次组。对一个任意像素,先确定该任意像素归入哪一个第1层次组,再确定所述任意像素归入哪一个第2层次组,依此类推,最后确定所述任意像素归入哪一个第L层次组。最终,在确定的那一个第L层次组中确定所述任意像素转换成该组中的哪一个调色板像素。
图1是根据本发明实施例的转换方式的示意图,在对任意像素进行转换之前,可以首先将调色板像素(图1中用黑实心点表示)按照像素的一个分量分成多组(图1中画出两组),再将每组(图1中共画出两组)按照像素的另一个分量细分成多组(图1中画出两组)。对一个任意像素(图1中用空心点表示),先确定其归入哪一组,再在确定的那一组中确定其转换成该组中的哪一个调色板像素。
以上通过若干特定的具体实例说明本发明的技术特征。本领域技术人员可由本说明书所揭示的内容轻易地了解本发明的其他优点与功效。本发明还可以通过另外不同的具体实施方式加以实施或应用,本说明书中的各项细节也可以基于不同观点与应用,在不背离本发明的精神下进行各种修饰或改变。
图2是根据本发明实施例的转换方式的流程示意图,如图2所示,该实施例中的转换方式至少包括如下步骤:
S202,将调色板像素(或等价地,像素索引)根据预定的规则分成K组(K通常取值1≤K≤16,K=1等同于不分组);该K组不一定是排他的,即同一调色板像素可能分入不同的组;该K组也不一定是完备的,即可能有调色板像素不分入任何一组;
S204,对一个任意像素,确定所述任意像素归入所述K组之一,称该组为最优组,即,将该组作为最优组;
S206,在该最优组中确定上述任意像素转换成最优组中的调色板像素之一,称该调色板像素为最优调色板像素,即,将该调色板像素作为与任意像素(例如,输入像素)对应的调色板像素。
以上所提供的图示仅以示意方式说明本发明的基本构想,图示中仅显示与本发明直接有关的组件而非按照实际实施时的组件数目、形状及尺寸绘制,其实际实施时各组件的型态、数量及比例可为一种随意的改变,且其组件布局型态也可能更为复杂。
以下是本发明的更多的实施细节和变体。
转换方式的实施例1
把所述调色板像素(或等价地,像素索引)根据预定的像素数值的特征分成K组;对一个任意像素样值,转换方式至少包括下列步骤:
根据上述预定的像素数值的特征和所述任意像素样值的数值确定所述任意像素样值归入所述K组中的一组,即确定最优组;
计算所述任意像素样值与所述最优组中的部分或全部调色板像素样值之间的距离,确定 一个所述距离最优的调色板像素样值,即确定最优调色板像素样值。
转换方式的实施例2
实施例1中的所述距离是像素之间的误差。
转换方式的实施例3
实施例1中的所述预定的像素数值的特征是像素的3个分量的数值大小的特征。
转换方式的实施例4
根据实施例3中的所述3个分量的数值大小的特征对所述调色板像素(或等价地,像素索引)进行分组的方式如下:首先,根据像素的一号分量的数值大小(从大到小)把所述调色板(称为第0层组)的像素分成I个组(都称为第1层组),I个组中的像素数目(或等价地,像素索引数目)尽量接近;其次,对I个第1层组中的每一个组,根据像素的二号分量的数值大小(从大到小)把该第1层组(记为第i组,i=1,2,3,……,I)的像素分成J(i)个组(都称为第2层组),J(i)个组中的像素数目(或等价地,像素索引数目)尽量接近;这样,所述调色板像素(或等价地,像素索引)被分成J=J(1)+J(2)+J(3)+……+J(I)个第2层组;最后,对这J个第2层组中的每一个组,根据像素的三号分量的数值大小(从大到小)把该组(记为第j组,j=1,2,3,……,J)的像素分成K(j)个组(都称为第3层组),K(j)个组中的像素数目(或等价地,像素索引数目)尽量接近;这样,所述调色板像素(或等价地,像素索引)最终被分成K=K(1)+K(2)+K(3)+……+K(J)个第3层组;所述一号分量,所述二号分量,所述三号分量,分别与所述第1层组,所述第2层组,所述第3层组相对应,即根据所述一号分量,所述二号分量,所述三号分量,分别产生所述第1层组,所述第2层组,所述第3层组。
转换方式的实施例5
实施例4中的I、J(i)、K(j)具有下列规则之一:
1)所有J(i)都相等于J0,因而J=I×J0;
2)所有K(j)都相等于K0,因而K=J×K0;
3)所有J(i)都相等于J0并且所有K(j)都相等于K0,因而J=I×J0并且K=I×J0×K0;
4)I=2,所有J(i)都相等于2并且所有K(j)都相等于2,因而J=4并且K=8;
5)I=4,所有J(i)都相等于4并且所有K(j)都相等于2,因而J=16并且K=32。
转换方式的实施例6
实施例4中的所述一号分量,所述二号分量,所述三号分量,分别是Y分量,U分量,V分量;
或者,所述一号分量,所述二号分量,所述三号分量,分别是Y分量,V分量,U分量;
或者,所述一号分量,所述二号分量,所述三号分量,分别是G分量,B分量,R分量;
或者,所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最大(记为N1)的分量,3个分量中不同数值的数目为其次(记为N2)的分量,3个分量中不同数值的数目为最小(记为N3)的分量,即N1≥N2≥N3。例如,一个调色板有下列8个像素,其中从左到右3个分量分别是Y分量、U分量、V分量:
P0=(32,74,125)
P1=(33,75,128)
P2=(32,76,128)
P3=(33,77,128)
P4=(33,78,128)
P5=(34,79,128)
P6=(35,80,128)
P7=(35,81,128)
Y分量中不同数值的数目是4,U分量中不同数值的数目是8,V分量中不同数值的数目是2。因此,所述一号分量,所述二号分量,所述三号分量,分别是U分量,Y分量,和V分量,N1=8,N2=4,N3=2;
或者,所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最小(记为N1)的分量,3个分量中不同数值的数目为其次(记为N2)的分量,3个分量中不同数值的数目为最大(记为N3)的分量,即N1≤N2≤N3。继续上面的例,所述一号分量,所述二号分量,所述三号分量,分别是V分量,Y分量,和U分量,N1=2,N2=4,N3=8。
转换方式的实施例7
实施例4和6中对一个组进行下一层次的分组时,根据该组中与层次对应的分量中不同数值的数目来确定细分成几个组。
转换方式的实施例8
实施例7中,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为1,则把该组分成1个组即不再细分,下一层次仍然只有一个组,否则(即不同数值的数目大于1),则把该组分成2个下一层次的组。继续实施例6中的例,在第0层组(即所述调色板)中进行第1层的分组时,U分量中不同数值的数目为8,所以将第0层组分成8个第1层组,分别有像素{P0,P1,P2,P3}和{P4,P5,P6,P7}。其次,在这2个第1层组中,Y分量中不同数值的数目为2和3,所以将这2个第1层组分别都分成2个第2层组,分 别有像素{P0,P2},{P1,P3},{P4,P5},{P6,P7}。最后,在这4个第2层组中,有1个组的V分量中不同数值的数目都为2,所以将这1个第2层组分成2个第3层组,另外3个组的V分量中不同数值的数目都为1,所以对这3个第2层组不再细分,分别都只有1个第3层组,总共有5个第3层组,分别有像素{P0},{P2},{P1,P3},{P4,P5},{P6,P7}。
转换方式的实施例9
实施例7中,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为N,则把该组分成N个组。继续实施例6中的最后的例(所述一号分量,所述二号分量,所述三号分量,分别是V分量,Y分量,和U分量,N1=2,N2=4,N3=8),在第0层组(即所述调色板)中进行第1层的分组时,V分量中不同数值的数目为2,所以将第0层组分成2个第1层组,分别有像素{P0}和{P1,P2,P3,P4,P5,P6,P7}。其次,在这2个第1层组中,Y分量中不同数值的数目为1和4,所以将这2个第1层组分别分成1个第2层组和4个第2层组共5个第2层组,分别有像素{P0},{P2},{P1,P3,P4},{P5},{P6,P7}。最后,在这5个第2层组中,U分量中不同数值的数目分别为1,1,3,1,2,所以将这5个第2层组分别分成1,1,3,1,2个第3层组,总共有8个第3层组,分别有像素{P0},{P2},{P1},{P3},{P4},{P5},{P6},{P7}。
转换方式的实施例10
可选地,当所述任意像素不能归入所述K组中的一组时,将该像素对应的最优组设置为空组。即所述任意像素不能归入任何一组,因而也不能转换为调色板像素。
可选地,对于最优组是空组的像素,将其最优调色板像素设置为该像素本身或空像素或默认值,其中,空像素表示该空组中的像素不能转换为调色板像素。
在本实施例中还提供了一种图像处理方法,图3是根据本发明实施例的图像处理方法的流程图,如图3所示,该流程包括如下步骤:
步骤S302,确定调色板像素中与输入的输入像素对应的对应像素,其中,所述输入像素包括所述调色板像素之外的像素;
步骤S304,将所述输入像素转换成所述调色板像素中的所述对应像素。
通过上述步骤,在对图像进行压缩之前,可以将调色板像素之外的输入像素也转换成调色板像素中的像素,有效提高图像的压缩率。解决了相关技术中存在的无法将当前块之外的任意像素转换为当前块的调色板像素的问题,进而达到了实现将当前块之外的任意像素转换成当前块的调色板像素的目的,提高了压缩效率的效果。
在一个可选的实施例中,在确定与输入像素对应的对应像素时,可以对调色板像素进行分组,包括:将所述调色板像素分为K组,其中,K为正整数;确定上述输入像素在该K组中所归入的组;在上述输入像素所归入的组中确定对应像素。
在一个可选的实施例中,将上述调色板像素分为K组包括:根据输入像素样值的特征将上述调色板像素分成K组;确定输入像素在所述K组中所归入的组包括:根据上述输入像素样值的特征和所述输入像素样值确定所述输入像素在所述K组中所归入的组(例如,选择与输入像素样值的特征相差小于预定值的像素所在的组为输入像素所归入的组);在上述输入像素所归入的组中确定对应像素包括:确定上述输入像素与输入像素所归入的组中的部分或全部调色板像素之间的样值的差值;确定一个与该输入像素的差值最小的调色板像素为上述对应像素。
其中,在对调色板像素进行分组的分组方式可以有多种,下面对如何进行分组进行举例说明:根据输入像素样值的特征将所述调色板像素分成K组包括:根据像素的分量的数值大小的特征将上述调色板像素分成K组。例如,可以按照像素的分量的数值由大到小的顺序进行分组,或者按照像素的分量的数值由小到大的顺序进行分组,每组中的像素的数量可以设置为相似,即两两组别之间的数量相差小于预定阈值。
在一个可选的实施例中,在对调色板像素进行分组时,可以按照像素的分量进行一次或多次分组,在本实施例中,根据上述像素的分量的数值大小的特征将调色板像素分成K组包括:根据上述像素的分量中的一号分量的数值大小把调色板像素分成K个组(即,只对调色板像素分一次组);
或者,根据像素的分量中的一号分量的数值大小把调色板像素分成L个组,其中,该L个组作为第1层组,L为正整数;根据像素的分量中的二号分量的数值大小将上述第1层组中的第x个组的像素分成M(x)个组,其中,该第1层组中的第x个组的像素所分成的组作为第2层组,x=1,2,3,……,I,M(x)为正整数,K=M(1)+M(2)+……+M(x)(即,按照一号分量对调色板像素先分一次组,再按照二号分量对分组后的组进行进一步划分,即对调色板像素进行了两次分组);
或者,根据上述像素的分量中的一号分量的数值大小把调色板的像素分成I个组,其中,该I个组作为第1层组,I为正整数;根据上述像素的分量中的二号分量的数值大小将第1层组中的第i个组的像素分成J(i)个组,其中,i=1,2,3,……,I,J(i)为正整数,该第1层组中的第i个组的像素所分成的组作为第2层组,上述调色板像素被分成J=J(1)+J(2)+J(3)+……+J(I)个第2层组;根据上述像素的分量中的三号分量的数值大小将第2层组中的第j个组的的像素分成K(j)个组,其中,j=1,2,3,……,J,K(j)为正整数,该第2层组中的第j个组的像素所分成的组作为第3层组,调色板像素最终被分成K=K(1)+K(2)+K(3)+……+K(J)个第3层组(即,对调色板像素进行了三次分组,且每次分组时所依据的分量是不同的,第一次分组时,所依据的是一号分量;第二次分组时,所依据的是二号分量;第三次分组时,所依据的是三号分量)。类似的,在以后的发展中,当像素中的分量为四个以上后,还可以分别按照不同的分量对调色板像素进行四次以上的层次分组。
在一个可选的实施例中,上述方法还可以包括以下至少之一:K个组中的各组像素的数目彼此之间相差小于第四预定阈值;L个组中的各组像素的数目彼此之间相差小于第五预定阈值;M(x)个组中的各组像素的数目彼此之间相差小于第六预定阈值;I个组中的各组像素数目 彼此之间相差小于第一预定阈值;J(i)个组中的各组像素数目彼此之间相差小于第二预定阈值;K(j)个组中的各组像素数目彼此之间相差小于第三预定阈值;I=2,所有J(i)都等于2并且所有K(j)都等于2,J=4并且K=8;I=4,所有J(i)都等于4并且所有K(j)都等于2,J=16并且K=32。
在一个可选的实施例中,上述方法还包括以下至少之一:
一号分量为Y分量,U分量,V分量中的任一个分量,或者为G分量,B分量,R分量中的任一个分量;
二号分量为Y分量,U分量,V分量中除一号分量外的任一个分量,或者为G分量,B分量,R分量中除一号分量外的任一个分量;
三号分量为Y分量,U分量,V分量中除一号分量和二号分量外的分量,或者为G分量,B分量,R分量中除一号分量和二号分量外的分量。
在一个可选的实施例中,上述方法包括以下之一:
一号分量,二号分量,三号分量,分别是Y分量,U分量,V分量;
一号分量,二号分量,三号分量,分别是Y分量,V分量,U分量;
一号分量,二号分量,三号分量,分别是G分量,B分量,R分量;
一号分量,二号分量,三号分量,分别是3个分量中不同数值的数目为最大的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最小的分量;
一号分量,二号分量,三号分量,分别是3个分量中不同数值的数目为最小的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最大的分量;
其中,上述3个分量为G分量,B分量,R分量,或者上述3个分量为G分量,B分量,R分量。
在一个可选的实施例中,对一个组进行下一层次的分组时,可以根据该组中与层次对应的分量中不同数值的数目来确定细分成下一层次中的几个组。
在一个可选的实施例中,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为1,则把该组分成1个下一层次中的组;否则把该组分成2个以上下一层次中的组。
在一个可选的实施例中,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为N,则把该组分成N个下一层次中的组。
在一个可选的实施例中,在将上述调色板像素分为K组之后,该方法还包括:如果上述输入像素不能归入K组中的任何一组(例如,该输入像素与调色板像素中的像素均有很大的差异),则将该输入像素归入空组;在将该输入像素归入上述空组后,将与输入像素对应的调 色板像素设置为上述输入像素本身或空像素或默认值。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。
在本实施例中还提供了一种图像处理装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。
图4是根据本发明实施例的图像处理装置的结构框图,如图4所示,该装置包括确定模块42和转换模块44,下面对该装置进行说明。
确定模块42,设置为确定调色板像素中与输入的输入像素对应的对应像素,其中,该输入像素包括调色板像素之外的像素;转换模块44,连接至上述确定模块42,设置为将上述输入像素转换成调色板像素中的对应像素。
在一个可选的实施例中,上述确定模块42在确定与输入像素对应的对应像素时,可以执行以下操作:对调色板像素进行分组,包括:将所述调色板像素分为K组,其中,K为正整数;确定上述输入像素在该K组中所归入的组;在上述输入像素所归入的组中确定对应像素。
在一个可选的实施例中,上述确定模块42在将上述调色板像素分为K组时,可以执行以下操作:根据输入像素样值的特征将上述调色板像素分成K组;确定输入像素在所述K组中所归入的组包括:根据上述输入像素样值的特征和所述输入像素样值确定所述输入像素在所述K组中所归入的组(例如,选择与输入像素样值的特征相差小于预定值的像素所在的组为输入像素所归入的组);在上述输入像素所归入的组中确定对应像素包括:确定上述输入像素与输入像素所归入的组中的部分或全部调色板像素之间的样值的差值;确定一个与该输入像素的差值最小的调色板像素为上述对应像素。
其中,上述确定模块42在对调色板像素进行分组时的分组方式可以有多种,下面对如何进行分组进行举例说明:根据输入像素样值的特征将所述调色板像素分成K组包括:根据像素的分量的数值大小的特征将上述调色板像素分成K组。例如,可以按照像素的分量的数值由大到小的顺序进行分组,或者按照像素的分量的数值由小到大的顺序进行分组,每组中的像素的数量可以设置为相似,即两两组别之间的数量相差小于预定阈值。
在一个可选的实施例中,上述确定模块42在对调色板像素进行分组时,可以按照像素的分量进行一次或多次分组,在本实施例中,根据上述像素的分量的数值大小的特征将调色板像素分成K组包括:根据上述像素的分量中的一号分量的数值大小把调色板像素分成K个组 (即,只对调色板像素分一次组);
或者,根据像素的分量中的一号分量的数值大小把调色板像素分成L个组,其中,该L个组作为第1层组,L为正整数;根据像素的分量中的二号分量的数值大小将上述第1层组中的第x个组的像素分成M(x)个组,其中,该第1层组中的第x个组的像素所分成的组作为第2层组,x=1,2,3,……,I,M(x)为正整数,K=M(1)+M(2)+……+M(x)(即,按照一号分量对调色板像素先分一次组,再按照二号分量对分组后的组进行进一步划分,即对调色板像素进行了两次分组);
或者,根据上述像素的分量中的一号分量的数值大小把调色板的像素分成I个组,其中,该I个组作为第1层组,I为正整数;根据上述像素的分量中的二号分量的数值大小将第1层组中的第i个组的像素分成J(i)个组,其中,i=1,2,3,……,I,J(i)为正整数,该第1层组中的第i个组的像素所分成的组作为第2层组,上述调色板像素被分成J=J(1)+J(2)+J(3)+……+J(I)个第2层组;根据上述像素的分量中的三号分量的数值大小将第2层组中的第j个组的的像素分成K(j)个组,其中,j=1,2,3,……,J,K(j)为正整数,该第2层组中的第j个组的像素所分成的组作为第3层组,调色板像素最终被分成K=K(1)+K(2)+K(3)+……+K(J)个第3层组(即,对调色板像素进行了三次分组,且每次分组时所依据的分量是不同的,第一次分组时,所依据的是一号分量;第二次分组时,所依据的是二号分量;第三次分组时,所依据的是三号分量)。类似的,在以后的发展中,当像素中的分量为四个以上后,还可以分别按照不同的分量对调色板像素进行四次以上的层次分组。
在一个可选的实施例中,包括以下至少之一:K个组中的各组像素的数目彼此之间相差小于第四预定阈值;L个组中的各组像素的数目彼此之间相差小于第五预定阈值;M(x)个组中的各组像素的数目彼此之间相差小于第六预定阈值;I个组中的各组像素数目彼此之间相差小于第一预定阈值;J(i)个组中的各组像素数目彼此之间相差小于第二预定阈值;K(j)个组中的各组像素数目彼此之间相差小于第三预定阈值;I=2,所有J(i)都等于2并且所有K(j)都等于2,J=4并且K=8;I=4,所有J(i)都等于4并且所有K(j)都等于2,J=16并且K=32。
在一个可选的实施例中,包括以下至少之一:
一号分量为Y分量,U分量,V分量中的任一个分量,或者为G分量,B分量,R分量中的任一个分量;
二号分量为Y分量,U分量,V分量中除一号分量外的任一个分量,或者为G分量,B分量,R分量中除一号分量外的任一个分量;
三号分量为Y分量,U分量,V分量中除一号分量和二号分量外的分量,或者为G分量,B分量,R分量中除一号分量和二号分量外的分量。
在一个可选的实施例中,包括以下之一:
一号分量,二号分量,三号分量,分别是Y分量,U分量,V分量;
一号分量,二号分量,三号分量,分别是Y分量,V分量,U分量;
一号分量,二号分量,三号分量,分别是G分量,B分量,R分量;
一号分量,二号分量,三号分量,分别是3个分量中不同数值的数目为最大的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最小的分量;
一号分量,二号分量,三号分量,分别是3个分量中不同数值的数目为最小的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最大的分量;
其中,上述3个分量为G分量,B分量,R分量,或者上述3个分量为G分量,B分量,R分量。
在一个可选的实施例中,对一个组进行下一层次的分组时,可以根据该组中与层次对应的分量中不同数值的数目来确定细分成下一层次中的几个组。
在一个可选的实施例中,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为1,则把该组分成1个下一层次中的组;否则把该组分成2个以上下一层次中的组。
在一个可选的实施例中,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为N,则把该组分成N个下一层次中的组。
在一个可选的实施例中,上述的图像处理装置还包括处理模块,设置为在将上述调色板像素分为K组之后,如果上述输入像素不能归入K组中的任何一组(例如,该输入像素与调色板像素中的像素均有很大的差异),则将该输入像素归入空组;在将该输入像素归入上述空组后,将与输入像素对应的调色板像素设置为上述输入像素本身或空像素或默认值。
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述模块分别位于多个处理器中。
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:
S1,确定调色板像素中与输入的输入像素对应的对应像素,其中,所述输入像素包括所述调色板像素之外的像素;
S2,将所述输入像素转换成所述调色板像素中的所述对应像素。
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行上述各方法实施例中的操作步骤。
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。
工业实用性
如上所述,本发明实施例提供的一种图像处理方法及装置具有以下有益效果:解决了相关技术中存在的无法将当前块之外的任意像素转换为当前块的调色板像素的问题,进而达到了实现将当前块之外的任意像素转换成当前块的调色板像素的目的,提高了压缩效率的效果。

Claims (25)

  1. 一种图像处理方法,至少包括将任意像素转换为调色板像素的步骤,其中,转换方式至少包括如下步骤:
    将调色板像素(或等价地,像素索引)根据预定的规则分成K组;
    对任意像素,确定所述任意像素归入所述K组之一,将该组作为最优组;
    在所述最优组中确定所述任意像素转换成所述最优组中的调色板像素之一,将该调色板像素作为最优调色板像素。
  2. 根据权利要求1所述的方法,其中,把所述调色板像素(或等价地,像素索引)根据预定的像素数值的特征分成K组;对任意像素样值,转换方式至少包括下列步骤:
    根据所述预定的像素数值的特征和所述任意像素样值的数值,将所述任意像素样值归入所述K组中的一组,将该组作为最优组;
    计算所述任意像素样值与所述最优组中的部分或全部调色板像素样值之间的距离,确定一个所述距离最优的调色板像素样值,将确定的调色板像素样值作为所述任意像素样值对应的调色板像素样值。
  3. 根据权利要求2所述的方法,其中,所述距离是像素之间的误差。
  4. 根据权利要求2或3所述的方法,其中:
    所述预定的像素数值的特征是像素的3个分量的数值大小的特征。
  5. 根据权利要求4所述的方法,其中:
    根据所述3个分量的数值大小的特征对所述调色板像素(或等价地,像素索引)进行分组的方式如下:
    根据像素的一号分量的数值大小(从大到小)把所述调色板(称为第0层组)的像素分成I个组(都称为第1层组),I个组中的像素数目(或等价地,像素索引数目)尽量接近;
    对I个第1层组中的每一个组,根据像素的二号分量的数值大小(从大到小)把该第1层组(记为第i组,i=1,2,3,……,I)的像素分成J(i)个组(都称为第2层组),J(i)个组中的像素数目(或等价地,像素索引数目)尽量接近;这样,所述调色板像素(或等价地,像素索引)被分成J=J(1)+J(2)+J(3)+……+J(I)个第2层组;
    对这J个第2层组中的每一个组,根据像素的三号分量的数值大小(从大到小)把该组(记为第j组,j=1,2,3,……,J)的像素分成K(j)个组(都称为第3层组),K(j)个组中的像素数目(或等价地,像素索引数目)尽量接近;这样,所述调色板像素(或等价地,像素索引)最终被分成K=K(1)+K(2)+K(3)+……+K(J)个第3层组;所述一号分量,所述二号分量,所述三号分量,分别与所述第1层组,所述第2层组,所述第3 层组相对应,即根据所述一号分量,所述二号分量,所述三号分量,分别产生所述第1层组,所述第2层组,所述第3层组。
  6. 根据权利要求5所述的方法,其中,所述I、J(i)、K(j)具有下列规则之一:
    规则1:所有J(i)都相等于J0,因而J=I×J0;
    规则2:所有K(j)都相等于K0,因而K=J×K0;
    规则3:所有J(i)都相等于J0并且所有K(j)都相等于K0,因而J=I×J0并且K=I×J0×K0;
    规则4:I=2,所有J(i)都相等于2并且所有K(j)都相等于2,因而J=4并且K=8;
    规则5:I=4,所有J(i)都相等于4并且所有K(j)都相等于2,因而J=16并且K=32。
  7. 根据权利要求5所述的方法,其中:
    所述一号分量,所述二号分量,所述三号分量,分别是Y分量,U分量,V分量;
    或者,
    所述一号分量,所述二号分量,所述三号分量,分别是Y分量,V分量,U分量;
    或者,
    所述一号分量,所述二号分量,所述三号分量,分别是G分量,B分量,R分量;
    或者,
    所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最大的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最小的分量;
    或者,所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最小的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最大的分量。
  8. 根据权利要求5或7所述的方法,其中:
    对一个组进行下一层次的分组时,根据该组中与层次对应的分量中不同数值的数目来确定细分成几个组。
  9. 根据权利要求8所述的方法,其中:
    对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为1,则把该组分成1个组即不再细分,下一层次仍然只有一个组,否则(即不同数值的 数目大于1),则把该组分成2个下一层次的组。
  10. 根据权利要求8所述的方法,其中:
    对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为N,则把该组分成N个组。
  11. 根据权利要求1所述方法,其中,在将调色板像素(或等价地,像素索引)根据预定的规则分成K组之后,所述方法还包括:
    如果所述任意像素不能归入所述K组中的任何一组,将所述输入像素归入空组;
    在将所述任意像素归入所述空组后,将所述最优调色板像素设置为所述任意像素本身或空像素或默认值。
  12. 根据权利要求1至11中任一项所述方法,其中,所述任意像素包括输入的输入像素。
  13. 一种图像处理方法,包括:
    确定调色板像素中与输入的输入像素对应的对应像素,其中,所述输入像素包括所述调色板像素之外的像素;
    将所述输入像素转换成所述调色板像素中的所述对应像素。
  14. 根据权利要求13所述的方法,其中,确定所述调色板像素中与所述输入像素对应的所述对应像素包括:
    将所述调色板像素分为K组,其中,K为正整数;
    确定所述输入像素在所述K组中所归入的组;
    在所述输入像素所归入的组中确定所述对应像素。
  15. 根据权利要求14所述的方法,其中,
    将所述调色板像素分为K组包括:根据输入像素样值的特征将所述调色板像素分成K组;
    确定所述输入像素在所述K组中所归入的组包括:根据所述输入像素样值的特征和所述输入像素样值确定所述输入像素在所述K组中所归入的组;
    在所述输入像素所归入的组中确定所述对应像素包括:确定所述输入像素与所述输入像素所归入的组中的部分或全部调色板像素之间的样值的差值;确定一个与所述输入像素的差值最小的调色板像素为所述对应像素。
  16. 根据权利要求15所述的方法,其中,根据输入像素样值的特征将所述调色板像素分成K组包括:
    根据像素的分量的数值大小的特征将所述调色板像素分成K组。
  17. 根据权利要求16所述的方法,其中,根据所述像素的分量的数值大小的特征将所述调色板像素分成K组包括:
    根据所述像素的分量中的一号分量的数值大小把所述调色板像素分成K个组;或者,
    根据所述像素的分量中的一号分量的数值大小把所述调色板像素分成L个组,其中,所述L个组作为第1层组,L为正整数;根据所述像素的分量中的二号分量的数值大小将所述第1层组中的第x个组的像素分成M(x)个组,其中,所述第1层组中的第x个组的像素所分成的组作为第2层组,x=1,2,3,……,I,M(x)为正整数,K=M(1)+M(2)+……+M(x);或者,
    根据所述像素的分量中的一号分量的数值大小把所述调色板的像素分成I个组,其中,所述I个组作为第1层组,I为正整数;根据所述像素的分量中的二号分量的数值大小将所述第1层组中的第i个组的像素分成J(i)个组,其中,i=1,2,3,……,I,J(i)为正整数,所述第1层组中的第i个组的像素所分成的组作为第2层组,所述调色板像素被分成J=J(1)+J(2)+J(3)+……+J(I)个第2层组;根据所述像素的分量中的三号分量的数值大小将所述第2层组中的第j个组的的像素分成K(j)个组,其中,j=1,2,3,……,J,K(j)为正整数,所述第2层组中的第j个组的像素所分成的组作为第3层组,所述调色板像素被分成K=K(1)+K(2)+K(3)+……+K(J)个第3层组。
  18. 根据权利要求17所述的方法,其中,包括以下至少之一:
    所述K个组中的各组像素的数目彼此之间相差小于第四预定阈值;
    所述L个组中的各组像素的数目彼此之间相差小于第五预定阈值;
    所述M(x)个组中的各组像素的数目彼此之间相差小于第六预定阈值;
    所述I个组中的各组像素数目彼此之间相差小于第一预定阈值;
    所述J(i)个组中的各组像素数目彼此之间相差小于第二预定阈值;
    所述K(j)个组中的各组像素数目彼此之间相差小于第三预定阈值;
    I=2,所有J(i)都等于2并且所有K(j)都等于2,J=4并且K=8;
    I=4,所有J(i)都等于4并且所有K(j)都等于2,J=16并且K=32。
  19. 根据权利要求17所述的方法,其中,包括以下至少之一:
    所述一号分量为Y分量,U分量,V分量中的任一个分量,或者为G分量,B分量,R分量中的任一个分量;
    所述二号分量为Y分量,U分量,V分量中除一号分量外的任一个分量,或者为G分量,B分量,R分量中除一号分量外的任一个分量;
    所述三号分量为Y分量,U分量,V分量中除一号分量和二号分量外的分量,或者为G分量,B分量,R分量中除一号分量和二号分量外的分量。
  20. 根据权利要求17所述的方法,其中,包括以下之一:
    所述一号分量,所述二号分量,所述三号分量,分别是Y分量,U分量,V分量;
    所述一号分量,所述二号分量,所述三号分量,分别是Y分量,V分量,U分量;
    所述一号分量,所述二号分量,所述三号分量,分别是G分量,B分量,R分量;
    所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最大的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最小的分量;
    所述一号分量,所述二号分量,所述三号分量,分别是3个分量中不同数值的数目为最小的分量,3个分量中不同数值的数目为其次的分量,3个分量中不同数值的数目为最大的分量;
    其中,所述3个分量为G分量,B分量,R分量,或者所述3个分量为G分量,B分量,R分量。
  21. 根据权利要求17至20中任一项所述的方法,其中,对一个组进行下一层次的分组时,根据该组中与层次对应的分量中不同数值的数目来确定细分成下一层次中的几个组。
  22. 根据权利要求21所述的方法,其中,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为1,则把该组分成1个下一层次中的组;否则把该组分成2个以上下一层次中的组。
  23. 根据权利要求21所述的方法,其中,对一个组进行下一层次的分组时,如果该组中与层次对应的分量中不同数值的数目为N,则把该组分成N个下一层次中的组。
  24. 根据权利要求14所述方法,其中,在将所述调色板像素分为K组之后,所述方法还包括:
    如果所述输入像素不能归入所述K组中的任何一组,则将所述输入像素归入空组;
    在将所述输入像素归入所述空组后,将所述输入像素对应的调色板像素设置为所述输入像素本身或空像素或默认值。
  25. 一种图像处理装置,包括:
    确定模块,设置为确定调色板像素中与输入的输入像素对应的对应像素,其中,所述输入像素包括所述调色板像素之外的像素;
    转换模块,设置为将所述输入像素转换成所述调色板像素中的所述对应像素。
PCT/CN2016/072040 2015-01-27 2016-01-25 图像处理方法及装置 WO2016119667A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP21176363.6A EP3893191A1 (en) 2015-01-27 2016-01-25 Method and device for image processing
EP16742729.3A EP3252706A4 (en) 2015-01-27 2016-01-25 Image processing method and apparatus

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201510040409.0 2015-01-27
CN201510040409 2015-01-27
CN201610045646.0A CN105828079B (zh) 2015-01-27 2016-01-22 图像处理方法及装置
CN201610045646.0 2016-01-22

Publications (1)

Publication Number Publication Date
WO2016119667A1 true WO2016119667A1 (zh) 2016-08-04

Family

ID=56542420

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/072040 WO2016119667A1 (zh) 2015-01-27 2016-01-25 图像处理方法及装置

Country Status (1)

Country Link
WO (1) WO2016119667A1 (zh)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1298160A (zh) * 1999-11-30 2001-06-06 松下电器产业株式会社 图象处理装置、图象处理方法和存储介质
CN1452397A (zh) * 2002-04-19 2003-10-29 精工爱普生株式会社 利用基数近似或利用差分码和转义码的帧压缩
CN1984229A (zh) * 2005-12-17 2007-06-20 富士施乐株式会社 图像处理装置、图像处理方法、图像处理程序、存储介质以及计算机数据信号
US20120281256A1 (en) * 2011-04-04 2012-11-08 Canon Kabushiki Kaisha Image processing apparatus, control method thereof, and storage medium
CN103209326A (zh) * 2013-03-29 2013-07-17 惠州学院 一种png图片的压缩方法
US20140147040A1 (en) * 2012-11-28 2014-05-29 Kabushiki Kaisha Toshiba Image encoding device, image decoding device, image encoding method, and image decoding method
CN104247410A (zh) * 2012-03-30 2014-12-24 富士通株式会社 彩色图表检测装置、彩色图表检测方法以及彩色图表检测用计算机程序
CN104301737A (zh) * 2013-07-15 2015-01-21 华为技术有限公司 目标图像块的解码方法和编码方法以及解码器和编码器

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1298160A (zh) * 1999-11-30 2001-06-06 松下电器产业株式会社 图象处理装置、图象处理方法和存储介质
CN1452397A (zh) * 2002-04-19 2003-10-29 精工爱普生株式会社 利用基数近似或利用差分码和转义码的帧压缩
CN1984229A (zh) * 2005-12-17 2007-06-20 富士施乐株式会社 图像处理装置、图像处理方法、图像处理程序、存储介质以及计算机数据信号
US20120281256A1 (en) * 2011-04-04 2012-11-08 Canon Kabushiki Kaisha Image processing apparatus, control method thereof, and storage medium
CN104247410A (zh) * 2012-03-30 2014-12-24 富士通株式会社 彩色图表检测装置、彩色图表检测方法以及彩色图表检测用计算机程序
US20140147040A1 (en) * 2012-11-28 2014-05-29 Kabushiki Kaisha Toshiba Image encoding device, image decoding device, image encoding method, and image decoding method
CN103209326A (zh) * 2013-03-29 2013-07-17 惠州学院 一种png图片的压缩方法
CN104301737A (zh) * 2013-07-15 2015-01-21 华为技术有限公司 目标图像块的解码方法和编码方法以及解码器和编码器

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3252706A4 *

Similar Documents

Publication Publication Date Title
US10341651B2 (en) Image coding method, decoding method, coding device and decoding device
WO2015120818A1 (zh) 图像编码、解码方法及装置
WO2015120823A1 (zh) 使用多种形式的参考像素存储空间的图像压缩方法和装置
BR112020026381A2 (pt) método de intrapredição
CN112823515A (zh) 使用用于多参考线的mpm配置方法处理视频信号的方法和设备
US20220377337A1 (en) Context Coding for Transform Skip Mode
WO2015021942A1 (zh) 定宽度变长度像素样值串匹配增强的图像压缩方法和装置
WO2016054985A1 (zh) 图像编码、解码方法及装置
US10575022B2 (en) Image encoding and decoding method, image processing device and computer storage medium
KR101946598B1 (ko) 이미지 코딩, 디코딩 방법 및 장치
BR112014009431B1 (pt) Método para codificar dados de vídeo, aparelho para codificar vídeo e memória legível por computador
CN104754362B (zh) 使用精细划分块匹配的图像压缩方法
TW202002636A (zh) 網格寫碼之量化係數寫碼
CN113950829A (zh) 简化的变换编解码工具
TW202041017A (zh) 視訊寫碼中之隱式變換選擇
US11917168B2 (en) Image encoding and decoding methods, image processing device, and computer storage medium
CN113785576B (zh) 编解码视频中的二次变换的使用
TW202110177A (zh) 用於視訊寫碼之適應性迴路濾波之非線性延伸
TW202106016A (zh) 增強內部寫碼區塊之解碼產出量
TW202139695A (zh) 用於將編碼樹單元編碼與解碼的方法、設備及系統
KR102532391B1 (ko) 영상 부호화 방법과 장치 및 영상 복호화 방법과 장치
TW202123708A (zh) 用於將編碼樹單元編碼與解碼的方法、設備及系統
CN113994666A (zh) 隐式选择变换候选
US9762916B2 (en) Encoding apparatus and method
WO2016202189A1 (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: 16742729

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2016742729

Country of ref document: EP