CN102509259A - Image scaling method based on directions of pixels in image - Google Patents

Image scaling method based on directions of pixels in image Download PDF

Info

Publication number
CN102509259A
CN102509259A CN2011102978265A CN201110297826A CN102509259A CN 102509259 A CN102509259 A CN 102509259A CN 2011102978265 A CN2011102978265 A CN 2011102978265A CN 201110297826 A CN201110297826 A CN 201110297826A CN 102509259 A CN102509259 A CN 102509259A
Authority
CN
China
Prior art keywords
image
gap
pixel point
pixel
gaps
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
CN2011102978265A
Other languages
Chinese (zh)
Other versions
CN102509259B (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.)
University of Shanghai for Science and Technology
Original Assignee
University of Shanghai for Science and Technology
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 University of Shanghai for Science and Technology filed Critical University of Shanghai for Science and Technology
Priority to CN 201110297826 priority Critical patent/CN102509259B/en
Publication of CN102509259A publication Critical patent/CN102509259A/en
Application granted granted Critical
Publication of CN102509259B publication Critical patent/CN102509259B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

The invention discloses an image scaling method based on the directions of pixels in an image. The image scaling method comprises the specific steps of: (1) inputting an original image; (2) calculating the energy of the original image; (3) calculating directions of various pixels in the original image; (4) determining interstices in the image according to the directions of the various pixels in the original image; and (5) calculating the energy values of the interstices in the image, selecting N interstices with minimum energy values, deleting the N interstices with minimum energy values, and obtaining a scaled image. According to the method, a plurality of interstices in the image are obtained once by using the directions of the various pixels during the process of image scaling, and the scaling operation speed can be increased; secondarily, the problem of the intersecting of the interstices can be automatically solved by a priority window adopted in the method, and the forming of intersected interstices is inhibited; and compared with the scaling method proposed by Rubinstein et al, the image scaling speed of the scaling method disclosed by the invention is obviously increased.

Description

