CN109447925A - Image processing method and device, storage medium, electronic equipment - Google Patents

Image processing method and device, storage medium, electronic equipment Download PDF

Info

Publication number
CN109447925A
CN109447925A CN201811142884.9A CN201811142884A CN109447925A CN 109447925 A CN109447925 A CN 109447925A CN 201811142884 A CN201811142884 A CN 201811142884A CN 109447925 A CN109447925 A CN 109447925A
Authority
CN
China
Prior art keywords
image
processed
main body
portrait
binary
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811142884.9A
Other languages
Chinese (zh)
Other versions
CN109447925B (en
Inventor
罗玲玲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201811142884.9A priority Critical patent/CN109447925B/en
Publication of CN109447925A publication Critical patent/CN109447925A/en
Application granted granted Critical
Publication of CN109447925B publication Critical patent/CN109447925B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/55Depth or shape recovery from multiple images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

This application involves a kind of image processing methods and device, electronic equipment, computer readable storage medium, obtain the original binary image of image to be processed, image to be processed, original binary image are moved to preset number pixel on the radiation direction on image to be processed respectively, the binary image after image to be processed, movement after being moved.It is synthesized according to image to be processed and original binary image, obtains the image of portrait main body.It is synthesized according to the image to be processed after movement and the binary image after movement, obtains the image in the shadow region of portrait main body.The image of portrait main body and the image in the shadow region of portrait main body are synthesized, obtained with the image for trembling light light effects.The diversity of rich image processing.

Description

Image processing method and device, storage medium, electronic equipment
Technical field
This application involves field of computer technology, more particularly to a kind of image processing method and device, storage medium, electricity Sub- equipment.
Background technique
With universal and mobile Internet the rapid development of mobile terminal, user's usage amount of mobile terminal is increasingly Greatly.The function of taking pictures, make video in mobile terminal has become one of user's common function.It taking pictures, making video In the process, user is frequently found under the scene of available light, it is captured or production video light effects it is impossible to meet The individual demand of user.
Summary of the invention
The embodiment of the present application provides a kind of image processing method and device, storage medium, electronic equipment, can add to image Jittered smooth light effects, the diversity of rich image processing.
A kind of image processing method, comprising:
Obtain the original binary image of image to be processed;
By the image to be processed, the original binary image respectively on the radiation direction on the image to be processed Mobile preset number pixel, the binary image after image to be processed, movement after being moved;
It is synthesized according to the image to be processed and the original binary image, obtains the image of portrait main body;
It is synthesized according to the image to be processed after the movement and the binary image after the movement, obtains the people As the image in the shadow region of main body;
The image of the portrait main body and the image in the shadow region of the portrait main body are synthesized, obtains having and tremble The image of light light effects.
A kind of image processing apparatus, described device include:
Original binary image obtains module, for obtaining the original binary image of image to be processed;
Mobile module, for by the image to be processed, the original binary image respectively in the image to be processed On radiation direction on mobile preset number pixel, image to be processed after being moved, move after binary image;
The image collection module of portrait main body, for being carried out according to the image to be processed and the original binary image Synthesis, obtains the image of portrait main body;
The image collection module in the shadow region of portrait main body, for according to image to be processed after the movement and described Binary image after movement is synthesized, and the image in the shadow region of the portrait main body is obtained;
Synthesis module, for closing the image of the portrait main body and the image in the shadow region of the portrait main body At obtaining with trembling the images of light light effects.
A kind of electronic equipment including memory, processor and stores the meter that can be run on a memory and on a processor The step of calculation machine program, processor executes image processing method as described above when executing computer program.
Above-mentioned image processing method and device, storage medium, electronic equipment obtain the original binary picture of image to be processed Image to be processed, original binary image are moved preset number picture by picture on the radiation direction on image to be processed respectively Element, the binary image after image to be processed, movement after being moved.According to image to be processed and original binary image into Row synthesis, obtains the image of portrait main body.It is synthesized according to the image to be processed after movement and the binary image after movement, Obtain the image in the shadow region of portrait main body.The image of portrait main body and the image in the shadow region of portrait main body are closed At obtaining with trembling the images of light light effects.
By carrying out binary conversion treatment to image to be processed, and then the image of portrait main body is obtained, after to movement Image to be processed carries out binary conversion treatment and then obtains the image in the shadow region of portrait main body.Then again by the figure of portrait main body Picture and the image in the shadow region of portrait main body are synthesized, and just obtain having the image for trembling light light effects, at rich image The diversity of reason.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is the internal structure chart of electronic equipment in one embodiment;
Fig. 2 is the flow chart of image processing method in one embodiment;
Fig. 3 is the flow chart of image processing method in another embodiment;
Fig. 4 is the stream for obtaining the radiation direction method on image to be processed in Fig. 3 according to the human face region of image to be processed Cheng Tu;
Fig. 5 A is to be synthesized in Fig. 2 according to the image to be processed after movement and the binary image after movement, obtains people As the flow chart of the image method in the shadow region of main body;
Fig. 5 B is to be synthesized in Fig. 2 according to the image to be processed after movement and the binary image after movement, obtains people As the schematic diagram of the image in the shadow region of main body;
Fig. 6 is the flow chart of image processing method in further embodiment;
Fig. 7 is the structural schematic diagram of image processing apparatus in one embodiment;
Fig. 8 is the structural schematic diagram of image processing apparatus in another embodiment;
Fig. 9 is the structural schematic diagram of image processing apparatus in further embodiment;
Figure 10 is the schematic diagram of image processing circuit in one embodiment.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, and It is not used in restriction the application.
Fig. 1 is the schematic diagram of internal structure of electronic equipment in one embodiment.As shown in Figure 1, the electronic equipment includes logical Cross processor, memory and the network interface of system bus connection.Wherein, which is used to provide calculating and control ability, Support the operation of entire electronic equipment.Memory for storing data, program etc., at least one computer journey is stored on memory Sequence, the computer program can be executed by processor, to realize the scene suitable for electronic equipment provided in the embodiment of the present application Recognition methods.Memory may include that magnetic disk, CD, read-only memory (Read-Only Memory, ROM) etc. are non-volatile Storage medium or random access memory (Random-Access-Memory, RAM) etc..For example, in one embodiment, depositing Reservoir includes non-volatile memory medium and built-in storage.Non-volatile memory medium is stored with operating system and computer journey Sequence.The computer program can be performed by processor, for realizing a kind of image procossing provided by following each embodiment Method.Built-in storage provides the running environment of cache for the operating system computer program in non-volatile memory medium. Network interface can be Ethernet card or wireless network card etc., for being communicated with external electronic equipment.The electronic equipment can To be mobile phone, tablet computer or personal digital assistant or wearable device etc..
In one embodiment, as shown in Fig. 2, providing a kind of image processing method, it is applied in Fig. 1 in this way It is illustrated for electronic equipment, comprising:
Step 210, the original binary image of image to be processed is obtained.
Binary conversion treatment is carried out to image and has just obtained binary image.Wherein, image binaryzation handles (Image It Binarization) is exactly to set 0 or 255 for the gray value of the pixel on image, that is, whole image is showed The process of apparent black and white effect.The pixel that all gray scales are greater than or equal to threshold value is judged as belonging to certain objects, gray scale Value indicates that otherwise these pixels are excluded other than object area, gray value 0 for 255, indicates the object of background or exception Body region.In this way, then to both comprising portrait or including the image of background, progress binary conversion treatment, so that it may prominent portrait area. Image to be processed had both included generally portrait or the image including background, and certainly, image to be processed can also only include portrait.It is right Image to be processed carries out binary conversion treatment, has just obtained the original binary image of image to be processed.Image to be processed can be It takes pictures preview screen, is also possible to the photo being saved in electronic equipment after taking pictures.
Step 220, image to be processed, original binary image are moved on the radiation direction on image to be processed respectively Preset number pixel, the binary image after image to be processed, movement after being moved.
Include original light information on image to be processed, light information can be obtained from whole image, it can also root The radiation direction on image to be processed is obtained according to the human face region of regional area image for example to be processed.Obtaining figure to be processed After the radiation direction of picture, image to be processed is integrally moved into preset number pixel on the radiation direction, can thus incited somebody to action To be processed image of a part of image to be processed out of image-region, after being moved.Similarly, by the original of image to be processed Beginning binary image also moves same number pixel on the radiation direction, so also can be by one of original binary image Divide the binary image out of image-region, after being moved.
Step 230, it is synthesized according to image to be processed and original binary image, obtains the image of portrait main body.
Original binary image is to the image obtained after image to be processed progress binary conversion treatment, and image binaryzation Processing is exactly to set 0 or 255 for the gray value of the pixel on image, that is, whole image is showed apparent black and white The process of effect.The pixel that all gray scales are greater than or equal to threshold value is judged as belonging to certain objects, and gray value is 255 tables Show, otherwise these pixels are excluded other than object area, gray value 0, indicate the object area of background or exception.Such as This, then to both comprising portrait or including the image of background, progress binary conversion treatment, so that it may prominent portrait area.I.e. in two-value Changing portrait area in image is 1, background area 0.According to image to be processed multiplied by original binary image, obtain leaving behind people As the image of main body, the background area other than portrait area is white space.
Step 240, it is synthesized according to the image to be processed after movement and the binary image after movement, obtains portrait master The image in the shadow region of body.
Binary image after movement is the image for obtain after binary conversion treatment to the image to be processed after movement. Similarly, the binary image after movement can also protrude the portrait area in the image to be processed after movement.I.e. in binary picture Portrait area is 1 as in, background area 0.Original binary image and the binary image after movement are overlapped, obtained The binary image of lap.Using the binary image of the binary picture image subtraction lap after movement, portrait is obtained The binary image in the shadow region of main body.Further according to the image to be processed after movement multiplied by portrait main body shadow region two Value image, obtains the image in the shadow region of portrait main body, other regions are white space.
Step 250, the image of portrait main body and the image in the shadow region of portrait main body are synthesized, obtains having and trembles The image of light light effects.
Then the image of the image for leaving behind portrait main body and the shadow for leaving behind portrait main body is synthesized, generates and closes Image after.Just there is the shadow of portrait main body and portrait main body on image after synthesis.This image for forming ghost image, just Referred to as there is the image for trembling light light effects.The pixel value of the background area of resulting image is 0 at this time, accordingly, it is possible to Preset pixel value is filled to the background area of the image, final output had both had prospect (portrait main body and portrait main body Shadow) again with background image.Background area is filled, the background that can choose pure color is filled, such as black Color or white etc..It can certainly be added on the image to final output according to the radiation direction on image to be processed Light efficiency effect, so that background will not be too dull.
In the embodiment of the present application, the original binary image of image to be processed is obtained, by image to be processed, original binaryzation The image mobile preset number pixel on the radiation direction on image to be processed respectively, image to be processed after being moved, Binary image after movement.It is synthesized according to image to be processed and original binary image, obtains the image of portrait main body. It is synthesized according to the image to be processed after movement and the binary image after movement, obtains the figure in the shadow region of portrait main body Picture.The image of portrait main body and the image in the shadow region of portrait main body are synthesized, obtains having and trembles light light effects Image.
By carrying out binary conversion treatment to image to be processed, and then the image of portrait main body is obtained, after to movement Image to be processed carries out binary conversion treatment and then obtains the image in the shadow region of portrait main body.Then again by the figure of portrait main body Picture and the image in the shadow region of portrait main body are synthesized, and just obtain having the image for trembling light light effects, at rich image The diversity of reason.
In one embodiment, step 210, the original binary image of image to be processed is obtained, comprising:
Obtain the depth data of image to be processed;
Portrait segmentation is carried out to image to be processed according to the depth data of image to be processed, obtains the original after portrait segmentation Beginning binary image.
Specifically, the depth data for obtaining image to be processed, when image to be processed, which can be, takes pictures preview screen, and such as It is configured with dual camera on fruit electronic equipment, then can directly realize the depth number for acquiring image to be processed by dual camera According to.
When image to be processed, which can be, takes pictures preview screen, image to be processed can also be acquired by TOF camera Depth data, it is, of course, also possible to obtain the depth data of image to be processed by other methods.TOF is Time of Flight's writes a Chinese character in simplified form, and literal translates as the meaning of flight time.TOF camera is then used by continuously transmitting light pulse to target Sensor receives the light returned from object, obtains object distance by flight (round-trip) time of detecting optical pulses, thus The depth data of image to be processed is acquired by TOF camera.
When being saved in the photo in electronic equipment after image to be processed is to take pictures, it is assumed that originally deep on this photo Degree image contains depth information, then depth data also just can be equally got from photo.
After the depth data for obtaining image to be processed, according to the depth data of image to be processed to image to be processed Portrait segmentation is carried out, the original binary image after portrait segmentation is obtained.Portrait segmentation refer to by picture portrait and Background is separated, and different regions is divided into, and is distinguished with different labels.For example, carrying out portrait to image to be processed Segmentation obtains indicating foreground part (referring exclusively to portrait area at this time) with 1 in the original binary image after portrait is divided, Background parts are indicated with 0.In the embodiment of the present application, the depth data of image to be processed is obtained by different methods, so Portrait segmentation is carried out further according to the depth data of image to be processed afterwards, is portrait area and background area by image segmentation to be processed The original binary image in domain.It is carried out obtaining binary image after portrait segmentation according to depth data, in the binary image The accuracy that portrait and background are separated is high.It is subsequent to carry out portrait segmentation after binary image handle, just into The accuracy of one step guarantee subsequent processing.
In one embodiment, as shown in figure 3, additionally providing a kind of image processing method, it is applied in Fig. 1 in this way Electronic equipment for be illustrated, further includes:
Step 260, the radiation direction on image to be processed is obtained according to the human face region of image to be processed.
In the embodiment of the present application, the direction of current light is certainly existed in every image to be processed, therefore, from figure to be processed Also the direction of the current light on image to be processed is embodied in portrait area as in after progress portrait segmentation.Figure to be processed Portrait area as in after progress portrait segmentation is the portrait part extracted from image to be processed, not from binary picture The portrait area extracted as in.Portrait area may include head zone (including human face region) and body region, from head Region or body region can extract the direction of current light, and specifically, selection is obtained from the human face region of portrait area Take the direction of current light.Because human face region is generally the focus of image attention, and human face region contains more light Information, so only from the direction that can intuitively and accurately get current light on whole image to be processed in human face region, Improve the efficiency and accuracy for obtaining the direction of current light on whole image to be processed.
Therefore a kind of image processing method is additionally provided, firstly, obtaining the original binary image of image to be processed, secondly The radiation direction on image to be processed is obtained according to the human face region of image to be processed.Then again by image to be processed, original two Value image moves preset number pixel, the figure to be processed after being moved on the radiation direction on image to be processed respectively Binary image after picture, movement.It is synthesized according to image to be processed and original binary image, obtains the figure of portrait main body Picture.It is synthesized according to the image to be processed after movement and the binary image after movement, obtains the shadow region of portrait main body Image.Finally, the image of portrait main body and the image in the shadow region of portrait main body are synthesized, obtains having and tremble light light The image of line effect.
In one embodiment, as shown in figure 4, step 260, obtains figure to be processed according to the human face region of image to be processed As upper radiation direction, comprising:
Step 262, the corresponding RGB RGB image of the human face region of image to be processed is transformed into tone by rgb space Saturation degree lightness HSV space obtains the corresponding HSV image of human face region of image to be processed.
The rgb color model and HSV colour model of image are referred here to, the following are the explanations to the two models.
Rgb color model is by the variation to red (Red, R), green (Green, G) blue (Blue, B) three Color Channels And their mutual superpositions obtain various colors.Rgb color mode almost includes human vision institute energy The all colours perceived, and most wide one of color system, the figure that people usually see or shot with terminal are used at present Picture usually RGB image.Rgb color mode is assigned with one using the RGB component that RGB model is each of image pixel Intensity value in 0~255 range.Such as: it be 0, B value is 255 that pure blue R value, which is 0, G value,;Tri- values of RGB of grey are equal (to be removed 0 and 255), white R, G, B value is all 255;R, G, B of black are 0.RGB image, which only uses three kinds of colors, can just make They mix according to different ratios, occur 16777216 kinds of colors on the screen.
HSV colour model is the intuitive nature according to color and a kind of color space created, color in this model Parameter is respectively tone (Hue, H), saturation degree (Saturation, S), lightness (Value, V).Wherein, H is measured with angle, is taken Being worth range is 0 °~360 °, is calculated counterclockwise since red, and red is 0 °, and green is 120 °, and blue is 240 °.It Complementary color be: yellow be 60 °, cyan be 180 °, magenta be 300 °;S indicates color close to the degree of spectrum colour.A kind of face Color can regard the result that certain spectrum colour is mixed with white as.Wherein ratio shared by spectrum colour is bigger, and color is close to spectrum The degree of color is just higher, and the saturation degree of color is also just higher.Saturation degree is high, and color is then deep and gorgeous.The white light ingredient of spectrum colour is 0, saturation degree reaches highest.Usual value range is 0%~100%, and value is bigger, and color is more saturated.Lightness V indicates bright Degree, for light source colour, brightness value is related with the brightness of illuminator;For object color, the transmittance of this value and object or Reflectivity is related.Usual value range is 0% (black) to 100% (white).
For a width RGB image, HSV image can be converted to, RGB image can also be converted to for HSV image.In reality During border is realized, the corresponding RGB RGB image of the human face region of image to be processed can be converted to according to the following steps HSV image:
The value range of the value of R, G, B is modified to 0-1 from 0-255 by step 1.
Here it is possible to be realized by following formula: (1-1) (1-2) (1-3)
R'=R/255 (1-1);
Wherein, in formula (1-1), R indicates the R value of each pixel in RGB image to be processed, and R ' indicates 0-1 range Interior R value.
G'=G/255 (1-2);
Wherein, in formula (1-2), G indicates the G value of each pixel in RGB image to be processed, and G ' indicates 0-1 range Interior G value.
B'=B/255 (1-3);
Wherein, in formula (1-3), B indicates the B value of each pixel in RGB image to be processed, and B ' indicates 0-1 range Interior B value.
Step 2 determines the R ', G ', B that are transformed within the scope of 0-1 ' in maximum value and minimum value and maximum value and most The difference of small value.
Here, R ', G ', B are determined according to formula (1-4) ' in maximum value:
Cmax=max (R', G', B') (1-4);
Wherein, in formula (1-4), Cmax R ', G ', B ' in maximum value, max () is maximizing function.
Determine R ', G ', B according to formula (1-5) ' in minimum value:
Cmin=min (R', G', B') (1-5);
Wherein, in formula (1-5), Cmin R ', G ', B ' in minimum value, min () is function of minimizing.
The difference of maximum value and minimum value is determined according to formula (1-6):
△=Cmax-Cmin (1-6);
Wherein, in formula (1-6), △ is the difference of maximum value and minimum value.
Step 3 calculates H value according to formula (1-7).
Wherein, in formula (1-7), H is the value of the tone H in HSV, and mod is mod function.
Step 4 calculates S value according to formula (1-8).
Wherein, in formula (1-8), S is the value of saturation degree S in HSV.
Step 5 calculates V value according to formula (1-9).
V=Cmax (1-9);
Wherein, in formula (1-9), V is the value of lightness V in HSV.
In the corresponding RGB RGB image of human face region to image to be processed, calculated according to above-mentioned conversion method After corresponding H, S, V value, the corresponding HSV image of human face region of image to be processed has just been obtained.
Step 264, lightness V component is obtained from the corresponding HSV image of the human face region of image to be processed.
After the corresponding HSV image of human face region for having obtained image to be processed, so that it may obtain on the HSV image The corresponding numerical value of lightness V component.
Step 266, the direction of current light is determined according to lightness V component.
Specifically, wherein lightness indicates bright degree, and for light source colour, the brightness of brightness value and illuminator has It closes;Usual value range is 0% (black) to 100% (white).That is the more big then polishing intensity of V value is bigger, the smaller then polishing intensity of V value It is smaller.So according to the lightness V component on the corresponding HSV image of human face region of image to be processed, so that it may determine current The direction of light.
In the embodiment of the present application, after obtaining the RGB image of human face region of image to be processed, by the RGB image HSV image is converted to, so that V component directly can be got from HSV image, determines current light further according to lightness V component The direction of line.The direction that current light is determined by the V component gone out embodied in HSV image, is compared to other methods more It is accurate to add.
In one embodiment, it is synthesized according to image to be processed and original binary image, obtains portrait main body Image, comprising:
According to image to be processed multiplied by original binary image, the image of portrait main body is obtained.
In the embodiment of the present application, portrait segmentation is being carried out to image to be processed, is obtaining the original two-value after portrait segmentation Change in image, foreground part (referring exclusively to portrait area at this time) is indicated with 1, indicates background parts with 0.It therefore, will be to be processed Image just obtains the image of (portrait area) portrait main body multiplied by original binary image.In the image of the portrait main body, in addition to It is all white space except portrait main part.
In one embodiment, as shown in Figure 5A, step 240, according to the image to be processed after movement and two after movement Value image is synthesized, and the image in the shadow region of portrait main body is obtained, comprising:
Step 242, original binary image and the binary image after movement are overlapped, obtain the two of lap Value image;
Step 244, using the binary image of the binary picture image subtraction lap after movement, portrait main body is obtained The binary image in shadow region;
Step 246, it is obtained according to the image to be processed after movement multiplied by the binary image in the shadow region of portrait main body The image in the shadow region of portrait main body.
As shown in Figure 5 B, it to be synthesized according to the image to be processed after movement and the binary image after movement, obtains The schematic diagram of the image in the shadow region of portrait main body.Specifically, after A indicates that original binary image, B indicate mobile in figure Binary image.A ∩ B indicates that original binary image is overlapped with the binary image after movement, obtained lap Binary image.Dotted portion is drawn in B- (A ∩ B) i.e. figure, is indicated using the binary picture image subtraction lap after movement Binary image, obtain the binary image in the shadow region of portrait main body.Finally, being multiplied according to the image to be processed after movement With the binary image B- (A ∩ B) in the shadow region of portrait main body, the image in the shadow region of portrait main body has just been obtained.
In the embodiment of the present application, the image in the shadow region of portrait main body, obtains original binary picture first in order to obtain As being overlapped with the binary image after movement, the binary image of lap is obtained.Then, then using two after movement Value image subtracts the binary image of lap, obtains the binary image in the shadow region of portrait main body.Finally, according to Image to be processed after movement obtains the shadow region of portrait main body multiplied by the binary image in the shadow region of portrait main body Image.Binary image is dexterously used, to also obtain the shadow of portrait main body, most after obtaining portrait main body The shadow of portrait main body and portrait main body is merged again afterwards, has just been obtained with the image for trembling light light effects.
In one embodiment, as shown in fig. 6, additionally providing a kind of image processing method, it is applied in Fig. 1 in this way Electronic equipment for be illustrated, comprising:
Step 610, the original binary image of image to be processed is obtained;
Step 620, image to be processed, original binary image are amplified on the radiation direction on image to be processed respectively Presupposition multiple obtains amplified image to be processed, amplified binary image;
Step 630, it is synthesized according to image to be processed and original binary image, obtains the image of portrait main body;
Step 640, it is synthesized according to amplified image to be processed and amplified binary image, obtains portrait master The image in the shadow region of body;
Step 650, the image of portrait main body and the image in the shadow region of portrait main body are synthesized, obtains having and trembles The image of light light effects.
It is all to the original binary image of image to be processed and image to be processed in previous embodiment in image to be processed On radiation direction on by the way of mobile preset number pixel, thus image to be processed after being moved, move after Binary image.It is synthesized further according to image to be processed and original binary image, obtains the image of portrait main body.According to The binary image after image to be processed and movement after movement is synthesized, and the image in the shadow region of portrait main body is obtained. Finally, the image of portrait main body and the image in the shadow region of portrait main body are synthesized, obtains having and tremble light light effects Image.
In the embodiment of the present application, by image to be processed, original binary image the light side on image to be processed respectively Amplification presupposition multiple upwards, obtains amplified image to be processed, amplified binary image.Similarly, according to figure to be processed Picture and original binary image are synthesized, and the image of portrait main body is obtained.After amplified image to be processed and amplification Binary image synthesized, obtain the image in the shadow region of portrait main body.Finally, by the image and portrait of portrait main body The image in the shadow region of main body is synthesized, and is obtained with the image for trembling light light effects.Equally may be used by the way of amplification To show the shadow of portrait main body and portrait main body.By this image for forming ghost image, referred to as has and tremble light light effects Image.
In one embodiment, as shown in fig. 7, providing a kind of image processing apparatus 700 includes: original binary image Obtain module 710, mobile module 720, the image collection module 730 of portrait main body, portrait main body the image in shadow region obtain Modulus block 740 and synthesis module 750.Wherein,
Original binary image obtains module 710, for obtaining the original binary image of image to be processed;
Mobile module 720, for by image to be processed, original binary image the light side on image to be processed respectively Preset number pixel is moved up, the binary image after image to be processed, movement after being moved;
The image collection module 730 of portrait main body, for being synthesized according to image to be processed and original binary image, Obtain the image of portrait main body;
The image collection module 740 in the shadow region of portrait main body, for according to after movement image to be processed and movement Binary image afterwards is synthesized, and the image in the shadow region of portrait main body is obtained;
Synthesis module 750 is obtained for synthesizing the image of portrait main body and the image in the shadow region of portrait main body To with the image for trembling light light effects.
In one embodiment, original binary image obtains module 710, is also used to obtain the depth number of image to be processed According to;Portrait segmentation is carried out to image to be processed according to the depth data of image to be processed, obtains original two after portrait segmentation Value image.
In one embodiment, as shown in figure 8, providing a kind of image processing apparatus 700 further include: radiation direction obtains Module 760, for obtaining the radiation direction on image to be processed according to the human face region of image to be processed.
In one embodiment, radiation direction obtains module 760, is also used to the human face region of image to be processed is corresponding RGB RGB image is transformed into tone saturation degree lightness HSV space by rgb space, obtains the human face region pair of image to be processed The HSV image answered;Lightness V component is obtained from the corresponding HSV image of human face region of image to be processed;According to lightness V component Determine the direction of current light.
In one embodiment, the image collection module 730 of portrait main body, is also used to according to image to be processed multiplied by original Binary image obtains the image of portrait main body.
In one embodiment, the image collection module 740 in the shadow region of portrait main body is also used to original binaryzation Image is overlapped with the binary image after movement, obtains the binary image of lap;Using the binaryzation after movement Image subtracts the binary image of lap, obtains the binary image in the shadow region of portrait main body;After movement Image to be processed obtains the image in the shadow region of portrait main body multiplied by the binary image in the shadow region of portrait main body.
In one embodiment, as shown in figure 9, providing a kind of image processing apparatus 900 includes: original binary image Obtain module 910, amplification module 920, the image collection module 930 of portrait main body, portrait main body the image in shadow region obtain Modulus block 940 and synthesis module 950.Wherein,
Original binary image obtains module 910, for obtaining the original binary image of image to be processed;
Amplification module 920, for by image to be processed, original binary image the light side on image to be processed respectively Amplification presupposition multiple upwards, obtains amplified image to be processed, amplified binary image;
The image collection module 930 of portrait main body, for being synthesized according to image to be processed and original binary image, Obtain the image of portrait main body;
The image collection module 940 in the shadow region of portrait main body, for according to amplified image to be processed and amplification Binary image afterwards is synthesized, and the image in the shadow region of portrait main body is obtained;
Synthesis module 950 is obtained for synthesizing the image of portrait main body and the image in the shadow region of portrait main body To with the image for trembling light light effects.
The division of modules is only used for for example, in other embodiments, can will scheme in above-mentioned image processing apparatus As processing unit is divided into different modules as required, to complete all or part of function of above-mentioned image processing apparatus.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated The step of image processing method provided by the various embodiments described above is realized when machine program is executed by processor.
In one embodiment, a kind of electronic equipment is provided, including memory, processor and storage are on a memory simultaneously The computer program that can be run on a processor, processor realize figure provided by the various embodiments described above when executing computer program As the step of processing method.
The embodiment of the present application also provides a kind of computer program products, when run on a computer, so that calculating Machine executes the step of image processing method provided by the various embodiments described above.
The embodiment of the present application also provides a kind of electronic equipment.The electronic equipment can be include mobile phone, tablet computer, PDA (Personal Digital Assistant, personal digital assistant), POS (Point of Sales, point-of-sale terminal), vehicle mounted electric Any terminal device such as brain, wearable device, by taking electronic equipment is mobile phone as an example: including image procossing electricity in above-mentioned electronic equipment Road, image processing circuit can use hardware and or software component realization, it may include define ISP (Image Signal Processing, image signal process) pipeline various processing units.Figure 10 is that image processing circuit shows in one embodiment It is intended to.As shown in Figure 10, for purposes of illustration only, only showing the various aspects of image processing techniques relevant to the embodiment of the present application.
As shown in Figure 10, image processing circuit includes the first ISP processor 1030, the 2nd ISP processor 1040 and control Logic device 1050.First camera 1010 includes one or more first lens 1012 and the first imaging sensor 1014.First Imaging sensor 1014 may include colour filter array (such as Bayer filter), and the first imaging sensor 1014 can be obtained with first The luminous intensity and wavelength information that each imaging pixel of imaging sensor 1014 captures, and providing can be by the first ISP processor One group of image data of 1030 processing.Second camera 1020 includes one or more second lens 1022 and the second image sensing Device 1024.Second imaging sensor 1024 may include colour filter array (such as Bayer filter), and the second imaging sensor 1024 can Luminous intensity and wavelength information that each imaging pixel of the second imaging sensor 1024 captures are obtained, and providing can be by second One group of image data of the processing of ISP processor 1040.
First image transmitting of the first camera 1010 acquisition is handled to the first ISP processor 1030, at the first ISP It, can be by statistical data (brightness of such as image, the contrast value of image, the image of the first image after managing the first image of processing of device 1030 Color etc.) be sent to control logic device 1050, control logic device 1050 can determine the first camera 1010 according to statistical data Control parameter, so that the first camera 1010 can carry out auto-focusing, the operation such as automatic exposure according to control parameter.First figure As that can store after the first ISP processor 1030 is handled into video memory 1060, the first ISP processor 1030 The image that stores in video memory 1060 can be read with to handling.In addition, the first image passes through ISP processor 1030 It can be sent directly to display 1070 after being handled and shown that display 1070 can also be read in video memory 1060 Image to be shown.
Wherein, the first ISP processor 1030 handles image data pixel by pixel in various formats.For example, each image Pixel can have the bit depth of 8,10,12 or 14 bits, and the first ISP processor 1030 can carry out image data one or more The statistical information of image processing operations, collection about image data.Wherein, image processing operations can be by identical or different locating depth Computational accuracy is spent to carry out.
Video memory 1060 can be independent special in a part, storage equipment or electronic equipment of memory device It with memory, and may include DMA (Direct Memory Access, direct direct memory access (DMA)) feature.
When receiving from the first 1014 interface of imaging sensor, the first ISP processor 1030 can carry out one or more A image processing operations, such as time-domain filtering.Image data that treated can be transmitted to video memory 1060, so as to shown Other processing is carried out before.First ISP processor 1030 receives processing data from video memory 1060, and to processing data Carry out the image real time transfer in RGB and YCbCr color space.Treated that image data can be defeated for first ISP processor 1030 Out to display 1070, so that user watches and/or by graphics engine or GPU (Graphics Processing Unit, figure Processor) it is further processed.In addition, the output of the first ISP processor 1030 also can be transmitted to video memory 1060, and show Device 1070 can read image data from video memory 1060.In one embodiment, video memory 1060 can be configured to Realize one or more frame buffers.
The statistical data that first ISP processor 1030 determines can be transmitted to control logic device 1050.For example, statistical data can Including automatic exposure, automatic white balance, automatic focusing, flicker detection, black level compensation, 1012 shadow correction of the first lens etc. the One imaging sensor, 1014 statistical information.Control logic device 1050 may include executing the processing of one or more routines (such as firmware) Device and/or microcontroller, one or more routines can statistical data based on the received, determine the control ginseng of the first camera 1010 Several and the first ISP processor 1030 control parameter.For example, the control parameter of the first camera 1010 may include gain, exposure Time of integration of control, stabilization parameter, flash of light control parameter, 1012 control parameter of the first lens (such as focus or zoom coke Away from) or the combination of these parameters etc..ISP control parameter may include for automatic white balance and color adjustment (for example, at RGB During reason) 1012 shadow correction parameter of gain level and color correction matrix and the first lens.
Similarly, the second image transmitting that second camera 1020 acquires is handled to the 2nd ISP processor 1040, the After two ISP processors 1040 handle the first image, can by the statistical data of the second image (brightness of such as image, image contrast Value, color of image etc.) it is sent to control logic device 1050, control logic device 1050 can determine the second camera shooting according to statistical data First 1020 control parameter, so that second camera 1020 can carry out the operation such as auto-focusing, automatic exposure according to control parameter. Second image can store after the 2nd ISP processor 1040 is handled into video memory 1060, the 2nd ISP processor 1040 can also read the image that stores in video memory 1060 with to handling.In addition, the second image is handled by ISP Device 1040 can be sent directly to display 1070 after being handled and be shown, display 1070 can also read video memory Image in 1060 is to be shown.Second camera 1020 and the 2nd ISP processor 1040 also may be implemented such as the first camera shooting First 1010 and the first treatment process described in ISP processor 1030.
The following are realize image processing method with image processing techniques in Figure 10.
Any reference to memory, storage, database or other media used in this application may include non-volatile And/or volatile memory.Suitable nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), Electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include arbitrary access Memory (RAM), it is used as external cache.By way of illustration and not limitation, RAM is available in many forms, such as It is static RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM).
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously The limitation to the application the scope of the patents therefore cannot be interpreted as.It should be pointed out that for those of ordinary skill in the art For, without departing from the concept of this application, various modifications and improvements can be made, these belong to the guarantor of the application Protect range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.

Claims (10)

1. a kind of image processing method characterized by comprising
Obtain the original binary image of image to be processed;
The image to be processed, the original binary image are moved on the radiation direction on the image to be processed respectively Preset number pixel, the binary image after image to be processed, movement after being moved;
It is synthesized according to the image to be processed and the original binary image, obtains the image of portrait main body;
It is synthesized according to the image to be processed after the movement and the binary image after the movement, obtains the portrait master The image in the shadow region of body;
The image of the portrait main body and the image in the shadow region of the portrait main body are synthesized, obtains having and trembles light light The image of line effect.
2. the method according to claim 1, wherein the original binary image for obtaining image to be processed, Include:
Obtain the depth data of the image to be processed;
Portrait segmentation is carried out to the image to be processed according to the depth data of the image to be processed, after obtaining portrait segmentation Original binary image.
3. the method according to claim 1, wherein the method also includes:
The radiation direction on the image to be processed is obtained according to the human face region of the image to be processed.
4. according to the method described in claim 3, it is characterized in that, described obtain according to the human face region of the image to be processed Radiation direction on the image to be processed, comprising:
It is bright that the corresponding RGB RGB image of the human face region of the image to be processed by rgb space is transformed into tone saturation degree HSV space is spent, the corresponding HSV image of human face region of the image to be processed is obtained;
Lightness V component is obtained from the corresponding HSV image of human face region of the image to be processed;
The direction of current light is determined according to the lightness V component.
5. the method according to claim 1, wherein described according to the image to be processed and the original two-value Change image to be synthesized, obtain the image of portrait main body, comprising:
According to the image to be processed multiplied by the original binary image, the image of portrait main body is obtained.
6. the method according to claim 1, wherein the image to be processed according to after the movement and described Binary image after movement is synthesized, and the image in the shadow region of the portrait main body is obtained, comprising:
The original binary image is overlapped with the binary image after the movement, obtains the binaryzation of lap Image;
Using the binary image of lap described in the binary picture image subtraction after the movement, the portrait main body is obtained The binary image in shadow region;
According to the image to be processed after the movement multiplied by the binary image in the shadow region of the portrait main body, obtain described The image in the shadow region of portrait main body.
7. a kind of image processing method characterized by comprising
Obtain the original binary image of image to be processed;
The image to be processed, the original binary image are amplified on the radiation direction on the image to be processed respectively Presupposition multiple obtains amplified image to be processed, amplified binary image;
It is synthesized according to the image to be processed and the original binary image, obtains the image of portrait main body;
It is synthesized according to the amplified image to be processed and the amplified binary image, obtains the portrait master The image in the shadow region of body;
The image of the portrait main body and the image in the shadow region of the portrait main body are synthesized, obtains having and trembles light light The image of line effect.
8. a kind of image processing apparatus, which is characterized in that described device includes:
Original binary image obtains module, for obtaining the original binary image of image to be processed;
Mobile module, for by the image to be processed, the original binary image respectively on the image to be processed Mobile preset number pixel on radiation direction, the binary image after image to be processed, movement after being moved;
The image collection module of portrait main body, for being closed according to the image to be processed and the original binary image At obtaining the image of portrait main body;
The image collection module in the shadow region of portrait main body, for according to after the movement image to be processed and the movement Binary image afterwards is synthesized, and the image in the shadow region of the portrait main body is obtained;
Synthesis module, for the image of the portrait main body and the image in the shadow region of the portrait main body to be synthesized, It obtains with the image for trembling light light effects.
9. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program quilt The step of image processing method as described in any one of claims 1 to 7 is realized when processor executes.
10. a kind of electronic equipment including memory, processor and stores the calculating that can be run on a memory and on a processor Machine program, which is characterized in that the processor is realized described in any one of claims 1 to 7 when executing the computer program Image processing method the step of.
CN201811142884.9A 2018-09-28 2018-09-28 Image processing method and device, storage medium and electronic equipment Active CN109447925B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811142884.9A CN109447925B (en) 2018-09-28 2018-09-28 Image processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811142884.9A CN109447925B (en) 2018-09-28 2018-09-28 Image processing method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN109447925A true CN109447925A (en) 2019-03-08
CN109447925B CN109447925B (en) 2021-07-09

Family

ID=65544645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811142884.9A Active CN109447925B (en) 2018-09-28 2018-09-28 Image processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN109447925B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112686122A (en) * 2020-12-25 2021-04-20 浙江大华技术股份有限公司 Human body and shadow detection method, device, electronic device and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060274064A1 (en) * 2005-06-01 2006-12-07 Microsoft Corporation System for softening images in screen space
CN101071511A (en) * 2007-06-26 2007-11-14 腾讯科技(深圳)有限公司 Shadow drawing method and device
CN101136108A (en) * 2007-09-26 2008-03-05 腾讯科技(深圳)有限公司 Shadows plotting method and rendering device thereof
US7439975B2 (en) * 2001-09-27 2008-10-21 International Business Machines Corporation Method and system for producing dynamically determined drop shadows in a three-dimensional graphical user interface
US7764286B1 (en) * 2006-11-01 2010-07-27 Adobe Systems Incorporated Creating shadow effects in a two-dimensional imaging space
CN102365657A (en) * 2009-03-27 2012-02-29 汤姆森特许公司 Method for generating shadows in an image
CN104123743A (en) * 2014-06-23 2014-10-29 联想(北京)有限公司 Image shadow adding method and device
CN104851122A (en) * 2015-05-08 2015-08-19 北京金山安全软件有限公司 Method and device for generating shadow special effect graph
CN104933746A (en) * 2015-05-21 2015-09-23 广东欧珀移动通信有限公司 Method and device for setting dynamic shadow for plane image
CN108525298A (en) * 2018-03-26 2018-09-14 广东欧珀移动通信有限公司 Image processing method, device, storage medium and electronic equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7439975B2 (en) * 2001-09-27 2008-10-21 International Business Machines Corporation Method and system for producing dynamically determined drop shadows in a three-dimensional graphical user interface
US20060274064A1 (en) * 2005-06-01 2006-12-07 Microsoft Corporation System for softening images in screen space
US7764286B1 (en) * 2006-11-01 2010-07-27 Adobe Systems Incorporated Creating shadow effects in a two-dimensional imaging space
CN101071511A (en) * 2007-06-26 2007-11-14 腾讯科技(深圳)有限公司 Shadow drawing method and device
CN101136108A (en) * 2007-09-26 2008-03-05 腾讯科技(深圳)有限公司 Shadows plotting method and rendering device thereof
CN102365657A (en) * 2009-03-27 2012-02-29 汤姆森特许公司 Method for generating shadows in an image
CN104123743A (en) * 2014-06-23 2014-10-29 联想(北京)有限公司 Image shadow adding method and device
CN104851122A (en) * 2015-05-08 2015-08-19 北京金山安全软件有限公司 Method and device for generating shadow special effect graph
CN104933746A (en) * 2015-05-21 2015-09-23 广东欧珀移动通信有限公司 Method and device for setting dynamic shadow for plane image
CN108525298A (en) * 2018-03-26 2018-09-14 广东欧珀移动通信有限公司 Image processing method, device, storage medium and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
孙俊: "《光谱技术在农作物/农产品信息无损检测中的应用》", 30 June 2017, 东南大学出版社 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112686122A (en) * 2020-12-25 2021-04-20 浙江大华技术股份有限公司 Human body and shadow detection method, device, electronic device and storage medium
CN112686122B (en) * 2020-12-25 2023-09-29 浙江大华技术股份有限公司 Human body and shadow detection method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109447925B (en) 2021-07-09

Similar Documents

Publication Publication Date Title
CN109767467A (en) Image processing method, device, electronic equipment and computer readable storage medium
EP3542347B1 (en) Fast fourier color constancy
CN107730445A (en) Image processing method, device, storage medium and electronic equipment
CN110149482A (en) Focusing method, device, electronic equipment and computer readable storage medium
CN109089047A (en) Control method and apparatus, the storage medium, electronic equipment of focusing
CN108055452A (en) Image processing method, device and equipment
CN107945107A (en) Image processing method, device, computer-readable recording medium and electronic equipment
CN108009999A (en) Image processing method, device, computer-readable recording medium and electronic equipment
CN107862657A (en) Image processing method, device, computer equipment and computer-readable recording medium
CN107800965B (en) Image processing method, device, computer readable storage medium and computer equipment
CN110536068A (en) Focusing method and device, electronic equipment, computer readable storage medium
CN108012078A (en) Brightness of image processing method, device, storage medium and electronic equipment
CN108712608A (en) Terminal device image pickup method and device
CN107911625A (en) Light measuring method, device, readable storage medium storing program for executing and computer equipment
CN107509031A (en) Image processing method, device, mobile terminal and computer-readable recording medium
CN110349163A (en) Image processing method and device, electronic equipment, computer readable storage medium
CN110191287A (en) Focusing method and device, electronic equipment, computer readable storage medium
CN107993209A (en) Image processing method, device, computer-readable recording medium and electronic equipment
CN109712177A (en) Image processing method, device, electronic equipment and computer readable storage medium
CN109685853A (en) Image processing method, device, electronic equipment and computer readable storage medium
CN110248101A (en) Focusing method and device, electronic equipment, computer readable storage medium
CN108156369A (en) Image processing method and device
CN108322651A (en) Image pickup method and device, electronic equipment, computer readable storage medium
CN115550570B (en) Image processing method and electronic equipment
CN107920205B (en) Image processing method, device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant