Invention content
The embodiment of the present invention is designed to provide a kind of patterning process, device, electronic equipment and storage medium, to solve
User needs to be patterned the problem so that cumbersome manually.Specific technical solution is as follows:
In a first aspect, an embodiment of the present invention provides a kind of patterning process, the method includes:
Obtain target image;
Determine at least one object included in the target image;
From identified at least one object, main object is determined;
Using position of the main object in the target image as the body position in preset composition principle, and
Processing is patterned to the target image according to preset composition principle.
Optionally, described from identified at least one object, the determining main object, including:
The object for whether including preset kind at least one object determined by judging, if identified at least one right
The object of preset kind in determined object is determined as main object by the object as including preset kind;Alternatively,
The maximum object of region area in identified at least one object is determined as main object;Alternatively,
According to the instruction for carrying out Object Selection from identified at least one object, and by pair specified by described instruction
As being determined as main object;Alternatively,
Will in identified at least one object positioned at the target image predeterminable area object determine based on it is right
As;Alternatively,
The region area of each object accounts for the ratio of the target image in object determined by obtaining, and is more than in advance from ratio
If proportion threshold value object in, determine main object.
Optionally, the object by preset kind in determined object is determined as main object, including:
When the quantity of the object of preset kind included in determined object is one, directly by the preset kind
Object is determined as main object;Alternatively,
When the quantity of the object of preset kind included in determined object is at least two, by region area maximum
The object of preset kind be determined as main object;Alternatively,
It is when the quantity of the object of preset kind included in determined object is at least two, clarity is highest
The object of preset kind is determined as main object.
Optionally, the composition principle includes in center composition principle, three points of composition principles and golden section composition principle
At least one.
Optionally, the position using the main object in the target image is as in preset composition principle
Body position, and processing is patterned to the target image according to preset composition principle, including:
According to the correspondence between the affiliated type of preset object and composition principle, corresponding to the main object
Composition principle is determined as target pattern principle;
Using position of the main object in the target image as the body position in the target pattern principle,
And processing is patterned to the target image according to the target pattern principle.
Optionally, the position using the main object in the target image is as in preset composition principle
Body position, and processing is patterned to the target image according to preset composition principle, including:
From preset at least two compositions principle, determine to the target image be patterned processing after obtained figure
Image planes accumulate maximum composition principle, as target pattern principle;
Using position of the main object in the target image as the body position in the target pattern principle,
And processing is patterned to the target image according to the target pattern principle.
Optionally, at least one object included in the determination target image, including:
By neural network image semantic segmentation model, at least one object included in the target image is identified.
Optionally, before the acquisition target image the step of, further include:
Obtain sample image, wherein the sample image includes at least one tagged object;
Preset neural network image semantic segmentation model is trained using the sample image, obtains meeting default
The neural network image semantic segmentation model of condition.
Optionally, described that processing is patterned to the target image according to preset composition principle, including:
It is located at the body position in preset composition principle based on the main object, the determining area in the first image is most
The length of each length of side of described first image, described first image are when big:According to preset composition principle to the target figure
Picture is patterned image obtained, within the scope of the target image after processing;
According to the length of identified each length of side, the target image is cut, obtains composition processing image.
Optionally, described that processing is patterned to the target image according to preset composition principle, including:
It is located at the body position in preset composition principle based on the main object, determines the second image, described second
Image is identical as the target image size;
Second image is compared with the target image, determines that overflow area, the overflow area are:It is described
Second image exceeds the region of the target image;
The corresponding image information of the overflow area obtained in advance is filled to the overflow area;
Overflow area after filling is spliced with overlapping region, becomes third image, the third image with it is described
Target image size is identical, and the overlapping region is the region that second image is overlapped with the target image.
Optionally, after the acquisition target image the step of, further include:
Obtain the image information in preset range around the target image;
The acquired image information of storage.
Second aspect, an embodiment of the present invention provides a kind of patterning apparatus, described device includes:
First acquisition module, for obtaining target image;
First determining module, for determining at least one object included in the target image;
Second determining module, for from identified at least one object, determining main object;
Composition processing module, for position of the main object in the target image is former as preset composition
Body position in then, and processing is patterned to the target image according to preset composition principle.
Optionally, second determining module includes:
First determination sub-module, the object for whether including preset kind at least one object determined by judging,
If it is, the object of preset kind in determined object is determined as main object;Alternatively,
Second determination sub-module, based on determining the maximum object of region area in identified at least one object
Body object;Alternatively,
Third determination sub-module, for the instruction according to the progress Object Selection from identified at least one object, and
Object specified by described instruction is determined as main object;Alternatively,
4th determination sub-module, for the predeterminable area of the target image will to be located in identified at least one object
Object be determined as main object;Alternatively,
5th determination sub-module, the region area for obtaining each object in identified at least one object account for the mesh
The ratio of logo image, and from the object that ratio is more than preset proportion threshold value, determine main object.
Optionally, first determination sub-module is specifically used for:
When the quantity of the object of preset kind included in determined object is one, directly by the preset kind
Object is determined as main object;Alternatively,
When the quantity of the object of preset kind included in determined object is at least two, by region area maximum
The object of preset kind be determined as main object;Alternatively,
It is when the quantity of the object of preset kind included in determined object is at least two, clarity is highest
The object of preset kind is determined as main object.
Optionally, the composition principle includes in center composition principle, three points of composition principles and golden section composition principle
At least one.
Optionally, the composition processing module includes:
6th determination sub-module is used for according to the correspondence between the affiliated type of preset object and composition principle, will
Composition principle corresponding to the main object is determined as target pattern principle;
First composition handles submodule, is used for the position using the main object in the target image as the mesh
The body position in composition principle is marked, and processing is patterned to the target image according to the target pattern principle.
Optionally, the composition processing module is specifically used for:
From preset at least two compositions principle, determine to the target image be patterned processing after obtained figure
Image planes accumulate maximum composition principle, as target pattern principle;
Using position of the main object in the target image as the body position in the target pattern principle,
And processing is patterned to the target image according to the target pattern principle.
Optionally, first determining module is specifically used for:
By neural network image semantic segmentation model, at least one object included in the target image is identified.
Optionally, described device further includes:
Second acquisition module, for obtaining sample image, wherein the sample image includes at least one tagged object;
Training module, for being instructed to preset neural network image semantic segmentation model using the sample image
Practice, obtains the neural network image semantic segmentation model for meeting preset condition.
Optionally, the composition processing module is specifically used for:
It is located at the body position in preset composition principle based on the main object, the determining area in the first image is most
The length of each length of side of described first image, described first image are when big:According to preset composition principle to the target figure
Picture is patterned image obtained, within the scope of the target image after processing;
According to the length of identified each length of side, the target image is cut, obtains composition processing image.
Optionally, the composition processing module is specifically used for:
It is located at the body position in preset composition principle based on the main object, determines the second image, described second
Image is identical as the target image size;
Second image is compared with the target image, determines that overflow area, the overflow area are:It is described
Second image exceeds the region of the target image;
The corresponding image information of the overflow area obtained in advance is filled to the overflow area;
Overflow area and overlapping region after filling is subjected to image mosaic, becomes third image, the third image with
The target image size is identical, and the overlapping region is the region that second image is overlapped with the target image.
Optionally, described device further includes:
Third acquisition module, for obtaining the image information around the target image in preset range;
Memory module, for storing acquired image information.
The third aspect, an embodiment of the present invention provides a kind of electronic equipment, including processor, communication interface, memory and
Communication bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes a kind of any of the above-described patterning process
Step.
Fourth aspect, an embodiment of the present invention provides a kind of computer readable storage medium, the computer-readable storage
Dielectric memory contains computer program, and the computer program realizes a kind of any of the above-described composition when being executed by processor
Method and step.
5th aspect, an embodiment of the present invention provides a kind of computer applied algorithm, the computer applied algorithm is being counted
When being run on calculation machine so that computer executes a kind of any of the above-described patterning process step.
In technical solution provided in an embodiment of the present invention, by obtaining target image, and determine included in target image
At least one object;Main object is determined from identified at least one object;In the target image by main object
Position is patterned place as the body position in preset composition principle, and according to preset composition principle to target image
Reason.The technical solution provided through the embodiment of the present invention, can determine main object from target image, and according to determining
The main object gone out carries out again composition to target image by preset composition principle and handles.In this way, for a user,
Processing can still be reconstructed to image in the case where avoiding manual operation, and then improve the facility of composition processing
Property.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
It is cumbersome when in order to solve the problems, such as to be patterned processing, and then the convenience of composition processing can be improved, this
Inventive embodiments provide a kind of patterning process.Wherein, a kind of patterning process provided in an embodiment of the present invention includes:
Obtain target image;
Determine at least one object included in target image;
From identified at least one object, main object is determined;
Using the position of main object in the target image as the body position in preset composition principle, and according to default
Composition principle processing is patterned to target image.
The technical solution provided through the embodiment of the present invention, can determine main object from target image, and according to
The main object determined carries out again composition to target image by preset composition principle and handles.In this way, for user
For, still image can be reconstructed processing in the case where avoiding manual operation, and then improve composition processing
Convenience.
A kind of patterning process provided in an embodiment of the present invention is introduced first below, as shown in Figure 1, the present invention is implemented
A kind of patterning process that example provides includes the following steps:
S101 obtains target image.
Wherein, target image can be that user is collected from acquisition vision facilities (such as camera) in shooting process
Image, that is to say, that target image is the image before generating and be presented to the user after user pressing camera button.It is this
In the case of, processing is reconstructed to target image by this programme, and obtain the reconstructed image after reconstruction processing, then by reconstruct image
As being presented to the user.
In addition, target image can also be existing image, according to the demand of user, which is carried out
Reconstruction processing.For example, target image can be image many years ago, at this point, place is reconstructed to the target image many years ago
Reason;In another example target image is the photo that user has just used that mobile phone is captured and stores, then just the target image is carried out at once
Reconstruction processing.
S102 determines at least one object included in target image.
Object in the embodiment of the present invention can be each things being demonstrated in image, for example, object can be personage,
Animal, article etc..
Wherein, each object in target image occupies certain image-region, even if included by target image
Multiple objects belong to same classification, but each object respectively occupies the region in target image, then at this point it is possible to think target
Image includes at least one object simultaneously.
For example, as shown in Fig. 2, the classification of object included in the target image has tree, sky, meadow and a people, and its
In, include 4 people, respectively A, B, C and D in the classification of people, also, A, B, C and D respectively occupy the mesh in the target image
Region in logo image, in this way, including A, B, C and D taking human as object in the target image.
In a kind of embodiment, it can come in recognition target image to be wrapped by neural network image semantic segmentation model
At least one object included.In a kind of specific implementation, neural network image semantic segmentation model can be in target image
Each pixel classify, and the pixel for belonging to same classification is identified as same color, in this way, target image
The image that obtained image can be made of the region of different colours after progress semantic segmentation.
For example, being the original image of target image as shown in Figure 3a, 3b is the target image by passing through neural network image
Semantic segmentation model carries out obtained image after semantic segmentation processing, wherein the car in target image is with same face
Color is identified, also, in fig 3b, and the region for identifying car color includes 4 individual regions, therefore, the target
Image includes the object of 4 cars.
For used neural network image semantic segmentation model, in a kind of embodiment, sample image can be passed through
Neural network image semantic segmentation model is trained.Specifically, sample image can be obtained;Using sample image to default
Neural network image semantic segmentation model be trained, obtain the neural network image semantic segmentation mould for meeting preset condition
Type.
Wherein, sample image includes at least one tagged object, and tagged object can be with the target in the embodiment of the present invention
Object is identical.For example, can be using Fig. 2 as sample image, the tagged object in Fig. 2 may include tree, sky, meadow and people.
When neural network image semantic segmentation model carries out semantic segmentation processing to sample image, to the picture in sample image
Vegetarian refreshments classification is more accurate, then identifies that the accuracy rate of the tagged object in sample image is higher.Preset condition can be self-defined sets
Fixed.
For example, can set preset condition as:70% or more is reached to the classification accuracy of pixel, then, sample graph
As carrying out repetition training to neural network image semantic segmentation model, in neural network image semantic segmentation model to pixel
When classification accuracy reaches 70% or more, then the neural network image semantic segmentation model can be applied in present invention implementation at this time
In example, semantic segmentation processing is carried out to target image.
Classify to each pixel in target image, and the pixel for belonging to same classification is identified as same
Kind color.
S103 determines main object from identified at least one object.
Wherein, main object may be considered the object for needing to give prominence to the key points in the target image, is then directed in composition
Main object is patterned, so that finally obtained patterned image highlights main object.
When target image includes at least two object, main object can be determined according to default rule, determine
The embodiment of main object is introduced separately below:
The first embodiment judges the object for whether including preset kind in identified at least one object, if institute
Determining at least one object includes the object of preset kind, based on the object determination of preset kind in determined object
Object.
After above-mentioned steps S102 determines object, then pair for whether including preset kind in identified object is judged
As if including the object of preset kind, can the object of the preset kind be directly determined as subject;If do not wrapped
The object of preset kind is included, then other embodiments for determining main object may be used to determine main object.
Wherein, the object of preset kind can be self-defined setting.For example, the object of preset kind can be people, then
Judge in target image in identified object whether to include people, if including people, by what is determined in the target image
People is as main object.
Second of embodiment, on the basis of the first above-mentioned embodiment, in identified at least one object
When object including preset kind, the realization method of main object is further determined according to the quantity of the object of preset kind
Including following at least two:
The first realization method, when the quantity of the object of preset kind included in determined object is one, then
It can be directly using the object of a preset kind as main object.
For example, the object of preset kind is behaved, only includes a people A in the object determined in target image, then may be used
With by the A directly as main object.
Second of realization method, when the quantity of the object of preset kind included in determined object is at least two
When, using the object of the maximum preset kind of region area as main object.
Specifically, after object included in determining target image, the area surface shared by each object can be obtained
Product.In this way, for the object of preset kind included in determined object, it is also possible to obtain the object of each preset kind
Shared region area.
In this way, there are when the object of at least two preset kinds in determined object, it can be maximum by region area
The object of preset kind is as main object.
For example, the object of preset kind is behaved, the object determined in target image includes three people A, B and C,
In, the region area shared by A is more than the region area shared by B, also greater than the region area shared by C, then understands that A is shared region
The maximum people of area, then can be by the A directly as main object.
The third realization method, when the quantity of the object of preset kind included in determined object is at least two
When, the object of the highest preset kind of clarity is determined as main object.
It specifically, can be each to the every an object determined after object included in determining target image
Analyzed from the clarity presented in the target image, and by the object of the highest preset kind of clarity determine based on
Object.
Certainly, in the case where the quantity of the object of preset kind is at least two, it is not limited in above-mentioned second in fact
Existing mode and the third realization method can also determine main object according to other rules from the object of preset kind.
The third embodiment, in above-mentioned steps S102 determines target image included at least one object it
Afterwards, the region area shared by each object can be obtained, and based on the maximum object of region area in identified object determined
Body object.
Wherein, region area can be expressed as the area shared by each region reality in target image, for example, target image institute
Including one of region be the length of side be 1 centimetre of square, then the region area can be expressed as 1 square centimeter.
Region area is also denoted as forming the pixel number in the region, for example, included by target image wherein
One region is made of 1000 pixels, then the region area in the region can be expressed as 1000 pixels.
For example, Fig. 4 a show the original image of target image, obtained image is Fig. 4 b after semantic segmentation is handled,
As shown in Figure 4 b, with different colours to distinguish and represent the region of each object, and region shared by each object can be obtained
Area.Wherein, object is that the region area shared by desk is maximum, then, can be using desk as master for the target image
Body object.
4th kind of embodiment, main object can be specified by user, specifically, can receive the instruction of user,
The instruction is to carry out Object Selection from identified at least one object, by the object of instruction determine based on it is right
As.
Object specified by user should be the object in identified object, for example, object determined by target image
Including sky, meadow, people and the woods, then the object specified by user is carried out from four kinds of sky, meadow, people and the woods objects
It chooses.
A kind of specific implementation can be arranged a button, work as user when carrying out patterning operation again to target image
When pressing the button, then the pattern specified into access customer is chosen specified object in identified object by user, and generates packet
Instruction containing the object specified by user, and the equipment that processing is reconstructed is parsed the instruction to obtain the instruction
Object, and the specified object is determined as main object.
5th kind of embodiment, the object that the predeterminable area of target image will be located in identified at least one object are true
It is set to main object.
Wherein, predeterminable area can be self-defined setting, a kind of realization method, can be with predeterminated position, and with the position
Centered on regional extent as predeterminable area.For example, using the center of image as predeterminated position, and with the center
It is the center of circle, circle that 1 centimetre is radius as predeterminable area, then, the object in the border circular areas can be used as main object.
6th kind of embodiment, the region area for obtaining each object in identified at least one object account for target image
Ratio, and from the object that ratio is more than preset proportion threshold value, determine main object.
Wherein, with reference to described in the third above-mentioned embodiment, region area can be there are two types of representation:Actual area
Pixel quantity in domain cartographic represenation of area and region indicates.
In the case of the first representation, the real area in region and target figure shared by each object can be obtained
The real area of picture;In this way, the ratio of acquired each object is then the real area and target image in region shared by each object
Real area between ratio.
In the case of second of representation, pixel number and the mesh in region shared by each object can be obtained
The pixel sum of logo image;In this way, the ratio of acquired each object is then the pixel number in region shared by each object
With the ratio of the pixel sum of target image.
Acquired ratio can be indicated with any one of above two representation, in this way, being determined obtaining
Object in every an object ratio after, acquired ratio can be screened using preset proportion threshold value,
In, preset proportion threshold value can be self-defined setting.
A kind of realization method filters out the ratio more than preset proportion threshold value from acquired ratio, in this way, can be with
The object of preset proportion threshold value be will be greater than as object to be selected, main object is also determined from the object to be selected.
For example, object included in target image has:Sky, meadow, trees, people A, people B and people C, wherein in target
In image, the ratio shared by sky is 20%, and the ratio shared by meadow is 20%, and the ratio shared by trees is 3%, shared by people A
Ratio be 30%, the ratio shared by people B be that the ratio shared by 7% and people C is 20%, and preset proportion threshold value is 10%,
In this way, only object of the proportion more than 10% can just be used as object to be selected.Therefore, object to be selected includes:Sky, grass
Ground, people A and people C, that is to say, that main object is also selected from sky, meadow, people A and people C.
For the 6th kind of embodiment, be conducive to that first exclusionary zone area is smaller, non-compliant object, and leave
Alternative objects of the larger object of region area as main object.
Determine that the mode of main object can select any one of the above embodiment, it is, of course, also possible to include other
Determination main object mode, do not limit herein.
S104, using the position of main object in the target image as the body position in preset composition principle, and root
Processing is patterned to target image according to preset composition principle.
Wherein, preset composition principle can be self-defined setting, and composition principle may include center composition principle, three
Divide at least one of composition principle and golden section composition principle.
For in any composition principle, there is at least one body position, which determines for being arranged
Main object so that highlighting main object in patterned image.
For example, centered on as shown in figure 5, composition principle schematic diagram, wherein the body position packet in the composition principle of center
Include one:The center of image, the i.e. body position of composition centered on position A1;As shown in fig. 6, for the principle of three points of compositions
Schematic diagram, wherein the body position in three points of composition principles may include four:Position B1, position B2, position B3 and position
B4;As shown in fig. 7, for the schematic diagram of golden section composition principle, wherein the body position in golden section composition principle includes
One:Position C1.
In addition, for golden section composition principle, as shown in fig. 7, the relationship of a and b meets following formula:
Wherein, symbol " ≈ " expression is approximately equal to, it is believed that the ratio of a and b is the numerical value near 1.618 values.
For preset composition principle, it is possible to use only a kind of composition principle can also use at least two composition principles.
It is introduced respectively in two kinds of situation below.
The first situation, preset composition principle is only with a kind of composition principle.At this point, preset composition principle can adopt
With any one of center composition principle, three points of composition principles and golden section composition principle.No matter above-mentioned three kind composition is selected
Any composition principle in principle only need to be patterned processing according to selected composition principle.
For example, composition principle centered on preset composition principle, wherein the body position of center composition principle is image
Center, then by position centered on main object position in the target image, and according to center composition principle to target
Image is patterned processing.The center of obtained patterned image is main object.
Certainly, other than above-mentioned three kinds of composition principles, other applicable composition principles can also be used, are not limited herein
It is fixed.
The second situation, preset composition principle use at least two composition principles.At this point, preset composition principle can be with
Using at least two in center composition principle, three points of composition principles and golden section composition principle.
In this case, each composition principle in preset at least two compositions principle can be to target image
It is patterned processing, to obtain corresponding patterned image.Certainly, for same target image, using different composition principles,
Obtained patterned image can be different.Therefore, it how is introduced in following embodiment from preset at least two
One such composition principle is selected to be patterned processing to target image in kind composition principle.
7th kind of embodiment, using the position of main object in the target image as the main body in preset composition principle
Position, and the step of being patterned processing (S104) to target image according to preset composition principle, may include steps of:
1, according to the correspondence between the affiliated type of preset object and composition principle, the main object is corresponding
Composition principle is determined as target pattern principle;
2, using main object position in the target image as the body position in target pattern principle, and according to target
Composition principle is patterned processing to target image.
Two steps in above-mentioned 7th kind of embodiment are introduced respectively below.
Step 1, the affiliated type of object may be considered the classification of object, for example, when object is behaved, affiliated type is behaved;
When object is trees, affiliated type is tree.
Wherein, the correspondence between the affiliated type of object and composition principle can be self-defined setting, specifically, right
One-to-one correspondence setting may be used in should being related to, for example, former with golden section composition when the affiliated type of object is behaved
Then it is one-to-one relationship, that is to say, that it is patterned processing only with golden section composition principle when main object is behaved,
And golden section composition principle also only can be just used in the case where main object is behaved.
In addition, can also use many-to-one correspondence in correspondence, i.e., a variety of affiliated types of object can correspond to
Same composition principle.For example, when the affiliated type of object is desk, bookshelf, TV, it is corresponding with center composition principle.
After determining main object, you can with according to the corresponding pass between the affiliated type of preset object and composition principle
System, and then determine the composition principle corresponding to main object.
Step 2, according to the target pattern principle determined, processing is patterned to target image, it is necessary first to will lead
The position of body object is set as the body position in target pattern principle, and processing then can be just patterned to target image.
For example, the affiliated type of the object of main object is behaved, corresponding composition principle is golden section composition principle, should
Body position in golden section composition principle is golden section position, i.e. position C1 in Fig. 7 then can be by the main object
Then the position of people in the target image carries out structure according to golden section composition principle as golden section position to target image
Figure processing.
8th kind of embodiment, using the position of main object in the target image as the main body in preset composition principle
Position, and the step of being patterned processing (S104) to target image according to preset composition principle, may include steps of:
A, from preset at least two compositions principle, determine to target image be patterned processing after obtained image
The maximum composition principle of area, as target pattern principle.
B, using main object position in the target image as the body position in target pattern principle, and according to target
Composition principle is patterned processing to target image.
In this embodiment, preset composition principle includes at least two, for example, it may be center composition principle, three
Divide at least two in composition principle and golden section composition principle.
In the case where main object determines, each preset composition principle can be utilized respectively respectively to main object
Confirm body position, and then is patterned processing respectively.
For example, preset composition principle includes two kinds:Center composition principle and golden section composition principle, then in using respectively
Heart composition principle and golden section composition principle are patterned processing to target image.Specifically, first, by the position of main object
Set the body position being determined as in composition principle.Wherein, for the composition principle of center, body position is center,
Then by the center of composition principle centered on main object location determination in the target image;It is former for golden section composition
For then, body position is golden section position, then is golden section by the location determination of main object in the target image
The golden section position of composition principle.
For different composition principles, processing is patterned to same image, different patterned images can be obtained.Cause
This, each preset composition principle is patterned processing to target image respectively, can obtain different patterned images.And
The area of different patterned images can also be different.
For example, preset composition principle includes two kinds:Center composition principle and golden section composition principle, then in using respectively
Heart composition principle and golden section composition principle are patterned processing to target image, can respectively obtain different composition figures
Picture:Composition principle obtained patterned image in center is image A, and the obtained patterned image of golden section composition principle is image
B;Also, the area of image A and image B can be different.
Obtain the area for the image that each composition principle is patterned target image after processing, the i.e. face of patterned image
Product, can be there are two types of acquisition pattern:First way is to be patterned after processing to obtain to target image by composition principle
Corresponding patterned image, in this way, the area of the patterned image can be obtained;The second way exists according to each composition principle
Generated data when processing are patterned, and then composition can be calculated according to data treated the area of patterned image,
In the second way, for each composition principle, actual generation patterned image can not had to, structure can be calculated
The area of figure image.
It, can be from the area obtained after the area for obtaining the patterned image corresponding to preset each composition principle
The maximum patterned image of area is chosen, and the maximum image of area is determined as last selected patterned image.
For example, preset composition principle includes two kinds:Center composition principle and golden section composition principle, then in using respectively
Heart composition principle and golden section composition principle are patterned processing to target image, wherein what is obtained utilizes center composition
The area of principle treated image is 5 square centimeters, and what is obtained utilizes golden section composition principle treated image
Area be 6 square centimeters, then using golden section composition principle handle after obtained patterned image as target image it is right
The patterned image answered.
By present embodiment, a variety of composition principles are provided, can be selected from a variety of composition principles so most preferably
A kind of composition principle is patterned processing to target image, and can obtain the maximum patterned image of area.
9th kind of embodiment, can wrap at the step of being patterned processing to target image according to preset composition principle
Include following steps:
It is located at the body position in preset composition principle based on main object, determines in the area maximum of the first image
The length of each length of side of first image, the first image are:After processing being patterned according to preset composition principle to target image
Image obtained, within the scope of target image;
According to the length of identified each length of side, target image is cut, obtains composition processing image.
Wherein, main object is placed in body position, under the premise of this, the obtained area within the scope of target image
Maximum image is the first image.
For example, as shown in figure 8,1 is target image, object based on circle, the body position in preset composition principle is
Center position, in the range of 1, will circle when being placed in center position, can obtain the image of multiple and different sizes, for example, 2,
3,4 etc..And wherein, maximum area is 2, therefore, is cut to target image 1 according to 2 size, so obtain be with 2
The composition of size handles image.
Tenth kind of embodiment, can wrap at the step of being patterned processing to target image according to preset composition principle
Include following steps:
It is located at the body position in preset composition principle based on main object, determines the second image, the second image and mesh
Logo image size is identical;
Second image is compared with target image, determines that overflow area, overflow area are:Second image exceeds target
The region of image;
The corresponding image information of the overflow area obtained in advance is filled to overflow area;
Overflow area after filling is spliced with overlapping region, becomes third image, third image and the target
Image size is identical, and overlapping region is the region that the second image is overlapped with target image.
The embodiment is illustrated with reference to Fig. 9.
As shown in figure 9, object based on circle, 1 is target image, and circle is located at the center in target image.It is preset
Body position in composition principle is at the one third on the left of image.Therefore, three be located at based on main object on the left of image
At/mono-, identified second image is 2 in Fig. 9, i.e., circle is located in the second image 2 at the one third in left side.
Wherein, the size of the second image 2 and target image 1 is identical, and the second image 2, can compared with target image 1
To think, the second image 2 be from target image 1 to right translation after it is obtained.Second image 2 has part weight with target image 1
The region of conjunction is c, i.e. c is overlapping region.Second image 2 and the misaligned region of target image 1 include region a and region b,
In, region b is overflow area, and the size of region b and region a are identical.
It includes image information to be in target image 1, i.e., the information that image can be shown, such as personage, trees, vehicle
Deng.And for overflow area b, overflow area b has had exceeded the range of target image 1.In order to keep reconstruction processing image
The continuity of presented image information, the image information included by overflow area b can be when obtaining target image 1 in target
Acquired image information around image information included by image 1.In this way, image information in overflow area b with it is adjacent heavy
The image information for closing region c is coherent.
Acquisition for the image information around target image, in a kind of embodiment, in the step of obtaining target image
Later, can also include:Obtain the image information in preset range around the target image;The acquired image information of storage.
It is illustrated with reference to Fig. 9.When obtaining target image 1, obtain around the target image 1 in preset range
Image information, and acquired image information is stored.Specifically, two image capture devices can be arranged (such as to take the photograph
As head), one of image capture device is used to acquire the image information included by target image 1, and obtained image is
Target image 1;Another image capture device is used to acquire the image information around target image 1.Wherein, preset range can be with
It is self-defined setting.
Determining overflow area b, and by the image information corresponding to overflow area b fill to overflow area b it
Afterwards, the overflow area b and overlapping region c after filling is spliced, forms third image.
By the embodiment, obtained second image after processing is patterned to target image, is maintained and target
The identical size of image, and the image information included by the second image is continuity, and then improve the experience of user.
In technical solution provided in an embodiment of the present invention, by obtaining target image, and determine included in target image
Object;Main object is determined from identified object;Using the position of main object in the target image as preset structure
Primitive then in body position, and processing is patterned to target image according to preset composition principle.Implement through the invention
The technical solution that example provides, can determine main object, and according to the main object determined, pass through from target image
Preset composition principle carries out again composition to target image and handles.In this way, for a user, can avoid being manually operated
In the case of, still image can be reconstructed processing, and then improve the convenience of composition processing.
Corresponding to above method embodiment, the embodiment of the present invention also provides a kind of patterning apparatus, as shown in Figure 10, the device
Including:
First acquisition module 1010, for obtaining target image;
First determining module 1020, for determining at least one object included in the target image;
Second determining module 1030, for from identified at least one object, determining main object;
Composition processing module 1040 is used for the position using the main object in the target image as preset structure
Primitive then in body position, and processing is patterned to the target image according to preset composition principle.
The technical solution provided through the embodiment of the present invention, can determine main object from target image, and according to
The main object determined carries out again composition to target image by preset composition principle and handles.In this way, for user
For, still image can be reconstructed processing in the case where avoiding manual operation, and then improve composition processing
Convenience.
Optionally, in a kind of embodiment, the second determining module 1030 may include:
First determination sub-module, the object for whether including preset kind at least one object determined by judging,
If it is, the object of preset kind in determined object is determined as main object;Alternatively,
Second determination sub-module, based on determining the maximum object of region area in identified at least one object
Body object;Alternatively,
Third determination sub-module, for the instruction according to the progress Object Selection from identified at least one object, and
Object specified by described instruction is determined as main object;Alternatively,
4th determination sub-module, for the predeterminable area of the target image will to be located in identified at least one object
Object be determined as main object;Alternatively,
5th determination sub-module, the region area for obtaining each object in identified at least one object account for the mesh
The ratio of logo image, and from the object that ratio is more than preset proportion threshold value, determine main object.
Optionally, in a kind of embodiment, the first determination sub-module can be specifically used for:
When the quantity of the object of preset kind included in determined object is one, directly by the preset kind
Object is determined as main object;
Alternatively,
When the quantity of the object of preset kind included in determined object is at least two, by region area maximum
The object of preset kind be determined as main object;Alternatively,
It is when the quantity of the object of preset kind included in determined object is at least two, clarity is highest
The object of preset kind is determined as main object.
Optionally, in a kind of embodiment, composition principle includes center composition principle, three points of composition principles and golden section
At least one of composition principle.
Optionally, in a kind of embodiment, composition processing module 1040 may include:
6th determination sub-module is used for according to the correspondence between the affiliated type of preset object and composition principle, will
Composition principle corresponding to the main object is determined as target pattern principle;
First composition handles submodule, is used for the position using the main object in the target image as the mesh
The body position in composition principle is marked, and processing is patterned to the target image according to the target pattern principle.
Optionally, in a kind of embodiment, composition processing module 1040 can be specifically used for:
From preset at least two compositions principle, determine to the target image be patterned processing after obtained figure
Image planes accumulate maximum composition principle, as target pattern principle;
Using position of the main object in the target image as the body position in the target pattern principle,
And processing is patterned to the target image according to the target pattern principle.
Optionally, in a kind of embodiment, the first determining module 1020 is specifically used for:
By neural network image semantic segmentation model, included at least one object in recognition target image.
Optionally, in a kind of embodiment, device can also include:
Second acquisition module, for obtaining sample image, wherein sample image includes at least one tagged object;
Training module is obtained for being trained to preset neural network image semantic segmentation model using sample image
To the neural network image semantic segmentation model for meeting preset condition.
Optionally, in a kind of embodiment, composition processing module 1040 is specifically used for:
It is located at the body position in preset composition principle based on main object, determines in the area maximum of the first image
The length of each length of side of first image, the first image are:After processing being patterned according to preset composition principle to target image
Image obtained, within the scope of target image;
According to the length of identified each length of side, target image is cut, obtains composition processing image.
Optionally, in a kind of embodiment, composition processing module 1040 is specifically used for:
It is located at the body position in preset composition principle based on main object, determines the second image, the second image and mesh
Logo image size is identical;
Second image is compared with target image, determines that overflow area, overflow area are:Second image exceeds target
The region of image;
The corresponding image information of the overflow area obtained in advance is filled to overflow area;
Overflow area and overlapping region after filling is subjected to image mosaic, becomes third image, third image with it is described
Target image size is identical, and the overlapping region is the region that second image is overlapped with the target image.
Optionally, in a kind of embodiment, device can also include:
Third acquisition module, for obtaining the image information around the target image in preset range;
Memory module, for storing acquired image information.
The technical solution provided through the embodiment of the present invention, can determine main object from target image, and according to
The main object determined carries out again composition to target image by preset composition principle and handles.In this way, for user
For, still image can be reconstructed processing in the case where avoiding manual operation, and then improve composition processing
Convenience.
The embodiment of the present invention additionally provides a kind of electronic equipment, as shown in figure 11, including processor 1110, communication interface
1120, memory 1130 and communication bus 1140, wherein processor 1110, communication interface 1120, memory 1130 pass through communication
Bus 1140 completes mutual communication,
Memory 1130, for storing computer program;
Processor 1110 when for executing the program stored on memory 1130, realizes following steps:
Obtain target image;
Determine at least one object included in target image;
From identified at least one object, main object is determined;
Using the position of main object in the target image as the body position in preset composition principle, and according to default
Composition principle processing is patterned to target image.
The technical solution provided through the embodiment of the present invention, can determine main object from target image, and according to
The main object determined carries out again composition to target image by preset composition principle and handles.In this way, for user
For, still image can be reconstructed processing in the case where avoiding manual operation, and then improve composition processing
Convenience.
Certainly, a kind of electronic equipment provided in an embodiment of the present invention can also be performed any described one in above-described embodiment
Kind patterning process.It is specifically shown in the embodiment corresponding to Fig. 1 and Fig. 1, which is not described herein again.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which can
It reads to be stored with instruction in storage medium, when run on a computer so that it is corresponding that computer executes above-mentioned Fig. 1 and Fig. 1
Any a kind of patterning process in embodiment.
The embodiment of the present invention additionally provides a kind of computer applied algorithm, which runs on computers
When so that computer executes any a kind of patterning process in above-described embodiment.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, controlling bus etc..For just
It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), can also include non-easy
The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be at least one storage device for being located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processing, DSP), it is application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete
Door or transistor logic, discrete hardware components.
The term used in the embodiment of the present application is the purpose only merely for description specific embodiment, is not intended to be limiting
The application.In the embodiment of the present application and "an" of singulative used in the attached claims, " described " and "the"
It is also intended to including most forms, unless context clearly shows that other meanings.It is also understood that term used herein
"and/or" refer to and include one or more associated list items purposes any or all may combine.
It will be appreciated that though may be described in the embodiment of the present application using term " first ", " second ", " third " etc.
Various connectivity ports and identification information etc., but these connectivity ports and identification information etc. should not necessarily be limited by these terms.These terms
Only it is used for connectivity port and identification information etc. being distinguished from each other out.For example, in the case where not departing from the embodiment of the present application range,
First connectivity port can also be referred to as second connection end mouth, and similarly, second connection end mouth can also be referred to as the first connection
Port.
Depending on context, word as used in this " if " can be construed to " ... when " or " when ...
When " or " in response to determination " or " in response to detection ".Similarly, depend on context, phrase " if it is determined that " or " if detection
(condition or event of statement) " can be construed to " when determining " or " in response to determination " or " when the detection (condition of statement
Or event) when " or " in response to detection (condition or event of statement) ".
Through the above description of the embodiments, it is apparent to those skilled in the art that, for description
It is convenienct and succinct, only the example of the division of the above functional modules, in practical application, can as needed and will be upper
It states function distribution to be completed by different function modules, i.e., the internal structure of device is divided into different function modules, to complete
All or part of function described above.The specific work process of the system, apparatus, and unit of foregoing description, before can referring to
The corresponding process in embodiment of the method is stated, details are not described herein.
In several embodiments provided herein, it should be understood that disclosed system, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the module or
The division of unit, only a kind of division of logic function, formula that in actual implementation, there may be another division manner, such as multiple units
Or component can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, institute
Display or the mutual coupling, direct-coupling or communication connection discussed can be by some interfaces, device or unit
INDIRECT COUPLING or communication connection can be electrical, machinery or other forms.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple
In network element.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme
's.
In addition, each functional unit in each embodiment of the application can be integrated in a processing unit, it can also
It is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.Above-mentioned integrated list
The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can be stored in a computer read/write memory medium.Based on this understanding, the technical solution of the application is substantially
The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words
It embodies, which is stored in a storage medium, including some instructions are used so that a computer
It is each that equipment (can be personal computer, server or the network equipment etc.) or processor (processor) execute the application
The all or part of step of embodiment the method.And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory
(Read Only Memory;Hereinafter referred to as:ROM), random access memory (Random Access Memory;Hereinafter referred to as:
RAM), the various media that can store program code such as magnetic disc or CD.
The above, the only specific implementation mode of the application, but the protection domain of the application is not limited thereto, it is any
Those familiar with the art can easily think of the change or the replacement in the technical scope that the application discloses, and should all contain
It covers within the protection domain of the application.Therefore, the protection domain of the application should be based on the protection scope of the described claims.