Image scaling method based on pixel point direction in image
Technical Field
The invention relates to the technical field of image zooming processing, in particular to an image zooming method based on the direction of pixel points in an image.
Background
With the rapid development of multimedia technology, display devices with different sizes of video display windows such as mobile phones, wide screen televisions, huge LEDs and the like are increasingly commonly applied in our lives, people require that the size of a display image is adapted to the size of the display window of the display device, and simultaneously require that key contents in the image can be clearly displayed, a text "zoom the image based on the content by using a slit method" published in the 3 rd phase of the computer association graphic article, volume 26, of the book of the computer association graphic article published by the 3 rd month in 2007, by Shai Avidan and Ariel Shamir et al, proposes a slit method based on image contents, deletes (or copies) all pixel points on a found slit by finding the smallest energy in the image to realize the reduction (or increase) of the image size, and the method proposes a new image zooming method and a concept of the slit, but the result of image zooming is easy to generate distortion, and the scaling run time is long.
The "improved seam cutting algorithm suitable for video adaptation" published in volume 27, phase 3 of the computer association graphic newspaper published by Rubinstein et al in 8.2008 discloses that the removal of a seam in an image may introduce new energy to the image, the introduced new energy is called forward energy, and the seam which minimizes the forward energy is solved, wherein the scaling method specifically comprises the following steps:
(1) defining an energy value for each pixel point in the image, wherein the energy value reflects the importance of the pixel point, and points with larger energy are more important;
(2) searching a vertical (or horizontal) gap which enables the introduced energy to be minimum from the image, wherein the vertical (or horizontal) gap refers to a curve from top to bottom (or from left to right) in the image, each row (or column) in the image has and only has one pixel point on the curve, any two adjacent rows of pixel points on the curve are adjacent, and the energy of the gap is defined as the sum of the energies of all the pixel points on the gap;
(3) deleting or copying all pixel points on the gaps in the image to realize the reduction or increase of the image size;
(4) the above steps are repeated until the image with the required size is obtained, the image zooming effect of the method is good, but the dynamic planning method is adopted when the gap is solved, and the dynamic planning is needed to be carried out once when one gap is solved, so that more time is spent when the size of the image is changed greatly.
In summary, the conventional image scaling method based on the gap has the problems of low image scaling efficiency and more time consumption, and the wide application of the image scaling technology of the gap is influenced.
Disclosure of Invention
The present invention is directed to overcome the problems in the prior art, and provides an image scaling method based on the direction of a pixel point in an image, which can reduce the scaling operation time and improve the image scaling efficiency while ensuring the image scaling quality.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
an image scaling method based on pixel point directions in an image comprises the following specific steps:
(1) inputting an original image;
(2) calculating the energy of the original image;
(3) calculating the direction of each pixel point in the original image;
(4) determining a gap in the image according to the direction of each pixel point in the image;
(5) calculating the energy value of the gap in the image, and selecting the minimum energy valueStrip gap, minimum energy value of deletion
Figure 175606DEST_PATH_IMAGE001
And (5) strip gaps to obtain the zoomed image.
The step (2) of calculating the energy of the original image comprises the following steps:
firstly, converting an image into a gray image, and then calculating the gradient amplitude of the gray image, wherein the calculation formula is as follows:
Figure 949527DEST_PATH_IMAGE002
(1)
wherein,
Figure 2011102978265100002DEST_PATH_IMAGE003
the energy of the image is represented by,
Figure 627764DEST_PATH_IMAGE004
Figure 2011102978265100002DEST_PATH_IMAGE005
representing coordinates of pixel points
Figure 766621DEST_PATH_IMAGE006
Figure 2011102978265100002DEST_PATH_IMAGE007
A gray-scale image is represented by a gray-scale image,the sign of the absolute value is represented,
Figure 803028DEST_PATH_IMAGE010
represent images respectively at
Figure 522722DEST_PATH_IMAGE004
Figure 645530DEST_PATH_IMAGE005
The partial derivative in the direction, the energy value of the corresponding pixel point position in the energy of the image is the energy value of each pixel point.
The step (3) of calculating the direction of each pixel point in the original image includes the following specific steps:
(3-1) calculating the gradient direction of each pixel point in the image, wherein the calculation formula is as follows:
Figure 2011102978265100002DEST_PATH_IMAGE011
(2)
wherein,
Figure 716254DEST_PATH_IMAGE012
Figure 2011102978265100002DEST_PATH_IMAGE013
Figure 831978DEST_PATH_IMAGE009
Figure 481877DEST_PATH_IMAGE010
represent images respectively at
Figure 582874DEST_PATH_IMAGE005
The partial derivative in the direction of the light,
Figure 174393DEST_PATH_IMAGE014
which represents the inverse tangent of the light beam,
Figure 2011102978265100002DEST_PATH_IMAGE015
representing coordinates of pixel points
Figure 681729DEST_PATH_IMAGE016
The direction of the gradient of (d);
(3-2) calculating the direction of each pixel point in the image, wherein the calculation formula is as follows:
(3)
wherein,representing coordinates of pixel points
Figure 440923DEST_PATH_IMAGE016
The direction of the gradient of (a) is,
Figure 836132DEST_PATH_IMAGE018
the gradient direction is changed to the tangential direction,
Figure 2011102978265100002DEST_PATH_IMAGE019
all tangential directions are directed below the horizontal,
Figure 463554DEST_PATH_IMAGE020
representing coordinates of pixel pointsIn the direction of (c).
The step (4) of determining the gap in the image according to the direction of each pixel point in the image includes the following specific steps:
(4-1) defining gaps in the image, which are specifically as follows:
defining a gap in the vertical direction, and the expression is as follows:
(4)
wherein,
Figure 615367DEST_PATH_IMAGE022
representing a gap in the image that is represented by,
Figure 2011102978265100002DEST_PATH_IMAGE023
representing the mapping in the vertical direction and the horizontal direction respectively,
Figure 627316DEST_PATH_IMAGE024
corresponding to the height and width of the original image respectively,
Figure 2011102978265100002DEST_PATH_IMAGE025
represents the sign of the absolute value;
defining a gap in the horizontal direction, and the expression is as follows:
Figure 358512DEST_PATH_IMAGE026
(5)
wherein,
Figure 351875DEST_PATH_IMAGE022
representing a gap in the image that is represented by,
Figure 933903DEST_PATH_IMAGE023
representing the mapping in the vertical direction and the horizontal direction respectively,
Figure 670914DEST_PATH_IMAGE024
corresponding to the height and width of the original image respectively,
Figure 194300DEST_PATH_IMAGE025
represents the sign of the absolute value;
(4-2) setting each pixel point in the first row in the image as the starting point of each gap respectively;
(4-3) finding the next pixel point of the gap in the image by using the priority window:
(4-3-1), defining a priority window in the image:
defining the priority window in the image as a 2 x 5 matrix window, wherein the elements of the 2 nd row in the matrix window are respectively: 5. 3, 1, 2, 4, which represent different priorities of the element positions, wherein the priorities with the highest priorities of 1, 2, 3, 4, 5 are sequentially reduced, and the priorities with the lowest priorities of 5 are sequentially reduced;
(4-3-2), determining the position of the priority window in the image:
if the direction of the starting point points to the pixel point at the lower left of the starting point, the starting point is positioned at the 4 th column position of the 1 st row in the priority window;
if the direction of the starting point points to the pixel point right below the starting point, the starting point is positioned at the position of the 1 st row and the 3 rd column in the priority window;
if the direction of the starting point points to the pixel point at the lower right of the starting point, the starting point is positioned at the 2 nd row position of the 1 st row in the priority window;
determining the position of the starting point in the priority window, and then determining the position of the priority window in the image;
(4-3-3), determining the position of the next pixel point forming the gap in the image:
in the priority window, setting a pixel point where the highest-order element 1 is located in the image as a next pixel point for forming a gap, and then judging whether the position of the highest-order element 1 in the image is occupied by other gaps in the image or not;
if the position of the highest-order element 1 in the image is not occupied by other gaps in the image, the pixel point at which the position of the highest-order element 1 in the image is located is the next pixel point forming the gap;
if the position of the highest order element 1 in the image is occupied by other slits, then the pixel point at the position of element 2 in the image is the next pixel point to form a slit;
if the position of priority element 2 in the image is occupied by other slots, then the pixel at the position of element 3 in the image is the next pixel to form a slot;
if the position of priority element 3 in the image is occupied by other slots, then the pixel at the position of element 4 in the image is the next pixel to form a slot;
if the position of precedence element 4 in the image is occupied by other slots, then the pixel at the position of element 5 in the image is the next pixel to form a slot;
if the 5 element positions of the 2 nd row in the priority window are occupied by other gaps in the image, stopping determining the position of the next pixel point forming the gap in the image, and finding the next pixel point of other gaps in the image by using the priority window;
(4-4) determining a gap in the image:
judging whether the next pixel point of the gap in the image is in the last line of the image or not, if the next pixel point of the gap in the found image is not in the last line of the image, taking the next pixel point of the gap in the image as a starting point, and turning to the step (4-3-2) to determine the new position of the priority window in the image; and if the next pixel point of the gap in the found image is in the last line of the image, forming a gap in the image by all the found pixel points, and similarly, repeating the steps, finding the next pixel point of other gaps in the image by using the priority window, and determining other gaps in the image.
Calculating the energy value of the gap in the image in the step (5), and selecting the energy value with the minimum energy value
Figure 686461DEST_PATH_IMAGE001
Strip gap, minimum energy value of deletion
Figure 928086DEST_PATH_IMAGE001
And (3) strip gaps to obtain a zoomed image, which comprises the following specific steps:
(5-1) calculating the energy value of the gap in the image, wherein the calculation formula is as follows:
Figure 2011102978265100002DEST_PATH_IMAGE027
(6)
wherein,
Figure 16259DEST_PATH_IMAGE028
which represents a gap in the image or images,
Figure 2011102978265100002DEST_PATH_IMAGE029
indicating a gap
Figure 722047DEST_PATH_IMAGE028
To
Figure 2011102978265100002DEST_PATH_IMAGE031
The number of the pixel points is one,
Figure 870263DEST_PATH_IMAGE032
indicating the first on the slitThe energy value of each pixel point is calculated,
Figure 2011102978265100002DEST_PATH_IMAGE033
representing the total number of pixel points on the slit,
Figure 740316DEST_PATH_IMAGE034
representing an energy value of the gap;
(5-2) is provided withRespectively the height and width of the original image,
Figure 2011102978265100002DEST_PATH_IMAGE035
the height and width of the target image to be obtained are respectively selected, so that the energy value is minimumA stripe gap, whose expression is:
Figure 773628DEST_PATH_IMAGE036
whereinis the width of the original image and,in order to be the width of the target image,
Figure 70934DEST_PATH_IMAGE001
in order to select the number of the gaps needing to be deleted, the energy values of the gaps in all the images are arranged in an ascending order, and the energy value is the smallest
Figure 823602DEST_PATH_IMAGE001
The strip gap is a gap to be deleted;
(5-3) deleting gaps in the image to obtain a zoomed image, which comprises the following specific steps:
(5-3-1) is provided with
Figure 261536DEST_PATH_IMAGE038
Is a gap in the image to be deleted;
(5-3-2), finding out from the first line of the image
Figure 744470DEST_PATH_IMAGE038
In the image
Figure 2011102978265100002DEST_PATH_IMAGE039
The positions at which the pixels of a row are located, wherein,
Figure 2011102978265100002DEST_PATH_IMAGE041
is the height of the original image; the first of the image
Figure 143539DEST_PATH_IMAGE039
Moving the pixel points on the right of the positions of the pixel points of the line one by one to the left, and deleting the image
Figure 131086DEST_PATH_IMAGE042
All pixel points of a column; after completion, the width of the image is reduced by one, and the width of the image becomes
Figure 2011102978265100002DEST_PATH_IMAGE043
(5-3-3) similarly, the same operation as in the step (5-3-2) is performed for the gaps in the other images to be deleted, and the width of the image is reduced
Figure 355394DEST_PATH_IMAGE001
The width of the image becomes
Figure 229941DEST_PATH_IMAGE037
The image is deleted from the original image
Figure 514291DEST_PATH_IMAGE001
Scaling the image after the low energy seam is striped.
Compared with the prior art, the image zooming method based on the pixel point direction in the image has the following advantages that: in the method, the direction of each pixel point is utilized in the image zooming process, gaps in a plurality of images are obtained at one time, and the zooming running speed can be improved; secondly, the priority window adopted by the method can automatically process the crossing problem of the gaps and inhibit the formation of the crossed gaps; the image zooming experiment shows that compared with the zooming method proposed by Rubinstein et al, the image zooming operation speed of the invention is obviously improved.
Drawings
FIG. 1 is a flow chart of an image scaling method based on pixel point directions in an image according to the present invention;
FIG. 2 is a flow chart of the image scaling method step (4) of the present invention;
FIG. 3 is a flow chart of the image scaling method step (5) of the present invention;
FIG. 4(a) is a schematic diagram of a priority window with a starting point in the image pointing to a pixel point to the lower left of the starting point;
FIG. 4(b) is a schematic view of a priority window in which the direction of a start point in an image points to a pixel point directly below the start point;
FIG. 4(c) is a schematic diagram of a priority window in which the direction of the origin in the image points to the pixel point to the lower right of the origin;
FIGS. 5(a) and 5 (b) are the original landscape image and the person image inputted in step (1);
FIGS. 6(a) and 6 (b) are the scaled images obtained in step (5);
FIGS. 7(a) and 7 (b) are prior art images obtained by scaling the images by the scaling method proposed by Rubinstein et al;
fig. 8 is a graph comparing the run times of the method of the present invention and the scaling method proposed by Rubinstein et al when scaling images to different sizes.
Detailed Description
Examples of the present invention will be described in further detail below with reference to the accompanying drawings.
As shown in fig. 1, fig. 2, and fig. 3, the image scaling method based on the pixel direction in the image of the present invention specifically includes the following steps:
(1) inputting an original image as shown in fig. 5(a) or (b);
(2) calculating the energy of the original image, and the steps are as follows:
firstly, converting an image into a gray image, and then calculating the gradient amplitude of the gray image, wherein the calculation formula is as follows:
Figure 926818DEST_PATH_IMAGE002
(1)
wherein,
Figure 17134DEST_PATH_IMAGE003
the energy of the image is represented by,
Figure 198717DEST_PATH_IMAGE004
Figure 201439DEST_PATH_IMAGE005
representing coordinates of pixel points
Figure 101262DEST_PATH_IMAGE006
Figure 667372DEST_PATH_IMAGE007
A gray-scale image is represented by a gray-scale image,
Figure 31357DEST_PATH_IMAGE008
the sign of the absolute value is represented,
Figure 391932DEST_PATH_IMAGE009
Figure 595030DEST_PATH_IMAGE010
represent images respectively at
Figure 840197DEST_PATH_IMAGE004
Partial derivative in direction, wherein the energy value of the position of a corresponding pixel point in the energy of the image is the energy value of each pixel point;
(3) calculating the direction of each pixel point in the original image, and the specific steps are as follows:
(3-1) calculating the gradient direction of each pixel point in the image, wherein the calculation formula is as follows:
(2)
wherein,
Figure 199000DEST_PATH_IMAGE012
Figure 372493DEST_PATH_IMAGE013
Figure 164179DEST_PATH_IMAGE010
represent images respectively at
Figure 322628DEST_PATH_IMAGE004
Figure 34232DEST_PATH_IMAGE005
DirectionThe partial derivative of the sum of the above,
Figure 899420DEST_PATH_IMAGE014
which represents the inverse tangent of the light beam,representing coordinates of pixel points
Figure 434755DEST_PATH_IMAGE016
The direction of the gradient of (d);
(3-2) calculating the direction of each pixel point in the image, wherein the calculation formula is as follows:
Figure 684471DEST_PATH_IMAGE017
(3)
wherein,
Figure 732061DEST_PATH_IMAGE015
representing coordinates of pixel pointsThe direction of the gradient of (a) is,
Figure 922664DEST_PATH_IMAGE018
the gradient direction is changed to the tangential direction,
Figure 976070DEST_PATH_IMAGE019
all tangential directions are directed below the horizontal,representing coordinates of pixel points
Figure 358827DEST_PATH_IMAGE016
The direction of (d);
(4) determining a gap in the image according to the direction of each pixel point in the image, wherein the method comprises the following specific steps:
(4-1) defining gaps in the image, which are specifically as follows:
defining a gap in the vertical direction, and the expression is as follows:
Figure 464317DEST_PATH_IMAGE021
(4)
wherein,representing a gap in the image that is represented by,
Figure 15701DEST_PATH_IMAGE023
representing the mapping in the vertical direction and the horizontal direction respectively,
Figure 729580DEST_PATH_IMAGE024
corresponding to the height and width of the original image respectively,
Figure 774896DEST_PATH_IMAGE025
represents the sign of the absolute value;
defining a gap in the horizontal direction, and the expression is as follows:
Figure 983155DEST_PATH_IMAGE026
(5)
wherein,
Figure 531948DEST_PATH_IMAGE022
representing a gap in the image that is represented by,
Figure 619989DEST_PATH_IMAGE023
representing the mapping in the vertical direction and the horizontal direction respectively,
Figure 949339DEST_PATH_IMAGE024
corresponding to the height and width of the original image respectively,
Figure 148240DEST_PATH_IMAGE025
represents the sign of the absolute value;
(4-2) setting each pixel point in the first row in the image as the starting point of each gap respectively;
(4-3) finding the next pixel point of the gap in the image by using the priority window:
(4-3-1), defining a priority window in the image:
defining the priority window in the image as a 2 x 5 matrix window, wherein the elements of the 2 nd row in the matrix window are respectively: 5. 3, 1, 2, 4, which represent different priorities of the element positions, wherein the priorities with the highest priorities of 1, 2, 3, 4, 5 are sequentially reduced, and the priorities with the lowest priorities of 5 are sequentially reduced;
(4-3-2), determining the position of the priority window in the image:
if the direction of the starting point points to the pixel point at the lower left of the starting point, the starting point is located at the 4 th column position of the 1 st row in the priority window, as shown in fig. 4 (a);
if the direction of the starting point points to the pixel point right below the starting point, the starting point is located at the position of the 1 st row and the 3 rd column in the priority window, as shown in fig. 4 (b);
if the direction of the starting point points to the pixel point at the lower right of the starting point, the starting point is located at the position of the 1 st row and the 2 nd column in the priority window, as shown in fig. 4 (c);
determining the position of the starting point in the priority window, and then determining the position of the priority window in the image;
(4-3-3), determining the position of the next pixel point forming the gap in the image:
in the priority window, setting a pixel point where the highest-order element 1 is located in the image as a next pixel point for forming a gap, and then judging whether the position of the highest-order element 1 in the image is occupied by other gaps in the image or not;
if the position of the highest-order element 1 in the image is not occupied by other gaps in the image, the pixel point at which the position of the highest-order element 1 in the image is located is the next pixel point forming the gap;
if the position of the highest order element 1 in the image is occupied by other slits, then the pixel point at the position of element 2 in the image is the next pixel point to form a slit;
if the position of priority element 2 in the image is occupied by other slots, then the pixel at the position of element 3 in the image is the next pixel to form a slot;
if the position of priority element 3 in the image is occupied by other slots, then the pixel at the position of element 4 in the image is the next pixel to form a slot;
if the position of precedence element 4 in the image is occupied by other slots, then the pixel at the position of element 5 in the image is the next pixel to form a slot;
if the 5 element positions of the 2 nd row in the priority window are occupied by other gaps in the image, stopping determining the position of the next pixel point forming the gap in the image, and finding the next pixel point of other gaps in the image by using the priority window;
(4-4) determining a gap in the image:
judging whether the next pixel point of the gap in the image is in the last line of the image or not, if the next pixel point of the gap in the found image is not in the last line of the image, taking the next pixel point of the gap in the image as a starting point, and turning to the step (4-3-2) to determine the new position of the priority window in the image; and if the next pixel point of the gap in the found image is in the last line of the image, forming a gap in the image by all the found pixel points, and similarly, repeating the steps, finding the next pixel point of other gaps in the image by using the priority window, and determining other gaps in the image.
(5) Calculating the energy value of the gap in the image, and selecting the minimum energy valueStrip gap, minimum energy value of deletionAnd (3) strip gaps to obtain a zoomed image, which comprises the following specific steps:
(5-1) calculating the energy value of each gap according to the energy of the image obtained in the step (2) and the gap in the image determined in the step (4), wherein the calculation formula is as follows:
Figure 377861DEST_PATH_IMAGE027
(6)
where s denotes a gap in the image,
Figure 177190DEST_PATH_IMAGE029
indicating the second over the slit s
Figure 700575DEST_PATH_IMAGE044
The number of the pixel points is one,
Figure 130419DEST_PATH_IMAGE032
indicating the first on the slit
Figure 910726DEST_PATH_IMAGE044
The energy value of each pixel point, n represents the total number of pixel points on the slit,
Figure 2011102978265100002DEST_PATH_IMAGE045
representing an energy value of the gap;
(5-2) is provided with
Figure 513745DEST_PATH_IMAGE024
Respectively, the height and width of the original image,
Figure 157216DEST_PATH_IMAGE035
the height and width of the target image to be obtained are respectively selected, so that the energy value is minimum
Figure 305432DEST_PATH_IMAGE001
A stripe gap, whose expression is:
Figure 34354DEST_PATH_IMAGE036
wherein
Figure 175485DEST_PATH_IMAGE033
is the width of the original image and,
Figure 673462DEST_PATH_IMAGE037
in order to be the width of the target image,
Figure 179530DEST_PATH_IMAGE001
for example, the height and width of the original image 5(a) are 706 and 1024 respectively, and the height and width of the target image to be obtained are 706 and 768 respectively, then 1024 + 768 slots with the minimum energy value need to be selected for deletion to reach the width of the target image, so that the slot with the minimum energy value is selected
Figure 208797DEST_PATH_IMAGE001
In the slit of the strip
Figure 91302DEST_PATH_IMAGE046
(ii) a Arranging the energy values of the gaps in all the images in ascending order, wherein the 256 gaps with the minimum energy values are the gaps to be deleted;
(5-3) deleting gaps in the image to obtain a zoomed image:
(5-3-1) is provided with
Figure 2011102978265100002DEST_PATH_IMAGE047
Is a gap in the image to be deleted;
(5-3-2), finding out from the first line in the image
Figure 506103DEST_PATH_IMAGE047
In the imageThe positions at which the pixels of a row are located, wherein,
Figure 699635DEST_PATH_IMAGE040
Figure 120252DEST_PATH_IMAGE041
for the height of the original image, the first of the image
Figure 655139DEST_PATH_IMAGE039
Moving pixels on the right side of the position where the pixel points of the row are located one by one leftwards, and deleting the first
Figure 503009DEST_PATH_IMAGE033
All pixel points are listed; after completion, the width of the image is reduced by one, and the width of the image becomes
Figure 428240DEST_PATH_IMAGE043
For example, find out from the first line of FIG. 5(a)
Figure 462667DEST_PATH_IMAGE047
In (1) belong to
Figure 789744DEST_PATH_IMAGE039
The positions at which the pixels of a row are located, wherein,moving the pixel points on the right of the position one by one to the left by one unit, deleting all the pixel points in the 1024 th row, and after the completion, reducing the width of the image by one, wherein the width of the image is changed into 1023;
(5-3-3) similarly, the same operation as in the step (5-3-2) is performed for the gaps in the other images to be deleted, and the width of the image is reduced
Figure 548938DEST_PATH_IMAGE001
The width of the image becomes
Figure 311358DEST_PATH_IMAGE037
For example, after the same deletion operation is performed in step (5-3-2) for the slits in the remaining image to be deleted in fig. 5(a), the width of the image is reduced by 256, and the width of the image becomes 768, which is a scaled image obtained by deleting 256 low-energy slits from fig. 5(a), as shown in fig. 6 (a).
In order to verify the effect of the image scaling method based on the direction of the pixel points in the image, the simulation experiment carried out on the scaling method is realized by programming on a PC test platform with a CPU (Central processing Unit) of 2.0GHz and a memory of 1G. As shown in fig. 7(a), (b), two images are scaled images by the scaling method proposed by Rubinstein et al; as shown in fig. 6(a) and (b), in the drawings, two images are scaled by the scaling method of the present invention, and it can be seen that the display effect of scaling is almost the same. However, at the running time of image scaling, the same image is compared with the scaling method proposed by Rubinstein et al according to the method of the present invention at different scales, and the comparison result is shown in fig. 8, in which the horizontal axis represents the image scaling and the vertical axis represents the running time of image scaling, and the two solid curves are: the solid line with boxes is the runtime curve of the scaling method proposed by Rubinstein et al, and the solid line with dots is the runtime curve of the scaling method of the present invention. As can be seen from the comparison result in the figure, the method reduces the scaling operation time and improves the scaling operation efficiency.
In order to verify the zooming effect of the image zooming method based on the pixel point direction in the image, the zooming method is compared with the zooming method proposed by Rubinstein et al in the prior art, and 80 standard test images are respectively zoomed according to three different zooming ratios of 50%, 75% and 125%, and the zooming operation speed is shown in the data in the table 1.
TABLE 1 comparison of operating speeds of the scaling method of the present invention with existing scaling methods
Figure 2011102978265100002DEST_PATH_IMAGE049
It can be seen from the above table that, when the images with the same size are respectively zoomed by three zoom scales, the zoom operation speed of the present invention is obviously improved.

