CN101430791A - Method and apparatus for synthesizing photo frame on picture - Google Patents

Method and apparatus for synthesizing photo frame on picture Download PDF

Info

Publication number
CN101430791A
CN101430791A CNA2008101742427A CN200810174242A CN101430791A CN 101430791 A CN101430791 A CN 101430791A CN A2008101742427 A CNA2008101742427 A CN A2008101742427A CN 200810174242 A CN200810174242 A CN 200810174242A CN 101430791 A CN101430791 A CN 101430791A
Authority
CN
China
Prior art keywords
picture
width
height
photo frame
interim
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
CNA2008101742427A
Other languages
Chinese (zh)
Other versions
CN101430791B (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.)
Shenzhen Xunlei Network Technology Co Ltd
Original Assignee
Shenzhen Xunlei Network Technology Co Ltd
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 Shenzhen Xunlei Network Technology Co Ltd filed Critical Shenzhen Xunlei Network Technology Co Ltd
Priority to CN2008101742427A priority Critical patent/CN101430791B/en
Publication of CN101430791A publication Critical patent/CN101430791A/en
Application granted granted Critical
Publication of CN101430791B publication Critical patent/CN101430791B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a method for synthesizing a picture frame on a picture. The method comprises the following steps: performing dynamic adjustment on a selected picture of an original picture frame needing synthesizing on an original image according to the size of the original image; and fusing the picture of the original picture frame after the dynamic adjustment with the original image to obtain a synthesized picture. Meanwhile, the invention discloses a device for synthesizing the picture frame on the picture. The method and the device can help better combine the picture and the picture frame, thus causing the synthesized picture to be more beautiful and recreational.

Description

A kind of on picture the method and apparatus of synthesizing photo frame
Technical field
The present invention relates to the picture treatment technology, particularly a kind of on picture the method and apparatus of synthesizing photo frame.
Background technology
Universal day by day along with digital camera, the aesthetic property of user's logarithmic code photo and recreational requirement are also more and more higher, and this function of synthesizing photo frame then just in time meets user's demand on photograph/picture.
More existing softwares possess the function of synthesizing photo frame on picture on the market, but these softwares all be usually simply will be already ready-made photo frame be attached to around the picture, can not dynamically adjust the size of picture or photo frame, so photo frame and picture combination has well often influenced the aesthetic property of the picture after synthetic and recreational.
Summary of the invention
In view of this, fundamental purpose of the present invention be to provide a kind of on picture the method for synthesizing photo frame, picture and photo frame can be combined preferably, thereby make the picture after synthetic have more aesthetic property and recreational.
Another object of the present invention is to provide a kind of on picture the device of synthesizing photo frame, picture and photo frame can be combined preferably, thereby make the picture after synthetic have more aesthetic property and recreational.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of on picture the method for synthesizing photo frame, this method comprises:
According to the size of original image, the selected original photo frame picture that need synthesize on described original image is dynamically adjusted;
Carry out dynamically with described that adjusted original photo frame picture merges with described original image, the picture after obtaining synthesizing.
A kind of on picture the device of synthesizing photo frame, this device comprises:
Adjustment unit is used for the size according to original image, and the selected original photo frame picture that need synthesize on described original image is dynamically adjusted;
Synthesis unit is used for carrying out dynamically with described that adjusted original photo frame picture merges with described original image, the picture after obtaining synthesizing.
As seen, adopt technical scheme of the present invention,, original photo frame picture to be synthesized is dynamically adjusted according to the size of original image, and then merge, thereby obtain final required picture after synthetic to carrying out dynamically adjusted original photo frame picture and original image.Compared with prior art, scheme of the present invention can combine picture and photo frame preferably, thereby makes the picture after synthesizing have more aesthetic property and recreational.
Description of drawings
Fig. 1 is the process flow diagram of method first embodiment of the present invention's synthesizing photo frame on picture.
Fig. 2 is the synoptic diagram of existing a kind of photo frame picture.
Fig. 3 is the process flow diagram of method second embodiment of the present invention's synthesizing photo frame on picture.
Fig. 4 is the synoptic diagram of existing another kind of photo frame picture.
Fig. 5 is for dynamically building the implementation procedure synoptic diagram of photo frame among the inventive method embodiment.
Fig. 6 is the composition structural representation of the present invention device embodiment of synthesizing photo frame on picture.
Fig. 7 is the composition structural representation of first preferred embodiment of the device of the present invention's synthesizing photo frame on picture.
Fig. 8 is the composition structural representation of second preferred embodiment of the device of the present invention's synthesizing photo frame on picture.
Fig. 9 is the composition structural representation of building subelement in device second preferred embodiment shown in Figure 8.
Embodiment
For solving problems of the prior art, propose among the present invention a kind of brand-new on picture the scheme of synthesizing photo frame: at first, according to the size of original image, to original photo frame picture, promptly the photo frame picture that synthesizes on described original image of the needs selected of user is dynamically adjusted; Then, will carry out dynamic adjusted original photo frame picture and original image and merge, the picture after obtaining synthesizing.
That is mentioned here dynamically adjusts original photo frame picture, can be meant size according to original image, original photo frame picture is carried out convergent-divergent in proportion, also can be meant size according to original image, the size of the required photo frame picture of dynamic calculation each several part, and the each several part that calculates made up, to obtain being fit to the photo frame picture of original image.
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in further detail.
Fig. 1 is the process flow diagram of method first embodiment of the present invention's synthesizing photo frame on picture.As shown in Figure 1, may further comprise the steps:
Step 101: the ratio A of the width W 0 of the picture viewing area in the width W 1 of calculating original image and the original photo frame picture, and the ratio B of the height H 0 of the picture viewing area in the height H 1 of original image and the original photo frame picture.
When the user need add photo frame for a certain picture, at first need to select the phase frame template that will add, promptly selected original photo frame picture, and can be selected, illustrate that then the photo frame picture must be existing, so correspondingly, the relevant information of this photo frame picture, as the width of photo frame picture itself, highly, the width and the height of the picture viewing area in the photo frame picture, and the information such as demonstration reference position of picture viewing area can get access to from the pairing configuration file of this photo frame picture at an easy rate.
Fig. 2 is the synoptic diagram of existing a kind of photo frame picture.As shown in Figure 2, oval The corresponding area wherein is the picture viewing area; The width of supposing this photo frame picture is W, highly is H; The width of picture viewing area is W0, highly is H0.Need to prove that in actual applications, the picture viewing area can show as various irregular shapes, so, the width of picture viewing area and highly typically refer to the minimum rectangle that comprises the picture viewing area width and the height; And the upper left end points position of this minimum rectangle promptly is called the demonstration reference position, i.e. (X0, Y0) the pairing position of coordinate shown in Fig. 2.
In the present embodiment, the width of supposing original image is W1, is H1 highly, and supposes that photo frame picture shown in Figure 2 is user-selected fixed original photo frame picture, then has:
A=W1/W0; (1)
B=H1/H0。(2)
Step 102: calculate the width W of original photo frame picture and the product width of A, and the product height of the height H of original photo frame picture and B, obtain the width and the height of adjusted original photo frame picture.
Promptly have:
width=W*A=W*(W1/W0); (3)
height=H*B=H*(H1/H0)。(4)
Step 103: the width W of original photo frame picture is adjusted into width, height H is adjusted into height.
Here the adjustment of being mentioned promptly refers to stretching/scaling, how to be embodied as prior art, repeats no more.
Step 104: creating a fabric width degree is width, highly is that height and content are the first empty interim picture.
Step 105: the correspondence position of demonstration reference position in the first interim picture that calculates the picture viewing area in the original photo frame picture.
Concrete account form is:
X1=X0*A=X0*(W1/W0); (5)
Y1=Y0*B=Y0*(H1/H0); (6)
Wherein, X0 and Y0 represent the horizontal ordinate of the demonstration reference position of the picture viewing area in the original photo frame picture respectively; X1 and Y1 represent the horizontal ordinate of the correspondence position of demonstration reference position in the first interim picture of the picture viewing area in the original photo frame picture respectively.
Step 106: original image is copied in the first interim picture, obtain the second interim picture, the correspondence position of demonstration reference position in the first interim picture of the picture viewing area in the position of first pixel of described original image and the original photo frame picture that calculated coincides.
After the processing by this step, original image in interim picture, will occupy four apex coordinates be respectively (X1, Y1), (X1+W1, Y1), (X1, Y1+H1), (X1+W1, zone Y1+H1).
Step 107: the adjusted original photo frame picture and the second interim picture are merged the picture after obtaining synthesizing, process ends.
Soon the second interim picture that obtains in photo frame picture that obtains in the step 103 and the step 106 merges, the picture after obtaining synthesizing, promptly final required picture.
In the present embodiment, can merge the adjusted original photo frame picture and the second interim picture according to mixed (blend) mode, because photo frame pictures etc. all are to preserve in the mode of alpha data usually, and the blend mode can merge these class data preferably.Specific implementation is a prior art, repeats no more.
Need to prove that the execution sequence of each step shown in Figure 1 is not limited to technical scheme of the present invention only for illustrating.Such as, step 103 is carried out after also can being placed on step 106.
In addition, for original image and original photo frame picture can be combined better, can also be before execution in step 101, further comprise a deterministic process: judge promptly whether picture viewing area in the original photo frame picture and original image are width greater than height or be height greater than width, whether be W0 promptly〉H0 and W1〉H1, or W0<H0 and W1<H1, if not, then original image is carried out in the clockwise direction the rotation of 90 degree, make the width of original image and height value exchange.Correspondingly, after execution of step 107, also need the picture after synthetic is carried out the rotation of 90 degree in the counterclockwise direction.
By above-mentioned introduction as can be seen, embodiment illustrated in fig. 1 in, according to the size of original image,, realize dynamic adjustment to original photo frame picture by original photo frame picture is carried out convergent-divergent in proportion; This dynamic adjustment mode is applicable to the exquisite photo frame of having made.To introduce another kind of dynamically adjustment mode below, promptly according to original picture size, dynamic calculation goes out the size of the each several part of required photo frame picture, and the each several part that calculates is made up, to obtain being fit to the photo frame picture of original image; This dynamic adjustment mode is applicable to the photo frame of the comparatively simple and shape comparison rule that user oneself makes.
Fig. 3 is the process flow diagram of method second embodiment of the present invention's synthesizing photo frame on picture.As shown in Figure 3, may further comprise the steps:
Step 301: the width src_Width and the width frame_Width of smaller value among the height src_Height and original photo frame picture and the ratio N of the smaller value among the height frame_Height that calculate original image.
In the present embodiment, suppose that src represents original image, frame represents original photo frame picture; Src_Width and src_Height represent the width and the height of original image respectively, and frame_Width and frame_Height represent the width and the height of original photo frame picture respectively; Then have:
srcSize=Min(src_Width,src_Height); (7)
frameSize=Min(frame_Width,frame_Height); (8)
N=srcSize/frameSize。(9)
Step 302: determine the scaling COEFFICIENT K according to the N value that calculates.
K=Min(10,Max(1,N))=Min(10,Max(1,srcSize/frameSize));
(10)
Wherein, Min represents to get smaller value, and Max represents to get higher value.As can be seen, the value of the scaling COEFFICIENT K of determining according to formula (10) will be between 1~10.
Step 303: calculate the width frame_Width of original photo frame picture and the product temp1 of scaling COEFFICIENT K, and the product temp2 of the height frame_Height of original photo frame picture and scaling COEFFICIENT K; And the width frame_Width of original photo frame picture is adjusted into temp1, the height frame_Height of original photo frame picture is adjusted into temp2.
In this step, promptly original photo frame picture is carried out scaling/stretching according to the scaling COEFFICIENT K of determining.
Step 304: four corner rectangles and the peripheral rectangular information of obtaining adjusted original photo frame picture.
Here the information of being mentioned is meant each rectangular width and elevation information.These information can obtain from the pairing configuration file of original photo frame picture.
As shown in Figure 4, Fig. 4 is the synoptic diagram of existing another kind of photo frame picture.Ra wherein, rb, rc and rd are four corner rectangles of this photo frame picture; Re, rf, rg and rh are the peripheral rectangle of this photo frame picture.The number of periphery rectangle re, rf, rg and rh and area etc. all not necessarily equate, decide on the concrete production method of photo frame; But it is normally the same to be positioned at each peripheral rectangular area on same the frame.
Step 305: create a content and be the 3rd empty interim picture.
The width width of the 3rd interim picture and height height are respectively:
width=src_Width+(extraspaceX*K); (11)
height=src_Height+(extraspaceY*K); (12)
Wherein, extraspaceX represents width poor of original photo frame picture and original image, and extraspaceY represents height poor of original photo frame picture and original image.
Step 306: the correspondence position of demonstration reference position in the 3rd interim picture that calculates the picture viewing area in the original photo frame picture.
Concrete account form is:
X1=X0*K; (13)
Y1=Y0*K; (14)
Wherein, show that reference position is the upper left end points position that comprises the minimum rectangle of picture viewing area; X0 and Y0 represent the horizontal ordinate and the ordinate of the demonstration reference position of the picture viewing area in the original photo frame picture respectively; The horizontal ordinate and the ordinate of the correspondence position of the demonstration reference position of the picture viewing area in the original photo frame picture that X1 and Y1 represent respectively to calculate in the 3rd interim picture.
Step 307: original image is copied in the 3rd interim picture, obtain the 4th interim picture; The correspondence position of demonstration reference position in the 3rd interim picture of the picture viewing area in the position of first pixel of described original image and the original photo frame picture that calculated coincides.
Step 308:, in the 4th interim picture, dynamically build photo frame for original image, process ends according to four the corner rectangles and the peripheral rectangle information of the adjusted original photo frame picture that gets access to.
Concrete dynamic build process is as follows:
For each the bar frame in the adjusted original photo frame picture, handle according to mode shown in Figure 5 respectively:
Step 501: four apex coordinates of region duplication to the four interim pictures that are arranged in the corner rectangle r1 correspondence in left side in this frame are respectively (0,0), (r1_Width, 0), (0, r1_Height) and (r1_Width, zone r1_Height).
Wherein, r1_Width represents the width of corner rectangle r1, and r1_Height represents the height of corner rectangle r1.
In the present embodiment,, mark a zone with four apex coordinates for ease of describing, wherein, corresponding different frames, the mode of choosing of true origin also can be different.Such as, when building upper side frame, can be with the upper left end points of the 4th interim picture as true origin.The operation of this step is the equal of the upper left corner that the corner rectangle that will be arranged in the upper left corner in the adjusted original photo frame picture copies to the 4th interim picture, so, four apex coordinates that duplicate the zone in the 4th shared interim picture of back will be respectively (0,0), (r1_Width, 0), (0, r1_Height) and (r1_Width, r1_Height).
Correspondingly, for guaranteeing when building other frame, the form of presentation of this step is still suitable, can be when building left frame, with the lower-left end points of the 4th interim picture as true origin, when building lower frame, with the bottom right end points of the 4th interim picture as true origin, when building left frame, with the upper right end points of the 4th interim picture as true origin.
Step 502: make i=r1_Width, j=width-r2_Width.
Wherein, r2_Width represents to be positioned at the width of the corner rectangle r2 on frame right side.
Step 503: whether judge i less than j, if then execution in step 504; Otherwise, execution in step 508.
Step 504: whether judge i+r5_Width less than j, if then execution in step 505; Otherwise, execution in step 506.
R5_Width represents to be positioned at the width of the peripheral rectangle r5 on the frame.
Step 505: four apex coordinates in region duplication to the four interim pictures of peripheral rectangle r5 correspondence are respectively (i, 0), (i+r5_Width, 0), (i, r5_Height) and (i+r5_Width, r5_Height) zone, execution in step 507 then.
Step 506: four apex coordinates that the subregion of peripheral rectangle r5 correspondence is copied in the 4th interim picture are respectively (i, 0), (j, 0), (i, r5_Height) and (j, zone r5_Height).
If i+r5_Width more than or equal to j, then illustrates the peripheral rectangle r5 situation of (corresponding " equaling ") can only be set between corner rectangle r1 and the r2, perhaps can only be provided with peripheral rectangle r5 a part (corresponding " and greater than " situation).At this moment, the right side that copies to the peripheral rectangle r5 in the 4th interim picture up and down the coordinate of two end points will be respectively (j, 0) and (j, r5_Height).
Step 507: make i=i+r5_Width, return execution in step 503 then.
Step 508: four apex coordinates in region duplication the 4th interim picture of corner rectangle r2 correspondence are respectively (width-r2_Width, 0), (width, 0), (width-r2_Width, r2_Height) and (width, r2_Height) zone, process ends.
So far, promptly finished building of a frame.The mode of building and the process shown in Figure 5 of other frame are similar, repeat no more.
Need to prove, in actual applications, be not that each bar frame all must be built in strict accordance with mode shown in Figure 5.Because with Fig. 4 is example, after having built upper side frame, corner rectangle ra and rb and peripheral rectangle re just have been copied in the 4th interim picture; So, when building left frame subsequently, because corner rectangle ra is that upper side frame and left frame are total, so, need not to duplicate corner rectangle ra in building the process of left frame, a need duplicates corner rectangle rd according to mode shown in Figure 5 and peripheral rectangle rh gets final product again.In a word, shown in Figure 5 is the explanation of principle only, can be based on the implementation procedure of this principle flexible design reality in application.
In addition, duplicating of being mentioned in the present embodiment promptly refers to a kind of fusion process, and be same, also can adopt the amalgamation mode of blend in the present embodiment.
Based on said method, Fig. 6 is the composition structural representation of the present invention device embodiment of synthesizing photo frame on picture.As shown in Figure 6, this device comprises:
Adjustment unit 61 is used for the size according to original image, and the selected original photo frame picture that need synthesize on described original image is dynamically adjusted;
Synthesis unit 62 is used for merging with carrying out dynamic adjusted original photo frame picture and original image with the picture after obtaining synthesizing.
Wherein, can further comprise different subelements respectively again in adjustment unit 61 and the synthesis unit 62, shown in Fig. 7 and 8:
Fig. 7 is the composition structural representation of device first preferred embodiment of the present invention's synthesizing photo frame on picture.As shown in Figure 7, can specifically comprise in the adjustment unit 61:
First computation subunit 71 is used for calculating the ratio A of width W 1 with the width W 0 of the picture viewing area of original photo frame picture of original image, and the ratio B of the height H 0 of the picture viewing area in the height H 1 of original image and the original photo frame picture; The width of described picture viewing area and highly be respectively the minimum rectangle that comprises the picture viewing area width and the height;
Second computation subunit 72 is used to calculate the width W of original photo frame picture and the product width of A, and the product height of the height H of original photo frame picture and B;
First adjusts subelement 73, is used for the width W of original photo frame picture is adjusted into width, and the height H of original photo frame picture is adjusted into height.
Can specifically comprise in the synthesis unit 62:
First creates subelement 74, is used to create a width and is width, highly is height and the content first interim picture for sky;
The 3rd computation subunit 75 is used for calculating the correspondence position of demonstration reference position in the first interim picture of the picture viewing area of original photo frame picture: X1=X0*A; Y1=Y0*B; Wherein, show that reference position is the upper left end points position that comprises the minimum rectangle of picture viewing area; X0 and Y0 represent the horizontal ordinate and the ordinate of the demonstration reference position of the picture viewing area in the original photo frame picture respectively; The horizontal ordinate and the ordinate of the correspondence position of the demonstration reference position of the picture viewing area in the original photo frame picture that X1 and Y1 represent respectively to calculate in the first interim picture;
The first replicon unit 76, be used for original image is copied to the first interim picture, obtain the second interim picture, the correspondence position of demonstration reference position in the first interim picture of the picture viewing area in the position of first pixel of described original image and the original photo frame picture that calculated coincides;
The first synthon unit 77 is used for the adjusted original photo frame picture and the second interim picture are merged, the picture after obtaining synthesizing.
In addition, also can further comprise in the device shown in Figure 7: rotary unit 63, be used for determining whether the picture viewing area of original photo frame picture and original image are width greater than height or be height greater than width, if not, then original image is carried out in the clockwise direction the rotation of 90 degree, make the width and the height value of original image exchange, and notice adjustment unit 61 is carried out self function according to postrotational original image; And be further used for, receive from the picture behind synthesis unit 62 synthetic, the picture after synthetic is carried out the rotations of 90 degree in the counterclockwise direction.
Fig. 8 is the composition structural representation of device second preferred embodiment of the present invention's synthesizing photo frame on picture.As shown in Figure 8, can specifically comprise in the adjustment unit 61:
The 4th computation subunit 81, be used for calculating the width src_Width of original image and smaller value and the width frame_Width of original photo frame picture and the ratio N of the smaller value among the height frame_Height of height src_Height, and according to definite scaling COEFFICIENT K: the K=Min (10 of the N value that calculates, Max (1, N)), wherein, Min represents to get smaller value, and Max represents to get higher value;
The 5th computation subunit 82 is used to calculate the width frame_Width of original photo frame picture and the product temp1 of scaling COEFFICIENT K, and the product temp2 of the height frame_Height of original photo frame picture and scaling COEFFICIENT K;
Second adjusts subelement 83, is used for the width frame_Width of original photo frame picture is adjusted into temp1, and the height frame_Height of original photo frame picture is adjusted into temp2.
Can specifically comprise in the synthesis unit 62:
Obtain subelement 84, be used to obtain four the corner rectangles and the peripheral rectangular information of adjusted original photo frame picture, described information is each rectangular width and elevation information;
Second creates subelement 85, is used to create a content and is the 3rd empty interim picture, the width width=src_Width+ (extraspaceX*K) of the 3rd interim picture, height height=src_Height+ (extraspaceY*K); Wherein, extraspaceX represents width poor of original photo frame picture and original image, and extraspaceY represents height poor of original photo frame picture and original image;
The 6th computation subunit 86 is used for calculating the correspondence position of demonstration reference position in the 3rd interim picture of the picture viewing area of original photo frame picture: X1=X0*K; Y1=Y0*K; Wherein, show that reference position is the upper left end points position that comprises the minimum rectangle of picture viewing area; X0 and Y0 represent the horizontal ordinate and the ordinate of the demonstration reference position of the picture viewing area in the original photo frame picture respectively; The horizontal ordinate and the ordinate of the correspondence position of the demonstration reference position of the picture viewing area in the original photo frame picture that X1 and Y1 represent respectively to calculate in the 3rd interim picture;
The second replicon unit 87, be used for original image is copied to the 3rd interim picture, obtain the 4th interim picture, the correspondence position of demonstration reference position in the 3rd interim picture of the picture viewing area in the position of first pixel of described original image and the original photo frame picture that calculated coincides;
The second synthon unit 88 is used for four corner rectangles and peripheral rectangle information according to the adjusted original photo frame picture that gets access to, dynamically builds photo frame for original image in the 4th interim picture, with the picture after obtaining synthesizing.
In addition, can comprise again in the second synthon unit 88: build subelement (not shown) for four, wherein, each builds subelement, be respectively applied for according to corner rectangle information and peripheral rectangle information in the frame in the adjusted original photo frame picture that gets access to, in the 4th interim picture, dynamically build a frame for original image; Building subelement for four is respectively applied for and builds four different frames.
Fig. 9 builds the composition structural representation of subelement for each.As shown in Figure 9, comprising:
The 3rd replicon unit 91, four apex coordinates of region duplication to the four interim pictures that are used for frame is arranged in the corner rectangle r1 correspondence in left side are respectively (0,0), (r1_Width, 0), (0, r1_Height) and (r1_Width, zone r1_Height);
Wherein, r1_Width represents the width of corner rectangle r1, and r1_Height represents the height of corner rectangle r1; When frame is upper side frame, with the upper left end points of the 4th interim picture as true origin; When frame is left frame, with the lower-left end points of the 4th interim picture as true origin; When frame is lower frame, with the bottom right end points of the 4th interim picture as true origin; When frame is left frame, with the upper right end points of the 4th interim picture as true origin;
The first assignment subelement 92 is used for giving i with the r1_Width assignment, and the assignment as a result that width and r2_Width are subtracted each other is to j, and r2_Width represents to be positioned at the width of the corner rectangle r2 on frame right side;
Whether first judgment sub-unit 93 is used to judge i less than j, if, then notify second judgment sub-unit 94 to carry out self function, otherwise, notify the 4th replicon unit 95 to carry out self function;
Second judgment sub-unit 94, whether the sum that is used to judge i and r5_Width is less than j, and r5_Width represents to be positioned at the width of the peripheral rectangle r5 on the frame; If, then four apex coordinates in region duplication to the four interim pictures of peripheral rectangle r5 correspondence are respectively (i, 0), (i+r5_Width, 0), (i, r5_Height) and (i+r5_Width, r5_Height) zone, otherwise four apex coordinates that the subregion of peripheral rectangle r5 correspondence is copied in the 4th interim picture are respectively (i, 0), (j, 0), (i, r5_Height) and (j, zone r5_Height); And the sum of i and r5_Width sent to first judgment sub-unit 93 as new i value;
The 4th replicon unit 95, be used for four apex coordinates of region duplication the 4th interim picture of corner rectangle r2 correspondence are respectively (width-r2_Width, 0), (width, 0), (width-r2_Width, r2_Height) and (width, zone r2_Height).
The concrete workflow of Fig. 6~9 shown device embodiment please refer to the respective description among the method embodiment, repeats no more herein.
In a word, adopt technical scheme of the present invention,, original photo frame picture to be synthesized is dynamically adjusted according to the size of original image, and then merge, thereby obtain final required picture after synthetic to carrying out dynamically adjusted original photo frame picture and original image.Compared with prior art, scheme of the present invention can combine picture and photo frame better, thereby makes the picture after synthesizing have more aesthetic property and recreational.
In sum, more than be preferred embodiment of the present invention only, be not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (15)

