Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair
Embodiment in bright, the every other implementation that those of ordinary skill in the art are obtained without creative efforts
Example, shall fall within the protection scope of the present invention.
It is the flow chart of image processing method provided in an embodiment of the present invention referring to Fig. 2, Fig. 2, is applied to include camera
Electronic equipment, as shown in Fig. 2, including the following steps:
Step 201 obtains the first image and the second image for corresponding to different shooting angles.
In the embodiment of the present invention, the acquisition of above-mentioned first image and the second image can determine electronic equipment in user
In when taking pictures across glass, the camera of electronic equipment corresponds to the image being continuously shot under different shooting angles, either
Electronic equipment is in the image corresponded under different shooting angles intercepted under dynamic interface.Wherein, above-mentioned first image is to use
Family needs the image obtained.In addition, it is necessary to explanation, above-mentioned first image and the second image can be electronic equipments in dynamic
The realtime graphic for obtaining and caching under preview interface can also be to be stored in corresponding under different shooting angles in electronic equipment
Non-real-time images.
Step 202, according to described first image and second image, determine the retroreflective regions in described first image.
It is same due to the variation of shooting angle according to the image-forming principle of camera in electronic equipment in the embodiment of the present invention
Object the first image in the second image position and/or shape can change, simultaneously as glass and window to be captured
Outer object is different at a distance from camera, and the object outside window of shooting is with the retroreflective regions because of glass generation in the first image and second
The variable quantity of position and/or shape in image is all different.Since glass is closer apart from electronic equipment, retroreflective regions exist
First image and the variable quantity of position and/or shape in the second image can be respectively greater than outside window object in the first image and the
The variable quantity of position and/or shape in two images.
Meanwhile the change of shooting angle can't change when camera is taken pictures that aperture and light intensity etc. can be with influence diagrams
The factor that the gray value of pixel changes as in, then being averaged between the region with same object in the first image and the second image
Gray value is identical or difference is smaller, and the coverage of the first image and the second image is constant, i.e. the first image and the second figure
As coordinate having the same is distributed.
It therefore, in embodiments of the present invention, can be by edge detection by the first image and second according to above principle
Image segmentation obtains the difference with average gray value in the second image in the first image at the subregion with different average gray values
Value is less than or equal to two sub-regions of predetermined threshold value as target area pair, compares the sub-district of the first image of target area centering
The variable quantity of position and/or shape between domain and the subregion of the second image, when the variable quantity is more than corresponding threshold value, then
Determine that the subregion of the first image is retroreflective regions.
Step 203 carries out image repair to the retroreflective regions in described first image.
In the embodiment of the present invention, when above-mentioned steps 202 determine the retroreflective regions in the first image, electronic equipment can profit
The image of retroreflective regions is repaired with various image repair methods.Wherein, above-mentioned image repair method can be:Missing figure
As various image repair algorithms such as complementing method, interpolation method and cellular automata algorithms, due to above-mentioned image repair method
Realization principle is known to those skilled in the art, is no longer repeated herein.
In the embodiment of the present invention, above-mentioned electronic equipment any can have the electronic equipment of camera, such as:Mobile phone is put down
Plate computer (Tablet Personal Computer), laptop computer (Laptop Computer), personal digital assistant
(personal digital assistant, abbreviation PDA), mobile Internet access device (Mobile Internet Device, MID)
Or the mobile terminals and camera etc. such as wearable device (Wearable Device).
The image processing method of the embodiment of the present invention, by comparing the first image for being obtained under different shooting angles and the
Two images, it may be determined that the retroreflective regions in the first image, to be repaired to the retroreflective regions in the first image.In this way may be used
With retroreflective regions carry out image repair in the photo that glass is shot to electronic equipment, the photo of electronic equipment shooting is promoted
Quality.
It is the flow chart of image processing method provided in an embodiment of the present invention referring to Fig. 3, Fig. 3, is applied to include camera
Electronic equipment, as shown in figure 3, including the following steps:
Step 301 obtains the first image and the second image for corresponding to different shooting angles.
In the embodiment of the present invention, the acquisition of above-mentioned first image and the second image can determine electronic equipment in user
In when taking pictures across glass, the image that the camera of electronic equipment is continuously shot under two different shooting angles, either
Electronic equipment is in the image under two different shooting angles intercepted under dynamic interface, is not defined herein.Wherein, on
It is that user needs the image obtained to state the first image.
In addition, be in dynamic previewing interface in electronic equipment, and when camera gets the first image, electronic equipment can be shown
Show prompt message, to prompt user to adjust the shooting angle of camera in preset time, is completed when user adjusts shooting angle
When, camera obtains the second image.In this way, electronic equipment can obtain corresponding to different angle within a preset time interval
One image and the second image avoid the longer object variation outside window for causing to shoot in the first image and the second image of time interval
Greatly, so that it is guaranteed that the accuracy of image repair.
Step 302, the average gray value for detecting described first image and all area to be tested in second image.
In the embodiment of the present invention, when above-mentioned steps 301 get the first image and the second image, electronic equipment can lead to
Cross image segmentation algorithm using the first image and the second image be divided into respectively multiple regions with different average gray values as
Area to be tested, and detect the average gray value of each area to be tested in the first image and the second image.Wherein, above-mentioned image point
It may include the partitioning algorithm based on threshold value, the partitioning algorithm based on edge and the partitioning algorithm etc. based on region to cut algorithm,
The realization principle of each algorithm is known to those skilled in the art, is no longer repeated herein.
Step 303, the target area pair for determining pending comparison according to testing result, wherein the target area is to packet
The second area for including the first area for belonging to the first image and belonging to the second image, and the average gray value of the first area with
The difference of the average gray value of the second area is less than or equal to predetermined threshold value.
In the embodiment of the present invention, the above-mentioned target area pair for determining pending comparison according to testing result, Ke Yishi:By
Each area to be tested is compared with each area to be tested in the second image successively respectively in one image, is obtained in the first image
Area to be tested has the target that the difference of average gray value is less than or equal to predetermined threshold value with area to be tested in the second image
Region pair, then the area to be tested of first image of target area centering is first area, and the area to be tested of the second image is
Second area.
Certainly, the above-mentioned target area pair for determining pending comparison according to testing result can also be:Electronic equipment is based on
The average gray value of each area to be tested in first image and the second image establishes area to be tested and the second figure in the first image
The relation mapping table of area to be tested as in, in the relation mapping table there are area to be tested in the first image of mapping relations and
The difference of the average gray value of area to be tested is less than or equal to predetermined threshold value in second image, and there are mapping relations for setting
Area to be tested in two figures is target area pair, and the area to be tested of the first image of target area centering is first area,
The area to be tested of second image is second area.
It should be noted that since the first image and the second image are the image being continuously shot, the first image and the second figure
The average gray value of same target is roughly the same as in, in this way, it may be determined that the first area and second of each target area centering
Region has same object.Wherein, the same object that above-mentioned first area and second area have can be understood as object outside window
Or the reflective hot spot of composition retroreflective regions.
Step 304 is compared the first area and the second area, determines described first based on comparative result
Region is retroreflective regions.
It is same due to the variation of shooting angle according to the image-forming principle of camera in electronic equipment in the embodiment of the present invention
Object the first image in the second image position and/or shape can change, simultaneously as glass and window to be captured
Outer object is different at a distance from camera, and the object outside window of shooting is with the retroreflective regions because of glass generation in the first image and second
The variable quantity of position and/or shape in image is all different.Since glass is closer apart from electronic equipment, retroreflective regions exist
First image and the variable quantity of position and/or shape in the second image can be respectively greater than outside window object in the first image and the
The variable quantity of position and/or shape in two images.
Optionally, above-mentioned steps 304 may include:Judge that the center between the first area and the second area is sat
Whether the difference of scale value is more than first threshold, if so, determining that the first area is retroreflective regions.
In the embodiment of the present invention, as shown in Figure 4 A, shot under the first angle that electronic equipment A is formed between glass B
The first image C is obtained, and C includes the first area D due to the reflective formation of glass surface;As shown in Figure 4 B, electronic equipment A with
Shooting obtains the second image C ' under the second angle formed between glass B, and C ' includes the secondth area of the reflective formation of glass surface
Domain D ', and can determine that first area D and second area D ' is target area pair by above-mentioned steps 303, electronic equipment can obtain
The difference for taking the centre coordinate value between first area D and second area D ', when the difference is more than first threshold, it is determined that the
One region D is retroreflective regions.
Wherein, above-mentioned first threshold can be preset fixed value, can also be to preset and taken with camera
Focal length when scape is preset with the corresponding fixed value of the focal length under that is, each focal length, works as camera shooting there are the dynamic value of mapping relations
When the focal length variations of head, first threshold also changes, and the shorter first threshold of focal length is smaller, and focal length is longer, and first threshold is bigger.
Optionally, above-mentioned steps 304 may include:Judge the area surface between the first area and the second area
Whether long-pending difference is more than second threshold, if so, determining that the first area is retroreflective regions.
In the embodiment of the present invention, in Fig. 4 A and Fig. 4 B, electronic equipment can obtain between first area D and second area D '
Region area difference, when the difference be more than second threshold when, it is determined that first area D be retroreflective regions.Wherein, above-mentioned
Two threshold values can be preset fixed value, can also be focal length presence mapping pass when presetting and finding a view with camera
The dynamic value of system is preset with the corresponding fixed value of the focal length under that is, each focal length, when the focal length variations of camera, the second threshold
Value also changes, and the shorter second threshold of focal length is smaller, and focal length is longer, and first threshold is bigger.
Step 305 carries out image repair to the retroreflective regions in described first image.
In the embodiment of the present invention, in the embodiment of the present invention, when above-mentioned steps 202 determine the retroreflective regions in the first image
When, electronic equipment can carry out image repair using the retroreflective regions in the first image of image repair method pair.Wherein, above-mentioned figure
As restorative procedure may include the image repairs algorithm such as missing image complementing method and interpolation method.Such as:Utilize missing image
Complementing method repairs the retroreflective regions in the first image, can be by by area identical with the retroreflective regions position in the second image
In the object map in domain to the retroreflective regions.
Optionally, above-mentioned steps 305 may include:By cellular automata algorithm to the reflective areas in described first image
Domain carries out image repair.
In the embodiment of the present invention, cellular automata is the model that iteration is updated using neighborhood, at random from eight neighbours
In select one it is non-missing cellular replace missing cellular, the image of retroreflective regions is repaiied using cellular automata algorithm
Multiple, by the object map in region adjacent with retroreflective regions in the first image to retroreflective regions, rule is as follows:
If cellular x is the cellular of non-missing image part, the t+1 moment extracts a non-missing from 8 neighbours at random
Partial cellular replaces:
Kt+i=random (St), St ∈ f (kt),
Wherein, k is the cellular of lack part, and S is the cellular of non-lack part, and f (kt) is neighbours' cellular of kt;
Using asynchronous refresh, cellular is from left to right gradually replaced from bottom to top according to the sequence of scanning;Lack part
Cellular become the part of non-missing after non-missing neighbours substitute, it is and another if certain missing cellular x is replaced in t moment
Missing cellular y is the neighbours of x, and when y is when being replaced at the t+1 moment, x is considered to belong to the cellular of non-missing in y neighbours;It loses
The cellular asynchronous refresh of image, all cellular updates are once used as an iteration.
Assuming that the first image is divided into grid, as shown in figure 5, the gray area of label 5 is missing image part in Fig. 5
Cellular i.e. the first image in retroreflective regions, the region of label 1 to 4 and label 6 to 9 is cellular i.e. first of non-certain part
Non- retroreflective regions in image, according to above-mentioned rule, random selection reflects one in label 1 to 4 and the corresponding cellular of label 6 to 9
Label 5 is incident upon to one cellular, the object of photosensitive region is replaced by the object outside window of the shooting of adjacent area, realizes to the
The reparation of retroreflective regions in one image.In this way, by successive ignition, the image of retroreflective regions shown in FIG. 1 can be repaiied
It is multiple, the effect after being repaired as shown in Figure 6.
Optionally, described first image and second image buffer storage be in the electronic equipment, above-mentioned steps 305 it
Afterwards, it can also include the second image-erasing that will be cached.In this way, electronic equipment can be by the first image of caching and second
The comparison of image obtains the retroreflective regions in the first image, and deletes the second image of caching, realizes the photograph to shooting
The image of retroreflective regions is repaired in real time in piece, and saves the memory space of electronic equipment.
The image processing method of the embodiment of the present invention, by detecting the first image for being obtained under different shooting angles and the
The average gray value of all area to be tested of two images determines the target area pair of pending comparison according to testing result, right
The first area and the second area are compared, and determine that the first area is retroreflective regions based on comparative result.
In this way can to electronic equipment in the photo that glass is shot retroreflective regions carry out image repair, promoted electronic equipment shooting
The quality of photo.
It is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention referring to Fig. 7, Fig. 7, as shown in fig. 7, should
Electronic equipment 700 includes image collection module 701, retroreflective regions determining module 702 and image repair module 703:
Image collection module 701, for obtaining the first image and the second image corresponding to different shooting angles;
Retroreflective regions determining module 702, for according to described first image and second image, determining first figure
Retroreflective regions as in;
Image repair module 703, for carrying out image repair to the retroreflective regions in described first image.
Optionally, as shown in figure 8, the retroreflective regions determining module 702 may include:
Average gray value detection unit 7021, it is all to be checked in described first image and second image for detecting
Survey the average gray value in region;
Target area is to determination unit 7022, the target area pair for determining pending comparison according to testing result, institute
Target area is stated to including belonging to the first area of the first image and belonging to the second area of the second image, and the first area
The difference of average gray value of average gray value and the second area be less than or equal to predetermined threshold value;
Retroreflective regions determination unit 7023, for being compared to the first area and the second area, based on than
Relatively result determines that the first area is retroreflective regions.
Optionally, the retroreflective regions determination unit 7023 can be also used for judging the first area and secondth area
Whether the difference of the centre coordinate value between domain is more than first threshold, if so, determining that the first area is retroreflective regions.
Optionally, the retroreflective regions determination unit 7023 can be also used for judging the first area and secondth area
Whether the difference of the region area between domain is more than second threshold, if so, determining that the first area is retroreflective regions.
Optionally, described image repair module 703 can be also used for through cellular automata algorithm to described first image
In retroreflective regions carry out image repair.
Optionally, described first image and second image buffer storage are in the electronic equipment, as shown in figure 9, described
Electronic equipment 700 can also include:
Image-erasing module 704, for described image repair module 703 to the retroreflective regions in described first image into
After row image repair, by the second image-erasing of caching.
Electronic equipment 700 can realize each process that electronic equipment is realized in the embodiment of the method for Fig. 1 to Fig. 6, to keep away
Exempt to repeat, which is not described herein again.
The electronic equipment 700 of the embodiment of the present invention, by comparing the first image for being obtained under different shooting angles and the
Two images, it may be determined that the retroreflective regions in the first image, to be repaired to the retroreflective regions in the first image.In this way may be used
With retroreflective regions carry out image repair in the photo that glass is shot to electronic equipment, the photo of electronic equipment shooting is promoted
Quality.
It is a kind of structural schematic diagram of mobile terminal provided in an embodiment of the present invention referring to Figure 10, Figure 10, as shown in Figure 10,
Mobile terminal 1000 includes:At least one processor 1010, memory 1020, at least one network interface 1040 and user interface
1030.Various components in mobile terminal 1000 are coupled by bus system 1050.It is understood that bus system 1050 is used
Connection communication between realizing these components.Bus system 1050 further includes power bus, control in addition to including data/address bus
Bus and status signal bus in addition processed.But for the sake of clear explanation, various buses are all designated as bus system in Fig. 10
1050.Mobile terminal 1000 further includes camera 1060.In addition, camera 1060 passes through bus system 1050 and mobile terminal
Various components connect.
Wherein, user interface 1030 may include display, keyboard or pointing device (for example, mouse, trace ball
(trackball), touch-sensitive plate or touch screen etc..
It is appreciated that the memory 1020 in the embodiment of the present invention can be volatile memory or non-volatile memories
Both device, or may include volatile and non-volatile memory.Wherein, nonvolatile memory can be read-only memory
(Read-Only Memory, ROM), programmable read only memory (Programmable ROM, PROM), erasable programmable are only
Read memory (Erasable PROM, EPROM), electrically erasable programmable read-only memory (Electrically EPROM,
) or flash memory EEPROM.Volatile memory can be random access memory (Random Access Memory, RAM), use
Make External Cache.By exemplary but be not restricted explanation, the RAM of many forms is available, such as static random-access
Memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random-access
Memory (Synchronous DRAM, SDRAM), double data speed synchronous dynamic RAM (Double Data
Rate SDRAM, DDRSDRAM), it is enhanced Synchronous Dynamic Random Access Memory (Enhanced SDRAM, ESDRAM), synchronous
Connect dynamic random access memory (Synch Link DRAM, SLDRAM) and direct rambus random access memory
(Direct Rambus RAM, DRRAM).The memory 1020 of system and method described herein be intended to including but not limited to this
A little and any other suitable type memory.
In some embodiments, memory 1020 stores following element, executable modules or data structures, or
Their subset of person or their superset:Operating system 1021 and application program 1022.
Wherein, operating system 1021, including various system programs, such as ccf layer, core library layer, driving layer etc., are used for
Realize various basic businesses and the hardware based task of processing.Application program 1022, including various application programs, such as media
Player (Media Player), browser (Browser) etc., for realizing various applied business.Realize the embodiment of the present invention
The program of method may be embodied in application program 1022.
In embodiments of the present invention, by the program for calling memory 1020 to store or instruction, specifically, can be application
The program stored in program 1022 or instruction, processor 1010 are used for:Obtain corresponding to different shooting angles the first image and
Second image;According to described first image and second image, the retroreflective regions in described first image are determined;To described
Retroreflective regions in one image carry out image repair.
The method that the embodiments of the present invention disclose can be applied in processor 1010, or real by processor 1010
It is existing.Processor 1010 may be a kind of IC chip, the processing capacity with signal.During realization, the above method
Each step can be completed by the instruction of the integrated logic circuit of the hardware in processor 1010 or software form.Above-mentioned
Processor 1010 can be general processor, digital signal processor (Digital Signal Processor, DSP), special
Integrated circuit (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components.It may be implemented or execute disclosed each method, step and the logic diagram in the embodiment of the present invention.It is general
Processor can be microprocessor or the processor can also be any conventional processor etc..In conjunction with institute of the embodiment of the present invention
The step of disclosed method, can be embodied directly in hardware decoding processor and execute completion, or with the hardware in decoding processor
And software module combination executes completion.Software module can be located at random access memory, and flash memory, read-only memory may be programmed read-only
In the storage medium of this fields such as memory or electrically erasable programmable memory, register maturation.The storage medium is located at
The step of memory 1020, processor 1010 reads the parameter in memory 1020, the above method is completed in conjunction with its hardware.
It is understood that embodiments described herein can use hardware, software, firmware, middleware, microcode or its
It combines to realize.For hardware realization, processing unit may be implemented in one or more application-specific integrated circuit (Application
Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal Processing,
DSP), digital signal processing appts (DSP Device, DSPD), programmable logic device (Programmable Logic
Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general processor,
In controller, microcontroller, microprocessor, other electronic units for executing herein described function or combinations thereof.
For software implementations, it can be realized herein by executing the module (such as process, function etc.) of function described herein
The technology.Software code is storable in memory and is executed by processor.Memory can in the processor or
It is realized outside processor.
Optionally, processor 1010 executes described according to described first image and second image, determines described first
Retroreflective regions in image, including:
Detect the average gray value of described first image and all area to be tested in second image;
The target area pair of pending comparison is determined according to testing result, wherein the target area is to including belonging to the
The first area of one image and the second area for belonging to the second image, and the average gray value of the first area and described second
The difference of the average gray value in region is less than or equal to predetermined threshold value;
The first area and the second area are compared, determine that the first area is anti-based on comparative result
Light region.
Optionally, processor 1010 execute it is described the first area and the second area are compared, based on than
Relatively result determines that the first area is retroreflective regions, including:
Judge whether the difference of the centre coordinate value between the first area and the second area is more than first threshold,
If so, determining that the first area is retroreflective regions.
Optionally, processor 1010 execute it is described the first area and the second area are compared, based on than
Relatively result determines that the first area is retroreflective regions, including:
Judge whether the difference of the region area between the first area and the second area is more than second threshold, if
It is, it is determined that the first area is retroreflective regions.
Optionally, processor 1010 executes the retroreflective regions in described first image and carries out image repair, including:
Image repair is carried out to the retroreflective regions in described first image by cellular automata algorithm.
Optionally, processor 1010 executes described first image and second image buffer storage in the electronic equipment,
After the retroreflective regions in described first image carry out image repair, further include:
By the second image-erasing of caching.
The mobile terminal 1000 of the embodiment of the present invention, by comparing the first image for being obtained under different shooting angles and the
Two images, it may be determined that the retroreflective regions in the first image, to be repaired to the retroreflective regions in the first image.In this way may be used
With retroreflective regions carry out image repair in the photo that glass is shot to electronic equipment, the photo of electronic equipment shooting is promoted
Quality.
Those of ordinary skill in the art may realize that lists described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
It is implemented in hardware or software, depends on the specific application and design constraint of technical solution.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
The scope of the present invention.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In embodiment provided herein, it should be understood that disclosed device and method can pass through others
Mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the division of the unit, only
A kind of division of logic function, formula that in actual implementation, there may be another division manner, such as multiple units or component can combine or
Person is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual
Between coupling, direct-coupling or communication connection can be INDIRECT COUPLING or communication link by some interfaces, device or unit
It connects, can be electrical, machinery or other forms.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple
In network element.Some or all of unit therein can be selected according to the actual needs to realize the embodiment of the present invention
Purpose.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also
It is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product
It is stored in a computer read/write memory medium.Based on this understanding, technical scheme of the present invention is substantially in other words
The part of the part that contributes to existing technology or the technical solution can be expressed in the form of software products, the meter
Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be
People's computer, server or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention.
And storage medium above-mentioned includes:USB flash disk, mobile hard disk, ROM, RAM, magnetic disc or CD etc. are various can to store program code
Medium.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain
Lid is within protection scope of the present invention.Therefore, protection scope of the present invention should be subject to the protection scope in claims.