Virtual photographing method, virtual photographing terminal and computer readable storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a blurring photographing method, a blurring photographing terminal, and a computer-readable storage medium.
Background
With the continuous development of mobile terminal hardware, the dual cameras have gradually become the standard configuration of the mobile terminal, and the inherent properties of the dual cameras provide a new photographing mode, including a blurring processing mode, for the mobile terminal. In a traditional blurring processing scheme, a focus range is determined, then a region outside the focus range is subjected to blurring processing, and a blurred picture is obtained, and the number of pixels needing blurring processing determines the calculation amount of the mobile terminal and the energy consumption of the mobile terminal in the photographing processing process. In the blurring process, the processing of the picture is realized by directly blurring the area outside the focus area, which results in large calculation amount and low battery endurance of the mobile terminal in the picture processing process.
Disclosure of Invention
The invention provides a virtual photographing method, a virtual photographing terminal and a computer readable storage medium, which are used for solving the problems that the calculated amount of picture virtual processing is large and the battery endurance is low when a mobile terminal photographs in the prior art.
According to an aspect of the present invention, there is provided a blurring photographing method, including:
acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred;
dividing the region to be virtualized into sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized;
acquiring the brightness average value of the sub-area;
and when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
The invention also provides a virtual photographing terminal, which comprises a processor, a memory and a communication bus;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is used for executing the blurring photographing program stored in the memory so as to realize the following steps:
acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred;
dividing the region to be virtualized into sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized;
acquiring the brightness average value of the sub-area;
and when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
The present invention also provides a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to perform the steps of:
acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred;
dividing the region to be virtualized into sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized;
acquiring the brightness average value of the sub-area;
and when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
According to the blurring photographing method provided by the invention, after the area to be blurred is determined through the acquired preview picture and the focus area of the preview picture, the area to be blurred is divided into sub-areas according to a preset brightness analysis model, then the brightness average value of the sub-areas is acquired, and when the brightness average value of the sub-areas is higher than a preset blurring threshold value, the sub-areas are blurred, and then the blurring processed picture of the preview picture is acquired. The method comprises the steps of dividing the area to be virtualized into different sub-areas, selecting the sub-area with the brightness average value higher than a certain brightness to perform virtualization processing, and not performing the virtualization processing on the sub-area with the brightness average value smaller than the virtualization threshold. Because the selective virtualization processing is carried out instead of carrying out the virtualization processing on all the areas to be virtualized, the calculation amount of the mobile terminal is reduced, meanwhile, the consumption of the battery is reduced, and the cruising ability of the battery is improved. Particularly, for the pictures shot under the environment with poor light conditions, the virtual shooting method provided by the invention has more obvious improvement on the battery endurance.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart of a blurring photographing method according to a first embodiment of the present invention;
fig. 2 is a schematic diagram illustrating the division of the region to be blurred in the blurring photographing method according to the first embodiment of the present invention;
fig. 3 is a schematic diagram illustrating division of the annular sub-region in the blurring photographing method according to the first embodiment of the present invention;
fig. 4 is a schematic diagram illustrating the division of the sub-rectangular area in the blurring photographing method according to the second embodiment of the present invention;
fig. 5 is a schematic diagram illustrating the selection input of the blurring threshold in the blurring photographing method according to the third embodiment of the present invention;
fig. 6 is a schematic diagram of a blurring threshold selection input 1 in the blurring photographing method according to the third embodiment of the present invention;
fig. 7 is a schematic diagram of a blurring threshold selection input 2 in the blurring photographing method according to the third embodiment of the present invention;
fig. 8 is a schematic diagram of obtaining a focus area in a blurring photographing method according to a fourth embodiment of the present invention;
fig. 9 is a schematic view of a rectangular focusing area in a blurring photographing method according to a fifth embodiment of the present invention;
fig. 10 is a flowchart of obtaining an average brightness value in the blurring photographing method according to the sixth embodiment of the present invention;
fig. 11 is a schematic diagram illustrating the setup of test points in the blurring photographing method according to a seventh embodiment of the present invention;
fig. 12 is a schematic diagram illustrating the division of sub-regions in the blurring photographing method according to the eighth embodiment of the present invention;
fig. 13 is a schematic diagram illustrating the division of sub-regions in the blurring photographing method according to the ninth embodiment of the present invention;
fig. 14 is a schematic structural diagram of a blurring photographing terminal in the tenth embodiment of the method of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
The first embodiment is as follows:
fig. 1 is a flowchart of a blurring photographing method according to a first embodiment of the present invention, and the blurring photographing method according to the first embodiment of the present invention shown in fig. 1 includes:
step 100, acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred.
Specifically, taking a mobile terminal as an example, as shown in fig. 2, a user of the mobile terminal takes a portrait photograph, all the portrait photographs are used for displaying a preview picture 110 on a display screen of a mobile phone, when the user feels that an avatar in the preview picture reaches a satisfactory state, a formal photograph is taken, a circular area where the portion of the avatar photographed in fig. 2 is located is a focus area 130, an area of the preview picture 110 except the focus area 130 is an area to be blurred 120, and for clear distinction, the area to be blurred 120 is represented by a dotted background.
In the conventional blurring processing method, the terminal directly performs blurring processing on all the areas to be blurred 120, and does not distinguish any brightness of the areas to be blurred 120 any more, but in the actual using process, due to the difference of the photographing environments where the users are located and the difference of the photographing requirements, sometimes the users take a photograph in an environment with poor lighting conditions, such as at night or in cloudy days, at this time, the brightness of the areas to be blurred outside the focusing area is already very dark, particularly, the brightness of the areas to be blurred farther away from the focusing area is darker, the contrast between the focusing area and the areas to be blurred outside is already very obvious in practice, and blurring processing does not need to be performed any more, but in the conventional blurring processing method, blurring processing calculation also needs to be performed, and the blurring processing which is meaningless in practice wastes energy consumption of the terminal, resulting in a reduction in the endurance of the terminal battery.
Step 200, dividing the region to be virtualized into sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized.
Specifically, in the method provided in this embodiment, the region to be blurred 120 is divided into at least two sub-regions for subsequent processing, where the preset luminance analysis model includes a model for performing luminance analysis after dividing the region to be blurred 120 into at least two sub-regions.
The brightness analysis model comprises sub-regions which are divided into various shapes, the sub-regions can be connected with each other, certain intervals can exist between the sub-regions, and flexible setting can be carried out according to actual requirements.
Taking fig. 3 as an example, a sub-region division model is given, and outside the focus region 130, a circle is drawn by taking a focus point as a center, and taking r + D, which is larger than the radius r of the focus region and has a preset length D, as a radius, and the length of r +2D, r +3D as a radius, respectively, as shown in fig. 3, in order to distinguish different sub-regions, a ring is distinguished by different backgrounds.
The sub-regions shown in fig. 3 are connected to each other, and in practical use, the sub-regions may be arranged at intervals, that is, a circle composed of a circle with a radius r and a circle with a radius r + D, and a circle composed of a circle with a radius r +2D and a circle with a radius r +3D are used as the regions to be blurred, but a circle composed of a circle with a radius r + D and a circle with a radius r +2D therebetween is not used as the regions to be blurred, and is not considered in the subsequent blurring process. Therefore, the area to be virtualized can be divided more flexibly to achieve different virtualization processing results.
And step 300, acquiring the brightness average value of the sub-area.
Specifically, after the different sub-regions are divided, since each sub-region is an independent region subjected to the blurring process and each sub-region still includes many pixels, on the premise that the blurring process is performed according to the luminance value, the luminance average value of each sub-region is obtained, and the luminance average value of the sub-region needs to be further obtained. And averaging the brightness values of all pixel points in each sub-region according to the preview picture to obtain the brightness average value of the sub-region.
Further, if the calculation amount of the terminal needs to be further reduced, the luminance average value of each sub-region can be obtained by adopting a mode of setting test points in the sub-regions for sampling, and the luminance values of all pixel points in all the sub-regions do not need to be calculated. The test points can be flexibly arranged at specific positions of the sub-areas, or can be uniformly distributed in each sub-area as much as possible within a certain upper limit of the number in order to ensure the accuracy of the processing result.
Also taking fig. 3 as an example, in fig. 3, four black dots are marked on each circle, where the black dots are the test points in step 300, and the brightness value of each circle is obtained through the four test points on each circle. Then, the brightness average value of each sub-region in fig. 3 is obtained by averaging the brightness values of the inner circumference and the outer circumference of the ring.
Furthermore, the test points can be arranged unevenly to meet the requirement of arranging more diversified sub-areas, so that the whole blurring treatment process is simpler.
And 400, when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Specifically, a blurring threshold is set, the blurring threshold is a brightness value, when the calculated average brightness value of the sub-regions is smaller than the blurring threshold, the brightness in the sub-regions is considered to be low without further blurring, and when the calculated average brightness value of the sub-regions is greater than or equal to the blurring threshold, the brightness value in the sub-regions is considered to be high, the contrast with the image in the focus region is not obvious, and further blurring is required.
In practical applications, the blurring threshold may be a fixed value, and may be fixed in an application program where the method is located, or may provide a numerical range, and perform corresponding adjustment according to the brightness value of the preview picture.
The blurring processing further includes calculating by using a gaussian fuzzy processing function, where the calculation formula is as follows:
where R is the radius range of the blurring processing region, and as an example in FIG. 3, the region between R + D and R +3D satisfies the above condition, R in the above formula is 3D-D, i.e. 2D. x and y are pixel coordinates of the relevant region, and similarly, taking fig. 3 as an example, when blurring the sub-region between r + D and r +3D radii, the coordinates of the pixel points in the sub-region are obtained, and then blurring is performed by using the above formula.
In the picture blurring processing method provided in this embodiment, after a to-be-blurred region that needs to be blurred is determined by an acquired preview picture and a focus region of the preview picture, the to-be-blurred region is divided into at least two annular sub-regions according to a preset luminance analysis model, and then a luminance average value of the sub-regions is obtained, and when the luminance average value of the sub-regions is higher than a preset blurring threshold, the blurring processing picture of the preview picture is obtained after the sub-regions are blurred. After the area to be virtualized is divided into different sub-areas, the sub-area with the brightness average value higher than a certain brightness is selected for virtualization, and the sub-area with the brightness average value smaller than the virtualization threshold value is not subjected to virtualization. Because the selective virtualization processing is carried out instead of carrying out the virtualization processing on all the areas to be virtualized, the calculation amount of the mobile terminal is reduced, meanwhile, the consumption of the battery is reduced, and the cruising ability of the battery is improved. Particularly, for the pictures shot under the environment with poor light conditions, the virtual shooting method provided by the invention has more obvious improvement on the battery endurance.
Example two:
fig. 4 is a schematic diagram illustrating division of rectangular sub-regions in a blurring photographing method according to a second embodiment of the present invention, and fig. 4 illustrates an embodiment different from the division of sub-regions according to the first embodiment, where the blurring photographing method includes:
step 100, acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred.
Specifically, taking a mobile terminal as an example, as shown in fig. 2, a user of the mobile terminal takes a portrait photograph, all the portrait photographs are used for displaying a preview picture 110 on a display screen of a mobile phone, when the user feels that an avatar in the preview picture reaches a satisfactory state, a formal photograph is taken, a circular area where the portion of the avatar photographed in fig. 2 is located is a focus area 130, an area of the preview picture 110 except the focus area 130 is an area to be blurred 120, and for clear distinction, the area to be blurred 120 is represented by a dotted background.
Step 200, dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized.
Specifically, in the method provided in this embodiment, the region to be blurred 120 is divided into at least two sub-regions for subsequent processing, where the preset luminance analysis model includes a model for performing luminance analysis after dividing the region to be blurred 120 into at least two sub-regions.
The brightness analysis model comprises sub-regions which are divided into various shapes such as a ring shape, a square shape, a round shape and the like, the sub-regions can be connected with each other, certain intervals can be formed between the sub-regions, and flexible setting can be carried out according to actual requirements.
Fig. 4 shows a different subregion partitioning method from the first embodiment, and is a partitioning model of another subregion, the region to be blurred 120 is partitioned into four parts outside the focus region 130, including a first subregion, a second subregion, a third subregion, and a fourth subregion, and according to the characteristics of photographing by the user, the light source is usually located in the upper half of the region to be blurred 120, so that the region to be blurred is simply partitioned into upper, lower, left, and right, and more targeted blurring processing can be performed.
The luminance analysis model may be given more models based on the two models, for example, based on fig. 4, the upper and lower layers, or more layers may be distinguished, and details are not repeated.
And step 300, acquiring the brightness average value of the sub-area.
Specifically, after the different sub-regions are divided, since each sub-region is an independent region subjected to the blurring process and each sub-region still includes many pixels, on the premise that the blurring process is performed according to the luminance value, the luminance average value of each sub-region is obtained, and the luminance average value of the sub-region needs to be further obtained. And averaging the brightness values of all pixel points in each sub-region according to the preview picture to obtain the brightness average value of the sub-region.
Further, taking fig. 4 as an example, on four side lengths of each sub-region in fig. 4, a plurality of test points may be respectively set, for example, two test points are set on a short side, and four test points are set on a long side, and luminance values of the test points are obtained according to luminance values of corresponding pixel points on the preview image.
The brightness value of each side is obtained by calculating the brightness values of all the test points on each side, and then the brightness values of the four sides of each sub-region are averaged to obtain the brightness average value of the four sub-regions.
And 400, when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Specifically, a blurring threshold is set, the blurring threshold is a brightness value, when the calculated average brightness value of the sub-regions is smaller than the blurring threshold, the brightness in the sub-regions is considered to be low without further blurring, and when the calculated average brightness value of the sub-regions is greater than or equal to the blurring threshold, the brightness value in the sub-regions is considered to be high, the contrast with the image in the focus region is not obvious, and further blurring is required.
In the method for blurring a picture provided in this embodiment, after the region to be blurred is divided into different rectangular sub-regions, a sub-region with a luminance average value higher than a certain luminance is selected for blurring, and for a sub-region with a luminance average value smaller than a blurring threshold, blurring is not performed. Because the selective virtualization processing is carried out instead of carrying out the virtualization processing on all the areas to be virtualized, the calculation amount of the mobile terminal is reduced, meanwhile, the consumption of the battery is reduced, and the cruising ability of the battery is improved. Particularly, for the pictures shot under the environment with poor light conditions, the virtual shooting method provided by the invention has more obvious improvement on the battery endurance.
Example three:
fig. 5 is a schematic view illustrating selection and input of a blurring threshold in a blurring photographing method according to a third embodiment of the present invention, which is a schematic view illustrating an embodiment of a blurring threshold obtaining method different from that of the first embodiment, where the blurring photographing method according to the present embodiment includes:
step 100, acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred.
Specifically, taking a mobile terminal as an example, as shown in fig. 2, a user of the mobile terminal takes a portrait photograph, all the portrait photographs are used for displaying a preview picture 110 on a display screen of a mobile phone, when the user feels that an avatar in the preview picture reaches a satisfactory state, a formal photograph is taken, a circular area where the portion of the avatar photographed in fig. 2 is located is a focus area 130, an area of the preview picture 110 except the focus area 130 is an area to be blurred 120, and for clear distinction, the area to be blurred 120 is represented by a dotted background.
Step 200, dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized.
Specifically, the luminance analysis model includes sub-regions divided into various shapes such as a ring shape, a square shape, a circle shape, and the like, and the sub-regions may be connected to each other or have a certain interval therebetween, and may be flexibly set according to actual requirements.
And step 300, acquiring the brightness average value of the sub-area.
Specifically, after the different sub-regions are divided, since each sub-region is an independent region subjected to the blurring process and each sub-region still includes many pixels, on the premise that the blurring process is performed according to the luminance value, the luminance average value of each sub-region is obtained, and the luminance average value of the sub-region needs to be further obtained. And averaging the brightness values of all pixel points in each sub-region according to the preview picture to obtain the brightness average value of the sub-region.
Further, if the calculation amount of the terminal needs to be further reduced, the luminance average value of each sub-region can be obtained by adopting a mode of setting the test points in the sub-regions for sampling, and the luminance values of all the pixel points in all the sub-regions do not need to be calculated. The test points can be flexibly arranged at specific positions of the sub-areas, or can be uniformly distributed in each sub-area as much as possible within a certain upper limit of the number in order to ensure the accuracy of the processing result.
And 400, when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Specifically, a blurring threshold is set, the blurring threshold is a brightness value, when the calculated average brightness value of the sub-regions is smaller than the blurring threshold, the brightness in the sub-regions is considered to be low without further blurring, and when the calculated average brightness value of the sub-regions is greater than or equal to the blurring threshold, the brightness value in the sub-regions is considered to be high, the contrast with the image in the focus region is not obvious, and further blurring is required.
In this embodiment, when the blurring threshold is displayed for the user, a recommended value or range may be given, and the recommended threshold or range may be adaptively adjusted according to the picture, or only an empirical value or an empirical range may be given. Fig. 5 is a schematic diagram of using an interactive interface for a user to select a blurring threshold when the terminal performs a photographing preview.
After the interface shown in fig. 5 is used to select the blurring threshold, and after the user inputs the selected blurring threshold, the method further provides the preliminary blurring processing result of the preview picture according to the blurring threshold selected by the user, in order to better represent the blurring effect, the deeper background of fig. 6 is used to represent the deep blurring processing, and the shallower background of fig. 7 is used to represent the shallow blurring processing. After the user selects different blurring threshold values in the blurring threshold value selection input bar, the final blurring threshold value can be determined according to the processing result, so that a satisfactory blurring processed picture is obtained.
In the picture blurring processing method provided in this embodiment, after a to-be-blurred region that needs to be blurred is determined by an acquired preview picture and a focus region of the preview picture, the to-be-blurred region is divided into at least two annular sub-regions according to a preset luminance analysis model, and then a luminance average value of the sub-regions is obtained, and when the luminance average value of the sub-regions is higher than a preset blurring threshold, the blurring processing picture of the preview picture is obtained after the sub-regions are blurred. In this embodiment, the selection of the blurring threshold is provided for the user, and the user can obtain preview pictures of different blurring processing results to perform final shooting selection by inputting different blurring thresholds according to shooting requirements and personal preferences. Due to the fact that the selection of the blurring threshold is provided, the method provided by the implementation is more in line with the use requirements of users, and the applicability of the blurring photographing method is improved.
Example four:
fig. 8 is a schematic view of obtaining a focus area in a blurring photographing method according to a fourth embodiment of the present invention, which is a preferred step of step 100 in the first embodiment, and includes:
and step 110, acquiring the preview picture and the focus point of the preview picture.
Specifically, the range of the focus area directly determines the range of the area to be blurred, and the range of the area to be blurred is closely related to the blurring result, so that the selection of the focus area and the blurring result are also directly related.
Based on the division of the sub-regions of the region to be blurred, the focus region of the preview picture not only directly obtains the focus region, but also supports flexible setting of the focus region. Firstly, a focus point needs to be determined on an acquired preview picture.
The focus point is determined according to the input selection of the user, or the camera is automatically given according to the prior art. The position of the focus point on the preview picture is uncertain, and may be located at the center of the preview picture or at a position far from the center of the preview picture.
And step 120, determining the focusing area according to the focusing point and a preset focusing radius.
Specifically, the preset focusing radius may give a fixed value according to the size, the average brightness value, and the like of the preview picture, or may be displayed on a photographing preview interface after providing a numerical range, so that the user can adjust the focusing radius to better meet the requirements of the user on the photographing result. The specific display and adjustment process is similar to the interactive process of selecting the blurring threshold by the user, and is not described herein again.
The determination of the focus area, in addition to the preset focus radius and focus point, provides a circular focus area, such as the focus radius r shown in fig. 8, and an obtained value input by the user, or performs adaptive adjustment according to the size and brightness average value of the preview picture, and may be changed from small to large within a given range. The ranges of the focus regions thus obtained are different, so that the ranges of the given regions to be blurred are also different, and the blurring results obtained by the subsequent blurring step are also different.
Step 200, dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized.
Specifically, the same procedure as in step 200 is performed. Due to the adoption of the mode of selecting the focus area, the area to be blurred for analysis in the step also differs according to the focus area, and even according to the same brightness analysis model, the division results of different sub-areas can be obtained.
And step 300, acquiring the brightness average value of the sub-area.
Specifically, the same procedure as in step 300 of the first embodiment is performed. It is understood that the luminance average values of different sub-regions are obtained based on the division results of the different sub-regions.
And 400, when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Specifically, in the same manner as in step 400 of the first embodiment, different blurring processing results are obtained based on the luminance average values of different sub-regions and the same blurring threshold.
In the blurring photographing method provided in this embodiment, the region to be blurred is determined through selection of the focus point and the preset focus region, so as to be used in the subsequent blurring processing step. The range of the area to be blurred can be flexibly set, so that the final blurring processing result can better meet the actual blurring requirement of the preview picture.
Example five:
fig. 9 is a schematic diagram of a rectangular focusing area in a blurring photographing method according to a fifth embodiment of the present invention, which is a preferred step of step 100 in the first embodiment, and includes:
and step 110, acquiring the preview picture and the focus point of the preview picture.
Specifically, the same procedure as in step 110 of example four is performed.
And step 120, determining the focusing area according to the focusing point and a preset focusing radius.
Specifically, the preset focusing radius may give a fixed value according to the size of the preview picture, or may be displayed on a photographing preview interface after providing a numerical range, so that a user can adjust the focusing radius to better meet the requirements of the user on the photographing result. The specific display and adjustment process is similar to the interactive process of selecting the blurring threshold by the user, and is not described herein again.
Further, the determining of the focus area may, in addition to the providing of a circular focus area according to the preset focus radius and the preset focus point, provide focus areas of other shapes, such as a rectangular focus area, a polygonal focus area, and the like according to the preset focus radius and preset focus radius values. And selecting the plurality of focusing radiuses, displaying the focusing radiuses on a photographing preview interface, and giving a final focusing area range according to a value determined by a user after the focusing radiuses are adjusted by the user.
As shown in fig. 9, when the shape of the focus area is the same as or similar to the shape of the preview picture, the given shape of the area to be blurred is more regular, so that the division of blurred sub-areas in the subsequent blurred photographing step and the selection of subsequent test points are facilitated, and a more accurate luminance average value of the sub-areas can be more conveniently obtained, thereby providing a more accurate blurring processing result.
Step 200, dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized.
Specifically, the same procedure as in step 200 is performed. Due to the adoption of the mode of selecting the focus area, the area to be blurred for analysis in the step also differs according to the focus area, and even according to the same brightness analysis model, the division results of different sub-areas can be obtained. Particularly, when the shape of the focus area is the same as that of the preview picture, the shape of the area to be blurred is regular, and therefore the sub-areas can be divided more conveniently.
And step 300, acquiring the brightness average value of the sub-area.
Specifically, the same procedure as in step 300 of the first embodiment is performed. It is understood that the luminance average values of different sub-regions are obtained based on the division results of the different sub-regions.
And 400, when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Specifically, in the same manner as in step 400 of the first embodiment, different blurring processing results are obtained based on the luminance average values of different sub-regions and the same blurring threshold.
In the blurring photographing method provided in this embodiment, the region to be blurred is determined through selection of the focus point and the preset focus region, so as to be used in the subsequent blurring processing step. The acquired focus area with the same shape as the preview picture enables the range of the area to be blurred to be flexibly set, and the final blurring processing result can better meet the actual blurring requirement of the preview picture.
Example six:
fig. 10 is a flowchart of obtaining an average brightness value in the blurring photographing method according to the sixth embodiment of the present invention, and the blurring photographing method according to the sixth embodiment of the present invention shown in fig. 10 is a preferred step of step 300 in the first embodiment, and includes:
step 100, acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred.
Specifically, the same procedure as in step 100 of the first embodiment is performed.
Step 200, dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized.
Specifically, the same procedure as in step 200 of the first embodiment is performed.
And 310, setting at least two test points in the boundary line and/or the area of the sub-area.
Specifically, in order to reduce the amount of calculation of the image blurring process, in the process of obtaining the luminance average value of the region, the luminance values of all the pixel points in the sub-region are not all used for calculating the luminance average value, but at least two test points are set, and the luminance average value of the sub-region where the test points are located is replaced by the luminance average value of all the test points.
Taking the sub-region division result of fig. 4 as an example, when the test points are arranged in the regions of the four sub-regions, the test points can be uniformly distributed in the four sub-regions, and the more the test points are, the more the test points are accurate to accurately obtain the brightness average value of the four sub-regions. When the test points are arranged on the boundary lines of the four subregions, similarly, the more the test points are, the more the average brightness value of the obtained subregions is ensured.
Taking the sub-area division result of fig. 3 as an example, when the test points are arranged in the area of the annular sub-area, a plurality of test points can be uniformly distributed in each annular, and the more the test points are arranged, the more the average brightness value of the obtained sub-area is. When the test points are arranged on the circumferences of the inner circle and the outer circle of the annular sub-area, the test points shown in fig. 3 are arranged in such a manner that the number of the test points on each circumference is the same, and in practice, N test points may be uniformly arranged on each circumference, for example, N is a positive integer between 1 and 36.
And 320, acquiring the brightness value of the test point according to the preview picture.
Specifically, the brightness value of the pixel where the test point is located may be obtained according to the preview picture.
Step 330, obtaining the average brightness value of the sub-region according to the brightness value.
Specifically, when the test points are arranged in the area of the sub-area, the brightness values of the test points are directly averaged.
When the test points are arranged on the boundary lines of the sub-regions, the brightness values of all the test points on each boundary line are averaged to obtain the brightness value of each boundary line, and then the brightness values of all the boundary lines are averaged to obtain the brightness average value of the sub-regions surrounded by all the boundary lines of one sub-region.
And 400, when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Specifically, the same procedure as in step 400 of the first embodiment is performed.
In the calculation process of the sub-region brightness average value provided by this embodiment, the brightness values of the test points are obtained by setting at least two test points in the boundary line and/or the region of the sub-region, and then the brightness average value of the sub-region is obtained according to the brightness values of the test points. And the positions of the test points are flexibly set, so that the blurring processing requirements of different preview pictures are met.
Example seven:
fig. 11 is a schematic diagram illustrating a setup of test points in a blurring photographing method according to a seventh embodiment of the present invention, which is a preferred step of step 300 in the first embodiment, and includes:
step 100, acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred.
Specifically, the same procedure as in step 100 of the first embodiment is performed.
Step 200, dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized.
Specifically, the same procedure as in step 200 of the first embodiment is performed.
And 310, setting at least two test points in the boundary line and/or the area of the sub-area.
Specifically, in order to reduce the amount of calculation of the image blurring process, in the process of obtaining the luminance average value of the region, the luminance values of all the pixel points in the sub-region are not all used for calculating the luminance average value, but at least two test points are set, and the luminance average value of the sub-region where the test points are located is replaced by the luminance average value of all the test points.
In this embodiment, as shown in fig. 11, a plurality of test points with different numbers are arranged on each circumference, and test points with different numbers are arranged according to the circumference of the circumference, for example, 4 test points are arranged on the inner circle of the r + D ring, 8 test points are arranged on the outer circle, 16 test points are arranged on the outer circle of the r +2D ring, and 16 test points are also arranged on the outer circle of the r +3D ring. The brightness average values obtained by the circumferences of different numbers of the test points are set, the correlation between the brightness average values is stronger, and the brightness average value of the sub-area obtained by subsequent calculation is more accurate.
And 320, acquiring the brightness value of the test point according to the preview picture.
Specifically, the brightness value of the pixel where the test point is located may be obtained according to the preview picture.
Step 330, obtaining the average brightness value of the sub-region according to the brightness value.
Specifically, when the test points are arranged in the area of the sub-area, the brightness values of the test points are directly averaged.
When the test points are arranged on the boundary lines of the sub-regions, the brightness values of all the test points on each boundary line are averaged to obtain the brightness value of each boundary line, and then the brightness values of all the boundary lines are averaged to obtain the brightness average value of the sub-regions surrounded by all the boundary lines of one sub-region.
And 400, when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Specifically, the same procedure as in step 400 of the first embodiment is performed.
In the calculation process of the sub-region brightness average value provided by this embodiment, the brightness values of the test points are obtained by setting at least two test points in the boundary line and/or the region of the sub-region, and then the brightness average value of the sub-region is obtained according to the brightness values of the test points. And the positions and the number of the test points are flexibly set, so that the blurring processing requirements of different preview pictures are met.
Example eight:
fig. 12 is a schematic diagram illustrating the division of sub-regions in the blurring photographing method according to the eighth embodiment of the present invention, which is a preferred step of step 200 in the first embodiment, and includes:
step 100, acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred.
Step 200, dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized.
Specifically, the blurring photographing method in the embodiment shown in fig. 12 is a preferred embodiment of the step 200 in the first embodiment, the division into at least two sub-regions includes division into at least two nested annular sub-regions, and the annular width of each annular sub-region gradually increases from inside to outside.
As shown in fig. 11, three circles are drawn with a focus point and a radius r + a, a radius r + B and a radius r + C, and (a < B < C), respectively, and form three rings outside the focus area, and the ring widths of the three rings gradually increase from inside to outside.
And step 300, acquiring the brightness average value of the sub-area.
Specifically, as with the method for obtaining the average brightness value in the first embodiment, the test points may be uniformly arranged in the circular sub-regions with different areas, so as to obtain the average brightness value of each sub-region.
And 400, when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Specifically, the same procedure as in step 400 of the first embodiment is performed.
In the blurring photographing method provided in this embodiment, after the brightness average values of the respective areas are obtained by dividing the area with blurring into annular sub-areas with different ring widths, the sub-area with the brightness average value higher than a certain brightness is selected for blurring, and the sub-area with the brightness average value smaller than the blurring threshold is not subjected to blurring. Because in the preview picture, the focus area is better highlighted, the closer the area to be blurred is to the focus area, the stronger the blurring requirement is, therefore, according to the distance from the focus area, different sub-area modes are set, a more reasonable blurring processing result can be obtained, and a more accurate picture is obtained.
Example nine:
fig. 13 is a schematic view illustrating the division of sub-regions in the blurring photographing method according to the ninth embodiment of the present invention, which is different from the division of sub-regions in the first embodiment of the method shown in fig. 1, and includes:
step 100, acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred.
Specifically, the same procedure as in step 100 of the first embodiment is performed.
Step 200, dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized.
Specifically, the division of the sub-regions in this embodiment is to divide the region to be blurred into a plurality of grid-shaped sub-regions, as shown in fig. 13, the sub-regions are divided into square grid-shaped sub-regions. Similarly, the partition can be divided into polygonal grid-shaped subareas or honeycomb-shaped grid-shaped subareas.
The areas of the grid-shaped subregions may be the same as each other, as shown in fig. 13, or may be different from each other, for example, the area of the grid-shaped subregion close to the focus region is small, and the area of the grid-shaped subregion far from the focus region is large.
And step 300, acquiring the brightness average value of the sub-area.
Specifically, the same procedure as in step 300 of the first embodiment is performed.
And 400, when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Specifically, the same procedure as in step 400 of the first embodiment is performed.
In the picture blurring processing method provided in this embodiment, after a to-be-blurred region that needs to be blurred is determined through an acquired preview picture and a focus region of the preview picture, the to-be-blurred region is divided into at least two latticed sub-regions according to a preset luminance analysis model, and then a luminance average value of the sub-regions is acquired, and when the luminance average value of the sub-regions is higher than a preset blurring threshold, the sub-regions are blurred, and then a blurring processed picture of the preview picture is acquired. Because the selective virtualization processing is carried out instead of carrying out the virtualization processing on all the areas to be virtualized, the calculation amount of the mobile terminal is reduced, meanwhile, the consumption of the battery is reduced, and the cruising ability of the battery is improved.
Fig. 14 is a schematic structural diagram of a blurring photographing terminal in the tenth embodiment of the method of the present invention, including: a processor 10, a memory 30 and a communication bus 20; the communication bus 20 is used to enable connection communication between the processor 10 and the memory 30.
The processor 10 is configured to execute the blurring program stored in the memory 30 to implement the following steps:
acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred;
dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized;
acquiring the brightness average value of the sub-area;
and when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Preferably, in the step of acquiring the preview picture and the focus area of the preview picture, the processor 10 is specifically configured to implement the following steps: acquiring the preview picture and a focus point of the preview picture; and determining the focusing area according to the focusing point and a preset focusing radius.
Preferably, in the step of obtaining the brightness average value of the sub-region, the processor 10 is specifically configured to implement the following steps: at least two test points are arranged in the boundary line and/or the area of the sub-area; acquiring the brightness value of the test point according to the preview picture; and acquiring the average brightness value of the sub-region according to the brightness value.
Preferably, the step of dividing into at least two sub-regions is specifically configured to implement the following steps: into at least two nested annular sub-regions.
Preferably, the processor 10 is specifically configured to implement the steps of: the ring width of each annular subregion is gradually increased from inside to outside.
Preferably, the step of dividing into at least two sub-regions is implemented by the processor 10: divided into at least two grid-like sub-areas.
In the image blurring processing device provided in this embodiment, after a to-be-blurred region that needs to be blurred is determined through an acquired preview image and a focus region of the preview image, the to-be-blurred region is divided into at least two annular sub-regions according to a preset luminance analysis model, and then a luminance average value of the sub-regions is obtained, and when the luminance average value of the sub-regions is higher than a preset blurring threshold, the blurring processing image of the preview image is obtained after the sub-regions are blurred. After the area to be virtualized is divided into different sub-areas, the sub-area with the brightness average value higher than a certain brightness is selected for virtualization, and the sub-area with the brightness average value smaller than the virtualization threshold value is not subjected to virtualization. Because the selective virtualization processing is carried out instead of carrying out the virtualization processing on all the areas to be virtualized, the calculation amount of the mobile terminal is reduced, meanwhile, the consumption of the battery is reduced, and the cruising ability of the battery is improved.
The present invention also protects a computer-readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to perform the steps of: acquiring a preview picture and a focus area of the preview picture, and determining an area except the focus area in the preview picture as an area to be blurred; dividing the region to be virtualized into at least two sub-regions according to a preset brightness analysis model, wherein the brightness analysis model comprises a sub-region division model for performing brightness analysis on the region to be virtualized; acquiring the brightness average value of the sub-area; and when the brightness average value is higher than a preset blurring threshold value, blurring the sub-region to obtain a blurring processed picture of the preview picture.
Preferably, the step of obtaining the preview picture and the focus area of the preview picture, the one or more programs are further executable by the one or more processors to implement the steps of: acquiring the preview picture and a focus point of the preview picture; and determining the focusing area according to the focusing point and a preset focusing radius.
Preferably, the step of obtaining the average value of the luminance of the sub-region, the one or more programs are further executable by the one or more processors to implement the steps of: at least two test points are arranged in the boundary line and/or the area of the sub-area; acquiring the brightness value of the test point according to the preview picture; and acquiring the average brightness value of the sub-region according to the brightness value.
Preferably, the step of dividing into at least two sub-areas, the one or more programs are further executable by the one or more processors to implement the steps of: into at least two nested annular sub-regions.
Preferably, the step of dividing into at least two nested ring-shaped sub-regions, the one or more programs are further executable by the one or more processors to implement: the ring width of each annular subregion is gradually increased from inside to outside.
Preferably, the step of dividing into at least two sub-areas, the one or more programs are further executable by the one or more processors to implement the steps of: divided into at least two grid-like sub-areas.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: ROM, RAM, magnetic or optical disks, and the like.
In short, the above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.