Summary of the invention
The embodiment of the invention provides a kind of image processing method and device thereof, can the picture of different-effect type be combined, and realizes true illusory mutual the replacing of following, and has createed a kind of ultra presence of narrative, has important use property and recreational value.
In order to solve the problems of the technologies described above, a kind of image processing method that the embodiment of the invention provides comprises:
Obtain pending image;
From preset at least a image effect partition information, choose, image division is gone out first effect process zone and second effect process zone according to selected image effect partition information;
From preset at least a image processing effect, choose, the image in the said first effect process zone is handled according to selected image processing effect; Keep the image effect in the said second effect process zone;
First effect process zone after handling and the image in the second effect process zone are merged.
Preferably, said image effect partition information comprises the material pattern-information; Comprise the first material area of the pattern and first Flame Image Process zone from the first effect process zone that image division goes out according to selected image effect partition information;
Preferably, the selected image processing effect of said basis carries out processed steps to the image in the said first effect process zone and comprises:
Keep the material pattern in the said first material area of the pattern; Image processing effect according to selected is handled the image in the said first Flame Image Process zone.
Preferably, the selected image effect partition information of said basis goes out image division after the step in first effect process zone and second effect process zone, before the step of the image effect in the said second effect process zone of said reservation, also comprises:
From preset at least a material pattern-information, choosing, is the second material area of the pattern and second Flame Image Process zone according to selected material pattern-information with the said second effect process area dividing;
The step of the image effect in the said second effect process zone of said reservation comprises:
Keep the material pattern in the said second material area of the pattern, and keep the image effect in the said second Flame Image Process zone.
Preferably, preset said image effect partition information comprises the alpha value that each pixel in the image is provided with;
The selected image effect partition information of said basis comprises the step that image division goes out first effect process zone and second effect process zone:
It is regional that alpha value in the selected image effect partition information is not that 0 pixel is divided into first effect process; It is regional that alpha value in the selected image effect partition information is that 0 pixel is divided into second effect process.
Preferably, preset said material pattern-information comprises the alpha value to each pixel setting of the image in the said second effect process zone;
The selected material pattern-information of said basis is that the second material area of the pattern and the regional step of second Flame Image Process comprise with the said second effect process area dividing:
With alpha value in the selected material pattern-information is not that 0 pixel is divided into the second material area of the pattern; It is regional that alpha value in the selected image effect partition information is that 0 pixel is divided into second Flame Image Process.
Preferably, saidly obtain pending image and comprise the video frame images that obtains real-time shooting or record;
The step that first effect process zone after said will the processing and the image in the second effect process zone merge comprises: the image after will merging is exported demonstration in real time as video frame images.
The embodiment of the invention also provides a kind of device of Flame Image Process, comprising:
Image collection module is used to obtain pending image;
First chooses division module, is used for choosing from preset at least a image effect partition information, according to selected image effect partition information image division is gone out first effect process zone and second effect process zone;
The effect process module is used for choosing from preset at least a image processing effect, according to selected image processing effect the image in the said first effect process zone is handled; Keep the image effect in the said second effect process zone;
Merge module, be used for first effect process zone after handling and the image in the second effect process zone are merged.
Preferably, said image effect partition information comprises the material pattern-information; The said first effect process zone comprises the first material area of the pattern and first Flame Image Process zone;
Said effect process module comprises:
The first image stick unit is used for keeping the image effect in the said second effect process zone;
The first pattern stick unit is used for keeping the material pattern of the said first material area of the pattern;
First processing unit is used for according to selected image processing effect the image in the said first Flame Image Process zone being handled.
Preferably, said image processing apparatus also comprises:
Second chooses division module, be used for choosing from preset at least a material pattern-information, and be the second material area of the pattern and second Flame Image Process zone according to selected material pattern-information with the said second effect process area dividing;
Said effect process module comprises:
The second pattern stick unit is used for keeping the material pattern of the said second material area of the pattern;
The second image stick unit is used for keeping the image effect in the said second Flame Image Process zone;
Second processing unit is used for according to selected image processing effect the image in the said first effect process zone being handled.
Preferably, said image collection module is used to the video frame images that obtains real-time shooting or record;
The device of said Flame Image Process also comprises:
The output display module is used for the image after the said merging module merging is exported demonstration in real time as video frame images.
Embodiment of the present invention embodiment, the embodiment of the invention is through obtaining pending image; And choose in the preset at least a image effect partition information, according to selected image effect partition information image division is gone out first effect process zone and second effect process zone; And then from preset at least a image processing effect, choose, according to selected image processing effect the image in the said first effect process zone is handled; Keep the image effect in the said second effect process zone; First effect process zone after handling and the image in the second effect process zone are merged; Take this to have realized to select material to similar real-time shooting or the video frame images special effect processing recorded according to the user; And then handle to obtain to satisfy the photo after the special effect processing of consumer entertainment and interest demand; And the simple easy operating of this image processing process can combine the picture of different-effect type, realizes true in illusory alternately mutual; Create a kind of ultra presence of narrative, had important use property and recreational value.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
With reference to accompanying drawing 1, be the first embodiment process flow diagram of image processing method of the present invention.
The described image processing method of present embodiment comprises:
Step S101 obtains pending image, here; Said pending image can be the video frame images of taking in real time or recording, and like the photochrome or the black-and-white photograph of video camera or camera production, also can be other any type of still image works; Drawing and artistic work etc. like scanning; With reference to shown in Figure 10, be a pending image, this image is a shooting photo.
Step S102 chooses from preset at least a image effect partition information, according to selected image effect partition information image division is gone out first effect process zone and second effect process zone.Concrete; Said image effect partition information is meant pending image is carried out the partition information that image effect is handled; Some Flame Image Process material templates also promptly are set in advance, are planned at least two processing regions in this picture material template, wherein first effect process zone is for carrying out the zone of special effect processing to pending image corresponding region; Second effect process zone keeps the zone of original effect for after pending image is carried out Flame Image Process.
Step S103 chooses from preset at least a image processing effect, according to selected image processing effect the image in the said first effect process zone is handled; Keep the image effect in the said second effect process zone.
Step S104 merges first effect process zone after handling and the image in the second effect process zone.Concrete after step S104, can also the image after merging be exported demonstration in real time as video frame images.
Promptly; Further; The embodiment of the invention can also be handled the video of recording a video or need to play, particularly except carrying out the effect process single image or picture; Obtaining pending image among the step S101 is the video frame images of taking in real time or recording; The video frame images of the video that perhaps need play, in turn execution in step S102 is to step S104 in real time whenever to obtain two field picture general, and the image after then every frame being handled synthetic video is successively exported demonstration in real time.When for example the user holds electronic equipment and records a video, start the technical scheme of the embodiment of the invention, so the image in this first effect process zone of the entering in display screen in real time display effect handle the back image.
Preferably, in one embodiment, the image effect partition information also comprises the material pattern-information described in the embodiment of the invention step S102, and the said first effect process zone comprises the first material area of the pattern and first Flame Image Process zone.With reference to figure 7; A material template example that provides for the embodiment of the invention; The said in this embodiment first effect process zone comprises white portion 1 shown in the figure and hand-type shape area of the pattern 2, and wherein zone 1 is said first Flame Image Process zone, after pending image is handled; Pairing image is rendered as the effect after the special effect processing in this regional extent; Zone 2 is the said first material area of the pattern, and after pending image was handled, the pairing image of this regional location was rendered as the material pattern.Preset in this embodiment said image effect partition information comprises the alpha value that each pixel in the image is provided with; The selected image effect partition information of said basis comprises the step that image division goes out first effect process zone and second effect process zone: it is regional that alpha value in the selected image effect partition information is not that 0 pixel is divided into first effect process; It is regional that alpha value in the selected image effect partition information is that 0 pixel is divided into second effect process.
Preferably; In another embodiment; Between step S102 and step S103, also comprise step: from preset at least a material pattern-information, choosing, is the second material area of the pattern and second Flame Image Process zone according to selected material pattern-information with the said second effect process area dividing.Further; In this embodiment; The step of the image effect in the said second effect process zone of the reservation among the said step S103 comprises: keep the material pattern in the said second material area of the pattern, and keep the image effect in the said second Flame Image Process zone.With reference to figure 8, Fig. 9; Material template shown in Figure 8 is divided into white portion 1 and black region 2; Wherein white portion is first effect process zone, and after pending image was handled, pairing image was rendered as the effect after the special effect processing in this regional extent; Black region 2 is second Flame Image Process zone; In the material template shown in Fig. 9, be divided into hand-type zone 3 and grid area 4 with the black region 2 corresponding zones shown in Fig. 8, wherein said hand-type zone 3 is the said second material area of the pattern; After pending image was handled, the pairing image of this regional location was rendered as the second material pattern.Said grid area 4 said second Flame Image Process zones, after pending image was handled, the pairing image of this regional location was left the original image effect.Concrete, preset in this embodiment said material pattern-information comprises the alpha value to each pixel setting of the image in the said second effect process zone; The selected material pattern-information of said basis will the said second effect process area dividing be that the step in the second material area of the pattern and second Flame Image Process zone comprises: with alpha value in the material pattern-information of selecting is not that 0 pixel is divided into the second material area of the pattern; It is regional that alpha value in the selected image effect partition information is that 0 pixel is divided into second Flame Image Process.
Implement present embodiment, present embodiment is through obtaining pending image; And choose in the preset at least a image effect partition information, according to selected image effect partition information image division is gone out first effect process zone and second effect process zone; And then from preset at least a image processing effect, choose, according to selected image processing effect the image in the said first effect process zone is handled; Keep the image effect in the said second effect process zone; First effect process zone after handling and the image in the second effect process zone are merged; Take this to have realized to select material to similar real-time shooting or the video frame images special effect processing recorded according to the user; And then handle to obtain to satisfy the photo after the special effect processing of consumer entertainment and interest demand; And the simple easy operating of this image processing process can combine the picture of different-effect type, realizes true in illusory alternately mutual; Create a kind of ultra presence of narrative, had important use property and recreational value.
Fig. 2 is the second embodiment process flow diagram of image processing method of the present invention, and this embodiment comprises:
Step S201, read pending image,, then the coloured image of input is carried out gray processing and handle, obtain gray-scale map A,, then do not handle if what import is gray-scale map if the figure of input be a coloured image.
Here, said gray-scale map is meant and only comprises monochrome information that do not comprise the image of chromatic information, the conversion formula that coloured image is converted to gray-scale map is following:
Y?=?0.299*R?+?0.587*G?+?0.114*B
Wherein R, G, B are respectively the brightness value of three passages of red, green, blue of colour picture, and Y is the brightness value of gray scale picture, can change above-mentioned formula into the integer arithmetic formula in the computing embodiment of the invention for ease, as follows:
Y?=?(R*306?+?G*601?+?B*117?+?512)?>>?10
Just can calculate the gray-scale map of photochrome through this formula.
Step S202 carries out reverse process with said gray-scale map, generates converse digraph.
Reverse process can be calculated through following formula and realize,
Y0?=?255?–?Yi
Wherein Yi is the gray-scale value of input gray level figure, and Y0 is the gray-scale value of its anti-phase figure, can obtain converse digraph through this formula.
Step S203 carries out the corruption of minimum value gray scale with the converse digraph of said generation, generates foreground picture layer C.
Adopt the local minimum operator that anti-phase figure is degenerated in the embodiment of the invention; Can the marginal information of anti-phase picture be strengthened; Can also select for use the template of 3*3 to carry out the minimum value corruption; Can make the faster and better quality of the speed of handling picture like this, specifically can calculate foreground picture through following formula
Y0(i,?j)?=?min(?min(Yi(i-1,?j-1),?Yi(i,?j-1),?Yi(i+1,?j-1)),min(Yi(i-1,?j),?Yi?(i,?j),?Yi(i+1,?j)),min(Yi(i-1,?j+1),?Yi?(i,?j+1),?Yi(i+1,?j+1)))
Wherein Yi is the gray-scale value of input inversion figure, and Y0 is the gray-scale value of corrosion back image.
Step S204; The foreground picture layer C that gray-scale map A after will handling through the coloured image gray processing of step S201 input or direct input acquisition gray-scale map A and step S103 generate carries out the color dodge hybrid processing; Effect process figure layer D after the processing of generation acquisition image effect, for example handwritten drawings effect or old film special efficacy effect etc.Color dodge hybrid processing implementation can be: foreground picture layer C promotes brightness according to the GTG brightness of gray-scale map A, and then merges mutually with gray-scale map A.
Step S205 imports the material template B that the user selects, and reads the pixel number certificate of the material template of said input.According to being three zones with pending image division, zone 1 is the final zone that generates after image effect is handled according to pixel number, and zone 2 is for keeping the zone of original input picture effect, and zone 3 is for showing the zone of the material pattern in the material template.
Step S206 divides partition information according to said step S205, merges the image that generates after final image effect is handled.
In this step; Partition information according to selected material template; Zone 1 pixel pixel value is the pixel value of the effect layer D corresponding region of step S204 generation; Zone 2 pixel values are the pixel value of original input picture corresponding region, and regional 3 pixel values are material area of the pattern corresponding pixel value in the material template.Finally can obtain net result image after the effect process through this step.As with reference to Figure 10, Figure 11, Figure 12, Figure 13, Figure 14, Figure 15 and Figure 16, Figure 10 is pending image (actual be coloured image), and Figure 11, Figure 13, Figure 15 be the material template, and Figure 12, Figure 14, Figure 16 are the net result image that generates after the effect process.Wherein, in Figure 12,14,16 light color frame zone, be the special effect processing zone of generation, also i.e. zone 1; The hand-type zone is the material area of the pattern; Also be zone 3, other are with the identical zone of original pending image and keep the original image zone, also are regional 2.The described method of present embodiment is to convert original image whole into complete effect layer D earlier in the processing procedure of step S201 to S204; And then in step S206 with effect layer D, material pattern in the material template and pending original image synthesize the effect image of final generation according to the subregion division information.Optional; Can also carry out the processing of step S201 according to the subregion division information of material template to the zone 1 of pending image in the processing procedure of step S201 to S204 in the present embodiment to step S204; In step S204, generate like this be exactly original image in zone 1 carry out the effect layer that image effect is handled, take this again also can to obtain final effect image through the processing procedure of step S205 and S206.
Need to prove that the preset material pattern-information (corresponding material area of the pattern) in the embodiment of the invention includes but not limited to the hand-type pattern of embodiment of the invention exemplified, can be the material pattern of self-defining arbitrary shape or color; Preset at least a image processing effect in the embodiment of the invention includes but not limited to the pencil drawing painting effect, can also comprise the drawing with colored pencil effect that exists in the prior art, old film effect, lomo film effect, snowflower effect or flame effect or the like.
Fig. 3 is the 3rd an embodiment process flow diagram of image processing method of the present invention, and this embodiment comprises:
Step S301 reads pending image, if the figure of input is a coloured image, then the coloured image to input carries out the gray processing processing, obtains gray-scale map A, if input is gray-scale map, does not then handle.
Step S302 carries out reverse process with said gray-scale map, generates converse digraph.
Step S303 carries out the corruption of minimum value gray scale with the converse digraph of said generation, generates foreground picture layer C.
Step S304; Gray-scale map A after will handling through the coloured image gray processing of step S301 input or directly input obtain gray-scale map A and carry out the color dodge hybrid processing with the foreground picture layer C that step S303 generates, generate obtain the image effect processing after effect process figure layer E.
The processing procedure of step S201 to S204 is identical among second embodiment of above-mentioned steps S301 to S304 and said image processing method of the present invention, repeats no more at this.
Step S305 imports the screen cover template B that the user selects, and reads the pixel number certificate of the screen cover template of said input.According to being two zones with pending image division, zone 1 is the final zone that generates after image effect is handled according to pixel number, and zone 2 is non-image processing region.
Step S306 imports the material template C that the user selects, and reads the pixel number certificate of the material template of said input.According to zone 2 is divided into two zones, zone 3 is the final zone that keeps the material effect image according to pixel number, and zone 4 is for keeping the zone identical with original image content.
Step S307 divides partition information according to said step S305 and S306, merges the image that generates after final image effect is handled.
The processing procedure of step S206 is identical among second embodiment of this step and image processing method of the present invention, repeats no more at this.
With reference to figure 4, for the embodiment of image processing apparatus of the present invention forms synoptic diagram, the said image processing apparatus of present embodiment comprises:
Image collection module 401 is used to obtain pending image, and pending image described herein can be the video frame images of taking in real time or recording; Photochrome or black-and-white photograph like video camera or camera production; Also can be other any type of still image works, like drawing and the artistic work etc. of scanning, with reference to shown in Figure 2; Be a pending image, this image is a shooting photo.
First chooses division module 402, is used for choosing from preset at least a image effect partition information, according to selected image effect partition information image division is gone out first effect process zone and second effect process zone.
Here; Said image effect partition information is meant pending image is carried out the partition information that image effect is handled; Some Flame Image Process material templates also promptly are set in advance, are planned at least two processing regions in this picture material template, wherein first effect process zone is for carrying out the zone of special effect processing to pending image corresponding region; Second effect process zone keeps the zone of original effect for after pending image is carried out Flame Image Process.
Effect process module 403 is used for choosing from preset at least a image processing effect, according to selected image processing effect the image in the said first effect process zone is handled; Keep the image effect in the said second effect process zone;
Merge module 404, be used for first effect process zone after handling and the image in the second effect process zone are merged;
Output display module 405 is used for the image after the said merging module merging is exported demonstration in real time as video frame images.
Preferably, with reference to figure 5, in one embodiment, the embodiment of the invention said first is chosen the image effect partition information that division module 402 chooses and is comprised the material pattern-information; The said first effect process zone comprises the first material area of the pattern and first Flame Image Process zone; Said effect process module 403 comprises:
The first image stick unit 40311 is used for keeping the image effect in the said second effect process zone;
The first pattern stick unit 40312 is used for keeping the material pattern of the said first material area of the pattern;
First processing unit 40313 is used for according to selected image processing effect the image in the said first Flame Image Process zone being handled.
Preferably; With reference to figure 6; In another embodiment; The described image processing apparatus of the embodiment of the invention also comprises: second chooses division module 406, be used for choosing from preset at least a material pattern-information, and be the second material area of the pattern and second Flame Image Process zone according to selected material pattern-information with the said second effect process area dividing;
Said effect process module 403 comprises:
The second pattern stick unit 40321 is used for keeping the material pattern of the said second material area of the pattern;
The second image stick unit 40322 is used for keeping the image effect in the said second Flame Image Process zone;
Second processing unit 40323 is used for according to selected image processing effect the image in the said first effect process zone being handled.
Implement present embodiment, present embodiment is through obtaining pending image; And choose in the preset at least a image effect partition information, according to selected image effect partition information image division is gone out first effect process zone and second effect process zone; And then from preset at least a image processing effect, choose, according to selected image processing effect the image in the said first effect process zone is handled; Keep the image effect in the said second effect process zone; First effect process zone after handling and the image in the second effect process zone are merged; Take this to have realized to select material to similar real-time shooting or the video frame images special effect processing recorded according to the user; And then handle to obtain to satisfy the photo after the special effect processing of consumer entertainment and interest demand; And the simple easy operating of this image processing process can combine the picture of different-effect type, realizes true in illusory alternately mutual; Create a kind of ultra presence of narrative, had important use property and recreational value.
One of ordinary skill in the art will appreciate that all or part of flow process that realizes in the foregoing description method; Be to instruct relevant hardware to accomplish through computer program; Described program can be stored in the computer read/write memory medium; This program can comprise the flow process like the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
Above disclosedly be merely preferred embodiment of the present invention, can not limit the present invention's interest field certainly with this, the equivalent variations of therefore doing according to claim of the present invention still belongs to the scope that the present invention is contained.