CN114241093B - Method and system for automatically typesetting photo book without shielding - Google Patents
Method and system for automatically typesetting photo book without shielding Download PDFInfo
- Publication number
- CN114241093B CN114241093B CN202210183398.1A CN202210183398A CN114241093B CN 114241093 B CN114241093 B CN 114241093B CN 202210183398 A CN202210183398 A CN 202210183398A CN 114241093 B CN114241093 B CN 114241093B
- Authority
- CN
- China
- Prior art keywords
- photo
- typeset
- images
- page
- book
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 60
- 238000010606 normalization Methods 0.000 claims description 68
- 238000004364 calculation method Methods 0.000 claims description 7
- 150000001875 compounds Chemical class 0.000 claims description 4
- 238000005429 filling process Methods 0.000 abstract description 7
- 101100181033 Caenorhabditis elegans unc-116 gene Proteins 0.000 description 5
- 238000010586 diagram Methods 0.000 description 3
- 230000002349 favourable effect Effects 0.000 description 3
- 238000006467 substitution reaction Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 239000000203 mixture Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/60—Editing figures and text; Combining figures or text
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T3/4084—Scaling of whole images or parts thereof, e.g. expanding or contracting in the transform domain, e.g. fast Fourier transform [FFT] domain scaling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Geometry (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Processing Or Creating Images (AREA)
- Editing Of Facsimile Originals (AREA)
- Document Processing Apparatus (AREA)
Abstract
The invention provides a method and a system for automatically typesetting a photo book without shielding, which belong to the field of photo book typesetting and can be used for: randomly distributing photos to be typeset for each page of the photo book according to the page number of the photo book and all photos uploaded by a client; determining the integral layout of the photo image to be typeset on each page of the photo book; calculating the integral zoom coefficient of the photo image to be typeset of each page of the photo book; obtaining a target image to be typeset on each page of the photo book; and correspondingly typesetting each target image to be typeset on each page of the photo book based on the corresponding overall layout of each page of the photo book. The method can thoroughly solve the problem of shielding in the automatic filling process of the photo book with the template, reduce the degree of manual participation, keep the integral layout aesthetic feeling of the photo book, not destroy the proportion of photo images, and ensure the regularity of the integral layout of the photo book.
Description
Technical Field
The invention relates to the field of photo book typesetting, in particular to a method and a system for automatically typesetting a photo book without shielding, which are mainly applied to template removal to realize automatic typesetting of the photo book.
Background
In the automatic filling process of the photo book with the template, after the photo book template is selected, the size of each photo frame in the photo book is fixed, the photos uploaded by a client can be of various sizes, and the photos uploaded by the client and the photo frame template in the photo book are often shielded to some extent in the matching process, so that only part of contents of the photos uploaded by the client are often displayed. Particularly, if the blocked part is a face or other important information areas in the photo, the blocked part is a very bad purchasing experience for the customer, the impression of the photo book product in the customer is damaged, and the purchasing intention of the customer is reduced. For enterprises, a lot of after-sales orders are generated, and the production cost is increased.
In order to solve the problem that part of photo contents are easily blocked in the automatic filling process of a template photo book, two solutions are generally provided in the prior art, namely a manual intervention method and a non-manual intervention method.
The manual intervention method is a more common method, and specifically, in the process of generating the photo book, a user himself/herself checks whether the information about the key is blocked. However, this will increase the operation time of the client, make the client feel cumbersome to operate, and reduce the purchase will of the client.
The non-manual intervention method is to analyze the photo image, extract the key information in the photo and ensure the key information to be displayed in the photo frame as much as possible. However, when the photo book template frame is matched with the key information area in the photo, in order to match the photo book template frame, a part of the area of the significant information area is often blocked.
For example, in the patent of the invention with the publication number CN105718439B, the face area of a single face or a plurality of faces is determined by the face recognition technology, and the extracted face area is matched with the target area, so that the face area in the photo is as much as possible in the target area. The method can avoid the human face area from being shielded for the photos containing the human face, and key information of the photos except the human face, such as pets, scenery, food and the like, which do not contain the human face photos can be shielded.
For another example, in the patent invention with publication No. CN112070859B, a significant information area of a photo image is extracted through a neural network, and the significant information area is matched with a photo frame, so that the significant area of the photo image to be typeset is displayed in a photo book template photo frame. Although the method extracts the photo salient information areas such as people, pets, landscapes, gourmets and the like, the extracted salient information areas need to be matched with the photo frame of the photo book template, and partial areas of the photo salient information areas of the photo images can be shielded in order to match the photo frame of the photo book template.
For another example, patent application publication No. CN108961363A discloses a method for composing an electronic photo and an electronic photo book, which compares the difference between the aspect ratio of the template photo filling area and the aspect ratio of the photo, if the difference is smaller than a preset value, the filling is performed directly, otherwise, the aspect ratio of the template photo filling area is adjusted to the aspect ratio of the photo, and then the filling is performed, after the aspect ratio of the template photo filling area is adjusted according to the aspect ratio of the photo image, the layout of the photo frame in the photo book template is changed, so that the overall layout of the whole page of photo image may be damaged, which is expressed as a mode that the original layout is vertically or horizontally protruded by one area or recessed by one area, and the design of the template photo filling area is easily damaged.
Therefore, the invention provides an automatic typesetting method and an automatic typesetting system for an unshielded photo book, which are used for solving the problems.
Disclosure of Invention
In view of the above-mentioned deficiencies of the prior art, the present invention provides a method and a system for automatic typesetting of a photo book without occlusion, which are used for thoroughly solving the occlusion problem in the automatic filling process of a photo book with a template based on photos uploaded by a customer, reducing the degree of manual participation, maintaining the overall layout aesthetic feeling of the photo book, and ensuring the regularity of the overall layout of a single page without damaging the photo image proportion.
The invention provides an automatic typesetting method of an unshielded photo book, which comprises the following steps:
s1: randomly distributing photos to be typeset for each page of the photo book according to the page number of the photo book and all photos uploaded by a client; each page of the photo book mentioned in the photo book automatic typesetting method is a single open page, and the open page is processed by two times of single open pages;
s2: carrying out scale normalization processing on photos to be typeset on each page of the photo book aiming at each page of the photo book to obtain photo images to be typeset on each page of the photo book;
s3: determining the overall layout of the photo images to be typeset on each page of the photo book to obtain the overall layout corresponding to each page of the photo book;
s4: calculating an integral zoom factor of the photo image to be typeset on each page of the photo book based on the photo typesetting area for typesetting the photo on each page of the photo book and the integral layout corresponding to each page of the photo book;
s5: multiplying each photo image to be typeset on each page of the photo book by the corresponding integral scaling coefficient to obtain a target image to be typeset on each page of the photo book;
s6: and correspondingly typesetting each target image to be typeset on each page of the photo book based on the corresponding overall layout of each page of the photo book.
Further, the implementation method of step S2 includes:
for each page of the photo book:
if the number of the photos to be typeset on the current page is equal to 1, the photo images to be typeset corresponding to the photos to be typeset on the current page are the photos to be typeset;
if the number of the photos to be typeset on the current page is more than 1, calculating the area of each photo to be typeset on the current page, and finding out one with the smallest area as a reference image, then calculating the scale normalization factor of each photo except the reference image in the photo to be typeset on the current page, then utilizing the calculated scale normalization factor, carrying out scale normalization processing on each photo except the reference image in the photos to be typeset on the current page correspondingly to obtain a scale-normalized image of each photo except the reference image in the photos to be typeset on the current page, the reference image and the obtained image after the scale normalization of each photo except the reference image in the photos to be typeset on the current page are all the photo images to be typeset on the current page.
Further, the method calculates the scale normalization factor of each photo except the reference image in the photos to be typeset on the current page, and then performs the scale normalization processing on each photo except the reference image in the photos to be typeset on the current page by using the calculated scale normalization factor, wherein the calculation formula is as follows:
in the formula (I), the compound is shown in the specification,andrespectively the width and height of the reference image in the photo to be laid out on the current page,representing the second of all photos to be typeset on the current page except the reference imageThe number of pictures is one of the pictures,,represents the first mentionedThe scale normalization factor corresponding to each photo,andare respectively the firstThe width and height of a photograph are such that,andare respectively the firstThe picture is obtained after the scale normalizationAnd n is the total number of all the photos except the reference image in the photos to be typeset on the current page.
Further, the step S3 is implemented by executing the following steps for each page of the photo book:
when the number of the photo images to be typeset on the current page of the photo book is 1, the whole layout corresponding to the page of the photo book is the photo images to be typeset on the current page;
and when the number of the photo images to be typeset on the current page of the photo book is more than 1, determining the overall layout corresponding to the current page according to the number and the aspect ratio of the photo images to be typeset on the current page of the photo book.
Further, when the number of photo images to be laid out on the current page of the photo book is greater than 1, determining the overall layout corresponding to the current page according to the number and the aspect ratio of the photo images to be laid out on the current page of the photo book, specifically comprising:
if the number of the photo images to be typeset on the current page of the photo book is two, judging whether each photo image to be typeset on the current page of the photo book has a transverse length smaller than a longitudinal length according to the ratio of the width to the height of the photo image to be typeset:
if the horizontal length is smaller than the longitudinal length, the overall layout of the two photo images to be typeset on the current page of the photo book is arranged in the left and right directions, wherein the width of the overall layout is the sum of the widths of the two photo images to be typeset, and the height of the overall layout is the height of the highest image in the two photo images to be typeset;
otherwise, the overall layout of the two photo images to be typeset is arranged up and down, wherein the width of the overall layout is the width of the image with the largest width in the current two photo images to be typeset, and the height of the overall layout is the sum of the heights of the current two photo images to be typeset.
Further, when the number of photo images to be laid out on the current page of the photo book is greater than 1, determining the overall layout corresponding to the current page according to the number and the aspect ratio of the photo images to be laid out on the current page of the photo book, specifically comprising:
if the number of the photo images to be typeset in the current page of the photo book is three, judging whether the three photo images to be typeset are all in a state that the transverse length is larger than the longitudinal length according to the ratio of the width to the height of the three photo images to be typeset:
if the horizontal length of the three photo images to be typeset is greater than the longitudinal length, the overall layout of the three photo images to be typeset is arranged from top to bottom, wherein the width of the overall layout is the width of the image with the maximum width in the current three photo images to be typeset, and the height of the overall layout is the sum of the heights of the current three photo images to be typeset;
if only two images in the three photo images to be typeset have the transverse length larger than the longitudinal length, the overall layout of the three photo images to be typeset is arranged from top to bottom, and the specific implementation method comprises the following steps: firstly, vertically arranging two photo images to be typeset with the transverse length larger than the longitudinal length according to the vertically arranged overall layout, then taking a new arrangement obtained by vertically arranging the vertically arranged overall layout as a whole, marking the new arrangement as a first vertically arranged image, carrying out image scale normalization processing on the first vertically arranged image and the photo images to be typeset with the transverse length not larger than the longitudinal length in the three photo images to be typeset to obtain two-scale normalized images, and then carrying out overall layout on the two-scale normalized images according to the horizontally arranged overall layout form;
if only one of the three photo images to be typeset has a transverse length greater than a longitudinal length, the three photo images to be typeset are arranged in an upper left-right mode in the overall layout, and the specific implementation method comprises the following steps: firstly, arranging two photo images to be typeset with transverse lengths not larger than the longitudinal length left and right according to the integral arrangement form of the left and right arrangement, then marking the whole arrangement obtained by the left and right arrangement according to the integral arrangement form of the left and right arrangement as a first left and right arrangement image, then carrying out image scale normalization processing on the first left and right arrangement image and the photo images to be typeset with transverse lengths larger than the longitudinal length in the three photo images to be typeset to obtain two new images with normalized scales, and then carrying out integral layout on the two new images with normalized scales according to the integral arrangement form of the up and down arrangement;
if the horizontal length of the three photo images to be typeset is not more than the longitudinal length, the following steps are carried out:
(1) if the height-to-width ratios of the three photo images to be typeset are equal, the overall layout of the three photo images to be typeset is a 'pin' shape layout, wherein the width of the overall layout is the sum of the widths of two photo images to be typeset distributed in the same row in the three photo images to be typeset, and the height of the overall layout is the sum of the heights of any two photo images to be typeset distributed up and down in the three photo images to be typeset;
if the aspect ratios of the three photo images to be laid out are not all equal and the maximum value among the aspect ratios of the three photo images to be laid out is greater than a preset first threshold value T1, the overall layout of the three photo images to be laid out is arranged from left to right, under the condition, the width of the overall layout of the three photo images to be laid out is the sum of the widths of the three photo images to be laid out, and the height of the overall layout of the three photo images to be laid out is the maximum value of the heights of the three photo images to be laid out;
(2) in addition, in other cases, the images with the highest aspect ratio in the three photo images to be laid out are individually used as the first group, and the other two photo images to be laid out are used as the second group, and the overall layout is performed according to the overall layout form of the left-upper and lower arrangement.
Further, when the number of photo images to be laid out on the current page of the photo book is greater than 1, determining the overall layout corresponding to the current page according to the number and the aspect ratio of the photo images to be laid out on the current page of the photo book, specifically comprising:
if the number of the photo images to be typeset on the current page of the photo book is four, calculating the ratio of the width to the height of each photo image to be typeset and the ratio of the height to the width of each photo image to be typeset, finding out the maximum ratio from the calculated ratios, and determining the overall layout of the four photo images to be typeset according to the aspect ratio or the height-to-width ratio of the maximum ratio when the maximum ratio is greater than a set second threshold value T2, otherwise, arranging the overall layout of the four photo images to be typeset in two rows and two columns;
wherein, the determining the overall layout of the four photo images to be typeset according to whether the maximum ratio is the aspect ratio or the aspect ratio specifically comprises:
if the maximum ratio is the height-width ratio, the four photo images to be typeset are arranged from top to bottom, and the implementation method comprises the following steps: taking the other three images except the image with the largest aspect ratio in the four photo images to be typeset as a group, performing up-to-middle-down arrangement according to the overall layout form of the up-to-middle-down arrangement, then taking the arrangement obtained by performing up-to-middle-down arrangement according to the overall layout form of the up-to-middle-down arrangement as a whole, marking as a first up-to-middle-down arrangement image, then performing image scale normalization on the first up-to-middle-down arrangement image and the image with the largest aspect ratio to obtain two new scale-normalized images, and then performing overall layout on the two new scale-normalized images according to the overall layout form of the left-to-right arrangement;
if the maximum ratio is the aspect ratio, the four photo images to be typeset are arranged from top to bottom, and the implementation method comprises the following steps: taking the other three images except the image with the maximum aspect ratio in the four photo images to be typeset as a group, performing left-middle-right arrangement according to the left-middle-right arranged overall layout form, taking the arrangement obtained by performing left-middle-right arrangement according to the left-middle-right arranged overall layout form as a whole, marking as a first left-middle-right arranged image, performing image scale normalization on the first left-middle-right arranged image and the image with the maximum aspect ratio to obtain two new scale-normalized images, and performing overall layout on the two new scale-normalized images according to the up-and-down arranged overall layout form.
Further, when the number of photo images to be laid out on the current page of the photo book is greater than 1, determining the overall layout corresponding to the current page according to the number and the aspect ratio of the photo images to be laid out on the current page of the photo book, specifically comprising:
if the number of the photo images to be typeset on the current page of the photo book is more than four, the photo images to be typeset on the current page of the photo book are integrally laid out according to the form of m rows and k columns, wherein the number of the columns of the first m-1 rows of the integral layout is k, the number of the columns of the last row is k + (L-m multiplied by k), wherein,,and L is the total number of all photo images to be typeset on the current page of the photo book.
Further, the step S4 is implemented by executing the following steps for each page of the photo book:
s41, determining a photo layout area for layout of photos on the current page of the photo book;
s42, determining the width and height of an effective layout area on the photo layout area for laying out the photo images to be laid out on the current page of the photo book; if a space gap exists between adjacent typeset images of the photo book, the width and the height of the effective typesetting area are subtracted by the space gap between the adjacent typeset images according to the overall layout corresponding to the current page of the photo book; if no space gap exists between the adjacent typesetting images of the photo book, the effective typesetting area on the photo typesetting area for typesetting the photo images to be typeset on the current page of the photo book is the photo typesetting area, and the width and the height of the effective typesetting area are the width and the height of the photo typesetting area;
s43, calculating the width ratio and the height ratio of the whole layout corresponding to the current page of the photo book in the effective typesetting area;
and S44, comparing the width ratio and the height ratio of the calculated effective typesetting area and the overall layout corresponding to the current page of the photo book to obtain the minimum value, wherein the minimum value is the overall zoom factor of the photo image to be typeset on the current page of the photo book.
In a second aspect, the present invention provides an automatic typesetting system for an unobstructed photo book, comprising:
a first processing unit for randomly allocating photos to be typeset for each page of the photo book according to the page number of the photo book and all photos uploaded by a client; each page of the photo book mentioned in the photo book automatic typesetting method is a single open page, and the open page is processed by two times of single open pages;
the second processing unit is used for carrying out scale normalization processing on the photo to be typeset on each page of the photo book aiming at each page of the photo book to obtain the photo image to be typeset on each page of the photo book;
the third processing unit is used for determining the overall layout of the photo images to be typeset on each page of the photo book to obtain the overall layout corresponding to each page of the photo book;
the fourth processing unit is used for calculating the integral scaling coefficient of the photo image to be typeset of each page of the photo book based on the photo typesetting area used for typesetting the photo on each page of the photo book and the integral layout corresponding to each page of the photo book;
the fifth processing unit is used for multiplying each photo image to be typeset on each page of the photo book by the corresponding integral scaling coefficient to obtain a target image to be typeset on each page of the photo book;
and the sixth processing unit is used for correspondingly typesetting each target image to be typeset on each page of the photo book based on the integral layout corresponding to each page of the photo book.
The invention has the beneficial effects that:
the method and the system for automatically typesetting the photo book without the occlusion are favorable for thoroughly solving the occlusion problem in the automatic filling process of the photo book with the template, do not need manual intervention, are favorable for reducing the degree of manual participation, can keep the integral layout aesthetic feeling of the photo book, can automatically typeset and lay out the photos uploaded by a client on the basis of the photos uploaded by the client, and are favorable for thoroughly solving the occlusion problem in the automatic filling process of the photo book with the template under the conditions of not damaging the image proportion of the photos and keeping the integral layout of the photo book regular.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Drawings
In order to more clearly illustrate the embodiments or prior art solutions of the present invention, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic flow diagram of a method of one embodiment of the invention.
Fig. 2 is a schematic block diagram of a system according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
FIG. 1 is a schematic flow chart of a method for automatic typesetting of an unobstructed photobook according to one embodiment of the invention.
As shown in fig. 1, the automatic composition method of photo books includes the following steps S1 to S6.
Step S1: the photos to be laid out are randomly assigned to each page of the photo book based on the number of pages in the photo book and all photos uploaded by the customer.
In the field of photo books, the number of pages of a photo book is equal to the number of pages of a single open page of the photo book when the photo book is single open, and equal to the number of pages of a half open page of the photo book when the photo book is half open.
The minimum unit of the automatic typesetting processing of the invention is the single open page of the photo book, and the references of "each page" and "each page" in the specification refer to the single open page of the photo book, wherein when the photo book is a double open page, the double open page is processed in two times of single open pages, and the number of the photos distributed to each page of the photo book is at least one.
In the present embodiment, the implementation method of step S1 includes the following steps S11 and S12.
And step S11, randomly distributing the photos to be typeset for each photo book page of the photo book (wherein, when the photo book is a single page, each single page of the photo book is a photo book page, and when the photo book is a half page, each half page of the photo book is a photo book page).
Specifically, if the photo book is a single-page, photos to be laid out are randomly assigned to each single-page of the photo book, and the number of the photos to be laid out is at least 1 per page, and if the photo book is a half-page, photos to be laid out are assigned to each half-page of the photo book, and the number of the photos assigned to each half-page is at least 2.
Step S12, when the photo book is a folio, performing secondary division on the photos distributed on each folio, that is, counting each folio of the photo book by two single sheets, and then randomly distributing the photos distributed on each folio of the photo book to the corresponding two single sheets, wherein the number of the photos to be typeset distributed on each single sheet is at least 1.
In specific implementation, a person skilled in the art may set, in advance, a number range of photos that are allowed to be uploaded by a client for the photo book according to actual experience, and the number of photos uploaded by the client may be within the number range. When the photo book is a single page, the value of the minimum value of the number range of photos allowed to be uploaded by a client, which is set for the photo book in advance, is not less than the page number of the photo book; when the photo book is a split page, the minimum value of the number range of photos allowed to be uploaded by the client, which is set for the photo book in advance, is not less than twice the number of pages of the photo book.
It should be noted that, in the specific implementation, a person skilled in the art may also select any related technology in the prior art to implement step S1 according to the actual situation.
Step S2: and carrying out scale normalization processing on the photo to be typeset on each page of the photo book aiming at each page of the photo book to obtain the photo image to be typeset on each page of the photo book.
The method can avoid the problem of large size difference of layout images caused by different resolution orders of magnitude by carrying out scale normalization processing on the photos to be typeset in each page of the photo book.
Specifically, the implementation method of step S2 is:
for each page of the photo book, the following steps are performed:
if the number of the photos to be typeset on the current page is equal to 1, the photo images to be typeset corresponding to the photos to be typeset on the current page are the photos to be typeset;
if the number of the photos to be typeset on the current page is more than 1, calculating the area of each photo to be typeset on the current page, finding out one with the smallest area as a reference image, then calculating the scale normalization factor of each photo except the reference image in the photos to be typeset on the current page, then utilizing the calculated scale normalization factor to correspondingly perform scale normalization processing on each photo except the reference image in the photos to be typeset on the current page, obtaining the scale-normalized images of each photo except the reference image in the photos to be typeset on the current page, and obtaining the scale-normalized images of each photo except the reference image in the photos to be typeset on the current page, wherein the reference image and the obtained scale-normalized images of each photo except the reference image in the photos to be typeset on the current page, namely all the photo images to be typeset on the current page.
Calculating the scale normalization factor of each photo except the reference image in the photo to be typeset on the current page, and then performing scale normalization processing on each photo except the reference image in the photo to be typeset on the current page correspondingly by using the calculated scale normalization factor, wherein the calculation formula is as follows:
in the formula (I), the compound is shown in the specification,andrespectively the width and height of the reference image in the photo to be laid out on the current page,representing the second of all photos to be typeset on the current page except the reference imageThe number of pictures is one of the pictures,,represents the firstThe scale normalization factor corresponding to each photo,andare respectively the firstThe width and height of the picture,andare respectively the firstAnd the width and the height of the photo image to be typeset are obtained after the photos are subjected to scale normalization, n is the total number of all the photos except the reference image in the photos to be typeset on the current page, the value of n is more than or equal to 1, and n is an integer.
Taking the photo book Q as an example, it is assumed that the photo book Q has 16 single-open pages (if the photo book Q is a half-open page, the photo book Q has eight half-open pages, i.e. eight photo book pages), which are the first page, the second page, the.
Taking the first page as an example, assuming that the photo to be typeset distributed on the page is the photo a, the photo image to be typeset obtained after the photo to be typeset on the first page is subjected to scale normalization is the photo a itself (actually, the photo a is not subjected to scale normalization processing).
Taking the third page as an example, assuming that the photos to be laid out distributed on the page are photos C1, C2 and C3, for the third page, performing scale normalization on the photos C1, C2 and C3, and the steps are as follows:
the areas of the photograph C1, the photograph C2 and the photograph C3 are respectively calculated and recorded as、、;
FromFinding out a value with the minimum area, and taking a photo corresponding to the value as a reference image; suppose that、、The smallest of the intermediate areas isIf so, the following are correspondingly provided: photograph C1 is the reference image in the photograph to be laid out on the third page;
calculate the scale normalization factor for photograph C2 and photograph C3: assuming that the photos C2 and C3 are the 1 st photo and the 2 nd photo in the photos C1, C2 and C3 (i.e. the photos C2 and C3) except the reference image (i.e. the photo C1), the scale normalization factors of the photos C2 and C3 are respectively equal toAndwherein, in the step (A),
in the formulaAndin turn the width and height of photograph C1,andrespectively the width and height of the photograph C2,andwidth and height, respectively, of photograph C3;
using a calculated scale normalization factorCarrying out scale normalization processing on the picture C2 and utilizing the scale normalization factor obtained by calculationCarrying out scale normalization processing on the photo C3 to respectively obtain images after the scale normalization processing corresponding to the photo C2 and the photo C3, and sequentially marking as the photo C22 and the photo C33;
the photos C22 and C33 obtained above and the photos C1 obtained above are all the photo images to be laid out obtained after the size normalization processing is performed on the photos to be laid out on the third page.
Step S3: and determining the overall layout of the photo images to be typeset on each page of the photo book to obtain the overall layout corresponding to each page of the photo book.
Specifically, the step S3 is implemented by executing the following steps for each page of the photo book:
step S31, when the number of photo images to be typeset on the current page of the photo book is 1, the whole layout corresponding to the page of the photo book is the photo images to be typeset on the current page;
step S32, when the number of the photo images to be typeset on the current page of the photo book is more than 1, determining the whole layout corresponding to the current page according to the number and the aspect ratio of the photo images to be typeset on the current page of the photo book.
For example, still taking the first page as an example, if the photo image to be typeset on the page is only the photo a, the overall layout corresponding to the first page is the photo a itself.
For another example, taking the third page as an example, the images of the photos to be laid out on the third page include a photo C1, a photo C22 and a photo C33, and at this time, the number of the images to be laid out on the third page is greater than 1, and then the overall layout corresponding to the third page is determined according to the number of the photos C1, the photos C22 and the photos C33 and the image aspect ratios of the photos C1, the photos C22 and the photos C33.
Preferably, step S32 includes:
if the number of the photo images to be typeset on the current page of the photo book is two, judging whether each photo image to be typeset on the current page of the photo book has a transverse length smaller than a longitudinal length according to the ratio of the width to the height of the photo image to be typeset:
if the horizontal length is smaller than the longitudinal length, the overall layout of the two photo images to be typeset on the current page of the photo book is arranged in the left and right directions, wherein the width of the overall layout is the sum of the widths of the two photo images to be typeset, and the height of the overall layout is the height of the highest image in the two photo images to be typeset;
otherwise, the overall layout of the two photo images to be typeset is arranged up and down, wherein the width of the overall layout is the width of the image with the largest width in the current two photo images to be typeset, and the height of the overall layout is the sum of the heights of the current two photo images to be typeset.
Preferably, the step S32 further includes:
if the number of the photo images to be typeset in the current page of the photo book is three, judging whether the three photo images to be typeset are all in a state that the transverse length is larger than the longitudinal length according to the ratio of the width to the height of the three photo images to be typeset:
if the horizontal length of the three photo images to be typeset is larger than the longitudinal length, the overall layout of the three photo images to be typeset is arranged from top to bottom, wherein the width of the overall layout is the width of the image with the maximum width in the current three photo images to be typeset, and the height of the overall layout is the sum of the heights of the current three photo images to be typeset;
secondly, if only two images in the three photo images to be typeset have the transverse length larger than the longitudinal length, the overall layout of the three photo images to be typeset is arranged from top to bottom, and the specific implementation method comprises the following steps: firstly, vertically arranging two photo images to be typeset with the transverse length larger than the longitudinal length according to the vertically arranged overall layout, then taking a new arrangement obtained by vertically arranging the vertically arranged overall layout as a whole, marking the new arrangement as a first vertically arranged image, carrying out image scale normalization processing on the first vertically arranged image and the photo images to be typeset with the transverse length not larger than the longitudinal length in the three photo images to be typeset to obtain two-scale normalized images, and then carrying out overall layout on the two-scale normalized images according to the horizontally arranged overall layout form;
if only one of the three photo images to be typeset has a transverse length larger than a longitudinal length, the overall layout of the three photo images to be typeset is arranged from top to bottom, and the specific implementation method comprises the following steps: firstly, arranging two photo images to be typeset with transverse lengths not larger than the longitudinal length left and right according to the integral arrangement form of the left and right arrangement, then marking the whole arrangement obtained by the left and right arrangement according to the integral arrangement form of the left and right arrangement as a first left and right arrangement image, then carrying out image scale normalization processing on the first left and right arrangement image and the photo images to be typeset with transverse lengths larger than the longitudinal length in the three photo images to be typeset to obtain two new images with normalized scales, and then carrying out integral layout on the two new images with normalized scales according to the integral arrangement form of the up and down arrangement;
if the horizontal length of the three photo images to be typeset is not more than the longitudinal length, the following steps are carried out:
if the height-to-width ratios of the three photo images to be typeset are equal, the overall layout of the three photo images to be typeset is a 'pin' shape layout, wherein the width of the overall layout is the sum of the widths of two photo images to be typeset distributed in the same row in the three photo images to be typeset, and the height of the overall layout is the sum of the heights of any two photo images to be typeset distributed up and down in the three photo images to be typeset;
if the aspect ratios of the three photo images to be laid out are not all equal and the maximum value among the aspect ratios of the three photo images to be laid out is greater than a preset first threshold value T1, the overall layout of the three photo images to be laid out is arranged from left to right, under the condition, the width of the overall layout of the three photo images to be laid out is the sum of the widths of the three photo images to be laid out, and the height of the overall layout of the three photo images to be laid out is the maximum value of the heights of the three photo images to be laid out;
in other cases, the three photo images to be laid out are individually used as the first group, and the other two photo images to be laid out are used as the second group, and the overall layout is performed according to the overall layout form of the left-upper and lower arrangement.
Wherein, the two photo images to be typeset in the second group correspond to the two photo images to be typeset with the transverse length larger than the longitudinal length; the photo images to be typeset in the first group correspond to the photo images to be typeset, the transverse length of which is not more than the longitudinal length, in the three photo images to be typeset.
Preferably, the step S32 further includes:
if the number of the photo images to be typeset on the current page of the photo book is four, calculating the ratio of the width to the height of each photo image to be typeset (namely the width-height ratio) and the ratio of the height to the width of each photo image to be typeset (namely the height-width ratio), finding out the maximum ratio (namely the maximum ratio) from the calculated ratios, and determining the overall layout of the four photo images to be typeset according to the aspect ratio or the height-width ratio of the maximum ratio when the maximum ratio is greater than a set second threshold value T2, otherwise, arranging the overall layout of the four photo images to be typeset in two rows and two columns.
In the two-row and two-column arrangement, for two images in each row, according to the fact that the two images after arrangement are equal in height and the sum of the widths is the width of the photo book, and for each image in each row, the aspect ratio before arrangement and the aspect ratio after arrangement are equal, the width and the height of the two images after arrangement can be calculated, and therefore the overall width and the height of four images in a two-row and two-column layout can be obtained.
Preferably, the determining the overall layout of the four photo images to be typeset according to whether the maximum ratio is the aspect ratio or the aspect ratio specifically includes:
if the maximum ratio is the height-width ratio, the four photo images to be typeset are arranged from top to bottom, and the implementation method comprises the following steps: taking the other three images except the image with the largest aspect ratio in the four photo images to be typeset as a group, performing up-and-down arrangement according to the overall layout of the up-and-down arrangement, then taking the arrangement obtained by performing up-and-down arrangement according to the overall layout of the up-and-down arrangement as a whole, marking as a first up-and-down arrangement image, then performing image scale normalization on the first up-and-down arrangement image and the image with the largest aspect ratio to obtain two new scale-normalized images, and then performing overall layout on the two new scale-normalized images according to the overall layout form of the left-and-right arrangement;
if the maximum ratio is the aspect ratio, the four photo images to be typeset are arranged from top to bottom, and the implementation method comprises the following steps: taking the other three images except the image with the maximum aspect ratio in the four photo images to be typeset as a group, performing left-middle-right arrangement according to the left-middle-right arranged overall layout form, taking the arrangement obtained by performing left-middle-right arrangement according to the left-middle-right arranged overall layout form as a whole, marking as a first left-middle-right arranged image, performing image scale normalization processing on the first left-middle-right arranged image and the image with the maximum aspect ratio to obtain two new scale-normalized images, and performing overall layout on the two new scale-normalized images according to the up-down arranged overall layout form.
Correspondingly: under the condition of the above-mentioned overall layout of top-left, middle-bottom arrangement, the width of the overall layout of the photo images is the sum of the width of the image with the largest aspect ratio among the current four photo images to be typeset and the maximum of the widths of the rest three images among the current four photo images to be typeset, and the height is the maximum of the sum of the height of the image with the largest aspect ratio among the current four photo images to be typeset and the heights of the rest three images among the current four photo images to be typeset; in the case of the above-described overall layout in which the images are arranged in the upper left, middle right direction, the overall layout width of the photographic images is the maximum value of the sum of the widths of the images having the largest aspect ratios among the current four photographic images to be laid out and the widths of the remaining three images (i.e., all the images except the image having the largest aspect ratio among the current four photographic images to be laid out), and the overall layout height of the photographic images is the sum of the height of the image having the largest aspect ratio among the current four photographic images to be laid out and the height of the remaining three images among the current four photographic images to be laid out.
Preferably, the step S32 further includes:
if the number of the photo images to be typeset on the current page of the photo book is more than four, carrying out overall layout on all the photo images to be typeset on the current page of the photo book according to the form of m lines and k lines, wherein the number of the lines of the first m-1 lines of the overall layout is k, and most preferablyThe number of columns in the next row is k + (L-m × k), where,,and L is the total number of all photo images to be typeset (namely to be typeset) on the current page of the photo book.
For example, if L =5, then there is,At this time, the overall layout is 2 rows and 2 columns, wherein the first row lays out 2 images, and the second row lays out k + (L-m × k) =2+ (5-2 × 2) =3 images.
It should be noted that the first threshold T1 is an empirical value tested by those skilled in the art according to the effect of the permutation, and the second threshold T2 is an empirical value tested by those skilled in the art according to the effect of the permutation. In this embodiment, T1=1.5 and T2= 2.5.
Step S4: and calculating the integral zoom factor of the photo image to be typeset on each page of the photo book based on the photo typesetting area for typesetting the photo on each page of the photo book and the integral layout corresponding to each page of the photo book.
In the art of photo books, a photo layout area for laying out a photo on each page of the photo book is determined by those skilled in the art according to the size and outer boundary of the page of the photo book.
The implementation method of step S4 is to execute the following steps for each page of the photo book:
s41, determining a photo layout area for layout of photos on the current page of the photo book;
s42, determining the width and height of the effective typesetting area for typesetting the photo images to be typeset on the current page of the photo book in the photo typesetting area; if a space gap exists between adjacent typeset images of the photo book, the width and the height of the effective typesetting area are subtracted by the space gap between the adjacent typeset images according to the overall layout corresponding to the current page of the photo book; if no space gap exists between the adjacent typesetting images of the photo book, the effective typesetting area on the photo typesetting area for typesetting the photo images to be typeset on the current page of the photo book is the photo typesetting area, and the width and the height of the effective typesetting area are the width and the height of the photo typesetting area;
s43, calculating the width ratio and the height ratio of the whole layout corresponding to the current page of the photo book in the effective typesetting area;
and S44, comparing the width ratio and the height ratio of the calculated effective typesetting area and the overall layout corresponding to the current page of the photo book to obtain the minimum value, wherein the minimum value is the overall zoom factor of the photo image to be typeset on the current page of the photo book.
It should be noted that, the existence of the space gap between the adjacent layout images of the photo book can be set by those skilled in the art according to the actual needs, and is generally set as the same parameter. The setting of the space gap between the adjacent layout images of the photo book is irrelevant to the user and belongs to the setting of the photo book.
In this specification, when a space gap exists between the laid-out images adjacent to each other in the photo book, the width of the space gap between the laid-out images adjacent to each other in the photo book layout is set to the same parameter value. In a specific implementation, the same parameter may be used to represent a spatial gap between adjacent laid-out images of the photo book, and when the value of the parameter is set to 0, the parameter represents that no spatial gap exists between adjacent laid-out images of the photo book, and when the value of the parameter is set to a value greater than 0, the parameter represents that a spatial gap exists between adjacent laid-out images of the photo book.
Wherein, let σ represent the width of the space gap between the adjacent layout images of the photo book, when σ is greater than 0, there are for each page of the photo book: the width of the effective typesetting area on the current page of the photo book is equal to the width of the photo typesetting area on the current page of the photo book, and the sum of the widths of the space gaps correspondingly existing in the direction of the width of the overall layout corresponding to the current page of the photo book is subtracted; the height of the effective typesetting area on the current page of the photo book is equal to the height of the photo typesetting area on the current page of the photo book, and the sum of the widths of the space gaps correspondingly existing in the direction of the height of the overall layout corresponding to the current page of the photo book is subtracted.
For example, taking the first page as an example, the photo to be laid out distributed on the page is photo a, the photo image to be laid out on the page is photo a itself, only one photo image to be laid out on the current page of the photo book is to be laid out, the overall layout form of the photo a on the first page is photo a itself, there is no space gap, the photo layout area for laying out the photo on the first page is recorded as a first photo layout area, the width and height of the first photo layout area are respectively Kw1 and Kh1, the width and height of the photo a are KwA and KhA respectively, the effective layout area for laying out the photo a on the first photo layout area is a first effective layout area, the first effective layout area is the first photo layout area itself, the ratio of the width of the first effective layout area to the width of the photo a is Kw1/KwA, the ratio of the height of the first effective typesetting area to the height of the photo A is Kh1/KhA, and the smallest one of Kw1/KwA and Kh1/KhA is the overall zoom factor of the photo A to be typeset on the first page.
For another example, taking the third page as an example, the photo images to be laid out on the third page are photos C1, C22 and C33, it is noted that the width and height of the photos C1 are KwC1 and KhC1, the width and height of the photos C22 are KwC22 and KhC22, and the width and height of the photos C33 are KwC33 and KhC33, respectively, and it is assumed that the overall layout corresponding to the third page is top-middle-bottom arrangement, σ>0, and assuming that the photograph C1, the photograph C22 and the photograph C33 are laid out in this order from top to bottom, there is a width of between the photograph C1 and the photograph C22Is empty ofAn interval of width between photograph C22 and photograph C33Assuming that the photo layout area on the third page is the second photo layout area, the width and height of the second photo layout area are respectively Kw2 and Kh2, and the effective layout area for laying out the photos C1, C22 and C33 on the second photo layout area is the second effective layout area, the width of the second effective layout area is equal to the width Kw2 of the second photo layout area, the height of the second effective layout area is equal to the height of the second photo layout area minus the width of the space gap between the photos C1 and C22 minus the width of the space gap between the photos C22 and C33, i.e. equal to Kh2- σ - σ, correspondingly, the ratio of the width of the second effective layout area to the whole layout area is Kw/max (6866, KwC22, KwC33), the ratio of the height of the second effective layout area to the whole layout area is (Kh)/(2-KhC 1+ KhC33), the smallest value of Kw2/max (KwC1, KwC22, KwC33) and (Kh 2-sigma)/(KhC 1+ KhC22+ KhC33) is the overall scaling factor of the photos C1, C22 and C33 to be laid out on the third page. For another example, assume that the overall layout corresponding to the third page is replaced by a "piny" layout from "top to bottom arranged" and that the photo C1 is located above the photos C22 and C33 and the photos C22 and C33 are in a "piny" layout (which can be specifically set by those skilled in the art according to actual situations), and the width between the photos C1 and C22 is as wide asThe space between the photograph C1 and the photograph C33 has a width ofThe space between the photographs C22 and C33 isThe space gap of (a) is then:
between the photograph C1 and the photograph C22,The width between the photographs C1 and C33 and between the photographs C22 and C33 isCorrespondingly, the ratio of the width of the second effective layout region to the overall layout region becomes (Kw2- σ)/(KwC22+ KwC33), and the ratio of the height of the second effective layout region to the overall layout region becomes (Kh2- σ)/(KhC1+ KhC22), (Kw2- σ)/(KwC22+ KwC33) and (Kh2- σ)/(KhC1+ KhC22), which have the smallest values, is the overall scaling coefficient of the photos C1, C22, and C33 to be laid out by the third page.
Step S5: and multiplying each photo image to be typeset on each page of the photo book by the corresponding integral scaling coefficient to obtain the target image to be typeset on each page of the photo book.
In the specific implementation, each photo image to be typeset on the photo book is multiplied by the whole scaling factor corresponding to the page on which the photo image is positioned respectively aiming at each page of the photo book, and the target image to be typeset corresponding to each photo image to be typeset on the photo book is obtained.
For example, also taking the third page as an example, assume that the overall zoom factor of the photos C1, C22 and C33 to be laid out on the page is as followsStill, the width and height of photograph C1 were KwC1 and KhC1, respectively, the width and height of photograph C22 were KwC22 and KhC22, respectively, and the width and height of photograph C33 were KwC33 and KhC33, respectively, then photograph C1 was scaled for this third pageZoom in and zoom out of photograph C22Zoom in and zoom out on photograph C33And obtaining target images to be typeset corresponding to the photos C1, C22 and C33 in sequence, wherein the target images to be typeset are all the target images to be typeset on the third page.
Step S6: and correspondingly typesetting each target image to be typeset on each page of the photo book based on the corresponding overall layout of each page of the photo book.
Specifically, the implementation method of step S6 is to perform the following steps for each page of the photo book:
acquiring the central point of a photo typesetting area on the current page of the photo book;
calculating the typesetting position of each target image to be typeset on the current page of the photo book based on the overall layout corresponding to the current page of the photo book;
and correspondingly typesetting each target image to be typeset on the current page of the photo book according to the typesetting position obtained by calculation.
In this embodiment, the calculation of the layout position adopts a centering principle.
If a space gap exists between adjacent typeset images of the photo book, when the typesetting position of the target image to be typeset is calculated, the position of the space gap corresponding to each adjacent image in the target image to be typeset on each page of the photo book is added to each adjacent image according to the corresponding overall layout of each page of the photo book.
Correspondingly, when a space gap exists between the adjacent typesetting images of the photo book, the corresponding space gap exists between the calculated typesetting positions of the corresponding images. For example, the width between the photograph C1 and the photograph C22 is as wide asFor example, the calculated layout positions of the target image to be laid out corresponding to the photograph C1 and the photograph C22 on the third page also have a width ofThe spatial gap of (a).
FIG. 2 is a diagram illustrating an embodiment of an automatic typesetting system for an unobstructed photobook according to the present invention.
As shown in fig. 2, the automatic composition system 100 for photo books includes:
a first processing unit 101 for randomly assigning a photo to be laid out to each page of the photo book based on the number of pages of the photo book and all photos uploaded by the customer; each page of the photo book mentioned in the automatic typesetting method of the photo book refers to a single open page, and the open pages are processed by two times of single open pages;
the second processing unit 102 is configured to perform scale normalization processing on the photo to be typeset on each page of the photo book, so as to obtain a photo image to be typeset on each page of the photo book;
a third processing unit 103, configured to determine an overall layout of the photo images to be typeset on each page of the photo book, so as to obtain an overall layout corresponding to each page of the photo book;
a fourth processing unit 104, configured to calculate an overall scaling factor of the photo image to be typeset for each page of the photo book to be typeset based on the photo typesetting area for typesetting the photo on each page of the photo book and the overall layout corresponding to each page of the photo book;
a fifth processing unit 105, configured to multiply each photo image to be typeset on each page of the photo book by the corresponding overall scaling factor to obtain a target image to be typeset on each page of the photo book;
the sixth processing unit 106 is configured to correspondingly lay out each target image to be laid out on each page of the photo book based on the corresponding overall layout of each page of the photo book.
It should be noted that the same or similar parts in the embodiments of the present specification may be referred to each other.
The scale normalization related in the invention is the normalization of the photo images on the scale, and is not the normalization of the two-dimensional images on the numerical value, thereby being beneficial to ensuring the uniformity of the photos to be typeset on each page of the photo book on the scale and avoiding the situations of very large photos and very small photos during typesetting and layout.
The method and the device for typesetting and laying the photos uploaded by the clients are based on the photos uploaded by the clients, so that the proportion of photo images is not damaged, the integral layout of the photo book is kept regular, the problem of shielding in the automatic filling process of the photo book with the template is thoroughly solved, the manual participation degree is reduced, and the integral layout aesthetic feeling of the photo book is ensured to a certain extent.
Although the present invention has been described in detail by referring to the drawings in connection with the preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made on the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and these modifications or substitutions should be within the scope of the present invention/any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present disclosure and the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (7)
1. An automatic typesetting method of a photo book without shielding is characterized by comprising the following steps:
s1: randomly distributing photos to be typeset for each page of the photo book according to the page number of the photo book and all photos uploaded by a client; each page of the photo book mentioned in the photo book automatic typesetting method is a single open page, and the open page is processed by two times of single open pages;
s2: carrying out scale normalization processing on the photo to be typeset on each page of the photo book aiming at each page of the photo book to obtain the photo image to be typeset on each page of the photo book;
s3: determining the overall layout of the photo images to be typeset on each page of the photo book to obtain the overall layout corresponding to each page of the photo book;
s4: calculating an integral zoom factor of the photo image to be typeset on each page of the photo book based on the photo typesetting area for typesetting the photo on each page of the photo book and the integral layout corresponding to each page of the photo book;
s5: multiplying each photo image to be typeset on each page of the photo book by the corresponding integral scaling coefficient to obtain a target image to be typeset on each page of the photo book;
s6: correspondingly typesetting each target image to be typeset on each page of the photo book based on the corresponding overall layout of each page of the photo book;
the implementation method of step S4 is to execute the following steps for each page of the photo book:
s41, determining a photo layout area for layout of photos on the current page of the photo book;
s42, determining the width and height of an effective layout area on the photo layout area for laying out the photo images to be laid out on the current page of the photo book; if a space gap exists between adjacent typeset images of the photo book, the width and the height of the effective typesetting area are subtracted by the space gap between the adjacent typeset images according to the overall layout corresponding to the current page of the photo book; if no space gap exists between the adjacent typesetting images of the photo book, the effective typesetting area on the photo typesetting area for typesetting the photo images to be typeset on the current page of the photo book is the photo typesetting area, and the width and the height of the effective typesetting area are the width and the height of the photo typesetting area;
s43, calculating the width ratio and the height ratio of the whole layout corresponding to the current page of the photo book in the effective typesetting area;
s44, comparing the width ratio and the height ratio of the calculated effective typesetting area and the overall layout corresponding to the current page of the photo book to obtain the minimum value, wherein the minimum value is the overall zoom coefficient of the photo image to be typeset on the current page of the photo book;
the implementation method of step S2 includes:
for each page of the photo book:
if the number of the photos to be typeset on the current page is equal to 1, the photo images to be typeset corresponding to the photos to be typeset on the current page are the photos to be typeset;
if the number of the photos to be typeset on the current page is more than 1, calculating the area of each photo to be typeset on the current page, and finding out one with the smallest area as a reference image, then calculating the scale normalization factor of each photo except the reference image in the photo to be typeset on the current page, then utilizing the calculated scale normalization factor, carrying out scale normalization processing on each photo except the reference image in the photos to be typeset on the current page correspondingly to obtain a scale-normalized image of each photo except the reference image in the photos to be typeset on the current page, the reference image and the obtained image after the scale normalization of each photo except the reference image in the photos to be typeset on the current page are all the photo images to be typeset on the current page;
calculating the scale normalization factor of each photo except the reference image in the photo to be typeset on the current page, and then performing scale normalization processing on each photo except the reference image in the photo to be typeset on the current page by using the calculated scale normalization factor, wherein the calculation formula is as follows:
in the formula (I), the compound is shown in the specification,andrespectively the photos to be typeset on the current pageThe width and height of the reference image in the patch,representing the second of all photos to be typeset on the current page except the reference imageThe number of pictures is one of the pictures,,represents the firstThe scale normalization factor corresponding to each photo,andare respectively the firstThe width and height of the picture,andare respectively the firstThe width and height of the photo image to be typeset obtained after the photos are subjected to scale normalization, n is the width and height of the photo image to be typeset except the reference image in the photo to be typeset on the current pageThe total number of all his photographs.
2. The automatic typesetting method for the unobstructed photobook according to claim 1, wherein the step S3 is implemented by executing the following steps for each page of the photobook respectively:
when the number of the photo images to be typeset on the current page of the photo book is 1, the corresponding overall layout of the page of the photo book is the photo images to be typeset on the current page;
and when the number of the photo images to be typeset on the current page of the photo book is more than 1, determining the overall layout corresponding to the current page according to the number and the aspect ratio of the photo images to be typeset on the current page of the photo book.
3. The method according to claim 2, wherein when the number of the photo images to be laid out on the current page of the photo book is greater than 1, the method determines the overall layout corresponding to the current page according to the number and aspect ratio of the photo images to be laid out on the current page of the photo book, and specifically comprises:
if the number of the photo images to be typeset in the current page of the photo book is two, judging whether each photo image to be typeset in the current page of the photo book is to be typeset, wherein the transverse length is smaller than the longitudinal length according to the ratio of the width to the height of the photo image to be typeset:
if the horizontal length is smaller than the longitudinal length, the overall layout of the two photo images to be typeset on the current page of the photo book is arranged in the left and right directions, wherein the width of the overall layout is the sum of the widths of the two photo images to be typeset, and the height of the overall layout is the height of the highest image in the two photo images to be typeset;
otherwise, the overall layout of the two photo images to be typeset is arranged up and down, wherein the width of the overall layout is the width of the image with the largest width in the current two photo images to be typeset, and the height of the overall layout is the sum of the heights of the current two photo images to be typeset.
4. The method according to claim 3, wherein when the number of photo images to be laid out on the current page of the photo book is greater than 1, the method determines the overall layout corresponding to the current page according to the number and aspect ratio of the photo images to be laid out on the current page of the photo book, and further comprises:
if the number of the photo images to be typeset in the current page of the photo book is three, judging whether the three photo images to be typeset are all in a state that the transverse length is larger than the longitudinal length according to the ratio of the width to the height of the three photo images to be typeset:
if the horizontal length of the three photo images to be typeset is greater than the longitudinal length, the overall layout of the three photo images to be typeset is arranged from top to bottom, wherein the width of the overall layout is the width of the image with the maximum width in the current three photo images to be typeset, and the height of the overall layout is the sum of the heights of the current three photo images to be typeset;
if only two images of the three photo images to be typeset have the transverse length larger than the longitudinal length, the overall layout of the three photo images to be typeset is arranged from top to bottom, and the specific implementation method comprises the following steps: firstly, vertically arranging two photo images to be typeset with the transverse length larger than the longitudinal length according to the vertically arranged overall layout, then taking a new arrangement obtained by vertically arranging the vertically arranged overall layout as a whole, marking the new arrangement as a first vertically arranged image, carrying out image scale normalization processing on the first vertically arranged image and the photo images to be typeset with the transverse length not larger than the longitudinal length in the three photo images to be typeset to obtain two-scale normalized images, and then carrying out overall layout on the two-scale normalized images according to the horizontally arranged overall layout form;
if only one of the three photo images to be typeset has a transverse length larger than a longitudinal length, the overall layout of the three photo images to be typeset is arranged from top to bottom, and the specific implementation method comprises the following steps: firstly, arranging two photo images to be typeset with transverse lengths not larger than the longitudinal length left and right according to the integral arrangement form of the left and right arrangement, then marking the whole arrangement obtained by the left and right arrangement according to the integral arrangement form of the left and right arrangement as a first left and right arrangement image, then carrying out image scale normalization processing on the first left and right arrangement image and the photo images to be typeset with transverse lengths larger than the longitudinal length in the three photo images to be typeset to obtain two new images with normalized scales, and then carrying out integral layout on the two new images with normalized scales according to the integral arrangement form of the up and down arrangement;
if the horizontal length of the three photo images to be typeset is not more than the longitudinal length, the following steps are carried out:
(1) if the height-to-width ratios of the three photo images to be typeset are equal, the overall layout of the three photo images to be typeset is a 'pin' shape layout, wherein the width of the overall layout is the sum of the widths of two photo images to be typeset distributed in the same row in the three photo images to be typeset, and the height of the overall layout is the sum of the heights of any two photo images to be typeset distributed up and down in the three photo images to be typeset;
if the aspect ratios of the three photo images to be laid out are not all equal and the maximum value among the aspect ratios of the three photo images to be laid out is greater than a preset first threshold value T1, the overall layout of the three photo images to be laid out is left-middle-right arrangement, in which case the width of the overall layout of the three photo images to be laid out is the sum of the widths of the three photo images and the height is the maximum value of the heights of the three photo images to be laid out;
(2) in addition, in other cases, the images with the highest aspect ratio in the three photo images to be laid out are individually used as the first group, and the other two photo images to be laid out are used as the second group, and the overall layout is performed according to the overall layout form of the left-upper and lower arrangement.
5. The method according to claim 4, wherein when the number of photo images to be laid out on the current page of the photo book is greater than 1, the method determines the overall layout corresponding to the current page according to the number and aspect ratio of the photo images to be laid out on the current page of the photo book, and further comprises:
if the number of the photo images to be typeset on the current page of the photo book is four, calculating the ratio of the width to the height of each photo image to be typeset and the ratio of the height to the width of each photo image to be typeset, finding out the maximum ratio from the calculated ratios, and determining the overall layout of the four photo images to be typeset according to the aspect ratio or the height-to-width ratio of the maximum ratio when the maximum ratio is greater than a set second threshold value T2, otherwise, arranging the overall layout of the four photo images to be typeset in two rows and two columns;
wherein, the determining the overall layout of the four photo images to be typeset according to whether the maximum ratio is the aspect ratio or the aspect ratio specifically comprises:
if the maximum ratio is the height-width ratio, the four photo images to be typeset are arranged from top to bottom, and the implementation method comprises the following steps: taking the other three images except the image with the largest aspect ratio in the four photo images to be typeset as a group, performing up-down arrangement according to the up-down arrangement overall layout form, then taking the arrangement obtained by performing up-down arrangement according to the up-down arrangement overall layout form as a whole, marking as a first up-down arrangement image, then performing image scale normalization processing on the first up-down arrangement image and the image with the largest aspect ratio to obtain two new scale normalized images, and then performing overall layout on the two new scale normalized images according to the left-right arrangement overall layout form;
if the maximum ratio is the aspect ratio, the four photo images to be typeset are arranged from top to bottom, and the implementation method comprises the following steps: taking the other three images except the image with the maximum aspect ratio in the four photo images to be typeset as a group, performing left-middle-right arrangement according to the left-middle-right arranged overall layout form, taking the arrangement obtained by performing left-middle-right arrangement according to the left-middle-right arranged overall layout form as a whole, marking as a first left-middle-right arranged image, performing image scale normalization processing on the first left-middle-right arranged image and the image with the maximum aspect ratio to obtain two new scale-normalized images, and performing overall layout on the two new scale-normalized images according to the up-down arranged overall layout form.
6. The method according to claim 5, wherein when the number of photo images to be laid out on the current page of the photo book is greater than 1, the method determines the overall layout corresponding to the current page according to the number and aspect ratio of the photo images to be laid out on the current page of the photo book, and further comprises:
if the number of the photo images to be typeset on the current page of the photo book is more than four, the photo images to be typeset on the current page of the photo book are integrally laid out according to the form of m rows and k columns, wherein the number of the columns of the first m-1 rows of the integral layout is k, the number of the columns of the last row is k + (L-m multiplied by k), wherein,,and L is the total number of all photo images to be typeset on the current page of the photo book.
7. An automatic typesetting system for an unshielded photo book, comprising:
a first processing unit for randomly distributing the photos to be typeset for each page of the photo book according to the page number of the photo book and all the photos uploaded by the client; each page of the photo book mentioned in the photo book automatic typesetting system is a single open page, and the open pages are processed by two times of single open pages;
the second processing unit is used for carrying out scale normalization processing on the photo to be typeset on each page of the photo book aiming at each page of the photo book to obtain the photo image to be typeset on each page of the photo book;
the third processing unit is used for determining the overall layout of the photo images to be typeset on each page of the photo book to obtain the overall layout corresponding to each page of the photo book;
the fourth processing unit is used for calculating the integral scaling coefficient of the photo image to be typeset of each page of the photo book based on the photo typesetting area used for typesetting the photo on each page of the photo book and the integral layout corresponding to each page of the photo book;
the fifth processing unit is used for multiplying each photo image to be typeset on each page of the photo book by the corresponding integral scaling coefficient to obtain a target image to be typeset on each page of the photo book;
a sixth processing unit, configured to type out each target image to be type-set on each page of the photo book correspondingly based on the overall layout corresponding to each page of the photo book;
the method for calculating the integral zoom factor of the photo image to be typeset on each page of the photo book based on the photo typesetting area for typesetting the photo on each page of the photo book and the integral layout corresponding to each page of the photo book comprises the following steps of:
s41, determining a photo layout area for layout of photos on the current page of the photo book;
s42, determining the width and height of an effective layout area on the photo layout area for laying out the photo images to be laid out on the current page of the photo book; if a space gap exists between adjacent typeset images of the photo book, the width and the height of the effective typesetting area are subtracted by the space gap between the adjacent typeset images according to the overall layout corresponding to the current page of the photo book; if no space gap exists between the adjacent typesetting images of the photo book, the effective typesetting area on the photo typesetting area for typesetting the photo images to be typeset on the current page of the photo book is the photo typesetting area, and the width and the height of the effective typesetting area are the width and the height of the photo typesetting area;
s43, calculating the width ratio and the height ratio of the whole layout corresponding to the current page of the photo book in the effective typesetting area;
s44, comparing the width ratio and the height ratio of the calculated effective typesetting area and the overall layout corresponding to the current page of the photo book to obtain the minimum value, wherein the minimum value is the overall zoom coefficient of the photo image to be typeset on the current page of the photo book;
the second processing unit is used for carrying out scale normalization processing on the photo to be typeset on each page of the photo book aiming at each page of the photo book to obtain the photo image to be typeset on each page of the photo book, and the implementation method comprises the following steps:
for each page of the photo book:
if the number of the photos to be typeset on the current page is equal to 1, the photo images to be typeset corresponding to the photos to be typeset on the current page are the photos to be typeset;
if the number of the photos to be typeset on the current page is more than 1, calculating the area of each photo to be typeset on the current page, and finding out one with the smallest area as a reference image, then calculating the scale normalization factor of each photo except the reference image in the photo to be typeset on the current page, then utilizing the calculated scale normalization factor, carrying out scale normalization processing on each photo except the reference image in the photos to be typeset on the current page correspondingly to obtain a scale-normalized image of each photo except the reference image in the photos to be typeset on the current page, the reference image and the obtained image after the scale normalization of each photo except the reference image in the photos to be typeset on the current page are all the photo images to be typeset on the current page;
calculating the scale normalization factor of each photo except the reference image in the photo to be typeset on the current page, and then performing scale normalization processing on each photo except the reference image in the photo to be typeset on the current page by using the calculated scale normalization factor, wherein the calculation formula is as follows:
in the formula (I), the compound is shown in the specification,andrespectively the width and height of the reference image in the photo to be laid out on the current page,representing the second of all photos to be typeset on the current page except the reference imageThe number of pictures is one of the pictures,,represents the firstThe scale normalization factor corresponding to each photo,andare respectively the firstThe width and height of the picture,andare respectively the firstAnd the width and the height of the photo image to be typeset are obtained after the photos are subjected to scale normalization, and n is the total number of all the photos except the reference image in the photos to be typeset on the current page.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210183398.1A CN114241093B (en) | 2022-02-28 | 2022-02-28 | Method and system for automatically typesetting photo book without shielding |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210183398.1A CN114241093B (en) | 2022-02-28 | 2022-02-28 | Method and system for automatically typesetting photo book without shielding |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114241093A CN114241093A (en) | 2022-03-25 |
CN114241093B true CN114241093B (en) | 2022-06-17 |
Family
ID=80748313
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210183398.1A Active CN114241093B (en) | 2022-02-28 | 2022-02-28 | Method and system for automatically typesetting photo book without shielding |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114241093B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104021112A (en) * | 2014-06-23 | 2014-09-03 | 时代新媒体出版社有限责任公司 | One-key book-forming system based on automatic typesetting |
CN108961363A (en) * | 2018-06-11 | 2018-12-07 | 天意有福科技股份有限公司 | A kind of composition method of electronic photo and electronic photo book |
Family Cites Families (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1886484B1 (en) * | 2005-05-30 | 2020-01-01 | FUJIFILM Corporation | Album creating apparatus, album creating method and program |
CN100578489C (en) * | 2006-12-15 | 2010-01-06 | 北京北大方正电子有限公司 | Method for layout of formula |
JP4956494B2 (en) * | 2008-06-30 | 2012-06-20 | 日本写真印刷株式会社 | Automatic typesetting system |
TWI453658B (en) * | 2011-02-25 | 2014-09-21 | Esobi Inc | A dynamic composing method for displayed screen |
US10664695B2 (en) * | 2016-10-26 | 2020-05-26 | Myscript | System and method for managing digital ink typesetting |
JP2019115013A (en) * | 2017-12-26 | 2019-07-11 | シャープ株式会社 | Preview display device, multifunction machine, and preview display method |
CN111626036B (en) * | 2020-05-27 | 2021-04-30 | 南京蓝鲸人网络科技有限公司 | Image-text typesetting processing method |
CN111708905B (en) * | 2020-06-23 | 2023-09-15 | 河源源丰电子有限公司 | Automatic typesetting method for electronic album |
CN112749538B (en) * | 2021-01-21 | 2022-08-12 | 厦门神州鹰软件科技有限公司 | Intelligent typesetting method and terminal |
-
2022
- 2022-02-28 CN CN202210183398.1A patent/CN114241093B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104021112A (en) * | 2014-06-23 | 2014-09-03 | 时代新媒体出版社有限责任公司 | One-key book-forming system based on automatic typesetting |
CN108961363A (en) * | 2018-06-11 | 2018-12-07 | 天意有福科技股份有限公司 | A kind of composition method of electronic photo and electronic photo book |
Also Published As
Publication number | Publication date |
---|---|
CN114241093A (en) | 2022-03-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4087475B2 (en) | Automatic cropping method for images | |
US8717632B2 (en) | Image processing method, image processing device and scanner | |
CN105450900B (en) | Distortion correction method and equipment for file and picture | |
RU2368006C1 (en) | Method and system for adaptive reformatting of digital images | |
CN104735465B (en) | The method and device of plane pattern advertisement is implanted into video pictures | |
US20060245666A1 (en) | Method and system for digital image enhancement | |
US10013784B2 (en) | Generating an assembled group image from subject images | |
EP1618739A1 (en) | Adjusting the brightness of a digital image | |
IL193428A (en) | Model-based dewarping method and apparatus | |
CN113055615B (en) | Conference all-in-one machine, screen segmentation display method and storage device | |
CN109191377A (en) | A kind of image magnification method based on interpolation | |
EP2765555B1 (en) | Image evaluation device, image selection device, image evaluation method, recording medium, and program | |
CN114241093B (en) | Method and system for automatically typesetting photo book without shielding | |
US20070286522A1 (en) | Method for sharpness enhancing an image | |
JP2001087229A5 (en) | ||
DE112013004718T5 (en) | Image processing apparatus and method, and program, printer and display apparatus | |
CN112070708A (en) | Image processing method, image processing apparatus, electronic device, and storage medium | |
US10573045B2 (en) | Generating an assembled group image from subject images | |
CN108920528B (en) | Convolutional neural network-oriented space-time geographic dynamic attribute vectorization method and system | |
KR101513931B1 (en) | Auto-correction method of composition and image apparatus with the same technique | |
KR101315464B1 (en) | Image processing method | |
CN106127744B (en) | Display foreground and background border Salience estimation and system | |
EP3531374A1 (en) | Method and device for acquiring target object, and robot | |
JP2005050051A (en) | Layout system, program, and method | |
JP2009217606A (en) | Method and program for generating line drawing for coloring picture |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |