Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clearlyChu, intactly description, obviously, described embodiment is the present invention's part embodiment, instead of allEmbodiment. Based on the embodiment in the present invention, those of ordinary skill in the art are not making creative laborThe every other embodiment obtaining under moving prerequisite, belongs to the scope of protection of the invention.
The described terminal of the embodiment of the present invention can comprise smart mobile phone (as Android mobile phone, iOS mobile phone,WindowsPhone mobile phone etc.), panel computer, palm PC, notebook computer, mobile internet device(MID, MobileInternetDevices) or Wearable equipment etc., above-mentioned terminal is only for example, but not poorLift, including but not limited to above-mentioned terminal.
Refer to Fig. 1, the first embodiment flow process of the method for a kind of image processing providing for the embodiment of the present inventionSchematic diagram. The method of the image processing described in the present embodiment, comprises the following steps:
That 101, determines pending image needs He Xu clear area, virtualization region.
In the embodiment of the present invention, pending image can be and utilizes the camera of terminal to take the image obtaining,Or pending image can be image in the RAM card of terminal or memory, or pending image canFor arbitrary image of downloading in users from networks. Pending image can be made up of two parts, needs virtualization regionWith need clear area. Need virtualization region, need this part to carry out Fuzzy processing, thereby, realize emptyChange effect. Need clear area, need this part region do not deal with or carry out image enhancement processing,Thereby it is comparatively clear this part region to be seen clearly carry out image.
Alternatively, terminal can be carried out target detection to pending image, thereby, by the target area detectingAs needing clear area, and using in this pending image, this needs region in addition, clear area as needing virtualization districtTerritory. For example, in the situation that hypothetical target is behaved, terminal can be carried out target detection to pending image, will treatProcess in image people region as needing clear area, and using other regions as needing virtualization region. SupposeIn pending image, have multiple people, and target is that (A is a people in the plurality of people for A in the plurality of peopleOr groups of people), terminal can be carried out target detection to pending image, using clear as need this A regionClear region, and using other regions in pending image as needing virtualization region. In the present embodiment, target canSpecified by user, or, system default.
Further alternatively, terminal can be carried out target detection to pending image, thereby, by the order detectingMark region as needing virtualization region, and using in this pending image, this needs region in addition, virtualization region as needClear area.
Alternatively, terminal can receive for the instruction of choosing that needs clear area in pending image, chooses this needInstruction is chosen to respond this in clear area, and needs region in addition, clear area as needing virtualization region this.When terminal is shown pending image on display screen, can carry out man-machine interaction, user can select according to personal likeSelect certain subregion in pending image as needing clear area, further, user can touching in terminalTouch on screen and click or iris out interested region as needing clear area, so, terminal detects user'sAfter touching operation, can generate for the instruction of choosing that needs clear area in this pending image, terminal existsWhen responding this and choosing instruction, the region of user being clicked on touch-screen or iris out interested region asNeed clear area, and using other regions in this pending image as needing virtualization region.
Further alternatively, terminal can receive for the instruction of choosing that needs virtualization region in pending image, choosingGetting this needs virtualization region to choose instruction to respond this, and needs region in addition, virtualization region clear as need thisRegion.
Alternatively, need clear area to be made up of multiple independently subregions, for example, user can be pendingIn image, choose multiple regions as needing clear area. In like manner, need virtualization region also can by multiple independently sonRegion composition.
102, the virtualization region zero clearing that needs in described pending image is obtained to the first zero clearing image.
In the embodiment of the present invention, terminal can be carried out all pixels that need virtualization region in pending imageZero clearing processing, this pixel value that needs the pixel in virtualization region is 0, process is to after needing the zero clearing of virtualization regionPending image be referred to as the first zero clearing image.
Particularly, in the time that to need virtualization region be 1 or multiple enclosed region, terminal can be determined needs virtualization districtThe bounds in territory, then, sets to 0 the pixel value of the pixel in the bounds in this virtualization region successively.
Particularly, if need virtualization region by pixel value be pixel corresponding to certain fixed value form need virtualizationWhen what pixel corresponding to pixel value in region or preset range formed needs virtualization region, can need void to thisThe pixel value of changing region sets to 0. For example, specify pixel corresponding to pixel value 100-150 in pending imageThe region that point forms is for needing virtualization region, and so, terminal can be determined corresponding pixel according to pixel value 100-150Point, then, sets to 0 the pixel value of corresponding pixel.
103, the clear area zero clearing that needs in described pending image is obtained to the second zero clearing image.
In the embodiment of the present invention, terminal can be carried out all pixels that need clear area in pending imageZero clearing processing, this pixel value that needs the pixel of clear area is 0, process is to after needing clear area zero clearingPending image be referred to as the second zero clearing image.
Particularly, in the time that to need clear area be 1 or multiple enclosed region, terminal can be determined needs circle of good definitionThe bounds in territory, then, sets to 0 the pixel value of the pixel in the bounds of this clear area successively.
Particularly, be that the need that form of pixel corresponding to certain fixed value are clear if need clear area by pixel valueWhen what pixel corresponding to pixel value in region or preset range formed needs clear area, can need clear to thisThe pixel value in clear region sets to 0. For example, specify pixel corresponding to pixel value 100-150 in pending imageThe Wei Xu clear area, region that point forms, so, terminal can be determined corresponding pixel according to pixel value 100-150Point, then, sets to 0 the pixel value of corresponding pixel.
104, described the second zero clearing image is carried out to Fuzzy processing.
In the embodiment of the present invention, terminal can adopt Gaussian Blur algorithm carry out obfuscation place to the second zero clearing imageReason.
Alternatively, terminal can be carried out gradual Fuzzy processing to this second zero clearing image, and wherein, this graduallyThe Fuzzy processing of entering formula represents in this second zero clearing image to need the closer to this pixel fuzzy in virtualization regionChange degree is less, more needs the obfuscation degree of pixel in virtualization region larger away from this.
105, the second zero clearing image after described Fuzzy processing and described the first zero clearing image are superposeed.
In the embodiment of the present invention, terminal can be carried out the second zero clearing image after obfuscation and the first zero clearing imageStack. Particularly, terminal can be by the second zero clearing image after obfuscation and the first zero clearing image correspondence positionThe pixel value of pixel be added.
In the embodiment of the present invention, due to the degree of depth corresponding to each the pixel position in pending image notThe same, thereby, for the pixel of a certain assigned address, if the degree of depth of this pixel is less than this pixelWhen the depth value of other pixels of vertex neighborhood, this pixel can be to the picture in this pixel neighborhood of a pointVegetarian refreshments causes certain light to block; On the contrary, if the depth value of this pixel is greater than this neighborhood of pixel pointsWhen the depth value of other pixels, this pixel can be caused by the pixel in this pixel neighborhood of a pointCertain light blocks. Particularly, as shown in Figure 1a, wherein, Fig. 1 a comprise distant view, close shot, camera lens,Imageing sensor, the object of trunnion axis is above-mentioned distant view, close shot, camera lens, imageing sensor to remain onOn same level axle, by finding out in Fig. 1 a, in the time that close shot blocks the light of distant view reflection,Cannot on imageing sensor, carry out imaging.
Based on above-mentioned theory, if Fig. 1 b is that example describes, in Fig. 1 b, left figure is an original image, shouldOriginal image can comprise needs He Xu clear area, virtualization region, and supposing to need virtualization region is that close shot region and need are clearClear region is distant view region, and MASK is the image that this left figure is carried out to binaryzation, can find out middle whiteRegion is for needing virtualization region, and surrounding black region needs clear area. And then, as shown in Fig. 1 c, Fig. 1 cMiddle image A is the first zero clearing image, and in Fig. 1 c, image B is the second zero clearing image. Image C in Fig. 1 cFor the image that image A is carried out obtaining after Fuzzy processing, the image D in Fig. 1 c is for to carry out image BThe image obtaining after Fuzzy processing, the image E in Fig. 1 c is the first image, its effect is equal to imageA+ image D (image A and image D superpose), can be found out by the image E in Fig. 1 C, needs virtualizationThe border of He Xu clear area, region is fuzzy, thereby, meet optical principle. Image F in Fig. 1 c isThe second image, its effect is equal to image B+image C (image B and image C superpose). By Fig. 1 cIn image F can find out, needing the border of He Xu clear area, virtualization region is clearly, thereby, also symbolClose optical principle.
Further, wherein, in the image A in Fig. 1 c, can be expressed as follows, wherein, A (i) represents that first is clearNull graph picture, MASK (i)=0 represents that the two-value of MASK region turns to 0, obtains the figure in image 1cPicture A, wherein, i represents arbitrary pixel.
Further, wherein, in the image B in Fig. 1 c, can be expressed as follows, wherein, B (i) represents that second is clearNull graph picture, is 1 after the binaryzation of MASK (i)=1 expression MASK region, obtains in image 1cImage B, i represents arbitrary pixel.
As a kind of possible embodiment, terminal also can be determined needing virtualization region and needing clear of pending imageClear region; The virtualization region zero clearing that needs in this pending image is obtained to the first zero clearing image; This is pendingThe clear area zero clearing that needs in image obtains the second zero clearing image; This first zero clearing image carry out obfuscation placeReason; The first zero clearing image after described Fuzzy processing and described the second zero clearing image are superposeed. Thereby,According to the method for the embodiment of the present invention, also can obtain meeting optical principle and sharply marginated background virtualization image.
That determines pending image by the embodiment of the present invention needs He Xu clear area, virtualization region; Described in inciting somebody to action, treatThe virtualization region zero clearing that needs of processing in image obtains the first zero clearing image; By clear the need in described pending imageThe zero clearing of clear region obtains the second zero clearing image; Described the second zero clearing image is carried out to Fuzzy processing; Described in inciting somebody to actionThe second zero clearing image after Fuzzy processing and described the first zero clearing image superpose. Thereby, by pendingImage is divided into needs He Xu clear area, virtualization region, and the second zero clearing image is carried out to Fuzzy processing, at mouldIn the process of gelatinization processing, not only Fuzzy processing is carried out in the virtualization region that needs to the second zero clearing image, and to clearlyFuzzy processing is carried out in the clear area that needs after zero, when the second zero clearing image after treatment and the first zero clearing imageAfter superposeing, be close shot region needing virtualization region, and while needing clear area to be distant view region, this need voidThe edge of change Yu Gaixu clear area, region there will be fuzzy, otherwise, be distant view region needing virtualization region,And while needing clear area to be close shot region, this needs the edge of Yu Gaixu clear area, virtualization region to keep clear,Thereby, can make virtualization effect more meet optics rule and more natural.
Refer to Fig. 2, the second embodiment flow process of the method for a kind of image processing providing for the embodiment of the present inventionSchematic diagram. The method of the image processing described in the present embodiment, comprises the following steps:
That 201, determines pending image needs He Xu clear area, virtualization region.
In the embodiment of the present invention, pending image can be and utilizes the camera of terminal to take the image obtaining,Or pending image can be image in the RAM card of terminal or memory, or pending image canFor arbitrary image of downloading in users from networks. Pending image can be made up of two parts, needs virtualization regionWith need clear area. Need virtualization region, need this part to carry out Fuzzy processing, thereby, realize emptyChange effect. Need clear area, need this part region do not deal with or carry out image enhancement processing,Thereby it is comparatively clear this part region to be seen clearly carry out image.
202, the virtualization region zero clearing that needs in described pending image is obtained to the first zero clearing image.
In the embodiment of the present invention, terminal can be carried out all pixels that need virtualization region in pending imageZero clearing processing, this pixel value that needs the pixel in virtualization region is 0, process is to after needing the zero clearing of virtualization regionPending image be referred to as the first zero clearing image.
203, the clear area zero clearing that needs in described pending image is obtained to the second zero clearing image.
In the embodiment of the present invention, terminal can be carried out all pixels that need clear area in pending imageZero clearing processing, this pixel value that needs the pixel of clear area is 0, process is to after needing clear area zero clearingPending image be referred to as the second zero clearing image.
204, described the second zero clearing image is carried out to Fuzzy processing.
In the embodiment of the present invention, terminal can adopt Gaussian Blur algorithm carry out obfuscation place to the second zero clearing imageReason.
Alternatively, terminal can be carried out gradual Fuzzy processing to this second zero clearing image, and wherein, this graduallyThe Fuzzy processing of entering formula represents in this second zero clearing image to need the closer to this pixel fuzzy in virtualization regionChange degree is less, more needs the obfuscation degree of pixel in virtualization region larger away from this.
205, described the first zero clearing image is carried out to figure image intensifying.
In the embodiment of the present invention, terminal can be carried out figure image intensifying to the first zero clearing image, can be to pending figurePicture in the clear area that needs carry out figure image intensifying, to the first zero clearing image carry out figure image intensifying can highlight this firstThe detail textures information of zero clearing image, meanwhile, also can strengthen the contrast of this first zero clearing image.
206, by the first zero clearing figure after the second zero clearing image after described Fuzzy processing and described figure image intensifyingPicture superposes.
In the embodiment of the present invention, terminal can be by first after the second zero clearing image after obfuscation and figure image intensifyingZero clearing image superposes. Particularly, terminal can be by after the second zero clearing image after obfuscation and figure image intensifyingThe first zero clearing image correspondence position on the pixel value of pixel be added.
As a kind of possible embodiment, terminal also can be determined needing virtualization region and needing clear of pending imageClear region; The virtualization region zero clearing that needs in this pending image is obtained to the first zero clearing image; This is pendingThe clear area zero clearing that needs in image obtains the second zero clearing image; This first zero clearing image carry out obfuscation placeReason; Described the second zero clearing image is carried out to figure image intensifying; By the first zero clearing image after this Fuzzy processing withThis second zero clearing image superposes. Thereby, according to the method for the embodiment of the present invention, also can obtain meeting lightLearn principle and sharply marginated background virtualization image. And, the background virtualization that embodiment of the present invention method obtainsImage can comprise more detail textures information.
That determines pending image by the embodiment of the present invention needs He Xu clear area, virtualization region; Described in inciting somebody to action, treatThe virtualization region zero clearing that needs of processing in image obtains the first zero clearing image; By clear the need in described pending imageThe zero clearing of clear region obtains the second zero clearing image; Described the second zero clearing image is carried out to Fuzzy processing; Described in inciting somebody to actionThe second zero clearing image after Fuzzy processing and described the first zero clearing image superpose. Thereby, by pendingImage is divided into needs He Xu clear area, virtualization region, and the second zero clearing image is carried out to Fuzzy processing, at mouldIn the process of gelatinization processing, not only Fuzzy processing is carried out in the virtualization region that needs to the second zero clearing image, and to clearlyFuzzy processing is carried out in the clear area that needs after zero, when the second zero clearing image after treatment with need virtualization region to enterAfter row stack, be close shot region needing virtualization region, and while needing clear area to be distant view region, this need virtualizationThe edge of Yu Gaixu clear area, region there will be fuzzy, otherwise, be distant view region needing virtualization region, andWhile needing clear area to be close shot region, this needs the edge of Yu Gaixu clear area, virtualization region to keep clear, because ofAnd, can make virtualization effect more meet optics rule and more natural.
Refer to Fig. 3 a, the first example structure schematic diagram of a kind of terminal providing for the embodiment of the present invention.Terminal described in the present embodiment, comprising:
The first determining unit 301, needs He Xu clear area, virtualization region for what determine pending image.
The first zero clearing unit 302, for the described pending image that described the first determining unit 301 is determinedThe virtualization region zero clearing that needs obtain the first zero clearing image.
The second zero clearing unit 303, for the described pending image that described the first determining unit 301 is determinedThe clear area zero clearing that needs obtain the second zero clearing image.
Processing unit 304, for entering described the second zero clearing image after described the second zero clearing unit 303 zero clearingsRow Fuzzy processing.
Superpositing unit 305, for by the second zero clearing image and institute after described processing unit 304 Fuzzy processingDescribed the first zero clearing image of stating after the first zero clearing unit zero clearing superposes.
Alternatively, as shown in Figure 3 b, described the first determining unit 301 in Fig. 3 a can comprise:
Detecting unit 3031, for carrying out target detection to pending image;
The second determining unit 3032, clear as need for the target area that described detecting unit 3031 is detectedClear region, and will described in described pending image, need region in addition, clear area as needing virtualization region.
Alternatively, as shown in Figure 3 c, described the first determining unit 301 in Fig. 3 a can comprise:
Receiving element 306, for receiving the instruction of choosing that needs clear area for pending image.
Choose unit 307, described in responding, choose instruction for choosing the described clear area that needs, and by described needRegion beyond clear area is as needing virtualization region.
Alternatively, as shown in Figure 3 d, the described terminal in Fig. 3 a also comprises:
Enhancement unit 308, for entering described the first zero clearing image after described the first zero clearing unit 302 zero clearingsRow figure image intensifying, by described superpositing unit 305 by the second zero clearing figure after described processing unit Fuzzy processingPicture with described enhancement unit 308 figure image intensifyings after the first zero clearing image superpose.
Alternatively, in Fig. 3 a-Fig. 3 d, described processing unit 304 specifically for:
Described the second zero clearing image after described the second zero clearing unit 303 zero clearings is carried out to gradual obfuscationProcess, wherein, described gradual Fuzzy processing represents in described the second zero clearing image the closer to described needThe obfuscation degree of the pixel in close shot virtualization region is less, more away from the described pixel that needs close shot virtualization regionThe obfuscation degree of point is larger.
By the described terminal of the embodiment of the present invention can determine pending image need virtualization region and need clearRegion; The virtualization region zero clearing that needs in described pending image is obtained to the first zero clearing image; Described in inciting somebody to action, wait to locateThe clear area zero clearing that needs in reason image obtains the second zero clearing image; Carry out fuzzy to described the second zero clearing imageChange and process; The second zero clearing image after described Fuzzy processing and described the first zero clearing image are superposeed.Thereby, pending image is divided into and needs He Xu clear area, virtualization region, and the second zero clearing image is carried out to mouldGelatinization processing, in the process of Fuzzy processing not only to the second zero clearing image to need virtualization region to carry out fuzzyChange and process, and Fuzzy processing is carried out in the clear area that needs after zero clearing, when the second zero clearing image after treatmentAfter needing virtualization region to superpose, be close shot region needing virtualization region, be prospective area and need clear area, it is fuzzy that this needs the edge of Yu Gaixu clear area, virtualization region there will be when in the territory, and needing virtualization region for far awayScene area, and while needing clear area to be close shot region, this needs the edge of Yu Gaixu clear area, virtualization region to protectIt is clear to hold, thereby, can make virtualization effect more meet optics rule and more natural.
Refer to Fig. 4, the second example structure schematic diagram of a kind of terminal providing for the embodiment of the present invention. ThisTerminal described in embodiment, comprising: at least one input equipment 1000; At least one output equipment 2000;At least one processor 3000, for example CPU; With memory 4000, above-mentioned input equipment 1000, outputEquipment 2000, processor 3000 and memory 4000 are connected by bus 5000.
Wherein, above-mentioned input equipment 1000 specifically can be contact panel, physical button or mouse.
Above-mentioned output equipment 2000 specifically can be display screen.
Above-mentioned memory 4000 can be high-speed RAM memory, also can be non-unsettled memory(non-volatilememory), for example magnetic disc store. Above-mentioned memory 4000 is for storing batch processingCode, above-mentioned input equipment 1000, output equipment 2000 and processor 3000 are for calling memory 4000The program code of middle storage, carry out operation as follows:
Above-mentioned processor 3000, for:
That determines pending image needs He Xu clear area, virtualization region;
The virtualization region zero clearing that needs in described pending image is obtained to the first zero clearing image;
The clear area zero clearing that needs in described pending image is obtained to the second zero clearing image;
Described the second zero clearing image is carried out to Fuzzy processing;
The second zero clearing image after described Fuzzy processing and described the first zero clearing image are superposeed.
What alternatively, above-mentioned processor 3000 was determined pending images needs He Xu clear area, virtualization region, bagDraw together:
Pending image is carried out to target detection;
Using the target area detecting as needing clear area, and clear by needing described in described pending imageRegion beyond region is as needing virtualization region.
What alternatively, above-mentioned processor 3000 was determined pending images needs He Xu clear area, virtualization region, bagDraw together:
Receive for the instruction of choosing that needs clear area in pending image;
Choose the described clear area that needs and choose instruction described in responding, and by the described district needing beyond clear areaTerritory is as needing virtualization region.
Alternatively, after above-mentioned processor 3000 carries out Fuzzy processing to described the second zero clearing image, also toolBody is used for:
Described the first zero clearing image is carried out to figure image intensifying;
Above-mentioned processor 3000, by the second zero clearing image after described Fuzzy processing and described the first zero clearingImage superposes, and comprising:
The first zero clearing image after the second zero clearing image after described Fuzzy processing and described figure image intensifying is enteredRow stack.
Alternatively, above-mentioned processor 3000 carries out Fuzzy processing to described the second zero clearing image, comprising:
Described the second zero clearing image is carried out to gradual Fuzzy processing, wherein, described gradual obfuscation placeReason represents the obfuscation degree the closer to the described pixel that needs close shot virtualization region in described the second zero clearing imageLess, more larger away from the obfuscation degree of the described pixel that needs close shot virtualization region.
In specific implementation, input equipment 1000, the output equipment 2000 described in the embodiment of the present invention and locatingReason device 3000 can be carried out first embodiment and second of the method for a kind of image processing that the embodiment of the present invention providesImplementation described in embodiment, also can carry out the first real of a kind of terminal that the embodiment of the present invention providesThe implementation of executing the terminal described in example, does not repeat them here.
Unit in all embodiment of the present invention, can pass through universal integrated circuit, for example CPU (CentralProcessingUnit, central processing unit), or by ASIC (ApplicationSpecificIntegratedCircuit, special IC) realize.
Step in embodiment of the present invention method can be carried out according to actual needs order and adjusted, merges and delete.
Unit in embodiment of the present invention terminal can merge according to actual needs, divides and delete.
One of ordinary skill in the art will appreciate that all or part of flow process realizing in above-described embodiment method,Be can carry out the hardware that instruction is relevant by computer program to complete, described program can be stored in a calculatingIn machine read/write memory medium, this program, in the time carrying out, can comprise as the flow process of the embodiment of above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-OnlyMemory,Or random access memory (RandomAccessMemory, be called for short RAM) etc. ROM).
Method and the terminal of a kind of image the processing above embodiment of the present invention being provided have been carried out detailed JieContinue, applied specific case herein principle of the present invention and embodiment are set forth, above enforcementThe explanation of example is just for helping to understand method of the present invention and core concept thereof; Meanwhile, for this areaThose skilled in the art, according to thought of the present invention, all can change in specific embodiments and applicationsPart, in sum, this description should not be construed as limitation of the present invention.