[go: up one dir, main page]

CN1632829A - A method to achieve image scaling - Google Patents

A method to achieve image scaling Download PDF

Info

Publication number
CN1632829A
CN1632829A CN200410102696.5A CN200410102696A CN1632829A CN 1632829 A CN1632829 A CN 1632829A CN 200410102696 A CN200410102696 A CN 200410102696A CN 1632829 A CN1632829 A CN 1632829A
Authority
CN
China
Prior art keywords
image
pixel
divergent
convergent
point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN200410102696.5A
Other languages
Chinese (zh)
Other versions
CN1288598C (en
Inventor
夏煜
王浩
怀千江
白锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
GUANGDONG ZHONGXING ELECTRONICS Co Ltd
Original Assignee
Vimicro Corp
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 Vimicro Corp filed Critical Vimicro Corp
Priority to CN200410102696.5A priority Critical patent/CN1288598C/en
Publication of CN1632829A publication Critical patent/CN1632829A/en
Application granted granted Critical
Publication of CN1288598C publication Critical patent/CN1288598C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4015Image demosaicing, e.g. colour filter arrays [CFA] or Bayer patterns

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Color Television Image Signal Generators (AREA)
  • Color Image Communication Systems (AREA)
  • Image Processing (AREA)

Abstract

This invention discloses an image zooming method, which comprises the following steps: the original image is of Bayer data form and the aim image is of RGB data form; to zoom each picture element in the original images to get the image in Bayer data form; then to convert the zoom image into RGB data form through plug operation to get the aim image. This method is first to zoom the image in Bayer data form till suitable size and then to convert the Bayer data form into RGB data form.

Description

一种实现图像缩放的方法A method to achieve image scaling

技术领域technical field

本发明涉及数字图像处理技术,尤指一种实现图像缩放的方法。The invention relates to digital image processing technology, especially a method for realizing image scaling.

背景技术Background technique

现实世界中的图像多为模拟图像,但是计算机只能处理数字信息,所以必须将模拟图像转换成适合计算机表示的形式,才能由计算机进行处理,这种将模拟图像转化为数字图像的过程是由图像采集模块完成的。图像采集模块对图像进行采样,将模拟图像离散化为像素点,并用某种颜色模型表示像素点的颜色值。常用的图像采集模块是Bayer传感器,Bayer传感器采用红绿蓝(RGB)颜色模型表示像素点的颜色值。RGB颜色模型有红(R)、绿(G)、蓝(B)三种颜色类型,Bayer传感器的原理是:每个像素点只采集一种颜色类型,图1显示的是Bayer传感器对像素点的颜色采集规律。由于在图1所示的坐标系下,像素点颜色类型在初始行的排列方式有所不同,所以存在如图1(a)~图1(d)所示的四种不同的图像采集格式。其中,图1(a)初始行的像素点颜色类型遵循GR的规律重复采集;图1(b)初始行的像素点颜色类型遵循RG的规律重复采集;图1(c)初始行的像素点颜色类型遵循BG的规律重复采集;图1(d)初始行的像素点颜色类型遵循GB的规律重复采集。所述行指的是图1(a)~图1(d)中沿x轴方向排列的像素点。The images in the real world are mostly analog images, but computers can only process digital information, so the analog images must be converted into a form suitable for computer representation before they can be processed by the computer. This process of converting analog images into digital images is done by The image acquisition module is completed. The image acquisition module samples the image, discretizes the analog image into pixels, and uses a certain color model to represent the color value of the pixels. The commonly used image acquisition module is a Bayer sensor, and the Bayer sensor uses a red-green-blue (RGB) color model to represent the color value of a pixel. The RGB color model has three color types: red (R), green (G), and blue (B). The principle of the Bayer sensor is: each pixel only collects one color type. color collection rules. Since the arrangement of pixel color types in the initial row is different in the coordinate system shown in Fig. 1, there are four different image acquisition formats as shown in Fig. 1(a) to Fig. 1(d). Among them, the pixel color type of the initial row in Figure 1(a) is collected repeatedly following the law of GR; the pixel color type of the initial line in Figure 1(b) is collected repeatedly following the law of RG; Figure 1(c) the pixel point of the initial row The color type is collected repeatedly according to the law of BG; the pixel color type of the initial row in Figure 1(d) is collected repeatedly according to the law of GB. The rows refer to the pixels arranged along the x-axis in FIG. 1( a ) to FIG. 1( d ).

在以下的说明中,将图1所示的四种图像数据格式统称为Bayer数据格式。Bayer数据格式的特点是每个像素点只具有R、G、B三种颜色类型中的一种颜色类型。In the following description, the four image data formats shown in FIG. 1 are collectively referred to as Bayer data formats. The characteristic of the Bayer data format is that each pixel has only one color type among the three color types of R, G, and B.

在用数码相机或者计算机显示图像时,由于显示屏的大小不同,经常需要对采集到的图像数据进行缩放操作。所谓缩放是指通过插值的方法将图像放大或缩小。现有技术采用图2所示的过程将Bayer数据格式缩放成符合大小要求的RGB数据格式。所述RGB数据格式是指图像中的每个像素点都具有R、G、B三种颜色类型。这里,将Bayer传感器采集到的图像称为原始图像,该原始图像是Bayer数据格式;经过缩放和数据格式转换后获得的图像称为目的图像,该目的图像是RGB数据格式。下面结合图2详细说明从原始图像获得目的图像的过程。When using a digital camera or a computer to display images, due to the different sizes of the display screens, it is often necessary to perform a scaling operation on the collected image data. The so-called scaling refers to enlarging or reducing the image by means of interpolation. The prior art uses the process shown in FIG. 2 to scale the Bayer data format into an RGB data format that meets the size requirement. The RGB data format means that each pixel in the image has three color types of R, G, and B. Here, the image collected by the Bayer sensor is called the original image, and the original image is in the Bayer data format; the image obtained after scaling and data format conversion is called the target image, and the target image is in the RGB data format. The process of obtaining the target image from the original image will be described in detail below with reference to FIG. 2 .

步骤201:将Bayer数据格式的图像转换成RGB数据格式。Step 201: Convert the image in Bayer data format into RGB data format.

Bayer传感器采集到的原始图像是Bayer数据格式,该数据格式遵循图1所示的规律,图像中的每个像素点只有一种颜色类型。在将Bayer数据格式转换成RGB数据格式的过程中,需要用插值的方法使每个像素点具有R、G、B三种颜色类型。The original image collected by the Bayer sensor is in the Bayer data format, which follows the law shown in Figure 1, and each pixel in the image has only one color type. In the process of converting the Bayer data format into the RGB data format, it is necessary to use an interpolation method to make each pixel point have three color types of R, G, and B.

下面以图1(a)中标出的像素点A为例说明Bayer数据格式转换成RGB数据格式的过程。从图1(a)可以看出,像素点A是G颜色类型,假设颜色值为G0。A点沿X轴方向的两个相邻点是R颜色类型,假设这两点的颜色值分别为R1和R2,则像素点A的R颜色类型的颜色值R0可以通过公式(1)所示的插值方法获得:The following takes pixel A marked in Fig. 1(a) as an example to illustrate the process of converting Bayer data format into RGB data format. It can be seen from Figure 1(a) that pixel A is of G color type, assuming the color value is G0. The two adjacent points of point A along the X-axis direction are of R color type, assuming that the color values of these two points are R1 and R2 respectively, then the color value R0 of the R color type of pixel point A can be expressed by the formula (1) The interpolation method obtains:

             R0=0.5*(R1+R2)                     (1)R0=0.5*(R1+R2) (1)

同理,A点沿Y轴方向的两个相邻点是B颜色类型,假设这两点的颜色值分别为B1和B2,则像素点A的B颜色类型的颜色值B0可以通过公式(2)所示的插值方法获得:Similarly, the two adjacent points of point A along the Y axis are of B color type, assuming that the color values of these two points are B1 and B2 respectively, then the color value B0 of the B color type of pixel point A can be obtained by the formula (2 ) shows the interpolation method to obtain:

           B0=0.5*(B1+B2)                          (2)B0=0.5*(B1+B2) B0=0.5*(B1+B2) (2)

公式(1)和公式(2)中采用的插值方法是最为简单的一种插值方法。在实际应用中,可以根据需要采用其它的插值方法,以获得更好的插值效果。The interpolation method used in formula (1) and formula (2) is the simplest interpolation method. In practical applications, other interpolation methods can be used as needed to obtain better interpolation effects.

经过上述过程的转换,像素点A具有三种颜色类型,其颜色值为G=G0,R=R0,B=B0。对Bayer数据格式的原始图像中的所有像素点进行上述过程的转换后,获得RGB数据格式的图像数据。After the conversion of the above process, the pixel point A has three color types, and its color values are G=G0, R=R0, and B=B0. After the conversion of the above process is performed on all the pixels in the original image in the Bayer data format, the image data in the RGB data format is obtained.

步骤202:对RGB数据格式的图像数据进行缩放操作,得到缩放后的RGB图像。Step 202: performing a scaling operation on the image data in the RGB data format to obtain a scaled RGB image.

本步骤中,对步骤201获得的图像进行缩放操作需要计算缩放后图像中所有像素点的颜色值,具体步骤如下:In this step, the zooming operation on the image obtained in step 201 needs to calculate the color values of all pixels in the zoomed image, and the specific steps are as follows:

首先,找出缩放后图像中的像素点在缩放前图像中的对应点。First, find the corresponding point of the pixel in the image after zooming in the image before zooming.

其次,根据找到的对应点在缩放前图像中选取插值数据点,对所选取插值数据点的颜色值进行插值计算,获得缩放后图像中相应像素点的颜色值。Secondly, according to the found corresponding points, the interpolation data points are selected in the image before zooming, and the color values of the selected interpolation data points are interpolated to obtain the color values of the corresponding pixel points in the zoomed image.

RGB数据格式的图像中每个像素点具有三种颜色类型,下面以R颜色类型为例说明缩放操作的过程。Each pixel in an image in the RGB data format has three color types. The following uses the R color type as an example to illustrate the scaling operation process.

假设:缩放前图像的大小为M×N,由于本文中提到的图像都是离散后的图像,所以图像的大小指的是像素点的个数。缩放前该图像R类型的颜色值为f(i,j),其中0≤i<M,0≤j<N。缩放后图像的大小为M′×N′,缩放后图像的R类型颜色值为f′(i′j′),其中0≤i′<M′,0≤j′<N′。Assumption: the size of the image before scaling is M×N. Since the images mentioned in this article are all discrete images, the size of the image refers to the number of pixels. The color value of the R type of the image before scaling is f(i, j), where 0≤i<M, 0≤j<N. The size of the zoomed image is M′×N′, and the R-type color value of the zoomed image is f′(i′j′), where 0≤i′<M′, 0≤j′<N′.

下面参照图3说明像素点(i′,j′)的R类型颜色值f′(i′,j′)的计算过程,具体如下:The calculation process of the R type color value f'(i', j') of the pixel point (i', j') is illustrated below with reference to Fig. 3, specifically as follows:

令x=i′M/M′,y=j′N/N′。这里,将坐标值为(x,y)的点称为缩放后像素点(i′,j′)在缩放前图像中的对应点。由(x,y)的值可得:

Figure A20041010269600061
Figure A20041010269600062
将坐标值为(i,j)的点作为像素点(i′,j′)在缩放前图像的参考点。如图3所示,对应点(x,y)距参考点(i,j)的水平和垂直距离分别为dx和dy,则dx=x-i,dy=y-j,且0≤dx≤1,0 ≤dy≤1。Let x=i'M/M', y=j'N/N'. Here, the point whose coordinate value is (x, y) is called the corresponding point of the zoomed pixel point (i′, j′) in the image before zooming. From the value of (x, y) can be obtained:
Figure A20041010269600061
Figure A20041010269600062
The point whose coordinate value is (i, j) is used as the reference point of the image of the pixel point (i′, j′) before scaling. As shown in Figure 3, the horizontal and vertical distances from the corresponding point (x, y) to the reference point (i, j) are dx and dy respectively, then dx=xi, dy=yj, and 0≤dx≤1, 0≤ dy≤1.

计算得到对应点(x,y)和参考点(i,j)的坐标值后,可以根据对应点(x,y)或参考点(i,j)选取插值数据点。对于不同的插值方法,所选取插值数据点的个数和位置是不同的。After the coordinate values of the corresponding point (x, y) and the reference point (i, j) are calculated, an interpolation data point can be selected according to the corresponding point (x, y) or the reference point (i, j). For different interpolation methods, the number and position of selected interpolation data points are different.

如果采用双线性插值法(Bi-Linear)计算(i′,j′)点的颜色值f′(i′,j′),可以选择图3标示的A、B、C、D四个点的颜色值进行插值计算,插值的结果由公式(3)可得:If the bilinear interpolation method (Bi-Linear) is used to calculate the color value f'(i', j') of point (i', j'), the four points A, B, C, and D marked in Figure 3 can be selected The color value is interpolated, and the result of the interpolation can be obtained from the formula (3):

f(i,j)=(1-dx)(1-dy)f(i,j)+dy(1-dx)f(i,j+1)+dx(1-dy)f(i+1,j)+dxdyf(i+1,j+1)(3)f(i,j)=(1-dx)(1-dy)f(i,j)+dy(1-dx)f(i,j+1)+dx(1-dy)f(i+1 ,j)+dxdyf(i+1,j+1)(3)

如果采用双三次样条插值法(Bi-Cubic)计算(i′, j′)点的颜色值f′(i′,j′),可以选择图3中以灰色显示的十六个点的颜色值进行插值计算。If the bicubic spline interpolation method (Bi-Cubic) is used to calculate the color value f'(i', j') of point (i', j'), the color of the sixteen points shown in gray in Figure 3 can be selected Values are interpolated.

对缩放后图像中的M′×N′个像素点都可以采用上述方法计算,以获得所有像素点的R类型颜色值。All the M'×N' pixels in the scaled image can be calculated using the above method to obtain the R-type color values of all pixels.

对B类型颜色值和G类型颜色值可以采用相似的方法计算,只需将公式(3)中的颜色值f(i,j)用相应类型的颜色值代入即可,此处不再赘述。A similar method can be used to calculate the B-type color value and the G-type color value. It is only necessary to substitute the color value f(i, j) in the formula (3) with the color value of the corresponding type, which will not be repeated here.

由步骤202可以看出,现有技术中使用的缩放方法需要对每个像素点的三种颜色类型都进行一次插值计算,才能完整地获得像素点的颜色值,这意味着每个像素点需要进行三次插值计算,而这种处理方法并没有提供更多的图像信息。在实际应用中,尤其在视频处理等实时性要求较高的场合,现有技术采用的方法在没有提高图像质量的情况下增加了计算的复杂度,所以是不合理的做法。It can be seen from step 202 that the scaling method used in the prior art needs to perform an interpolation calculation on the three color types of each pixel to completely obtain the color value of the pixel, which means that each pixel needs Perform cubic interpolation calculations, and this processing method does not provide more image information. In practical applications, especially in occasions with high real-time requirements such as video processing, the method adopted in the prior art increases the complexity of calculation without improving the image quality, so it is unreasonable.

发明内容Contents of the invention

有鉴于此,本发明的主要目的在于提供一种实现图像缩放的方法,减少图像缩放时的计算量,降低图像缩放的计算复杂度,加快图像处理速度,以便更好地应用于视频图像缩放等实时性要求高的场合。In view of this, the main purpose of the present invention is to provide a method for realizing image scaling, which reduces the amount of calculations during image scaling, reduces the computational complexity of image scaling, and speeds up image processing, so that it can be better applied to video image scaling, etc. Occasions with high real-time requirements.

为达到上述目的,本发明的技术方案具体是这样实现的:In order to achieve the above object, the technical solution of the present invention is specifically realized in the following way:

一种实现图像缩放的方法,原始图像是Bayer数据格式,目的图像是RGB数据格式,其特征在于,该方法包括以下步骤:A kind of method that realizes image scaling, original image is Bayer data format, purpose image is RGB data format, it is characterized in that, this method comprises the following steps:

a、对原始图像中的每个像素点进行缩放操作,缩放后得到Bayer数据格式的图像;a. Perform a scaling operation on each pixel in the original image, and obtain an image in Bayer data format after scaling;

b、将步骤a得到的缩放后图像转换成RGB数据格式,得到目的图像。b. Convert the scaled image obtained in step a into RGB data format to obtain the target image.

进一步地,步骤a所述对像素点的缩放操作包括以下步骤:Further, the zooming operation on pixels described in step a includes the following steps:

a1、确定缩放后图像中该像素点的颜色类型;a1. Determine the color type of the pixel in the zoomed image;

a2、在缩放前图像中选取一个或一个以上与步骤a1所述像素点具有相同颜色类型的插值数据点,利用所选取插值数据点的颜色值插值计算出步骤a1所述像素点的颜色值。a2. Select one or more interpolation data points of the same color type as the pixel points in step a1 in the image before zooming, and use the color values of the selected interpolation data points to interpolate to calculate the color value of the pixel points in step a1.

进一步地,步骤a1中确定缩放后图像中像素点的颜色类型操作具体包括:首先,设置缩放后图像的初始行排列方式;其次,根据缩放后图像的初始行排列方式以及步骤a1所述像素点的坐标值确定步骤a1所述像素点的颜色类型。Further, the operation of determining the color type of the pixels in the zoomed image in step a1 specifically includes: first, setting the initial row arrangement of the zoomed image; secondly, according to the initial row arrangement of the zoomed image and the pixel points described in step a1 The coordinate value of determines the color type of the pixel described in step a1.

较佳地,所述步骤a2之前进一步包括:选取步骤a1中所述像素点在缩放前图像中的对应点;Preferably, before the step a2, it further includes: selecting the corresponding point of the pixel in the step a1 in the image before zooming;

则步骤a2所述选取插值数据点的方法具体是:根据所述对应点选取插值数据点。Then, the method for selecting interpolation data points in step a2 is specifically: selecting interpolation data points according to the corresponding points.

进一步地,步骤a21中选取对应点的操作具体是:根据步骤a1所述像素点的坐标值以及缩放前后图像的大小得到步骤a1所述像素点在缩放前图像中的对应点。Further, the operation of selecting the corresponding point in step a21 is specifically: according to the coordinate value of the pixel point in step a1 and the size of the image before and after zooming, the corresponding point of the pixel point in step a1 in the image before zooming is obtained.

较佳地,步骤a22中选取插值数据点的操作具体是:首先,在缩放前图像中选取包围步骤a21所述对应点的矩形网格区;其次,选取所有落在矩形网格区内和落在矩形网格上的与步骤a1所述像素点具有相同颜色类型的点作为插值数据点。Preferably, the operation of selecting interpolation data points in step a22 is specifically: firstly, selecting a rectangular grid area surrounding the corresponding points described in step a21 in the image before zooming; secondly, selecting all the points falling within the rectangular grid area and Points on the rectangular grid having the same color type as the pixel points described in step a1 are used as interpolation data points.

较佳地,所述矩形网格区与坐标轴平行。Preferably, the rectangular grid area is parallel to the coordinate axis.

较佳地,步骤a1所述像素点是G颜色类型,则所述矩形网格区与坐标轴成45度角。Preferably, the pixel points in step a1 are of G color type, then the rectangular grid area forms an angle of 45 degrees with the coordinate axis.

由上述技术方案可见,本发明的这种实现图像缩放的方法先把Bayer数据格式的图像缩放到符合大小要求,然后将Bayer数据格式转换成RGB数据格式。这样的处理方法使得进行缩放操作时,只需对缩放后图像的像素点进行一次插值操作,计算量仅为现有技术的三分之一,从而加快图像处理速度,使该方法更适用于视频处理等实时性要求较高的领域。It can be seen from the above technical solution that the image zooming method of the present invention first zooms the image in the Bayer data format to meet the size requirement, and then converts the Bayer data format into an RGB data format. Such a processing method makes it only necessary to perform an interpolation operation on the pixels of the zoomed image during the scaling operation, and the calculation amount is only one-third of the existing technology, thus speeding up the image processing speed and making the method more suitable for video Processing and other fields with high real-time requirements.

附图说明Description of drawings

图1(a)~图1(d)为Bayer传感器采集到的Bayer数据格式的图像;Figure 1(a) to Figure 1(d) are images in Bayer data format collected by Bayer sensors;

图2为现有技术中具有Bayer数据格式的图像缩放成RGB数据格式的流程图;Fig. 2 is the flowchart that the image with Bayer data format is zoomed into RGB data format in the prior art;

图3为现有技术中插值数据点的选取示意图;Fig. 3 is the selection schematic diagram of interpolation data point in the prior art;

图4为本发明中具有Bayer数据格式的图像缩放成RGB数据格式的流程图;Fig. 4 is the flowchart that the image with Bayer data format is zoomed into RGB data format among the present invention;

图5为本发明中图像缩放操作流程图;Fig. 5 is the flow chart of image scaling operation in the present invention;

图6为本发明一个较佳实施例中R或B类型像素点在缩放前图像中插值数据点的选取示意图;Fig. 6 is a schematic diagram of selecting interpolation data points of R or B type pixel points in the image before zooming in a preferred embodiment of the present invention;

图7为本发明一个较佳实施例中G类型像素点在缩放前图像中插值数据点的选取示意图。Fig. 7 is a schematic diagram of selection of interpolation data points of G type pixel points in the image before zooming in a preferred embodiment of the present invention.

具体实施方式Detailed ways

本发明的核心思想是:原始图像是Bayer数据格式,目的图像是RGB数据格式,对原始图像中的每个像素点进行缩放操作,缩放后得到Bayer数据格式的图像;然后,将缩放后图像通过插值操作转换成RGB数据格式,得到目的图像。The core idea of the present invention is: the original image is in Bayer data format, and the target image is in RGB data format, each pixel in the original image is scaled, and the image in Bayer data format is obtained after zooming; then, the zoomed image is passed through The interpolation operation is converted into RGB data format to obtain the target image.

为使本发明的目的、技术方案及优点更加清楚明白,以下参照附图并举实施例,对本发明进一步详细说明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and examples.

如图4所示,本发明分两个阶段将Bayer数据格式的图像缩放成符合大小要求的RGB数据格式。As shown in FIG. 4 , the present invention scales the image in the Bayer data format into an RGB data format that meets the size requirement in two stages.

第一阶段:完成图像的缩放操作,缩放后的图像仍保持Bayer数据格式。The first stage: the scaling operation of the image is completed, and the scaled image still maintains the Bayer data format.

在下面的叙述中,缩放前图像的像素点颜色值表示为f(i,j),缩放后图像的像素点颜色值表示为f′(i′,j′)。In the following description, the pixel color value of the image before scaling is expressed as f(i, j), and the pixel color value of the image after scaling is expressed as f'(i', j').

图5显示的是缩放后图像中的某个像素点(i′,j′)的颜色值的计算过程,具体包括以下步骤:Figure 5 shows the calculation process of the color value of a certain pixel point (i′, j′) in the zoomed image, which specifically includes the following steps:

步骤501:变换Bayer数据格式的初始行排列方式,根据缩放后图像的初始行排列方式确定像素点(i′,j′)的颜色类型。Step 501: Transform the initial row arrangement of the Bayer data format, and determine the color type of the pixel (i′, j′) according to the initial row arrangement of the scaled image.

假设缩放前图像的初始行排列方式如图1(a)所示,在本步骤中,系统可以灵活选择图1中(a)~(d)四种初始行排列方式中的任意一种作为缩放后图像的Bayer数据格式。即:本发明中,缩放前后图像的初始行排列方式可以不同。Assuming that the initial row arrangement of the image before scaling is shown in Figure 1(a), in this step, the system can flexibly choose any of the four initial row arrangements in Figure 1 (a)-(d) as the zooming method. The Bayer data format of the post image. That is: in the present invention, the initial row arrangement of the image before and after zooming may be different.

确定了缩放后图像的初始行排列方式后,像素点(i′,j′)的颜色类型由初始行排列方式和(i′,j′)的坐标值唯一确定。After the initial row arrangement of the scaled image is determined, the color type of the pixel point (i′, j′) is uniquely determined by the initial row arrangement and the coordinate value of (i′, j′).

缩放后图像选择图1(a)所示的初始行排列方式,则像素点(i′,j′)的颜色类型通过公式(4)确定:After scaling the image, select the initial row arrangement shown in Figure 1(a), then the color type of the pixel point (i′, j′) is determined by the formula (4):

缩放后图像选择图1(b)所示的初始行排列方式,则像素点(i′,j′)的颜色类型通过公式(5)确定:After zooming, the image selects the initial row arrangement shown in Figure 1(b), then the color type of the pixel point (i′, j′) is determined by the formula (5):

Figure A20041010269600102
Figure A20041010269600102

缩放后图像选择图1(c)所示的初始行排列方式,则像素点(i′,j′)的颜色类型通过公式(6)确定:After scaling the image, select the initial row arrangement shown in Figure 1(c), then the color type of the pixel point (i′, j′) is determined by the formula (6):

Figure A20041010269600103
Figure A20041010269600103

缩放后图像选择图1(d)所示的初始行排列方式,则像素点(i′,j′)的颜色类型通过公式(7)确定:After scaling the image, select the initial row arrangement shown in Figure 1(d), then the color type of the pixel point (i′, j′) is determined by the formula (7):

Figure A20041010269600111
Figure A20041010269600111

本发明这种方法可以根据实际需要改变图像的初始行排列方式,给后续的数据处理带来极大的灵活度。The method of the present invention can change the initial line arrangement of the image according to actual needs, bringing great flexibility to subsequent data processing.

步骤502:选择缩放后图像中的像素点(i′,j′)在缩放前图像中的对应点(x,y)或参考点(i,j)。Step 502: Select the corresponding point (x, y) or reference point (i, j) of the pixel point (i', j') in the image after scaling in the image before scaling.

选择对应点的方法如下:令x=i′M/M′,y=j′N/N′,则对应点(x,y)的位置如图6或图7所示。The method of selecting the corresponding point is as follows: let x=i′M/M′, y=j′N/N′, then the position of the corresponding point (x, y) is shown in Fig. 6 or Fig. 7 .

选择参考点的方法如下:在如图6或图7所示的坐标系下,选择位于对应点(x,y)的左上角,与点(x,y)距离最近,且与像素点(i′,j′)具有相同颜色类型的点作为像素点(i′,j′)的参考点,图6或图7中的点(i,j)就是所选择的参考点。The method of selecting a reference point is as follows: in the coordinate system shown in Figure 6 or Figure 7, select the upper left corner of the corresponding point (x, y), the closest distance to the point (x, y), and the pixel point (i ', j') with the same color type as the reference point of the pixel point (i', j'), and the point (i, j) in Figure 6 or Figure 7 is the selected reference point.

步骤503~504:根据对应点(x,y)或参考点(i,j)选取插值数据点,计算像素点(i′,j′)的颜色值。Steps 503-504: Select the interpolation data point according to the corresponding point (x, y) or the reference point (i, j), and calculate the color value of the pixel point (i′, j′).

从图1的分布情况可以看出,Bayer数据格式中R颜色类型和B颜色类型的像素点个数相同,G颜色类型的像素点个数是R颜色类型或B颜色类型的两倍,即G∶R∶B的比例是2∶1∶1,下面分别讨论具有不同颜色类型的像素点的插值数据点的选取方法:From the distribution in Figure 1, it can be seen that the number of pixels of R color type and B color type in the Bayer data format is the same, and the number of pixels of G color type is twice that of R color type or B color type, that is, G The ratio of :R:B is 2:1:1, and the selection methods of interpolation data points for pixels with different color types are discussed below:

其一、R或B类型像素点的插值数据点的选取。如图6所示,A点就是步骤502选择的参考点(i,j)。First, the selection of interpolation data points of R or B type pixels. As shown in FIG. 6 , point A is the reference point (i, j) selected in step 502 .

如果采用Bi-Linear插值法计算(i′,j′)点的颜色值f′(i′,j′),可以选择图6标示的A、B、C、D四个点的颜色值进行插值计算,A、B、C、D四点位于图6所示平行于坐标网格的矩形网格上,在图6的坐标系下,A、B、C、D四点的坐标值分别为:(i,j)、(i,j+2)、(i+2,j)和(i+2,j+2),插值的结果由公式(8)可得:If the Bi-Linear interpolation method is used to calculate the color value f'(i', j') of point (i', j'), the color values of the four points A, B, C, and D indicated in Figure 6 can be selected for interpolation Calculation, the four points A, B, C, and D are located on the rectangular grid parallel to the coordinate grid shown in Figure 6. In the coordinate system of Figure 6, the coordinate values of the four points A, B, C, and D are respectively: (i, j), (i, j+2), (i+2, j) and (i+2, j+2), the result of interpolation can be obtained from formula (8):

f′(i′,j′)=(1-dx)(1-dy)f(i,j)+dy(1-dx)f(i,j+2)+dx(1-dy)f(i+2,j)+dxdyf(i+2,j+2)(8)f'(i', j')=(1-dx)(1-dy)f(i,j)+dy(1-dx)f(i,j+2)+dx(1-dy)f( i+2,j)+dxdyf(i+2,j+2)(8)

其中,插值数据点的插值参数dx和dy计算如下:由步骤502可得,x=i′M/M′,y=j′N/N′,则对应点(x,y)距参考点(i,j)的水平和垂直距离分别为dx′和dy′,则dx′=x-i,dy′=y-j。利用公式(9)将dx′和dy′归一化到[0,1.0)区间后得到的值即为dx和dy。Wherein, the interpolation parameters dx and dy of the interpolation data points are calculated as follows: by step 502, x=i'M/M', y=j'N/N', then the corresponding point (x, y) is far from the reference point ( The horizontal and vertical distances of i, j) are dx' and dy' respectively, then dx'=x-i, dy'=y-j. The values obtained after normalizing dx' and dy' to the interval [0, 1.0) using formula (9) are dx and dy.

Figure A20041010269600121
Figure A20041010269600121

Bi-Linear插值法中对插值数据点的选取和现有技术类似,所不同的是本发明中插值数据点在X轴方向和Y轴方向的间隔是现有技术的两倍。The selection of interpolation data points in the Bi-Linear interpolation method is similar to that of the prior art, except that the intervals of the interpolation data points in the present invention in the X-axis direction and the Y-axis direction are twice that of the prior art.

如果采用Bi-Cubic插值法计算(i′,j′)点的颜色值f′(i′,j′),可以选择图6中以灰色显示的十六个点的颜色值进行插值计算。If the Bi-Cubic interpolation method is used to calculate the color value f'(i', j') of point (i', j'), the color values of the sixteen points shown in gray in Figure 6 can be selected for interpolation calculation.

其二、G类型像素点的插值数据点的选取。如图7所示,A点就是步骤502选择的参考点(i,j)。Second, the selection of the interpolation data points of the G-type pixel points. As shown in FIG. 7 , point A is the reference point (i, j) selected in step 502 .

如果采用Bi-Linear插值法计算(i′,j′)点的颜色值f′(i′,j′),可以选择图7标示的A、B、C、D四个点的颜色值进行插值计算,A、B、C、D四点位于图7所示与坐标网格成45度夹角的矩形网格上,在图7的坐标系下,A、B、C、D四点的坐标值分别为:(i,j)、(i-1,j+1)、(i+l,j+1)和(i,j+2),插值的结果由公式(10)可得:If the Bi-Linear interpolation method is used to calculate the color value f'(i', j') of point (i', j'), the color values of the four points A, B, C, and D indicated in Figure 7 can be selected for interpolation Calculate, the four points A, B, C, and D are located on the rectangular grid at an angle of 45 degrees to the coordinate grid shown in Figure 7. In the coordinate system of Figure 7, the coordinates of the four points A, B, C, and D The values are: (i, j), (i-1, j+1), (i+l, j+1) and (i, j+2), the interpolation result can be obtained from formula (10):

f′(i′,j′)=(1-dx)(1-dy)f(i,j)+dy(1-dx)f(i-1,j+1)+dx(1-dy)f(i+1,j+1)+dxdyf(i,j+2)  (10)f'(i', j')=(1-dx)(1-dy)f(i,j)+dy(1-dx)f(i-1,j+1)+dx(1-dy) f(i+1,j+1)+dxdyf(i,j+2) (10)

其中,插值数据点的插值参数dx和cy计算如下:由步骤502可得,x=i′M/M′,y=j′N/N′,对应点(x,y)距参考点(i,j)的水平和垂直距离分别为dx′和dy′,则dx′=x-i,dy′=y-j。利用公式(11)将dx′和dy′归一化到[0,1.0)区间后得到的值即为dx和dy。Wherein, the interpolation parameters dx and cy of the interpolation data points are calculated as follows: by step 502, x=i'M/M', y=j'N/N', the corresponding point (x, y) is far from the reference point (i , j) the horizontal and vertical distances are dx' and dy' respectively, then dx'=x-i, dy'=y-j. The values obtained after normalizing dx' and dy' to the interval [0, 1.0) using formula (11) are dx and dy.

Figure A20041010269600122
Figure A20041010269600122

从图7可以看出,本发明这一较佳实施例选取与X、Y坐标网格成45度角的矩形网格上的所有与(i′,j′)具有相同颜色类型的点作为插值数据点。这种45度角矩形网格选取的插值数据点在整体上最接近像素点(i′,j′),所以插值得出的结果能够更准确地描述像素点(i′j′)的颜色值。As can be seen from Fig. 7, this preferred embodiment of the present invention selects all points with the same color type as (i', j') on the rectangular grid that forms an angle of 45 degrees with the X, Y coordinate grid as interpolation data point. The interpolation data points selected by this 45-degree rectangular grid are the closest to the pixel point (i′, j′) on the whole, so the result of interpolation can describe the color value of the pixel point (i′j′) more accurately .

对于G类型像素点的插值数据点的选取,Bi-Linear插值法也可以采用与R或B类型像素点相类似的选取方法,即插值数据点围成的矩形网格与坐标网格平行。但是,对G类型像素点而言,这种选取方法忽略了更接近(i′,j′)点的数据点,所以插值得出的结果不如45度角矩形网格选取的插值数据点得出的结果准确。For the selection of interpolation data points of G-type pixels, the Bi-Linear interpolation method can also adopt a selection method similar to that of R or B-type pixels, that is, the rectangular grid surrounded by interpolation data points is parallel to the coordinate grid. However, for G-type pixels, this selection method ignores the data points closer to (i′, j′), so the interpolation result is not as good as the interpolation data points selected by the 45-degree rectangular grid. The result is accurate.

如果采用Bi-Cubic插值法计算(i′,j′)点的颜色值f′(i′,j′),可以选择图7中以灰色显示的十六个点的颜色值进行插值计算。If the Bi-Cubic interpolation method is used to calculate the color value f'(i', j') of point (i', j'), the color values of the sixteen points shown in gray in Figure 7 can be selected for interpolation calculation.

采用上述方法可以获得缩放后图像中所有M′×N′个像素点的颜色值。和现有技术相比,本发明的方法只需要计算M′×N′个像素点的插值,而现有技术需要三次计算M′× N′个像素点的插值,故本发明的方法大大减少了计算量,加快图像处理速度。The above method can be used to obtain the color values of all M′×N′ pixels in the image after scaling. Compared with the prior art, the method of the present invention only needs to calculate the interpolation of M'×N' pixels, while the prior art needs to calculate the interpolation of M'×N' pixels three times, so the method of the present invention greatly reduces Reduce the amount of calculation and speed up image processing.

第二个阶段:将Bayer数据格式的图像数据转换成RGB数据格式。The second stage: convert the image data in Bayer data format into RGB data format.

该步骤与现有技术中的步骤201相同,此处不再赘述。This step is the same as step 201 in the prior art, and will not be repeated here.

由上述的实施例可见,本发明的这种实现图像缩放的方法减少图像缩放操作的计算复杂度,计算量仅为现有技术的三分之一,从而加快图像处理速度,使该方法更适用于视频处理等实时性要求较高的领域。It can be seen from the above-mentioned embodiments that the method for realizing image zooming of the present invention reduces the computational complexity of the image zooming operation, and the calculation amount is only one-third of that of the prior art, thus speeding up the image processing speed and making the method more applicable It is suitable for fields with high real-time requirements such as video processing.

以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of the present invention. within the scope of protection.

Claims (8)

1, a kind of method that realizes image zoom, original image is the Bayer data layout, and the purpose image is the RGB data layout, it is characterized in that, and this method may further comprise the steps:
A, each pixel in the original image is carried out zoom operations, obtain the image of Bayer data layout behind the convergent-divergent;
Image transitions becomes the RGB data layout behind b, the convergent-divergent that step a is obtained, obtains the purpose image.
2, method according to claim 1 is characterized in that, the described zoom operations to pixel of step a may further comprise the steps:
A1, determine behind the convergent-divergent color type of this pixel in the image;
A2, before convergent-divergent, choose the interpolated data point that one or more and the described pixel of step a1 have the same color type in the image, utilize the color value interpolation calculation of selected interpolated data point to go out the color value of the described pixel of step a1.
3, method according to claim 2 is characterized in that, determines among the step a1 behind the convergent-divergent that the color type operation of pixel specifically comprises in the image: at first, the initial row arrangement mode of image behind the convergent-divergent is set; Secondly, according to the color type of the described pixel of coordinate figure determining step a1 of the initial row arrangement mode of image behind the convergent-divergent and the described pixel of step a1.
4, method according to claim 2 is characterized in that, further comprises before the described step a2: choose the corresponding point in the image before convergent-divergent of pixel described in the step a1;
Then the described method of choosing interpolated data point of step a2 specifically: choose the interpolated data point according to described corresponding point.
5, method according to claim 4, it is characterized in that, the operation of choosing corresponding point among the step a21 specifically: the size according to image before and after the coordinate figure of the described pixel of step a1 and the convergent-divergent obtains the described pixel of step a1 corresponding point in the image before convergent-divergent.
6, method according to claim 4 is characterized in that, the operation of choosing interpolated data point among the step a22 specifically: at first, before convergent-divergent, choose the rectangular node district that surrounds the described corresponding point of step a21 in the image; Secondly, choosing all drops on dropping in rectangular node the district in and has the point of same color type as the interpolated data point with the described pixel of step a1 on the rectangular node.
7, method according to claim 6 is characterized in that, described rectangular node district is parallel with coordinate axis.
According to claim 6 or 7 described methods, it is characterized in that 8, the described pixel of step a1 is the G color type, then described rectangular node district becomes miter angle with coordinate axis.
CN200410102696.5A 2004-12-27 2004-12-27 A method for implementing image zoom Expired - Fee Related CN1288598C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200410102696.5A CN1288598C (en) 2004-12-27 2004-12-27 A method for implementing image zoom

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200410102696.5A CN1288598C (en) 2004-12-27 2004-12-27 A method for implementing image zoom

Publications (2)

Publication Number Publication Date
CN1632829A true CN1632829A (en) 2005-06-29
CN1288598C CN1288598C (en) 2006-12-06

Family

ID=34848133

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200410102696.5A Expired - Fee Related CN1288598C (en) 2004-12-27 2004-12-27 A method for implementing image zoom

Country Status (1)

Country Link
CN (1) CN1288598C (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100515024C (en) * 2005-12-27 2009-07-15 华晶科技股份有限公司 Color Information Reconstruction Method for Reducing Image Resolution
CN102457722A (en) * 2010-10-26 2012-05-16 珠海全志科技股份有限公司 Processing method and device for Bayer image
CN102857781A (en) * 2012-09-27 2013-01-02 深圳市掌网立体时代视讯技术有限公司 Anti-aliasing method and anti-aliasing device in image compression
CN109379572A (en) * 2018-12-04 2019-02-22 北京达佳互联信息技术有限公司 Image conversion method, device, electronic equipment and storage medium
CN109767390A (en) * 2019-01-15 2019-05-17 湖南泽天智航电子技术有限公司 A kind of digital picture of block parallel disappears image rotation method
CN111093045A (en) * 2019-12-10 2020-05-01 北京佳讯飞鸿电气股份有限公司 Method and device for scaling video sequence resolution
CN116896688A (en) * 2023-09-11 2023-10-17 归芯科技(深圳)有限公司 Bayer image processing method, device, chip and storage medium
US12248948B1 (en) * 2018-05-31 2025-03-11 Blue Yonder Group, Inc. System and method of integrating social trends in assortment planning

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100515024C (en) * 2005-12-27 2009-07-15 华晶科技股份有限公司 Color Information Reconstruction Method for Reducing Image Resolution
CN102457722A (en) * 2010-10-26 2012-05-16 珠海全志科技股份有限公司 Processing method and device for Bayer image
CN102457722B (en) * 2010-10-26 2014-01-22 珠海全志科技股份有限公司 Processing method and device for Bayer image
CN102857781A (en) * 2012-09-27 2013-01-02 深圳市掌网立体时代视讯技术有限公司 Anti-aliasing method and anti-aliasing device in image compression
CN102857781B (en) * 2012-09-27 2014-12-17 深圳市掌网立体时代视讯技术有限公司 Anti-aliasing method and anti-aliasing device in image compression
US12248948B1 (en) * 2018-05-31 2025-03-11 Blue Yonder Group, Inc. System and method of integrating social trends in assortment planning
US11470294B2 (en) 2018-12-04 2022-10-11 Beijing Dajia Internet Information Technology Co., Ltd. Method, device, and storage medium for converting image from raw format to RGB format
WO2020114087A1 (en) * 2018-12-04 2020-06-11 北京达佳互联信息技术有限公司 Method and device for image conversion, electronic equipment, and storage medium
CN109379572A (en) * 2018-12-04 2019-02-22 北京达佳互联信息技术有限公司 Image conversion method, device, electronic equipment and storage medium
CN109767390A (en) * 2019-01-15 2019-05-17 湖南泽天智航电子技术有限公司 A kind of digital picture of block parallel disappears image rotation method
CN111093045A (en) * 2019-12-10 2020-05-01 北京佳讯飞鸿电气股份有限公司 Method and device for scaling video sequence resolution
CN116896688A (en) * 2023-09-11 2023-10-17 归芯科技(深圳)有限公司 Bayer image processing method, device, chip and storage medium
CN116896688B (en) * 2023-09-11 2023-12-26 归芯科技(深圳)有限公司 Bayer image processing method, device, chip and storage medium

Also Published As

Publication number Publication date
CN1288598C (en) 2006-12-06

Similar Documents

Publication Publication Date Title
CN100336076C (en) Image providing method and equipment
US8749694B2 (en) Methods and apparatus for rendering focused plenoptic camera data using super-resolved demosaicing
CN101860673B (en) Image processing apparatus and image processing method
CN1217526C (en) Image processing device, image processing method, image processing program and its recording medium
CN101124815B (en) Image pickup device, image capturing method and method of designing image pickup device
CN1220365C (en) Screen correction method and image pickup device
CN1812592A (en) Method and apparatus for processing image data of a color filter array
CN102682426A (en) Image processing apparatus, image processing method, and program
CN1288916C (en) Image dead point and noise eliminating method
CN1622134A (en) Image conversion method capable of realizing zooming
CN1739116A (en) Apparatus and method for producing thumbnail images and for improving image quality of re-sized images
CN107924558A (en) Image processing apparatus, image processing method, recording medium, program and filming apparatus
CN1820496A (en) Image Correction Method and Camera Device
TWI588757B (en) Edge detection system and methods
CN101031029A (en) Method and apparatus for processing video image
CN1977383A (en) CMOS image sensor
CN1913576A (en) Color filter lens array interpolation method
CN1632829A (en) A method to achieve image scaling
CN1288549A (en) Method and system for processing images
CN1457472A (en) Distance calculation method and image pickup device
CN1604613A (en) imaging device
CN109285113B (en) Improved color image interpolation method based on gradient
CN1906632A (en) Image processing device and image processing method
CN1780405A (en) A conversion method and module from raw Bayer interpolation to full color
CN1275022A (en) Detection method and system for inner and outer video camera parameters of virtual studio

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: GUANGDONG ZHONGXING ELECTRONICS CO., LTD.

Free format text: FORMER OWNER: BEIJING VIMICRO CORPORATION

Effective date: 20150311

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 100083 HAIDIAN, BEIJING TO: 519031 ZHUHAI, GUANGDONG PROVINCE

TR01 Transfer of patent right

Effective date of registration: 20150311

Address after: 519031 Guangdong city of Zhuhai province Hengqin Baohua Road No. 6, room 105 -478

Patentee after: GUANGDONG ZHONGXING ELECTRONICS CO., LTD.

Address before: 100083, Haidian District, Xueyuan Road, Beijing No. 35, Nanjing Ning building, 15 Floor

Patentee before: Beijing Vimicro Corporation

DD01 Delivery of document by public notice

Addressee: GUANGDONG ZHONGXING ELECTRONICS CO., LTD.

Document name: Notification of Passing Examination on Formalities

DD01 Delivery of document by public notice

Addressee: Shen Yingming

Document name: payment instructions

DD01 Delivery of document by public notice
DD01 Delivery of document by public notice

Addressee: Shen Yingming

Document name: Notice of termination of patent right

DD01 Delivery of document by public notice
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20061206

Termination date: 20201227