CN101692336B - Method for zooming out images - Google Patents
Method for zooming out images Download PDFInfo
- Publication number
- CN101692336B CN101692336B CN2009100192316A CN200910019231A CN101692336B CN 101692336 B CN101692336 B CN 101692336B CN 2009100192316 A CN2009100192316 A CN 2009100192316A CN 200910019231 A CN200910019231 A CN 200910019231A CN 101692336 B CN101692336 B CN 101692336B
- Authority
- CN
- China
- Prior art keywords
- row
- give
- pixel
- factor
- image
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Image Processing (AREA)
Abstract
The invention discloses a method for zooming out images, comprising the step of determining row rejection factors and column rejection factors of the images according to the dimensions of the original images and the dimensions of the target images zoomed out and the steps of determining the pixel points supposed to be rejected according to the row rejection factors and column rejection factors and obtaining the target images zoomed out. The method adopts the method of exclusion, uses rows or columns as the basic units to draw and reject each pixel of the image, realizes zooming out the images and saves the memory space occupied by image zooming out.
Description
Technical field
The present invention relates to image processing field, relate in particular to a kind of method of dwindling of image.
Background technology
At present, image dwindles method commonly used neighbour's sampling method, bilinear interpolation and bicubic interpolation method etc.The ultimate principle of these methods all is to get some pixels of image, through being transformed into the point of target image correspondence after the various variations; Then, according to certain algorithm, the pixel of select target image, these pixels are combined into target image together.There is following shortcoming in these image downscaling methods of the prior art: 1, owing to the mapping algorithm more complicated that adopts in the method, programming realizes relatively difficulty; 2, these algorithms all are the pixels that selection will keep, and dwindle at image and may get some overlapping pixels in the process, and are improper if these overlapping pixels are selected, and cause image distortion to a certain degree easily; 3, these methods all are all decodings earlier to image, and then compression, need occupy bigger cushion space, are unsuitable for being applied in the limited occasion of memory headroom, in embedded platform.
Summary of the invention
The present invention is directed to the above-mentioned shortcoming and defect that image downscaling method exists in the prior art, a kind of method of dwindling of new image is provided, adopt elimination methods, be that elementary cell is evenly reeled off raw silk from cocoons to each pixel of image and given up with the row or column, image is compressed while decoding, save image and dwindled shared memory headroom, improved the quality of dwindling the back image.
For solving the problems of the technologies described above, the present invention is achieved by the following technical solutions:
A kind of image dwindle method, it is characterized in that, comprise the steps:
A, according to the size of original image with dwindle after the size of target image determine that the row of image is given up the factor and row are given up the factor;
B, give up the factor and described row according to described row and give up the factor and determine the pixel that to give up, the target image after obtaining dwindling.
According to the present invention, described original image is of a size of W * H, and the target image after described the dwindling is of a size of W1 * H1, and it is H/ (H-H1+1) that then described row is given up the factor, and it is W/ (W-W1+1) that described row are given up the factor.Select the factor of giving up of above-mentioned definition for use, can make the pixel that is rejected in original image, at utmost evenly distribute, guaranteed evenly to abandon the pixel that is rejected, thereby made that the image fault after dwindling is littler.
According to a kind of technical scheme of the present invention, can dwindle image with the behavior elementary cell, then described step b specifically comprises step by step following:
B1, give up the position that the factor is judged the row that should give up in the original image, and give up whole pixels of the row that should give up in the original image according to described row;
B2, give up the factor according to described row and judge whether the pixel in the row should not give up is given up; The pixel that needs are given up is given up to fall, remaining pixel is placed in the buffer zone pixel as target image.
Wherein, give up the factor according to row among the described step b1 and judge that the process of the position of the row that should give up in the original image is: definition loop variable i, i=i+H/ (H-H1+1), i initial value are 0, cycle index is that (H-H1) is inferior; (i+0.5) rounded downwards, and the value after rounding is the position of the described row that should give up.
Giving up the process that the factor judges whether the pixel in the row should not give up is given up according to row among the described step b2 is: definition loop variable j, and j=j+W/ (W-W1+1), j initial value are 0, cycle index is that (W-W1) is inferior; (j+0.5) rounded downwards, and the value after rounding is the position of the row at the pixel place that should give up, the pixel that should give up be with described rounding after the corresponding row of value and the pixel of the described capable crossover location that should not give up.
According to the present invention, also can adopt the position of the definite pixel that should give up of following method:
Give up the factor according to row among the described step b1 and judge that the process of the position of the row that should give up in the original image is: definition loop variable i, i=i+H/ (H-H1+1), i initial value are 0, cycle index is that (H-H1) is inferior; (i-0.5) rounded downwards, and the value after rounding+1 is the position of the described row that should give up.
Giving up the process that the factor judges whether the pixel in the row should not give up is given up according to row among the described step b2 is: definition loop variable j, and j=j+W/ (W-W1+1), j initial value are 0, cycle index is that (W-W1) is inferior; (j-0.5) rounded downwards, and the value after rounding+1 is the position of the row at the pixel place that should give up, the pixel that should give up be with described rounding after the corresponding row in value+1 and the pixel of the described capable crossover location that should not give up.
According to another kind of technical scheme of the present invention, except that can adopt above-mentioned image is dwindled as elementary cell with row, also can dwindle image as elementary cell with row, then described step b specifically comprises step by step following:
B3, give up the position that the factor is judged the row that should give up in the original image, and give up whole pixels of the row that should give up in the original image according to described row;
B4, give up the factor according to described row and judge whether the pixel in the row should not give up is given up; The pixel that needs are given up is given up to fall, remaining pixel is placed in the buffer zone pixel as target image.
Wherein, give up the factor according to row among the described step b3 and judge that the process of the position of the row that should give up in the original image is: definition loop variable j, j=j+W/ (W-W1+1), j initial value are 0, cycle index is that (W-W1) is inferior; (j+0.5) rounded downwards, and the value after rounding is the position of the described row that should give up.
Giving up the process that the factor judges whether the pixel in the row should not give up is given up according to row among the described step b4 is: definition loop variable i, and i=i+H/ (H-H1+1), i initial value are 0, cycle index is that (H-H1) is inferior; (i+0.5) rounded downwards, and the value after rounding is the position of the row at the pixel place that should give up, the pixel that should give up be with described rounding after the corresponding row of value and the pixel of the described row crossover location that should not give up.
According to the present invention, also can adopt the position of the definite pixel that should give up of following method:
Give up the factor according to row among the described step b3 and judge that the process of the position of the row that should give up in the original image is: definition loop variable j, j=j+W/ (W-W1+1), j initial value are 0, cycle index is that (W-W1) is inferior; (j-0.5) rounded downwards, and the value after rounding+1 is the position of the described row that should give up.
Giving up the process that the factor judges whether the pixel in the row should not give up is given up according to row among the described step b4 is: definition loop variable i, and i=i+H/ (H-H1+1), i initial value are 0, cycle index is that (H-H1) is inferior; (i-0.5) rounded downwards, the value after rounding+1st, the position of the row at the pixel place that should give up, the pixel that should give up be with described rounding after the corresponding row in value+1 and the pixel of the described row crossover location that should not give up.
Compared with prior art, advantage of the present invention and good effect are: determine to give up the factor by the size of original image and the size of target image, each pixel of image is reeled off raw silk from cocoons as elementary cell with row or column and to give up, only need the application cushion space corresponding with the target image size and the delegation or the corresponding cushion space of a row pixel of original image can realize dwindling of image, the committed memory space is less.Can save very big memory headroom when particularly original image resolution is higher, be highly suitable for the limited image demonstration fields of internal memory such as embedded platform.And, carry out equally distributed reeling off raw silk from cocoons and give up by the described factor of giving up, can not cause the distortion of the image after dwindling, improved the quality that image dwindles.
Description of drawings
Fig. 1 is the ultimate principle process flow diagram of image downscaling method of the present invention;
Fig. 2 is the particular flow sheet of an embodiment of image downscaling method of the present invention.
Embodiment
The present invention is further detailed explanation below in conjunction with accompanying drawing.
Fig. 1 shows the ultimate principle process flow diagram of image downscaling method of the present invention.Described image downscaling method comprises according to original image size and target image size determines that the row of image gives up the step S102 that the factor and row are given up the factor, and gives up the factor and described row according to described row and give up pixel that the factor determines to give up, give up the step S103 of corresponding pixel with the target image that obtains dwindling.Utilize described row to give up the factor and described row are given up the factor, original image is evenly reeled off raw silk from cocoons give up, guarantee that the target image that dwindles is undistorted.
Wherein, described row is given up the factor be used for determining need the reel off raw silk from cocoons position of row of the original image given up when image dwindles, and described row are given up the factor be used for determining need the reel off raw silk from cocoons position of row of the original image given up when image dwindles.When image dwindles, can reel off raw silk from cocoons to pixel as elementary cell with the row of original image and give up, also can reel off raw silk from cocoons to pixel as elementary cell and give up with the row of original image.
Image downscaling method of the present invention gives up the factor according to described row and described row are given up the factor, carries out image while decoding and dwindles.Give up if reel off raw silk from cocoons as elementary cell with the row of original image, the image of application dwindles storage space and the occupied storage space of original image one-row pixels that buffer size needs for the target image size; Give up if reel off raw silk from cocoons as elementary cell with the row of original image, the image of application dwindles buffer size for storage space and the occupied storage space of original image one row pixel that the target image size needs, dwindles shared memory headroom thereby saved image greatly.
Embodiment one:
Figure 2 shows that the particular flow sheet of an embodiment of image downscaling method of the present invention.
Described embodiment one reels off raw silk from cocoons to the pixel of image as elementary cell with row and gives up, and realizes dwindling of image.Detailed process is as follows:
Step S201: image dwindles flow process to begin.
Step S202: the reading images file, judge image type, read file header, obtain the wide W and the high H of original image.In this embodiment, W=10, H=8, promptly original image size is 10 * 8.
Step S203: obtain the area size that target image will show.
Step S204: the wide W1 and the high H1 that calculate target image.This embodiment at first obtains the area size that target image will show, calculates the compression factor of image, calculates the width and the height of target image then according to described compression factor.In this embodiment, W1=8, H1=5, promptly target image is of a size of 8 * 5.
Step S205: determine that row is given up the factor and row are given up the factor.
In this embodiment one, it is H/ (H-H1+1)=8/ (8-5+1)=2 that definition line is given up the factor; It is W/ (W-W1+1)=10/ (10-8+1)=3.33 that the definition row are given up the factor.
Step S206: according to W, W1 and H1 application buffer zone.This embodiment reels off raw silk from cocoons to the pixel of image as elementary cell with row and gives up, and therefore, needing the buffer zone of application is the required space and the required space sum of target image of delegation of original image.Wherein, the required space of delegation is the width W of original image.
Step S207: give up capable whether the giving up of Y that the factor is judged original image according to described row.If Y is capable need to be given up, go to step S212, if do not give up execution in step S208.Wherein, Y from 1 until H.
This embodiment one gives up the factor and described row according to described row and gives up the factor and determine that the processing procedure of the pixel that should give up is divided into two big steps when image being dwindled as elementary cell with row:
The first step: give up the position that the factor is judged the row that should give up in the original image according to described row, and give up whole pixels of the row that should give up in the original image.
Second step: give up the factor according to described row and judge whether the pixel in the row that should not give up is given up; The pixel that needs are given up is given up to fall, remaining pixel is placed in the buffer zone pixel as target image.
Give up the factor according to described row and judge that the method for position of the row that should give up in the original image is as follows: define a loop variable i, i=i+H/ (H-H1+1), i initial value are 0, and cycle index is that (H-H1) is inferior; (i+0.5) rounded downwards, and the value after rounding is the position of the described row that should give up.
In this embodiment one, calculating the row that should give up according to H=8, H1=5 is the 2nd row, the 4th row and the 6th row.If when the Y of pre-treatment is capable is wherein delegation in this triplex row, then execution in step S212; Otherwise execution in step S208.
Step S208: when judging that current Y is capable and be should not give up capable, to capable decoding of Y of image.
Step S209: give up the pixel that the factor determines that Y should give up in capable according to row.
The method of determining is: define a loop variable j, j=j+W/ (W-W1+1), j initial value are 0, and cycle index is that (W-W1) is inferior; (j+0.5) rounded downwards, and the value after rounding is the position of the row at the pixel place that should give up.The pixel that should give up be with described rounding after the corresponding row of value and the pixel of the described capable crossover location that should not give up.
In this embodiment one, the row that calculate the pixel place that should give up according to W=10, W1=8 are the 3rd row and the 7th row.Accordingly, the capable pixel that should give up of Y is the 3rd point and the 7th point.
Step S210: judge the capable pixel of Y whether all screening finish.If all screening finishes, execution in step S211 continues to give up the definite pixel that should give up of the factor according to row otherwise go to step S209.
Step S211: the capable whole pixels of Y all utilize row give up the factor determine whether to give up finish after, give up to fall the pixel that should give up, and with Y capable in remaining pixel be saved in the buffer zone.
Step S212: Y is added 1, skip to the next line data.
Step S213: the view data that judges whether to handle all row.If handle all line data, execution in step S214; Otherwise go to step S207, continue to give up the factor and row and give up the factor pair pixel and reel off raw silk from cocoons and give up according to row.
Step S214: after handling the data of all images, what store in the buffer zone is target image after dwindling, then target image.
S215: flow process finishes.
Embodiment two:
Embodiment two is identical with the step of embodiment one, and be with the difference of embodiment one: original size of images is 20 * 20 among the embodiment two, and target image is of a size of 16 * 16, i.e. W=20, H=20, W1=16, H1=16.Give up the factor and described row according to described row and give up the factor and calculate as can be known, the reel off raw silk from cocoons position of the row given up of original image is the 4th row, eighth row, the 12nd row and the 16th row, and the position of the row given up of reeling off raw silk from cocoons is that the 4th row, the 8th row, the 12nd row and the 16th are listed as.
Whether the foregoing description all is to judge earlier that current Y is capable to give up, and then decodes.Certainly, also can decode to current Y line data earlier, and then judge whether to give up.
In image downscaling method of the present invention, give up the position of the row that should give up in the factor judgement original image according to row and also can adopt following method: definition loop variable i, i=i+H/ (H-H1+1), i initial value are 0, cycle index is that (H-H1) is inferior; (i-0.5) rounded downwards, and the value after rounding+1 is the position of the described row that should give up.
Give up the factor according to row and judge that the position of the row at the pixel place in the row should not give up also can adopt following method to realize: definition loop variable j, j=j+W/ (W-W1+1), j initial value are 0, cycle index is that (W-W1) is inferior; (j-0.5) rounded downwards, and the value after rounding+1 is the position of the row at the pixel place that should give up.
Fig. 2 embodiment dwindles image as elementary cell with row, certainly, also can dwindle image as elementary cell with row.
When classifying elementary cell as image is dwindled, give up the factor and described row according to described row and give up the factor and determine that the processing procedure of the pixel that should give up comprises following two big steps:
The first step: give up the position that the factor is judged the row that should give up in the original image according to described row, and give up whole pixels of the row that should give up in the original image;
Second step: give up the factor according to described row and judge whether the pixel in the row that should not give up is given up; The pixel that needs are given up is given up to fall, remaining pixel is placed in the buffer zone pixel as target image.
Concrete processing procedure can repeat no more with reference to the described disposal route of figure 2 embodiment herein.
Certainly; the above only is a kind of preferred implementation of the present invention; should be understood that; for those skilled in the art; under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.
Claims (9)
- An image dwindle method, it is characterized in that, comprise the steps:A, according to the size of original image with dwindle after the size of target image determine that the row of image is given up the factor and row are given up the factor;B, give up the factor and described row according to described row and give up the factor and determine the pixel that to give up, the target image after obtaining dwindling;Wherein, described original image is of a size of W * H, and the target image after described the dwindling is of a size of W1 * H1, and it is H/ (H-H1+1) that then described row is given up the factor, and it is W/ (W-W1+1) that described row are given up the factor.
- Image according to claim 1 dwindle method, it is characterized in that described step b specifically comprises step by step following:B1, give up the position that the factor is judged the row that should give up in the original image, and give up whole pixels of the row that should give up in the original image according to described row;B2, give up the factor according to described row and judge whether the pixel in the row should not give up is given up; The pixel that needs are given up is given up to fall, remaining pixel is placed in the buffer zone pixel as target image.
- 3. image according to claim 2 dwindles method, it is characterized in that, give up the factor according to row among the described step b1 and judge that the process of the position of the row that should give up in the original image is: definition loop variable i, i=i+H/ (H-H1+1), the i initial value is 0, and cycle index is that (H-H1) is inferior; (i+0.5) rounded downwards, and the value after rounding is the position of the described row that should give up.
- 4. according to the method for dwindling of claim 2 or 3 described images, it is characterized in that, giving up the process that the factor judges whether the pixel in the row should not give up is given up according to row among the described step b2 is: definition loop variable j, j=j+W/ (W-W1+1), the j initial value is 0, and cycle index is that (W-W1) is inferior; (j+0.5) rounded downwards, and the value after rounding is the position of the row at the pixel place that should give up, the pixel that should give up be with described rounding after the corresponding row of value and the pixel of the described capable crossover location that should not give up.
- Image according to claim 2 dwindle method, it is characterized in that,Give up the factor according to row among the described step b1 and judge that the process of the position of the row that should give up in the original image is: definition loop variable i, i=i+H/ (H-H1+1), i initial value are 0, cycle index is that (H-H1) is inferior; (i-0.5) rounded downwards, and the value after rounding+1 is the position of the described row that should give up;Giving up the process that the factor judges whether the pixel in the row should not give up is given up according to row among the described step b2 is: definition loop variable j, and j=j+W/ (W-W1+1), j initial value are 0, cycle index is that (W-W1) is inferior; (j-0.5) rounded downwards, and the value after rounding+1 is the position of the row at the pixel place that should give up, the pixel that should give up be with described rounding after the corresponding row in value+1 and the pixel of the described capable crossover location that should not give up.
- Image according to claim 1 dwindle method, it is characterized in that described step b specifically comprises step by step following:B3, give up the position that the factor is judged the row that should give up in the original image, and give up whole pixels of the row that should give up in the original image according to described row;B4, give up the factor according to described row and judge whether the pixel in the row should not give up is given up; The pixel that needs are given up is given up to fall, remaining pixel is placed in the buffer zone pixel as target image.
- 7. image according to claim 6 dwindles method, it is characterized in that, give up the factor according to row among the described step b3 and judge that the process of the position of the row that should give up in the original image is: definition loop variable j, j=j+W/ (W-W1+1), the j initial value is 0, and cycle index is that (W-W1) is inferior; (j+0.5) rounded downwards, and the value after rounding is the position of the described row that should give up.
- 8. according to the method for dwindling of claim 6 or 7 described images, it is characterized in that, giving up the process that the factor judges whether the pixel in the row should not give up is given up according to row among the described step b4 is: definition loop variable i, i=i+H/ (H-H1+1), the i initial value is 0, and cycle index is that (H-H1) is inferior; (i+0.5) rounded downwards, and the value after rounding is the position of the row at the pixel place that should give up, the pixel that should give up be with described rounding after the corresponding row of value and the pixel of the described row crossover location that should not give up.
- Image according to claim 6 dwindle method, it is characterized in that,Give up the factor according to row among the described step b3 and judge that the process of the position of the row that should give up in the original image is: definition loop variable j, j=j+W/ (W-W1+1), j initial value are 0, cycle index is that (W-W1) is inferior; (j-0.5) rounded downwards, and the value after rounding+1 is the position of the described row that should give up;Giving up the process that the factor judges whether the pixel in the row should not give up is given up according to row among the described step b4 is: definition loop variable i, and i=i+H/ (H-H1+1), i initial value are 0, cycle index is that (H-H1) is inferior; (i-0.5) rounded downwards, the value after rounding+1st, the position of the row at the pixel place that should give up, the pixel that should give up be with described rounding after the corresponding row in value+1 and the pixel of the described row crossover location that should not give up.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100192316A CN101692336B (en) | 2009-10-09 | 2009-10-09 | Method for zooming out images |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009100192316A CN101692336B (en) | 2009-10-09 | 2009-10-09 | Method for zooming out images |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101692336A CN101692336A (en) | 2010-04-07 |
CN101692336B true CN101692336B (en) | 2011-06-15 |
Family
ID=42081018
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009100192316A Expired - Fee Related CN101692336B (en) | 2009-10-09 | 2009-10-09 | Method for zooming out images |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101692336B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2011134144A1 (en) * | 2010-04-28 | 2011-11-03 | 深圳艾科创新微电子有限公司 | Image downscaling method and apparatus |
CN102568443B (en) * | 2010-12-29 | 2013-10-09 | 无锡华润矽科微电子有限公司 | Digital image scaling method |
CN102750667A (en) * | 2011-11-21 | 2012-10-24 | 新奥特(北京)视频技术有限公司 | Method and device for image fast magnifying and reducing |
WO2021237569A1 (en) * | 2020-05-28 | 2021-12-02 | 深圳市大疆创新科技有限公司 | Encoding method, decoding method, apparatus and system |
CN111756997B (en) * | 2020-06-19 | 2022-01-11 | 平安科技(深圳)有限公司 | Pixel storage method and device, computer equipment and readable storage medium |
-
2009
- 2009-10-09 CN CN2009100192316A patent/CN101692336B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN101692336A (en) | 2010-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101692336B (en) | Method for zooming out images | |
US9208403B1 (en) | Systems and methods for processing image data associated with line detection | |
KR101785982B1 (en) | Method and apparatus for generating mosaic image | |
Zhan et al. | Achieving on-mobile real-time super-resolution with neural architecture and pruning search | |
CN102332001A (en) | Video thumbnail generation method and device | |
EP1613095A2 (en) | Deblocking filter apparatus and methods using sub-macro-block-shifting register arrays | |
WO2010050911A1 (en) | Method and system for image resizing based on interpolation enhanced seam operations | |
JP2007280284A (en) | Method and device for enhancing resolution of image | |
EP2104357A2 (en) | Method and device for generating an image data stream, method and device for reconstructing a current image from an image data stream, image data stream and storage medium carrying an image data stream | |
CN111402139A (en) | Image processing method, image processing device, electronic equipment and computer readable storage medium | |
JP2009177651A (en) | Distortion correction device | |
CN109325901A (en) | A kind of method and device for realizing image procossing | |
CN101753799A (en) | Median filtering method and median filtering circuit using the same | |
JP4189252B2 (en) | Image processing apparatus and camera | |
CN102568443B (en) | Digital image scaling method | |
KR100827106B1 (en) | Apparatus and method for discriminating filter condition region in deblocking filter | |
JP2009187548A (en) | Method for generating thumbnail image and device for it | |
CN108510425A (en) | Reversible water mark method based on IPPVO and optimization MHM | |
CN103942543B (en) | A kind of image-recognizing method and device | |
CN102663715A (en) | Super-resolution method and device | |
TW200933528A (en) | Image scaling method | |
JP2013165380A (en) | Image processing apparatus and image processing method | |
CN102842111B (en) | Enlarged image compensation method and device | |
TWI330987B (en) | Method and apparatus for determining whether adjacent macroblocks are located in the same slice | |
EP2777014A1 (en) | Method and apparatus for tightly coupled, low power image processing |
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 | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20110615 Termination date: 20191009 |
|
CF01 | Termination of patent right due to non-payment of annual fee |