Claims (5)

1. An image scaling method based on pixel point directions in an image is characterized by comprising the following specific steps:
(1) inputting an original image;
(2) calculating the energy of the original image;
(3) calculating the direction of each pixel point in the original image;
(4) determining a gap in the image according to the direction of each pixel point in the image;
(5) calculating the energy value of the gap in the image, and selecting the minimum energy value
Figure 900753DEST_PATH_IMAGE001
Strip gap, minimum energy value of deletion
Figure 697808DEST_PATH_IMAGE001
And (5) strip gaps to obtain the zoomed image.
2. The method according to claim 1, wherein the step (2) of calculating the energy of the original image comprises the following steps:
firstly, converting an image into a gray image, and then calculating the gradient amplitude of the gray image, wherein the calculation formula is as follows:
(1)
wherein,
Figure 30536DEST_PATH_IMAGE003
the energy of the image is represented by,
Figure 103534DEST_PATH_IMAGE004
Figure 71490DEST_PATH_IMAGE005
representing coordinates of pixel points
Figure 167622DEST_PATH_IMAGE006
Figure 692275DEST_PATH_IMAGE007
A gray-scale image is represented by a gray-scale image,
Figure 823042DEST_PATH_IMAGE008
the sign of the absolute value is represented,
Figure 24217DEST_PATH_IMAGE009
Figure 342065DEST_PATH_IMAGE010
represent images respectively at
Figure 857360DEST_PATH_IMAGE004
The partial derivative in the direction, the energy value of the corresponding pixel point position in the energy of the image is the energy value of each pixel point.
3. The image scaling method based on the pixel point direction in the image according to claim 2, wherein the step (3) of calculating the direction of each pixel point in the original image comprises the following specific steps:
(3-1) calculating the gradient direction of each pixel point in the image, wherein the calculation formula is as follows:
Figure 965442DEST_PATH_IMAGE011
(2)
wherein,
Figure 886310DEST_PATH_IMAGE013
Figure 539140DEST_PATH_IMAGE009
Figure 19800DEST_PATH_IMAGE010
represent images respectively at
Figure 640137DEST_PATH_IMAGE004
Figure 231655DEST_PATH_IMAGE005
The partial derivative in the direction of the light,
Figure 191521DEST_PATH_IMAGE014
which represents the inverse tangent of the light beam,
Figure 653202DEST_PATH_IMAGE015
representing coordinates of pixel points
Figure 432939DEST_PATH_IMAGE016
The direction of the gradient of (d);
(3-2) calculating the direction of each pixel point in the image, wherein the calculation formula is as follows:
Figure 890465DEST_PATH_IMAGE017
(3)
wherein,
Figure 704837DEST_PATH_IMAGE015
representing coordinates of pixel points
Figure 340349DEST_PATH_IMAGE016
The direction of the gradient of (a) is,the gradient direction is changed to the tangential direction,
Figure 806283DEST_PATH_IMAGE019
all tangential directions are directed below the horizontal,
Figure 537478DEST_PATH_IMAGE020
representing coordinates of pixel points
Figure 530842DEST_PATH_IMAGE016
In the direction of (c).
4. The image scaling method based on the pixel point direction in the image according to claim 3, wherein the step (4) of determining the gap in the image according to the direction of each pixel point in the image comprises the following specific steps:
(4-1) defining gaps in the image, which are specifically as follows:
defining a gap in the vertical direction, and the expression is as follows:
Figure 98221DEST_PATH_IMAGE021
(4)
wherein,
Figure 100812DEST_PATH_IMAGE022
representing a gap in the image that is represented by,
Figure 686514DEST_PATH_IMAGE023
representing the mapping in the vertical direction and the horizontal direction respectively,corresponding to the height and width of the original image respectively,
Figure 92404DEST_PATH_IMAGE025
represents the sign of the absolute value;
defining a gap in the horizontal direction, and the expression is as follows:
Figure 446157DEST_PATH_IMAGE026
(5)
wherein,
Figure 824048DEST_PATH_IMAGE022
representing a gap in the image that is represented by,
Figure 424794DEST_PATH_IMAGE023
representing the mapping in the vertical direction and the horizontal direction respectively,
Figure 950453DEST_PATH_IMAGE024
corresponding to the height and width of the original image respectively,
Figure 294847DEST_PATH_IMAGE025
represents the sign of the absolute value;
(4-2) setting each pixel point in the first row in the image as the starting point of each gap respectively;
(4-3) finding the next pixel point of the gap in the image by using the priority window:
(4-3-1), defining a priority window in the image:
defining the priority window in the image as a 2 x 5 matrix window, wherein the elements of the 2 nd row in the matrix window are respectively: 5. 3, 1, 2, 4, which represent different priorities of the element positions, wherein the priorities with the highest priorities of 1, 2, 3, 4, 5 are sequentially reduced, and the priorities with the lowest priorities of 5 are sequentially reduced;
(4-3-2), determining the position of the priority window in the image:
if the direction of the starting point points to the pixel point at the lower left of the starting point, the starting point is positioned at the 4 th column position of the 1 st row in the priority window;
if the direction of the starting point points to the pixel point right below the starting point, the starting point is positioned at the position of the 1 st row and the 3 rd column in the priority window;
if the direction of the starting point points to the pixel point at the lower right of the starting point, the starting point is positioned at the 2 nd row position of the 1 st row in the priority window;
determining the position of the starting point in the priority window, and then determining the position of the priority window in the image;
(4-3-3), determining the position of the next pixel point forming the gap in the image:
in the priority window, setting a pixel point where the highest-order element 1 is located in the image as a next pixel point for forming a gap, and then judging whether the position of the highest-order element 1 in the image is occupied by other gaps in the image or not;
if the position of the highest-order element 1 in the image is not occupied by other gaps in the image, the pixel point at which the position of the highest-order element 1 in the image is located is the next pixel point forming the gap;
if the position of the highest order element 1 in the image is occupied by other slits, then the pixel point at the position of element 2 in the image is the next pixel point to form a slit;
if the position of priority element 2 in the image is occupied by other slots, then the pixel at the position of element 3 in the image is the next pixel to form a slot;
if the position of priority element 3 in the image is occupied by other slots, then the pixel at the position of element 4 in the image is the next pixel to form a slot;
if the position of precedence element 4 in the image is occupied by other slots, then the pixel at the position of element 5 in the image is the next pixel to form a slot;
if the 5 element positions of the 2 nd row in the priority window are occupied by other gaps in the image, stopping determining the position of the next pixel point forming the gap in the image, and finding the next pixel point of other gaps in the image by using the priority window;
(4-4) determining a gap in the image:
judging whether the next pixel point of the gap in the image is in the last line of the image or not, if the next pixel point of the gap in the found image is not in the last line of the image, taking the next pixel point of the gap in the image as a starting point, and turning to the step (4-3-2) to determine the new position of the priority window in the image; and if the next pixel point of the gap in the found image is in the last line of the image, forming a gap in the image by all the found pixel points, and similarly, repeating the steps, finding the next pixel point of other gaps in the image by using the priority window, and determining other gaps in the image.
5. The method according to claim 4, wherein said step (5) of calculating the energy value of the gap in the image selects the one with the smallest energy value
Figure 167443DEST_PATH_IMAGE001
Strip gap, minimum energy value of deletion
Figure 939090DEST_PATH_IMAGE001
And (3) strip gaps to obtain a zoomed image, which comprises the following specific steps:
(5-1) calculating the energy value of the gap in the image, wherein the calculation formula is as follows:
(6)
wherein,
Figure 834550DEST_PATH_IMAGE028
which represents a gap in the image or images,
Figure 187034DEST_PATH_IMAGE029
indicating a gapTo
Figure 380566DEST_PATH_IMAGE030
The number of the pixel points is one,indicating the first on the slit
Figure 336070DEST_PATH_IMAGE030
The energy value of each pixel point is calculated,
Figure 449520DEST_PATH_IMAGE032
representing the total number of pixel points on the slit,
Figure 374750DEST_PATH_IMAGE033
representing an energy value of the gap;
(5-2) is provided with
Figure 412107DEST_PATH_IMAGE024
Respectively the height and width of the original image,
Figure 739184DEST_PATH_IMAGE034
the height and width of the target image to be obtained are respectively selected, so that the energy value is minimum
Figure 820272DEST_PATH_IMAGE001
A stripe gap, whose expression is:
Figure 232799DEST_PATH_IMAGE035
wherein
Figure 260798DEST_PATH_IMAGE032
is the width of the original image and,
Figure 255430DEST_PATH_IMAGE036
in order to be the width of the target image,
Figure 710682DEST_PATH_IMAGE001
in order to select the number of the gaps needing to be deleted, the energy values of the gaps in all the images are arranged in an ascending order, and the energy value is the smallestThe strip gap is a gap to be deleted;
(5-3) deleting gaps in the image to obtain a zoomed image, which comprises the following specific steps:
(5-3-1) is provided with
Figure 973353DEST_PATH_IMAGE037
Is a gap in the image to be deleted;
(5-3-2), finding out from the first line of the image
Figure 275021DEST_PATH_IMAGE037
In the image
Figure 711294DEST_PATH_IMAGE030
The positions at which the pixels of a row are located, wherein,
Figure 832834DEST_PATH_IMAGE038
Figure 202636DEST_PATH_IMAGE039
is the height of the original image; the first of the image
Figure 421127DEST_PATH_IMAGE030
Moving the pixel points on the right of the positions of the pixel points of the line one by one to the left, and deleting the image
Figure 218182DEST_PATH_IMAGE040
All pixel points of a column; after completion, the width of the image is reduced by one, and the width of the image becomes
(5-3-3) similarly, the same operation as in the step (5-3-2) is performed for the gaps in the other images to be deleted, and the width of the image is reduced
Figure 547980DEST_PATH_IMAGE001
The width of the image becomes
Figure 558662DEST_PATH_IMAGE036
The image is deleted from the original image
Figure 588935DEST_PATH_IMAGE001
Scaling the image after the low energy seam is striped.
CN 201110297826 2011-09-28 2011-09-28 Image scaling method based on directions of pixels in image Expired - Fee Related CN102509259B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110297826 CN102509259B (en) 2011-09-28 2011-09-28 Image scaling method based on directions of pixels in image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110297826 CN102509259B (en) 2011-09-28 2011-09-28 Image scaling method based on directions of pixels in image

