RELATED APPLICATION

This application claims priority to PCT Application No. PCT/CN2018/102986, filed on Aug. 29, 2018, which in turn claims priority to Chinese Patent Application No. 201710826678.9, entitled “IMAGE PROCESSING METHOD AND APPARATUS, STORAGE MEDIUM, AND ELECTRONIC APPARATUS,” filed with the China National Intellectual Property Administration on Sep. 13, 2017. The two applications are incorporated by reference in their entirety.

FIELD OF THE TECHNOLOGY

This application relates to the field of image processing, and specifically, to an image processing method and apparatus, a storage medium, and an electronic apparatus.

BACKGROUND OF THE DISCLOSURE

In computer graphics, an ideal pinhole camera (with a lens size of 0) is usually used to project onto a virtual film. Therefore, there is only one transmission path from the scene to the film. If a depth of field effect is desired, approximate simulation needs to be performed on a blur generated by a real lens.

However, in the related technology, the blur texture is sampled and mixed only on the body of the object, and the COC diffusion is not physically performed on pixels, and distortion is generated when the depth is discontinuous, that is, a very hard profile appears at the edge of an object that should be blurred. To obtain accurate diffusion calculation results, a high computing capability of a graphics card is required. This is not suitable for low-end devices.

SUMMARY

The embodiments of this application provide an image processing method and apparatus, a storage medium, and an electronic apparatus, to resolve at least the technical problem that a depth of field display effect is poor caused by an inaccurate image processing method.

According to an aspect of the embodiments of this application, an image processing method is provided. The image processing method includes performing edge expansion on an object in a scene according to a location parameter to obtain a profile of an expanded object, the location parameter being a relative location parameter of the object in the scene from a viewpoint; identifying a circle of confusion (COC) value of a vertex of the object as a COC value of a corresponding vertex of the profile of the expanded object; determining a color of each pixel of the expanded object according to the COC value of the corresponding vertex and a texture of the object in the scene; and displaying the expanded object based on the color of each pixel.

According to another aspect of the embodiments of this application, an image processing apparatus is further provided. The image processing apparatus includes one or more processors, and one or more memories storing program units, the program units being executed by the processor. The program units include an expansion unit, configured to perform edge expansion on an object in a scene according to a location parameter, to obtain a profile of an expanded object, the location parameter being a relative location parameter of the object in the scene from a viewpoint; a first processing unit, configured to use a circle of confusion (COC) value of a vertex of the object as a COC value of a corresponding vertex of the profile of the expanded object; a determining unit, configured to determine a color of each pixel of the expanded object according to the COC value of the corresponding vertex and a texture of the object in the scene; and a displaying unit, configured to display the expanded object based on the color of each pixel.

Another aspect of the present disclosure provides an electronic apparatus, comprising a memory, a processor, and a computer program that is stored in the memory and that is capable of running on the processor to implement the method comprising: performing edge expansion on an object in a scene according to a location parameter to obtain a profile of an expanded object, the location parameter being a relative location parameter of the object in the scene from a viewpoint; identifying a circle of confusion (COC) value of a vertex of the object as a COC value of a corresponding vertex of the profile of the expanded object; determining a color of each pixel of the expanded object according to the COC value of the corresponding vertex and a texture of the object in the scene; and displaying the expanded object based on the color of each pixel.

Another aspect of the present disclosure provides a computer readable medium containing program instructions for image processing. Execution of the program instructions by one or more processors of a computer system causes the one or more processors to implement the steps of: performing edge expansion on an object in a scene according to a location parameter to obtain a profile of an expanded object, the location parameter being a relative location parameter of the object in the scene from a viewpoint; identifying a circle of confusion (COC) value of a vertex of the object as a COC value of a corresponding vertex of the profile of the expanded object; and determining a color of each pixel of the expanded object according to the COC value of the corresponding vertex and a texture of the object in the scene. The one or more processors further implement the step of displaying the expanded object based on the color of each pixel.

In embodiments of this application, the following steps are executed: performing edge expansion on an object in a scene according to a location parameter, to obtain a profile of an expanded object, the location parameter being a relative location parameter of the object in the scene from a viewpoint; using a COC value of a vertex of the object as a COC value of a corresponding vertex of the profile of the expanded object; determining a color of each pixel of the expanded object according to the COC value of the corresponding vertex and a pre-obtained texture of the object in the scene; and displaying the expanded object based on the color of each pixel, so that a display effect is more real by performing edge expansion on the object according to an image depth of field display principle. Embodiments of the present disclosure achieve the technical effect of improving a depth of field display effect, thereby resolving the technical problem related to poor depth of field caused by an inaccurate image processing method.