1, a kind of on picture the method for synthesizing photo frame, it is characterized in that this method comprises:
According to the size of original image, the selected original photo frame picture that need synthesize on described original image is dynamically adjusted;
Carry out dynamically with described that adjusted original photo frame picture merges with described original image, the picture after obtaining synthesizing.
2, method according to claim 1 is characterized in that, described size according to original image is dynamically adjusted original photo frame picture and to be comprised:
The ratio A of the width W 0 of the picture viewing area in the width W 1 of calculating described original image and the described original photo frame picture, and the ratio B of the height H 0 of the picture viewing area in the height H 1 of described original image and the described original photo frame picture; The width of described picture viewing area and highly be respectively the minimum rectangle that comprises described picture viewing area width and the height;
Calculate the width W of described original photo frame picture and the product width of described A, and the product height of the height H of described original photo frame picture and described B;
The width W of described original photo frame picture is adjusted into width, the height H of described original photo frame picture is adjusted into height.
3, method according to claim 2 is characterized in that, describedly carries out dynamically with described that adjusted original photo frame picture merges with described original image, and the picture after obtaining synthesizing comprises:
Create a width and be width, highly be the first empty interim picture for height and content;
Calculate the correspondence position of demonstration reference position in the described first interim picture of the picture viewing area in the described original photo frame picture: X1=X0*A; Y1=Y0*B;
Wherein, described demonstration reference position is the upper left end points position that comprises the minimum rectangle of described picture viewing area; Described X0 and Y0 represent the horizontal ordinate and the ordinate of the demonstration reference position of the picture viewing area in the described original photo frame picture respectively; The horizontal ordinate and the ordinate of the correspondence position of the demonstration reference position of the picture viewing area in the original photo frame picture that described X1 and Y1 represent respectively to calculate in the described first interim picture;
Described original image is copied in the described first interim picture, obtain the second interim picture, the correspondence position of demonstration reference position in the described first interim picture of the picture viewing area in the position of first pixel of described original image and the described original photo frame picture that calculates coincides;
The described adjusted original photo frame picture and the described second interim picture are merged the picture after obtaining synthesizing.
According to each described method in the claim 1~3, it is characterized in that 4, described size according to original image before original photo frame picture dynamically adjusted, further comprises:
Judge whether picture viewing area in the described original photo frame picture and described original image are width greater than height or be height greater than width, if not, then described original image is carried out in the clockwise direction the rotation of 90 degree, make the width of described original image and height value exchange;
After the described picture that obtains after synthetic, further comprise:
Picture after described synthesizing is carried out the rotations of 90 degree in the counterclockwise direction.
5, method according to claim 1 is characterized in that, described size according to original image is dynamically adjusted original photo frame picture and to be comprised:
Calculate width src_Width and the width frame_Width of smaller value among the height src_Height and described original photo frame picture and the ratio N of the smaller value among the height frame_Height of described original image;
According to the N value that calculates determine scaling COEFFICIENT K: K=Min (10, Max (1, N)); Wherein, Min represents to get smaller value, and Max represents to get higher value;
Calculate the width frame_Width of described original photo frame picture and the product temp1 of described scaling COEFFICIENT K, and the product temp2 of the height frame_Height of described original photo frame picture and described scaling COEFFICIENT K;
The width frame_Width of described original photo frame picture is adjusted into temp1, the height frame_Height of described original photo frame picture is adjusted into temp2.
6, method according to claim 5 is characterized in that, describedly carries out dynamically with described that adjusted original photo frame picture merges with described original image, and the picture after obtaining synthesizing comprises:
Obtain four the corner rectangles and the peripheral rectangular information of adjusted original photo frame picture, described information is each rectangular width and elevation information;
Create a content and be the 3rd empty interim picture, the width width=src_Width+ (extraspaceX*K) of the described the 3rd interim picture, height height=src_Height+ (extraspaceY*K); Wherein, described extraspaceX represents width poor of described original photo frame picture and described original image, and described extraspaceY represents height poor of described original photo frame picture and described original image;
Calculate the correspondence position of demonstration reference position in the described the 3rd interim picture of the picture viewing area in the described original photo frame picture: X1=X0*K; Y1=Y0*K;
Wherein, described demonstration reference position is the upper left end points position that comprises the minimum rectangle of described picture viewing area; Described X0 and Y0 represent the horizontal ordinate and the ordinate of the demonstration reference position of the picture viewing area in the described original photo frame picture respectively; The horizontal ordinate and the ordinate of the correspondence position of the demonstration reference position of the picture viewing area in the original photo frame picture that described X1 and Y1 represent respectively to calculate in the described the 3rd interim picture;
Described original image is copied in the described the 3rd interim picture, obtain the 4th interim picture; The correspondence position of demonstration reference position in the described the 3rd interim picture of the picture viewing area in the position of first pixel of described original image and the described original photo frame picture that calculates coincides;
According to four the corner rectangles and the peripheral rectangle information of the described adjusted original photo frame picture that gets access to, in the described the 4th interim picture, dynamically build photo frame, with the picture after obtaining synthesizing for described original image.
7, method according to claim 6, it is characterized in that, four the corner rectangles and the peripheral rectangle information of the described adjusted original photo frame picture that gets access to of described foundation, in the described the 4th interim picture, dynamically build photo frame and comprise for described original image:
For each the bar frame in the described adjusted original photo frame picture, handle in such a way respectively:
A, be arranged in this frame the left side corner rectangle r1 correspondence region duplication to four apex coordinates of the described the 4th interim picture be respectively (0,0), (r1_Width, 0), (0, r1_Height) and (r1_Width, zone r1_Height);
Wherein, described r1_Width represents the width of corner rectangle r1, and described r1_Height represents the height of corner rectangle r1; When described frame is upper side frame, with the upper left end points of the described the 4th interim picture as true origin; When described frame is left frame, with the lower-left end points of the described the 4th interim picture as true origin; When described frame is lower frame, with the bottom right end points of the described the 4th interim picture as true origin; When described frame is left frame, with the upper right end points of the described the 4th interim picture as true origin;
B, make i=r1_Width, j=width-r2_Width; Described r2_Width represents to be positioned at the width of the corner rectangle r2 on described frame right side;
C, whether judge described i less than j, if, execution in step d then; Otherwise, execution in step f;
D, judge described i and r5_Width sum whether less than j, described r5_Width represents to be positioned at the width of the peripheral rectangle r5 on the described frame;
If, then the region duplication of described peripheral rectangle r5 correspondence four apex coordinates in the described the 4th interim picture are respectively (i, 0), (i+r5_Width, 0), (i, r5_Height) and (i+r5_Width, zone r5_Height);
Otherwise four apex coordinates that the subregion of described peripheral rectangle r5 correspondence is copied in the described the 4th interim picture are respectively (i, 0), (j, 0), (i, r5_Height) and (j, zone r5_Height);
E, make i=i+r5_Width, return execution in step c then;
F, four apex coordinates in region duplication the described the 4th interim picture of described corner rectangle r2 correspondence are respectively (width-r2_Width, 0), (width, 0), (width-r2_Width, r2_Height) and (width, zone r2_Height).
8, method according to claim 1 is characterized in that, described the described adjusted original photo frame picture and described original image of carrying out dynamically merged and comprise:
Carry out dynamically with described that adjusted original photo frame picture and described original image merge according to mixed blend mode.
9, a kind of on picture the device of synthesizing photo frame, it is characterized in that this device comprises:
Adjustment unit is used for the size according to original image, and the selected original photo frame picture that need synthesize on described original image is dynamically adjusted;
Synthesis unit is used for carrying out dynamically with described that adjusted original photo frame picture merges with described original image, the picture after obtaining synthesizing.
10, device according to claim 9 is characterized in that, described adjustment unit comprises:
First computation subunit, be used for calculating the ratio A of width W 1 with the width W 0 of the picture viewing area of described original photo frame picture of described original image, and the ratio B of the height H 0 of the picture viewing area in the height H 1 of described original image and the described original photo frame picture; The width of described picture viewing area and highly be respectively the minimum rectangle that comprises described picture viewing area width and the height;
Second computation subunit is used to calculate the width W of described original photo frame picture and the product width of described A, and the product height of the height H of described original photo frame picture and described B;
First adjusts subelement, is used for the width W of described original photo frame picture is adjusted into width, and the height H of described original photo frame picture is adjusted into height.
11, device according to claim 10 is characterized in that, described synthesis unit comprises:
First creates subelement, is used to create a width and is width, highly is height and the content first interim picture for sky;
The 3rd computation subunit is used for calculating the correspondence position of demonstration reference position in the described first interim picture of the picture viewing area of described original photo frame picture: X1=X0*A; Y1=Y0*B; Wherein, described demonstration reference position is the upper left end points position that comprises the minimum rectangle of described picture viewing area; Described X0 and Y0 represent the horizontal ordinate and the ordinate of the demonstration reference position of the picture viewing area in the described original photo frame picture respectively; The horizontal ordinate and the ordinate of the correspondence position of the demonstration reference position of the picture viewing area in the original photo frame picture that described X1 and Y1 represent respectively to calculate in the described first interim picture;
The first replicon unit, be used for described original image is copied to the described first interim picture, obtain the second interim picture, the correspondence position of demonstration reference position in the described first interim picture of the picture viewing area in the position of first pixel of described original image and the described original photo frame picture that calculates coincides;
The first synthon unit is used for the described adjusted original photo frame picture and the described second interim picture are merged, the picture after obtaining synthesizing.
12, according to each described device in the claim 9~11, it is characterized in that, further comprise in this device: rotary unit, be used for determining whether the picture viewing area of described original photo frame picture and described original image are width greater than height or be height greater than width, if not, then described original image is carried out in the clockwise direction the rotation of 90 degree, make the width and the height value of described original image exchange, and notify described adjustment unit to carry out self function according to postrotational original image; And be further used for, receive from the picture behind described synthesis unit synthetic, described picture after synthetic is carried out the rotations of 90 degree in the counterclockwise direction.
13, device according to claim 9 is characterized in that, described adjustment unit comprises:
The 4th computation subunit, be used for calculating the width src_Width of described original image and smaller value and the width frame_Width of described original photo frame picture and the ratio N of the smaller value among the height frame_Heiht of height src_Height, and according to definite scaling COEFFICIENT K: the K=Min (10 of the N value that calculates, Max (1, N)), wherein, Min represents to get smaller value, and Max represents to get higher value;
The 5th computation subunit is used to calculate the width frame_Width of described original photo frame picture and the product temp1 of described scaling COEFFICIENT K, and the product temp2 of the height frame_Height of described original photo frame picture and described scaling COEFFICIENT K;
Second adjusts subelement, is used for the width frame_Width of described original photo frame picture is adjusted into temp1, and the height frame_Height of described original photo frame picture is adjusted into temp2.
14, device according to claim 13 is characterized in that, described synthesis unit comprises:
Obtain subelement, be used to obtain four the corner rectangles and the peripheral rectangular information of adjusted original photo frame picture, described information is each rectangular width and elevation information;
Second creates subelement, is used to create a content and is the 3rd empty interim picture, the width width=src_Width+ (extraspaceX*K) of the described the 3rd interim picture, height height=src_Height+ (extraspaceY*K); Wherein, described extraspaceX represents width poor of described original photo frame picture and described original image, and described extraspaceY represents height poor of described original photo frame picture and described original image;
The 6th computation subunit is used for calculating the correspondence position of demonstration reference position in the described the 3rd interim picture of the picture viewing area of described original photo frame picture: X1=X0*K; Y1=Y0*K; Wherein, described demonstration reference position is the upper left end points position that comprises the minimum rectangle of described picture viewing area; Described X0 and Y0 represent the horizontal ordinate and the ordinate of the demonstration reference position of the picture viewing area in the described original photo frame picture respectively; The horizontal ordinate and the ordinate of the correspondence position of the demonstration reference position of the picture viewing area in the original photo frame picture that described X1 and Y1 represent respectively to calculate in the described the 3rd interim picture;
The second replicon unit, be used for described original image is copied to the described the 3rd interim picture, obtain the 4th interim picture, the correspondence position of demonstration reference position in the described the 3rd interim picture of the picture viewing area in the position of first pixel of described original image and the described original photo frame picture that calculates coincides;
The second synthon unit is used for four corner rectangles and peripheral rectangle information according to the described adjusted original photo frame picture that gets access to, dynamically builds photo frame for described original image in the described the 4th interim picture, with the picture after obtaining synthesizing.
15, device according to claim 14 is characterized in that, the described second synthon unit comprises:
Build subelement for four; Wherein, each builds subelement, be respectively applied for according to corner rectangle information and peripheral rectangle information in the frame in the described adjusted original photo frame picture that gets access to, in the described the 4th interim picture, dynamically build a frame for described original image; Build subelement and be respectively applied for and build four different frames for described four; Wherein, each is built in the subelement and further comprises:
The 3rd replicon unit, the region duplication that is used for frame is arranged in the corner rectangle r1 correspondence in left side is respectively (0,0), (r1_Width, 0), (0 to four apex coordinates of the described the 4th interim picture, r1_Height) and (r1_Width, zone r1_Height);
Wherein, described r1_Width represents the width of corner rectangle r1, and described r1_Height represents the height of corner rectangle r1; When described frame is upper side frame, with the upper left end points of the described the 4th interim picture as true origin; When described frame is left frame, with the lower-left end points of the described the 4th interim picture as true origin; When described frame is lower frame, with the bottom right end points of the described the 4th interim picture as true origin; When described frame is left frame, with the upper right end points of the described the 4th interim picture as true origin;
The first assignment subelement is used for giving i with the r1_Width assignment, and the assignment as a result that width and r2_Width are subtracted each other is to j, and described r2_Width represents to be positioned at the width of the corner rectangle r2 on described frame right side;
Whether first judgment sub-unit is used to judge described i less than j, if, then notify described second judgment sub-unit to carry out self function, otherwise, notify described the 4th replicon unit to carry out self function;
Described second judgment sub-unit, whether the sum that is used to judge i and r5_Width is less than j, and described r5_Width represents to be positioned at the width of the peripheral rectangle r5 on the described frame; If, then the region duplication of described peripheral rectangle r5 correspondence four apex coordinates in the described the 4th interim picture are respectively (i, 0), (i+r5_Width, 0), (i, r5_Height) and (i+r5_Width, r5_Height) zone, otherwise four apex coordinates that the subregion of described peripheral rectangle r5 correspondence is copied in the described the 4th interim picture are respectively (i, 0), (j, 0), (i, r5_Height) and (j, zone r5_Height); And i and r5_Width sum sent to described first judgment sub-unit as new i value;
Described the 4th replicon unit, be used for four apex coordinates of region duplication the described the 4th interim picture of described corner rectangle r2 correspondence are respectively (width-r2_Width, 0), (width, 0), (width-r2_Width, r2_Height) and (width, zone r2_Height).
CN2008101742427A 2008-11-14 2008-11-14 Method and apparatus for synthesizing photo frame on picture Active CN101430791B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101742427A CN101430791B (en) 2008-11-14 2008-11-14 Method and apparatus for synthesizing photo frame on picture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101742427A CN101430791B (en) 2008-11-14 2008-11-14 Method and apparatus for synthesizing photo frame on picture

Publications (2)

Publication Number Publication Date
CN101430791A true CN101430791A (en) 2009-05-13
CN101430791B CN101430791B (en) 2012-02-08

Family

ID=40646172

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101742427A Active CN101430791B (en) 2008-11-14 2008-11-14 Method and apparatus for synthesizing photo frame on picture

Country Status (1)

Country Link
CN (1) CN101430791B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104598542A (en) * 2014-12-30 2015-05-06 广州酷狗计算机科技有限公司 Display method and device for multimedia information
CN105512410A (en) * 2015-12-15 2016-04-20 厉小润 Strip picture based random picture frame generation method
CN105447267B (en) * 2015-12-15 2018-09-21 厉小润 A kind of picture frame based on image recognition technology and the synthetic method for drawing core
CN109808406A (en) * 2019-04-09 2019-05-28 广州真迹文化有限公司 The online method for mounting of painting and calligraphy pieces, system and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4602286A (en) * 1982-01-15 1986-07-22 Quantel Limited Video processing for composite images
WO2006135358A1 (en) * 2005-06-08 2006-12-21 Thomson Licensing Method, apparatus and system for alternate image/video insertion

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104598542A (en) * 2014-12-30 2015-05-06 广州酷狗计算机科技有限公司 Display method and device for multimedia information
CN104598542B (en) * 2014-12-30 2018-12-21 广州酷狗计算机科技有限公司 The display methods and device of multimedia messages
CN105512410A (en) * 2015-12-15 2016-04-20 厉小润 Strip picture based random picture frame generation method
CN105512410B (en) * 2015-12-15 2018-09-21 厉小润 A kind of arbitrary picture frame generation method based on striped picture
CN105447267B (en) * 2015-12-15 2018-09-21 厉小润 A kind of picture frame based on image recognition technology and the synthetic method for drawing core
CN109808406A (en) * 2019-04-09 2019-05-28 广州真迹文化有限公司 The online method for mounting of painting and calligraphy pieces, system and storage medium

Also Published As

Publication number Publication date
CN101430791B (en) 2012-02-08

Similar Documents

Publication Publication Date Title
CN106803884B (en) Image processing apparatus
JP2007251914A (en) Image signal processing apparatus, and virtual reality creating system
JPH03113578A (en) Graphic output processing system
JP5061227B2 (en) Video signal processing apparatus and virtual reality generation system
JP2020533710A (en) Image stitching method and device, storage medium
WO2006057267A1 (en) Face image synthesis method and face image synthesis device
JP5743016B2 (en) Apparatus and method for generating images
JP2016096487A (en) Imaging system
CN101430791B (en) Method and apparatus for synthesizing photo frame on picture
US20090091511A1 (en) Aspect-ratio independent, multimedia capture and editing systems and methods thereof
JP2004320661A (en) Method for correcting area outside screen in geometrical correction interface using auxiliary line
JP2007148784A (en) Image composition system and image composition method
TWI238978B (en) Two-dimensional image rendering processing method and device, and computer-readable medium thereof
Singh et al. The ibar: A perspective-based camera widget
JP5249733B2 (en) Video signal processing device
CN103795925A (en) Interactive main-and-auxiliary-picture real-time rendering photographing method
JP2017062831A (en) Method and image processing apparatus
JP2002238064A (en) Large screen display device
JP4631878B2 (en) Video signal processing device, virtual reality generation system
KR100493292B1 (en) apparatus for controlling split zoom of display device
JP2008028481A (en) Image processor, remote image processing system and image processing method
CN112988101B (en) Image processing method and device, nonvolatile storage medium and processor
JP6705477B2 (en) Image processing system, image processing method and program
CA2940408C (en) Collaboration system with raster-to-vector image conversion
JP2007019694A (en) Photographic image processor for digital camera, and computer program for photographic 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
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20170221

Address after: A District No. 9018 building 518057 Guangdong Han innovation city of Shenzhen province Nanshan District high tech park, North Central Avenue, 4 floor 401

Patentee after: Shenzhen thunder network culture Co., Ltd.

Address before: 518057 Guangdong, Shenzhen, Nanshan District science and technology in the road, Shenzhen, No. 11, software park, building 7, level 8, two

Patentee before: Xunlei Network Technology Co., Ltd., Shenzhen

TR01 Transfer of patent right

Effective date of registration: 20180301

Address after: Nanshan District Guangdong streets of science and technology of Shenzhen city in Guangdong province 518057 two Road No. 11 Shenzhen Software Park Building 7, 8 floor

Patentee after: Xunlei Network Technology Co., Ltd., Shenzhen

Address before: A District No. 9018 Han innovation building 518057 Shenzhen city Nanshan District high tech park, North Central Avenue, 4 floor 401

Patentee before: Shenzhen thunder network culture Co., Ltd.

TR01 Transfer of patent right