Publications (2)

Publication Number Publication Date
CN102509259A true CN102509259A (en) 2012-06-20
CN102509259B CN102509259B (en) 2013-04-03

Family

ID=46221337

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110297826 Expired - Fee Related CN102509259B (en) 2011-09-28 2011-09-28 Image scaling method based on directions of pixels in image

Country Status (1)

Country Link
CN (1) CN102509259B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106530232A (en) * 2016-11-10 2017-03-22 河北工业大学 Image zooming method
CN108447067A (en) * 2018-03-19 2018-08-24 哈尔滨工业大学 It is a kind of that the visible images sea horizon detection method being fitted with RANSAC is cut out based on energy seam
CN109961079A (en) * 2017-12-25 2019-07-02 北京君正集成电路股份有限公司 Image detecting method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7228008B2 (en) * 2002-09-17 2007-06-05 Samsung Electronics Co., Ltd. Method for scaling a digital image in an embedded system
CN101179671A (en) * 2006-11-10 2008-05-14 上海奇码数字信息有限公司 Image scaling device and image scaling method
CN102129666A (en) * 2010-12-31 2011-07-20 华亚微电子(上海)有限公司 Image scaling method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7228008B2 (en) * 2002-09-17 2007-06-05 Samsung Electronics Co., Ltd. Method for scaling a digital image in an embedded system
CN101179671A (en) * 2006-11-10 2008-05-14 上海奇码数字信息有限公司 Image scaling device and image scaling method
CN102129666A (en) * 2010-12-31 2011-07-20 华亚微电子(上海)有限公司 Image scaling method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
薛银珠等: "Video retargeting using optimized crop-and-scale", 《JOURNAL OF SHANGHAI UNIVERSITY》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106530232A (en) * 2016-11-10 2017-03-22 河北工业大学 Image zooming method
CN106530232B (en) * 2016-11-10 2019-09-06 河北工业大学 A kind of image-scaling method
CN109961079A (en) * 2017-12-25 2019-07-02 北京君正集成电路股份有限公司 Image detecting method and device
CN109961079B (en) * 2017-12-25 2021-06-04 北京君正集成电路股份有限公司 Image detection method and device
CN108447067A (en) * 2018-03-19 2018-08-24 哈尔滨工业大学 It is a kind of that the visible images sea horizon detection method being fitted with RANSAC is cut out based on energy seam

