[summary of the invention]
Purpose of the present invention is exactly to be difficult to technical problems such as realization in order to solve convergent-divergent and algorithm complexity, operation time long, the hardware circuit of can only carrying out for the picture of specific dimensions that exists in the prior art image zooming processing method, the invention provides a kind of image zooming processing method and processing unit.
Concrete technical scheme of the present invention is as follows:
The invention provides a kind of image zooming processing method, this method comprises:
Reception sources pictorial information data are also decoded, and obtain source picture bitmap format data;
According to the first image zooming ratio of setting, change the quantity of source picture bitmap format data pixels point, the bitmap format data of formation intermediate picture according to the position coordinates of pixel;
According to the second image zooming ratio of setting, change the quantity of pixel in the intermediate picture bitmap format data according to the mean value of the color value of neighbor pixel, form Target Photo bitmap format data.
The described first image zooming ratio is the picture reduce in scale, and the described second image zooming ratio is the picture magnification ratio.
According to the picture reduce in scale of setting, change the quantity of source picture bitmap format data pixels point according to the position coordinates of pixel, formation intermediate picture bitmap format data specifically comprise:
The position coordinates of each pixel in the picture bitmap format data of setting source;
According to the picture reduce in scale of setting, to source picture bitmap format data according to extracting one or more pixel every a pixel or every the position coordinates of a plurality of pixels line by line;
According to the picture reduce in scale of setting, to source picture bitmap format data according to extracting one or more pixel every a pixel or every the position coordinates of a plurality of pixels by row;
Form intermediate picture bitmap format data.
According to the picture magnification ratio of setting, change the quantity of pixel in the intermediate picture bitmap format data according to the mean value of the color value of neighbor pixel, form Target Photo bitmap format data, specifically comprise:
According to the picture magnification ratio of setting, calculate the mean value of the represented color value of adjacent a plurality of pixels in the intermediate picture bitmap format data line by line;
According to the picture magnification ratio of setting, by the mean value of the represented color value of adjacent a plurality of pixels in the column count intermediate picture bitmap format data;
Be that the pixel of above-mentioned mean value adds in the intermediate picture bitmap format data between adjacent a plurality of pixels line by line with color value;
Is that the pixel of above-mentioned mean value adds in the intermediate picture bitmap format data between adjacent a plurality of pixels by row with color value;
Form Target Photo bitmap format data.
The described first image zooming ratio is the picture magnification ratio, and the described second image zooming ratio is the picture reduce in scale.
According to the picture magnification ratio of setting, change the quantity of source picture bitmap format data pixels point according to the position coordinates of pixel, formation intermediate picture bitmap format data specifically comprise:
The position coordinates of each pixel in the picture bitmap format data of setting source;
According to the picture magnification ratio of setting, to source picture bitmap format data according to adding one or more repetition pixels every a pixel or every the position coordinates of a plurality of pixels line by line;
According to the picture magnification ratio of setting, to source picture bitmap format data according to adding one or more repetition pixels every a pixel or every the position coordinates of a plurality of pixels by row;
Form intermediate picture bitmap format data.
According to the picture reduce in scale of setting, change the quantity of pixel in the intermediate picture bitmap format data according to the mean value of the color value of neighbor pixel, form Target Photo bitmap format data, specifically comprise:
According to the picture reduce in scale of setting, calculate the mean value of the represented color value of adjacent a plurality of pixels in the intermediate picture bitmap format data line by line;
According to the picture reduce in scale of setting, by the mean value of the represented color value of adjacent a plurality of pixels in the column count intermediate picture bitmap format data;
Be that the pixel of above-mentioned mean value substitutes the adjacent a plurality of pixels in the intermediate picture bitmap format data line by line with color value;
Is that the pixel of above-mentioned mean value substitutes in the intermediate picture bitmap format data between adjacent a plurality of pixels by row with color value;
Form Target Photo bitmap format data.
Described image zooming processing method further comprises: the bitmap format data of receiving target picture are encoded, and obtain Target Photo information data and output.
The present invention also provides a kind of image zooming processing unit, and this device comprises:
Decoding unit is used for the source pictorial information data that receive are decoded, and obtains source picture bitmap format data;
The first convergent-divergent processing unit is used for according to the first image zooming ratio of setting, and changes the quantity of source picture bitmap format data pixels point, the bitmap format data of formation intermediate picture according to the position coordinates of pixel;
The second convergent-divergent processing unit is used for according to the second image zooming ratio of setting, and changes the quantity of pixel in the intermediate picture bitmap format data according to the mean value of the color value of neighbor pixel, forms Target Photo bitmap format data.
The described first convergent-divergent processing unit comprises:
The setting coordinate subelement, the position coordinates of each pixel in the picture bitmap format data of setting source;
First image zooming is used to set the first image zooming ratio than row setup unit;
The first pixel control unit according to the first image zooming ratio of setting and the position coordinates of pixel, reaches by row line by line to source picture bitmap format data pick-up or interpolation pixel.
The described second convergent-divergent processing unit comprises:
Second image zooming is used to set the second image zooming ratio than row setup unit;
The color value computing unit is used to calculate the mean value of the represented color value of adjacent a plurality of pixels;
The second pixel control unit is used for the mean value according to the color value of second image zooming ratio of setting and neighbor pixel, reaches line by line by row and extracts or substitute pixel in the described intermediate picture bitmap format data.
Described image zooming processing unit also comprises:
Coding unit, the bitmap format data that are used for the Target Photo that will receive are encoded, and obtain Target Photo information data and output.
Compared to prior art, the main beneficial effect of image zooming processing method of the present invention and processing unit is:
(1). according to the position coordinates of pixel, source picture bitmap format data are extracted or add pixel than row according to first, the source image zooming of making is the suitable intermediate picture of a size; According to the mean value of the represented color value of neighbor pixel, middle picture is carried out convergent-divergent again, obtain Target Photo.Therefore, by aforesaid operations, the present invention can carry out convergent-divergent to the picture of arbitrary dimension, can satisfy the requirement of different display devices, has compatible preferably.
(2). the present invention only needs the color value of neighbor pixel is averaged calculating, so its algorithm is simple, operation time is short, and hardware circuit is easy to realize and be convenient to operation.
[embodiment]
The present invention relates to a kind of image zooming processing method and processing unit, describe technical scheme of the present invention in detail below in conjunction with accompanying drawing:
Embodiment 1
As shown in Figure 1, a kind of image zooming processing method provided by the invention comprises step:
101, reception sources pictorial information data and decoding are obtained source picture bitmap format data; Described source pictorial information data are BMP format picture, JPG format picture, PNG format picture, TGA format picture or PCX format picture etc.;
102,, change the quantity of source picture bitmap format data pixels point, the bitmap format data of formation intermediate picture according to the position coordinates of pixel according to the first image zooming ratio of setting;
103, according to the second image zooming ratio of setting, change the quantity of pixel in the intermediate picture bitmap format data according to the mean value of the color value of neighbor pixel, form Target Photo bitmap format data.
Embodiment 2
On the basis of embodiment 1, further among the embodiment 2, the described first image zooming ratio is the picture reduce in scale, and the described second image zooming ratio is the picture magnification ratio, and then described step 102 and described step 103 specifically comprise:
(1). the source picture is carried out picture dwindle when handling operation:
The position coordinates of each pixel in the picture bitmap format data of setting source., n row capable as the total m of the pixel in the picture bitmap format data of source, set be positioned at wherein that i is capable, the coordinate of the pixel of j row for (i, j), set coordinate and be (i, the color value of pixel j) be expressed as f (i, j).
According to the picture reduce in scale value of source picture, set the reduce in scale value of the less source picture of a numerical value earlier to intermediate picture to Target Photo.For example: the dimension of picture of the Target Photo that obtain is the B/E of the dimension of picture of source picture, the reduce in scale value that can set the source picture earlier is D/F, promptly set earlier and obtain the intermediate picture of D/F that dimension of picture is the dimension of picture of source picture, wherein, B, D, E, F are natural number, B<E, D<F, the numerical value of D/F<B/E.
According to the reduce in scale value of the source picture of setting to intermediate picture, to source picture bitmap format data according to extracting one or more pixel every a pixel or every the position coordinates of a plurality of pixels line by line; To source picture bitmap format data according to extracting one or more pixel every a pixel or every the position coordinates of a plurality of pixels by row; Form intermediate picture bitmap format data.
According to the source picture in the picture reduce in scale value of Target Photo and the step 102 the source picture to the picture reduce in scale value of intermediate picture, by calculating the picture magnification ratio value of intermediate picture to Target Photo.For example: the dimension of picture of the Target Photo that obtain is the B/E of the dimension of picture of source picture, and the source picture of setting in the step 102 is D/F to the reduce in scale value of intermediate picture, and then intermediate picture is to the picture magnification ratio value B*F/E*D of Target Photo.
According to the magnification ratio value of the intermediate picture of setting to Target Photo, calculate the mean value of adjacent two pixels in the intermediate picture bitmap format data or the represented color value of adjacent a plurality of pixels line by line, and by the mean value of the represented color value of adjacent a plurality of pixels in the column count intermediate picture bitmap format data.For example, pixel for i in capable, get adjacent (i, j+1) pixel, (i, j+2) pixel ..., (i, j+X) pixel, the mean value of the color value of the individual pixel of then above-mentioned adjacent X (X is the natural number more than or equal to 2) for [f (and i, j+1)+f (i, j+2) ..., f (i, j+X)]/X, the pixel for i+1 in capable and the like; For the pixel in the j row, get adjacent (i+1, j) pixel, (i+2, j) pixel ..., (mean value of the color value of the individual pixel of then above-mentioned adjacent Y (Y is the natural number more than or equal to 2) is [f (i+1 for i+Y, j) pixel, j)+f (i+2, j), Pang, f (i+Y, j)]/Y, for the pixel in the j+1 row.
Be that the pixel of the mean value of above-mentioned color value adds in the intermediate picture bitmap format data between adjacent a plurality of pixels line by line with color value, is that the pixel of above-mentioned mean value adds in the intermediate picture bitmap format data between adjacent two pixels or the adjacent a plurality of pixel by row with color value, forms Target Photo bitmap format data.
(2). when the source picture is carried out the operation of picture processing and amplifying:
The position coordinates of each pixel in the picture bitmap format data of setting source., n row capable as the total m of the pixel in the picture bitmap format data of source, set be positioned at wherein that i is capable, the coordinate of the pixel of j row for (i, j), set coordinate and be (i, the color value of pixel j) be expressed as f (i, j).
According to the picture magnification ratio value of source picture, set earlier the reduce in scale value of a suitable source picture to intermediate picture to Target Photo.For example: the dimension of picture of the Target Photo that obtain is the B/E of the dimension of picture of source picture, the reduce in scale value that can set the source picture earlier is D/F, promptly set earlier and obtain the intermediate picture of D/F that dimension of picture is the dimension of picture of source picture, wherein, B, D, E, F are natural number, B>E, D<F, the numerical value of D/F<1<B/E.
According to the reduce in scale value of the source picture of setting to intermediate picture, to source picture bitmap format data according to extracting one or more pixel every a pixel or every the position coordinates of a plurality of pixels line by line; To source picture bitmap format data according to extracting one or more pixel every a pixel or every the position coordinates of a plurality of pixels by row; Form intermediate picture bitmap format data.
According to the source picture in the picture magnification ratio value of Target Photo and the step 102 the source picture to the picture reduce in scale value of intermediate picture, by calculating the picture magnification ratio value of intermediate picture to Target Photo.For example: the dimension of picture of the Target Photo that obtain is the B/E of the dimension of picture of source picture, and the source picture of setting in the step 102 is D/F to the reduce in scale value of intermediate picture, and then intermediate picture is to the picture magnification ratio value B*F/E*D of Target Photo.
According to the magnification ratio value of the intermediate picture of setting to Target Photo, calculate the mean value of adjacent two pixels in the intermediate picture bitmap format data or the represented color value of adjacent a plurality of pixels line by line, and by the mean value of the represented color value of adjacent a plurality of pixels in the column count intermediate picture bitmap format data.For example, pixel for i in capable, get adjacent (i, j+1) pixel, (i, j+2) pixel ..., (i, j+X) pixel, the mean value of the color value of the individual pixel of then above-mentioned adjacent X (X is the natural number more than or equal to 2) for [f (and i, j+1)+f (i, j+2) ..., f (i, j+X)]/X, the pixel for i+1 in capable and the like; For the pixel in the j row, get adjacent (i+1, j) pixel, (i+2, j) pixel ..., (mean value of the color value of the individual pixel of then above-mentioned adjacent Y (Y is the natural number more than or equal to 2) is [f (i+1 for i+Y, j) pixel, j)+f (i+2, j) ..., f (i+Y, j)]/Y, for the pixel in the j+1 row.
Be that the pixel of the mean value of above-mentioned color value adds in the intermediate picture bitmap format data between adjacent a plurality of pixels line by line with color value, is that the pixel of above-mentioned mean value adds in the intermediate picture bitmap format data between adjacent two pixels or the adjacent a plurality of pixel by row with color value, forms Target Photo bitmap format data.
Embodiment 3
On the basis of embodiment 1, further among the embodiment 3, the described first image zooming ratio is the picture magnification ratio, and the described second image zooming ratio is the picture reduce in scale, and then described step 102 and described step 103 specifically comprise:
(1). the source picture is carried out picture dwindle when handling operation:
The position coordinates of each pixel in the picture bitmap format data of setting source., n row capable as the total m of the pixel in the picture bitmap format data of source, set be positioned at wherein that i is capable, the coordinate of the pixel of j row for (i, j), set coordinate and be (i, the color value of pixel j) be expressed as f (i, j).
According to the picture reduce in scale value of source picture, set the magnification ratio value that a suitable source picture arrives intermediate picture earlier to Target Photo.For example: the dimension of picture of the Target Photo that obtain is the B/E of the dimension of picture of source picture, the magnification ratio value that can set the source picture earlier is D/F, promptly set earlier and obtain the intermediate picture of D/F that dimension of picture is the dimension of picture of source picture, wherein, B, D, E, F are natural number, B<E, D>F, the numerical value of D/F>1>B/E.
According to the magnification ratio value of the source picture of setting to intermediate picture, to source picture bitmap format data according to adding one or more repetition pixels every a pixel or every the position coordinates of a plurality of pixels line by line; To source picture bitmap format data according to adding one or more repetition pixels every a pixel or every the position coordinates of a plurality of pixels by row; Form intermediate picture bitmap format data.
According to the source picture in the picture reduce in scale value of Target Photo and the step 102 the source picture to the picture magnification ratio value of intermediate picture, by calculating the picture reduce in scale value of intermediate picture to Target Photo.For example: obtain dimension of picture and be the Target Photo of B/E of the dimension of picture of source picture, the source picture of setting in the step 102 is D/F to the magnification ratio value of intermediate picture, and then intermediate picture arrives the picture reduce in scale value B*F/E*D of Target Photo.
According to the reduce in scale value of the intermediate picture of setting to Target Photo, calculate the mean value of the represented color value of adjacent a plurality of pixels in the intermediate picture bitmap format data line by line, and the mean value that pursues the represented color value of adjacent a plurality of pixels in the column count intermediate picture bitmap format data.For example, pixel for i in capable, get adjacent (i, j+1) pixel, (i, j+2) pixel ..., (i, j+X) pixel, the mean value of the color value of the individual pixel of then above-mentioned adjacent X (X is the natural number more than or equal to 2) for [f (and i, j+1)+f (i, j+2), Pang, f (i, j+X)]/X, the pixel for i+1 in capable and the like; For the pixel in the j row, get adjacent (i+1, j) pixel, (i+2, j) pixel ..., (mean value of the color value of the individual pixel of then above-mentioned adjacent Y (Y is the natural number more than or equal to 2) is [f (i+1 for i+Y, j) pixel, j)+f (i+2, j) ..., f (i+Y, j)]/Y, for the pixel in the j+1 row.
Be that the pixel of above-mentioned mean value substitutes the adjacent a plurality of pixels in the intermediate picture bitmap format data line by line with color value; Pursue between the adjacent a plurality of pixels in the alternative intermediate picture bitmap format data of pixel that row are above-mentioned mean value with color value; Form Target Photo bitmap format data.
(2). when the source picture is carried out the operation of picture processing and amplifying:
The position coordinates of each pixel in the picture bitmap format data of setting source., n row capable as the total m of the pixel in the picture bitmap format data of source, set be positioned at wherein that i is capable, the coordinate of the pixel of j row for (i, j), set coordinate and be (i, the color value of pixel j) be expressed as f (i, j).
According to the picture magnification ratio value of source picture, set the magnification ratio value that a bigger source picture arrives intermediate picture earlier to Target Photo.For example: the dimension of picture of the Target Photo that obtain is the B/E of the dimension of picture of source picture, the magnification ratio value that can set the source picture earlier is D/F, promptly set earlier and obtain the intermediate picture of D/F that dimension of picture is the dimension of picture of source picture, wherein, B, D, E, F are natural number, B>E, D>F, the numerical value of D/F>B/E.
According to the magnification ratio value of the source picture of setting to intermediate picture, to source picture bitmap format data according to adding one or more repetition pixels every a pixel or every the position coordinates of a plurality of pixels line by line; To source picture bitmap format data according to adding one or more repetition pixels every a pixel or every the position coordinates of a plurality of pixels by row; Form intermediate picture bitmap format data.
According to the source picture in the picture magnification ratio value of Target Photo and the step 102 the source picture to the picture magnification ratio value of intermediate picture, by calculating the picture reduce in scale value of intermediate picture to Target Photo.For example: obtain dimension of picture and be the Target Photo of B/E of the dimension of picture of source picture, the source picture of setting in the step 102 is D/F to the magnification ratio value of intermediate picture, and then intermediate picture arrives the picture reduce in scale value B*F/E*D of Target Photo.
According to the reduce in scale value of the intermediate picture of setting to Target Photo, calculate the mean value of the represented color value of adjacent a plurality of pixels in the intermediate picture bitmap format data line by line, and the mean value that pursues the represented color value of adjacent a plurality of pixels in the column count intermediate picture bitmap format data.For example, pixel for i in capable, get adjacent (i, j+1) pixel, (i, j+2) pixel ..., (i, j+X) pixel, the mean value of the color value of the individual pixel of then above-mentioned adjacent X (X is the natural number more than or equal to 2) for [f (and i, j+1)+f (i, j+2), Pang, f (i, j+X)]/X, the pixel for i+1 in capable and the like; For the pixel in the j row, get adjacent (i+1, j) pixel, (i+2, j) pixel ..., (mean value of the color value of the individual pixel of then above-mentioned adjacent Y (Y is the natural number more than or equal to 2) is [f (i+1 for i+Y, j) pixel, j)+f (i+2, j) ..., f (i+Y, j)]/Y, for the pixel in the j+1 row.
Be that the pixel of above-mentioned mean value substitutes the adjacent a plurality of pixels in the intermediate picture bitmap format data line by line with color value; Pursue between the adjacent a plurality of pixels in the alternative intermediate picture bitmap format data of pixel that row are above-mentioned mean value with color value; Form Target Photo bitmap format data.
Embodiment 4
On the basis of embodiment 1, embodiment 2 or embodiment 3, a kind of image zooming processing method provided by the invention further comprises step:
104, the bitmap format data of receiving target picture are encoded, and obtain Target Photo information data and output.
Embodiment 5
As shown in Figure 3, the present invention also provides a kind of image zooming processing unit, and this image zooming processing unit comprises:
Decoding unit is used for the source pictorial information data that receive are decoded, and obtains source picture bitmap format data;
The first convergent-divergent processing unit is used for according to the first image zooming ratio of setting, and changes the quantity of source picture bitmap format data pixels point, the bitmap format data of formation intermediate picture according to the position coordinates of pixel;
The second convergent-divergent processing unit is used for according to the second image zooming ratio of setting, and changes the quantity of pixel in the intermediate picture bitmap format data according to the mean value of the color value of neighbor pixel, forms Target Photo bitmap format data.
Embodiment 6
As shown in Figure 4, on the basis of embodiment 5, further among the embodiment 6, the described first convergent-divergent processing unit comprises:
The setting coordinate unit, the position coordinates of each pixel in the picture bitmap format data of setting source;
First image zooming is used to set the first image zooming ratio than row setup unit;
The first pixel control unit is used for according to the first image zooming ratio of setting and the position coordinates of pixel, reaches line by line by row source picture bitmap format data pick-up or interpolation pixel.
Embodiment 7
As shown in Figure 5, on the basis of embodiment 5, further among the embodiment 7, the described second convergent-divergent processing unit comprises:
Second image zooming is used to set the second image zooming ratio than row setup unit;
The color value computing unit is used to calculate the mean value of the represented color value of adjacent a plurality of pixels;
The second pixel control unit is used for the mean value according to the color value of second image zooming ratio of setting and neighbor pixel, reaches line by line by row and extracts or substitute pixel in the described intermediate picture bitmap format data.
Embodiment 8
On the basis of embodiment 5, embodiment 6 or embodiment 7, described image zooming processing unit also comprises:
Coding unit, the bitmap format data that are used for the Target Photo that will receive are encoded, and obtain Target Photo information data and output.
The invention provides a kind of image zooming processing method and processing unit, compared to prior art, main beneficial effect of the present invention is:
(1). according to the position coordinates of pixel, source picture bitmap format data are extracted or add pixel than row according to first, the source image zooming of making is the suitable intermediate picture of a size; According to the mean value of the represented color value of neighbor pixel, middle picture is carried out convergent-divergent again, obtain Target Photo.Therefore, by aforesaid operations, the present invention can carry out convergent-divergent to the picture of arbitrary dimension, can satisfy the requirement of different display devices, has compatible preferably.
(2). the present invention only needs the color value of neighbor pixel is averaged calculating, so its algorithm is simple, operation time is short, and hardware circuit is easy to realize and be convenient to operation.
It should be noted that, above embodiment is only unrestricted in order to technical scheme of the present invention to be described, although the present invention is had been described in detail with reference to preferred embodiment, those of ordinary skill in the art is to be understood that, can make amendment or be equal to replacement technical scheme of the present invention, and not breaking away from the spirit and scope of technical solution of the present invention, it all should be encompassed in the middle of the claim scope of the present invention.