Also Published As

Publication number Publication date
CN102509259B (en) 2013-04-03

Similar Documents

Publication Publication Date Title
US7079143B2 (en) Waveform drawing system and method
US8582952B2 (en) Method and apparatus for identifying video transitions
US10656811B2 (en) Animation of user interface elements
US8565554B2 (en) Resizing of digital images
US9582610B2 (en) Visual post builder
US9159155B2 (en) Image rendering
US9715501B2 (en) Dimensional conversion in presentations
JP2007304576A (en) Rendering of translucent layer
CN107257452A (en) A kind of image processing method, device and computing device
US20130106884A1 (en) Multiple image buffer simulation
CN104461439A (en) Information processing method and electronic equipment
US8726185B1 (en) Method and apparatus for rendering overlapped objects
CN102509259A (en) Image scaling method based on directions of pixels in image
CN105427235A (en) Image browsing method and system
CN111489410B (en) Method and device for drawing shot point data of observation system
CN103188554A (en) Image coding method and image coding system
US8704850B2 (en) Two-dimensional object packing
CN110807113B (en) Non-iterative elimination method for rectangular primitive overlap in visual layout
CN108389208B (en) Intelligent image adaptive display method based on semantic segmentation
CN104517273A (en) Image super-resolution processing method and apparatus
Wu et al. Fast and improved seam carving with strip partition and neighboring probability constraints
US8861894B2 (en) Methods and apparatus for edge-aware pixel data generation
JP6326914B2 (en) Interpolation apparatus and interpolation method
US20140040719A1 (en) Browser-based text fitting
US11532106B2 (en) Color gradient capture from source image content

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: 20130403

Termination date: 20150928

EXPY Termination of patent right or utility model