WO2020019133A1 - Method and device for determining shadow effect and electronic device - Google Patents

Method and device for determining shadow effect and electronic device Download PDF

Info

Publication number
WO2020019133A1
WO2020019133A1 PCT/CN2018/096691 CN2018096691W WO2020019133A1 WO 2020019133 A1 WO2020019133 A1 WO 2020019133A1 CN 2018096691 W CN2018096691 W CN 2018096691W WO 2020019133 A1 WO2020019133 A1 WO 2020019133A1
Authority
WO
WIPO (PCT)
Prior art keywords
target object
picture
target
shadow
sub
Prior art date
Application number
PCT/CN2018/096691
Other languages
French (fr)
Chinese (zh)
Inventor
菲永奥利维尔
李建亿
Original Assignee
太平洋未来科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 太平洋未来科技(深圳)有限公司 filed Critical 太平洋未来科技(深圳)有限公司
Priority to PCT/CN2018/096691 priority Critical patent/WO2020019133A1/en
Priority to CN201810960587.9A priority patent/CN108986203A/en
Publication of WO2020019133A1 publication Critical patent/WO2020019133A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/60Shadow generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/006Mixed reality

Definitions

  • the present invention relates to the technical field of image processing, and in particular, to a method, a device, and an electronic device for determining a shadow effect.
  • Augmented Reality (AR) technology is a technology that calculates the position and angle of a camera image in real time, adds corresponding images, videos, and 3D models, and places virtual objects on the screen to interact with the real world.
  • AR devices By using AR devices, users can sense the existence of virtual objects.
  • the inventors found that in the process of implementing the present invention, when rendering a virtual object with a shadow effect, the shadow shape of the virtual object is generally determined only according to the shape of the virtual object. In a real scene, due to various factors, The influence of the shadow shape will generally deviate from its object body, which makes the shadow effect of the virtual object inconsistent with the real world.
  • the method, device, and electronic device for determining a shadow effect provided by the embodiments of the present invention are used to solve at least the foregoing problems in related technologies.
  • An embodiment of the present invention provides a method for determining a shadow effect, including:
  • Obtain a target picture decompose the target picture into a first preset number of sub-pictures; determine a light intensity weighting center according to the image moment of the sub picture, and determine based on the light intensity weighting center and the geometric center of the sub-picture Light source position information of the target picture; and generating a shadow effect of the target object according to the light source position information and position information and contour information of the target object on the target picture.
  • generating the shadow effect of the target object according to the light source position information and the position information and contour information of the target object on the target picture includes: according to the light source position information and the target on the target picture Position information of the object, determining a center position of the shadow of the target object; acquiring surrounding environment information of the target object on the target picture, and determining a corresponding shadow environment adjustment factor according to the surrounding environment information; based on the The contour information obtains the congruent graphics of the target object, and the congruent graphics are processed according to the shadow environment adjustment factor to obtain the shadow shape of the target object; generated according to the center position of the shadow and the shadow shape The shadow effect of the target object.
  • the contour information is obtained by the following steps: judging whether the target object belongs to a regular shape through a pre-trained model; if it belongs to a regular shape, extracting feature information corresponding to the regular shape as the contour of the target object Information; if it does not belong to a regular shape, determine the outline information of the target object according to the target object and pixel values around the target object.
  • the method further comprises: obtaining an average light intensity according to the light intensity of each of the sub-pictures as the light intensity corresponding to the target picture; and processing the shadow effect of the target object according to the light intensity.
  • determining the light source position information of the target picture based on the light intensity weighting center and the geometric center of the sub-picture includes: according to the light intensity weighting center of the sub-picture and the geometric center of the sub-picture Determining a light angle of the sub-picture; determining a weight value corresponding to each of the sub-pictures; and performing a weighted sum of a vector of light angles of each of the sub-pictures according to the weight value to obtain a light angle corresponding to the target picture Determining the light source position information of the target picture according to the light angle and the pixel value of the target picture.
  • Another aspect of the embodiments of the present invention provides a device for determining a shadow effect, including:
  • An obtaining module is configured to obtain a target picture and decompose the target picture into a first preset number of sub-pictures; a determining module is used to determine a light intensity weighting center according to an image moment of the sub-picture, and based on the sub-picture The light intensity weighting center and the geometric center determine light source position information of the target picture; a generating module is configured to generate the target object according to the light source position information and position information and contour information of the target object on the target picture Shadow effect.
  • the generating module includes: a first determining unit, configured to determine a center position of a shadow of the target object according to the light source position information and the position information of the target object on the target picture; a second determining unit, It is configured to obtain the surrounding environment information of the target object on the target picture, and determine a corresponding shading environment adjustment factor according to the surrounding environment information; a processing unit is configured to obtain a full range of the target object based on the contour information. Iso-graphics, and processing the congruent graphics according to the shadow environment adjustment factor to obtain the shadow shape of the target object; a generating unit for generating the target object according to the center position of the shadow and the shadow shape Shadow effect.
  • the generating module is further configured to determine whether the target object belongs to a regular shape through a pre-trained model; if the target object belongs to a regular shape, extract feature information corresponding to the regular shape as contour information of the target object ; If it does not belong to a regular shape, determine the outline information of the target object according to the target object and pixel values around the target object.
  • the generating module is further configured to obtain an average light intensity according to the light intensity of each of the sub-pictures as the light intensity corresponding to the target picture; and process the shadow effect of the target object according to the light intensity.
  • the determining module is further configured to determine a light angle of the sub-picture according to a light intensity weighting center of the sub-picture and a geometric center of the sub-picture; determine a weight value corresponding to each of the sub-pictures; The weight value is a weighted sum of a vector of light angles of the sub-pictures to obtain a light angle corresponding to the target picture; a light source of the target picture is determined according to the light angle and a pixel value of the target picture location information.
  • Another aspect of the embodiments of the present invention provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a memory that can be used by the at least one processor And an instruction that is executed by the at least one processor, so that the at least one processor can execute the foregoing method for determining a shadow effect.
  • the electronic device includes a mobile phone, and the target picture in the method for determining a shadow effect is obtained through a camera device of the mobile phone.
  • the mobile phone includes a front panel with a display screen and a mobile phone back cover; a middle and lower part of the mobile phone back cover is provided with a recessed area, and a support plate adapted to the shape and size of the recessed area is installed in the recessed area; The upper end of the support plate is hinged with the recessed area, so that the support plate can be rotated to a predetermined angle with the back cover of the mobile phone; a lower end of the support plate is provided with a connecting piece, and one end of the connecting piece and The support plate is soft-connected, and the other end is provided with a plugging portion adapted to the shape and size of the mobile phone charging interface, and the plugging portion is mated with the mobile phone charging interface;
  • the support plate includes a first plate body, a second plate body, a first connection plate, a second connection plate, and a link, the first plate body, the first connection plate, the second connection plate, and the second The plates are sequentially connected to form a plate; the first plate has opposite first and second ends, the second plate has opposite third and fourth ends, and the link includes a first A rod body and a second rod body, opposite ends of the first rod body are hinged to the first end and the third end, respectively, and opposite ends of the second rod body are respectively connected to the second end and the fourth end End-to-phase hinge, wherein the first rod body and the second rod body are both disposed on a side of the support plate away from the front panel; the first connection plate and the second connection plate are located on the first Between the plate body and the second plate body, one side of the first connection plate is hinged to one side of the first plate body, and one side of the second connection plate is opposite to one side of the second plate body.
  • the other side of the first connection plate is hinged with the other side of the second connection plate, the first connection plate and the second connection plate
  • the first plate is provided on a side of the support plate near the front plate; the first plate is provided with a first portion disposed along a thickness direction of the first plate, and the first portion is located at a hinge between the first plate and the connecting rod.
  • the second plate body is provided with a second portion provided along its thickness direction, and the second portion is located on the second plate
  • the first portion, the second portion, the first connecting plate, the second connecting plate, and the connecting rod form five Rod body mechanism.
  • the recessed area includes a bottom wall and a side wall, and the bottom wall and / or the side wall is provided with a ventilation structure, and the ventilation structure is a plurality of ventilation holes or ventilation grilles.
  • the connecting member is made of rubber.
  • each of the first end, the second end, the third end, and the fourth end is provided with a recessed portion, and opposite ends of the first rod body are respectively disposed in the recessed portion of the first end and the first end.
  • the opposite ends of the second rod body are respectively placed in the recessed portion of the third end and the recessed portion of the fourth end.
  • the method, device, and electronic device for determining a shadow effect provided by the embodiments of the present invention can accurately and conveniently obtain the position of a light source in a picture, while considering other antecedent factors in the process of generating a shadow effect of a virtual object, Thus, the shadow effect of the virtual object is more realistic, and the immersion of the user is improved.
  • a mobile phone with a support plate can make the shooting and playback of the mobile phone more stable. The user does not need to use the protective case and stickers of the mobile phone. It will not affect the heat dissipation and make the mobile phone more beautiful.
  • the quality of image acquisition can be used separately from the above method.
  • FIG. 1 is a flowchart of a method for determining a shadow effect according to an embodiment of the present invention
  • FIG. 2 is a light intensity weighted center and a weighted center coordinate position map of a sub-picture provided by an embodiment of the present invention
  • step S103 is a specific flowchart of step S103 provided by an embodiment of the present invention.
  • FIG. 4 is a structural diagram of a device for determining a shadow effect according to an embodiment of the present invention.
  • FIG. 5 is a structural diagram of a device for determining a shadow effect according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a hardware structure of an electronic device that executes a method for determining a shadow effect provided by an embodiment of a method of the present invention
  • FIG. 7 is a schematic structural diagram of a mobile phone that acquires a target picture in a method for determining a shadow effect according to an embodiment of the present invention
  • FIG. 8 is an exploded view of a mobile phone support plate for obtaining a target picture in a method for determining a shadow effect according to an embodiment of the present invention
  • FIG. 9 is a schematic diagram of a mobile phone support plate for obtaining a target picture in a method for determining a shadow effect according to an embodiment of the present invention in a supported state;
  • FIG. 10 is an enlarged view of part A of FIG. 9;
  • FIG. 11 is an enlarged view of a portion B of FIG. 9;
  • FIG. 12 is a schematic diagram of a mobile phone supporting plate for obtaining a target picture in a method for determining a shadow effect according to an embodiment of the present invention in a folded state.
  • FIG. 1 is a flowchart of a method for determining a shadow effect according to an embodiment of the present invention. As shown in FIG. 1, a method for determining a shadow effect provided by an embodiment of the present invention includes:
  • the target picture may be a certain frame in a video or a single picture frame captured from a camera, which is not limited in the present invention.
  • the acquisition timing may be based on a user's operation instruction, or when the scene of the video meets a preset requirement or condition.
  • the shadow effect corresponding to the target object is also different.
  • the target picture is decomposed into a first preset number of small square grid elements composed of a preset size, and each small square grid element is used as a sub-picture, where The sub-picture is composed of a second preset number of pixels.
  • the target picture can be decomposed into C columns and R rows (where C and R are integers, and C ⁇ 2, R ⁇ 2) to obtain multiple sub-pictures, each of which consists of p pixels.
  • the target picture can be extracted with grayscale, and the influence of the color on the light intensity acquisition can also be avoided.
  • S102 Determine a light intensity weighting center according to the image moment of the sub-picture, and determine light source position information of the target picture based on the light intensity weighting center and the geometric center of the sub-picture.
  • An image moment is a set of moments calculated from digital graphics. It usually describes the global features of the image and provides a lot of information about the different types of geometric features of the image, such as size, position, direction, and shape. For example: First-order moments are related to shape; second-order moments show the degree of expansion of a curve around a straight line average; third-order moments are a measure of the symmetry of the mean; second- and third-order moments can be used to derive a set of seven
  • Moment invariant and invariant moment are the statistical characteristics of the image, which meet the invariant invariance of translation, expansion and rotation.
  • geometric invariant moment can be used as an important feature to represent an object.
  • the above-mentioned first, second, third, and seven invariant moments derived from the second and third moments have specific calculation formulas in textbooks. According to these formulas, determining the light intensity weighting center belongs to this field. Technical common sense, the present invention is not described in detail here.
  • the light intensity weighting center g is determined by the image moment, and its coordinate position in the sub-image is (x g , y g ).
  • the light angle of the sub-picture is determined according to its light intensity weighted center and geometric center. Specifically, as shown in FIG. 2, the coordinate position (x c , y c ) of the geometric center c in the sub-picture is determined, and the coordinate position of the geometric center c is compared with the coordinate position of the light intensity weighted center g.
  • Vector from center c to weighted center g The direction of is the result of being affected by light, which provides us with a local light effect indication of the target picture location where the sub-picture is located.
  • vectors representss the direction of the light
  • d represents the modulus of the vector cg ⁇ represents the light angle of the sub-picture.
  • a weight value corresponding to each sub-picture may be determined according to a vector mode of a light angle corresponding to each sub-picture, and / or a light angle, and / or previous experience.
  • a confidence factor may be calculated according to a weight value corresponding to each sub-picture and a vector of a light angle corresponding to each sub-picture.
  • the weight value is Make adjustments.
  • the confidence factor is a ratio of the vector sum of the angle of the light rays to the sum of the weight values.
  • the confidence factor can indicate whether the weight value matches the trend of the vector. The closer the confidence factor is to 1, this indicates that the weight value The more appropriate.
  • the confidence factor is less than the preset value, it means that the determined weight value is inappropriate. At this time, the weight value needs to be adjusted. After the adjustment, a new confidence factor is calculated and tested according to the above method until the new confidence factor can be greater than the preset threshold. .
  • the length of the vector of the light angle of each sub-picture is determined according to the weight value, and then the vectors determined by each length are added to obtain the vector of the light angle corresponding to the target picture, and the vector of the light angle corresponding to the target picture To get the light angle corresponding to the target picture.
  • the light source position information of the target picture is determined according to the light angle and the pixel value of the target picture. Specifically, pixel values along the ray angle and points near the ray angle in the target picture are acquired, so as to obtain the brightness distribution along the ray angle. The closer the pixel value is to zero, the darker the color of the pixel; the closer the pixel value is to the maximum value of 255, the brighter the color of the pixel. Therefore, by comparing the pixel values of these points, The point where the pixel value is the largest is inferred as the coordinate position of the light source, and optionally, the sitting mark of the light source may be (x l , y l ).
  • S103 Generate a shadow effect of the target object according to the light source position information and the position information and contour information of the target object on the target picture.
  • the position of the shadow display can be determined according to the position of the light source and the position of the target object, and the display shape of the shadow is obtained according to the contour information of the object.
  • the combination of the two generates the shadow effect of the target object.
  • the contour information can be obtained by the following steps:
  • the target object may be a person, an animal, an article, a flower, a tree, or the like.
  • the regular shape refers to a general geometric shape, such as a circle, a rectangle, or the like.
  • the irregular shape includes, but is not limited to, a contour light of a person or an animal.
  • some training sets can be prepared in advance.
  • the training set includes regular-shaped objects and irregular-shaped objects.
  • the training set is used to train the model so that the model can identify whether each object belongs to a regular shape or an irregular shape. Further, For models with regular shapes, the model can also identify their corresponding shapes.
  • corresponding feature information is extracted according to its corresponding shape.
  • the extracted features are radius; when the target object is rectangular, the extracted features are length and width.
  • the outline of the target object can be obtained.
  • the target object does not belong to a regular shape
  • the pixel value included in the target object itself is very different from the pixel values at its edges
  • the critical points where the pixel values change suddenly can be extracted around the target object.
  • the points are connected as outline information of the irregularly shaped target object.
  • this step may be performed through the following sub-steps:
  • S1031 Determine the center position of the shadow of the target object according to the light source position information and the position information of the target object on the target picture.
  • the position information of the target object on the target picture is generally obtained as coordinate information (x i , y i ) on the target image.
  • the light source coordinate information (x l , y l ) determined according to step S102 can be The shadow position of the target object relative to the shadow center position of the light source is calculated.
  • the shadow center position can be determined by the following formula. Among them, x s is the abscissa of the shadow center, and y s is the ordinate of the shadow center.
  • S1032 Acquire the surrounding environment information of the target object on the target picture, and determine a corresponding shading environment adjustment factor according to the surrounding environment information.
  • the surrounding environment of the target object (such as surrounding buildings, surrounding objects, etc.) will affect its shadow shape, so the environmental information about the target object in the target picture, such as the surrounding environment and The relative position of the target object, the shape information of the surrounding objects, and so on, determine the corresponding shadow environment adjustment factor according to these information, and is used to adjust the shadow shape of the target object.
  • S1033 Obtain the congruent graphics of the target object based on the contour information, and process the congruent graphics according to the shadow environment adjustment factor to obtain the shadow shape of the target object.
  • a congruent figure corresponding to the target object is obtained. Compressing or stretching the congruent graphics according to the shadow environment adjustment factor in step S1032 to obtain the shadow shape of the target object.
  • the congruent graphic is a regular graphic
  • the radius or length and width of the regular graphic may be multiplied by the shadow environment adjustment factor to obtain a shadow shape; when the congruent graphic is an irregular graphic, the inconsistent graphic may be changed. Multiply the regular pattern by the shadow environment adjustment factor to get the shadow shape.
  • S1034 Generate a shadow effect of the target object according to a center position of the shadow and the shadow shape.
  • the center point of the shadow shape is determined, and the center point of the shadow shape is placed at the center position of the shadow of the target object in the target image, thereby determining the position of the shadow in the target picture, and generating the shadow effect of the target object.
  • the average light intensity can also be obtained according to the light intensity of each sub-picture as the corresponding light intensity of the target picture; according to The light intensity adjusts the pixel value corresponding to the shape of the shadow to obtain a shadow effect corresponding to the intensity of the light source.
  • the method for determining a shadow effect provided by the embodiment of the present invention can accurately and conveniently obtain the position of a light source in a picture, and at the same time, consider other prerequisite factors in the process of generating a shadow effect of a virtual object, thereby making the shadow effect of the virtual object more realistic and improved. User immersion.
  • FIG. 4 is a structural diagram of a device for determining a shadow effect according to an embodiment of the present invention.
  • the apparatus specifically includes: an obtaining module 100, a determining module 200, and a generating module 300. among them,
  • An obtaining module 100 is configured to obtain a target picture and decompose the target picture into a first preset number of sub-pictures; a determining module 200 is configured to determine a light intensity weighting center according to an image moment of the sub-picture, and based on the sub-picture The light intensity weighting center and the geometric center of the picture determine the light source position information of the target picture; a generating module 300 is configured to generate all the information according to the light source position information and the position information and contour information of the target object on the target picture. Describes the shadow effect of the target object.
  • the apparatus for determining a shadow effect provided by an embodiment of the present invention is specifically configured to execute the method provided by the embodiment shown in FIG. 1 and FIG. 2, and its implementation principles, methods, and functional uses are similar to the embodiments shown in FIG. 1 and FIG. 2. , Will not repeat them here.
  • FIG. 5 is a structural diagram of a device for determining a shadow effect according to an embodiment of the present invention. As shown in FIG. 5, the device specifically includes: an acquisition module 100, a determination module 200, and a generation module 300. among them,
  • An obtaining module 100 is configured to obtain a target picture and decompose the target picture into a first preset number of sub-pictures; a determining module 200 is configured to determine a light intensity weighting center according to an image moment of the sub-picture, and based on the sub-picture The light intensity weighting center and the geometric center of the picture determine the light source position information of the target picture; a generating module 300 is configured to generate all the information according to the light source position information and the position information and contour information of the target object on the target picture. Describes the shadow effect of the target object.
  • the generating module 300 includes a first determining unit 310, a second determining unit 320, a processing unit 330, and a generating unit 340.
  • a first determining unit 310 is configured to determine a center position of a shadow of the target object according to the light source position information and the position information of the target object on the target picture; a second determining unit 320 is configured to acquire the target object The surrounding environment information on the target picture, and the corresponding shading environment adjustment factor is determined according to the surrounding environment information; the processing unit 330 is configured to obtain the congruent graphics of the target object based on the contour information, and according to the The shadow environment adjustment factor processes the congruent graphics to obtain a shadow shape of the target object; a generating unit 340 is configured to generate a shadow effect of the target object according to a center position of the shadow and the shadow shape.
  • the generating module 300 is further configured to determine whether the target object belongs to a regular shape by using a pre-trained model; if the target object belongs to a regular shape, extract feature information corresponding to the regular shape as contour information of the target object ; If it does not belong to a regular shape, determine the outline information of the target object according to the target object and pixel values around the target object.
  • the generating module 300 is further configured to obtain an average light intensity according to the light intensity of each of the sub-pictures as the light intensity corresponding to the target picture; and process the shadow effect of the target object according to the light intensity. .
  • the determining module 200 is further configured to determine a light angle of the sub-picture according to a light intensity weighting center of the sub-picture and a geometric center of the sub-picture; determine a weight value corresponding to each of the sub-pictures; The weight value is a weighted sum of a vector of light angles of the sub-pictures to obtain a light angle corresponding to the target picture; a light source of the target picture is determined according to the light angle and a pixel value of the target picture location information.
  • the apparatus for determining a shadow effect provided by the embodiment of the present invention is specifically configured to execute the method provided by the embodiment shown in FIG. 1 to FIG. 3, and the implementation principles, methods, and functional uses thereof are similar to the embodiment shown in FIG. 1-3, I will not repeat them here.
  • the above-mentioned apparatus for determining a shadow effect may be used as one of the software or hardware functional units, which may be independently provided in the above-mentioned electronic device, or may be used as one of the functional modules integrated in the processor to execute the embodiments of the present invention. How to determine the shadow effect.
  • FIG. 6 is a schematic diagram of a hardware structure of an electronic device that executes a method for determining a shadow effect provided by an embodiment of a method of the present invention.
  • the electronic device includes:
  • One or more processors 610 and a memory 620 are taken as an example in FIG. 6.
  • the apparatus for performing the method for determining a shadow effect may further include an input device 630 and an output device 630.
  • the processor 610, the memory 620, the input device 630, and the output device 640 may be connected through a bus or other methods. In FIG. 6, the connection through the bus is taken as an example.
  • the memory 620 is a non-volatile computer-readable storage medium, and can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as the method for determining a shadow effect in the embodiment of the present invention. Corresponding program instructions / modules.
  • the processor 610 executes various functional applications and data processing of the server by running non-volatile software programs, instructions, and modules stored in the memory 620, that is, a method for determining the shadow effect.
  • the memory 620 may include a storage program area and a storage data area, wherein the storage program area may store an operating system and an application program required for at least one function; the storage data area may store a use of a determining device for a shadow effect according to an embodiment of the present invention Data created, etc.
  • the memory 620 may include a high-speed random access memory 620, and may further include a non-volatile memory 620, such as at least one magnetic disk memory 620, a flash memory device, or other non-volatile solid-state memory 620.
  • the memory 620 may optionally include a memory 620 remotely disposed with respect to the processor 66, and these remote memories 620 may be connected to the shadow effect determining device through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
  • the input device 630 may receive inputted numeric or character information, and generate key signal inputs related to user settings and function control of the determination device of the shadow effect.
  • the input device 630 may include a device such as a pressing module.
  • the one or more modules are stored in the memory 620, and when executed by the one or more processors 610, perform a method of determining the shadow effect.
  • the electronic devices in the embodiments of the present invention exist in various forms, including but not limited to:
  • Mobile communication equipment This type of equipment is characterized by mobile communication functions, and its main goal is to provide voice and data communication.
  • Such terminals include: smart phones (such as iPhone), multimedia phones, feature phones, and low-end phones.
  • Ultra-mobile personal computer equipment This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has the characteristics of mobile Internet access.
  • Such terminals include: PDA, MID and UMPC devices, such as iPad.
  • Portable entertainment equipment This type of equipment can display and play multimedia content. These devices include audio and video players (such as iPods), handheld game consoles, e-books, as well as smart toys and portable car navigation devices.
  • the electronic device in this embodiment may be a mobile phone with a support structure.
  • the mobile phone may be used to obtain a target picture in the method for determining a shadow effect in the foregoing embodiment.
  • the mobile phone is provided with a support plate on the back cover, which can make the mobile phone support stably, and is stable enough when acquiring target images and videos, thereby obtaining high-quality target pictures, and laying a foundation for subsequent processing of the target pictures.
  • the mobile phone's built-in support plate prevents the user from using a mobile phone case with a stand and an externally sticky stand, which facilitates the heat dissipation of the mobile phone, improves the aesthetics, and solves the fatigue caused by the user holding the mobile phone for a long time.
  • the mobile phone includes a front panel with a display screen (not shown in the figure) and a mobile phone back cover 1000; a middle and lower part of the mobile phone back cover 1000 is provided with a recessed area 1100, and the recessed area 1100 is inside
  • a support plate 2000 adapted to the shape and size of the recessed area 1100 is installed; the upper end of the support plate 2000 is hinged to the recessed area 1100 so that the support plate 2000 can be rotated to the mobile phone back cover 1000 is a preset angle.
  • the upper end of the support plate 2000 in this embodiment may have a rotating shaft, and the upper end of the recessed portion has a shaft hole adapted to the rotating shaft. The cooperation between the rotating shaft and the shaft hole is used to realize the support plate 2000. It can be rotated, of course, other rotating mechanisms with simpler structures are also within the optional range of this embodiment.
  • a connection piece 3000 is provided at the lower end of the support plate 2000.
  • One end of the connection piece 3000 is soft-connected to the support plate 2000 and the other end has A plugging portion 310 adapted to the shape and size of the mobile phone charging interface 4000.
  • the plugging portion 310 is mated with the mobile phone charging interface 4000.
  • the connecting member 3000 in this embodiment is made of rubber. The use of rubber not only has good deformation ability, but also has low cost and is easy to implement.
  • a rotatable support plate is provided in the recessed area of the back cover of the mobile phone, which can support the mobile phone side by side to meet the user's requirements.
  • the lower end of the support plate is fixed by connecting with the charging interface of the mobile phone, and it can also protect the charging interface and improve the functionality of the support plate.
  • the expansion of the support plate in this embodiment is also very convenient. It only needs to be pulled out from the charging port of the mobile phone.
  • the existing support plate cannot play the role of fixing the mobile phone. Therefore, the inventor made further improvements to the above-mentioned support plate structure.
  • the support plate 2000 in this embodiment specifically includes a first plate body 2100, a second plate body 2200, a first connection plate 2300, a second connection plate 2400, and a connecting rod 2500.
  • the first plate body 2100, the first connection plate 2300, the second connection plate 2400, and the second plate body 2200 are sequentially connected to form a plate body.
  • the first plate body 2100 has opposite first ends and second ends (i.e., FIG.
  • the second plate body 2200 has opposite third and fourth ends (ie, the upper and lower ends in the figure), and the link 2500 includes a first rod body 2510 and a second rod body 2520, opposite ends of the first rod body 2510 are hinged to the first end and the third end, respectively, and opposite ends of the second rod body 2520 are respectively connected to the second end and the fourth end Phase articulation, wherein the first rod body 2510 and the second rod body 2520 are both disposed on a side of the support plate away from the front panel.
  • the number of the connecting rods 2500 in this embodiment may also be one, and two ends of one connecting rod 2500 are respectively connected to the first and second ends, or two ends of one connecting rod 2500 are respectively connected to the first and second ends.
  • the three ends are connected to the fourth end, or one end of a link 2500 is connected to the middle of one side of the first plate 2100, and the other end is connected to the middle of one side of the second plate 2200.
  • the first connection The plate 2300 and the second connection plate 2400 are separate structures, that is, the first connection plate 2300 and the second connection plate 2400 are each composed of two plate-shaped members.
  • Above a link 2500 is the first connection plate 2300 and the second connection One plate-like member of the plate 2400, and below the link 2500 is another plate-like member of the first connection plate 2300 and the second connection plate 2400.
  • first connection plate 2300 and the second connection plate 2400 in this embodiment are located between the first plate body 2100 and the second plate body 2200, and one side of the first connection plate 2300
  • One side of the first plate body 2100 is hinged
  • one side of the second connection plate 2400 is hinged with one side of the second plate body 2200
  • the other side of the first connection plate 2300 is connected to the second plate
  • the other side of the connection plate 2400 is hinged, wherein the first connection plate 2300 and the second connection plate 2400 are disposed on a side of the support plate 2000 near the front panel.
  • the first plate body 2100 in this embodiment is provided with a first portion 2110 disposed along a thickness direction thereof, and the first portion 2110 is located in the first plate body 2100 and the connecting rod 2500.
  • the second plate body 2200 is provided with a second portion 2210 disposed along the thickness direction of the second plate body 2200, and the second portion 2210 is located between the hinge between the second plate body 2200 and the connecting rod 2500 and the hinge between the second plate body 2200 and the second connecting plate 2400; the first portion 2110, the second portion 2210, the first portion A connecting plate 2300, a second connecting plate 2400, and a connecting rod 2500 form a five-bar mechanism.
  • the above structure forms a five-bar mechanism through the first portion 2110, the second portion 2210, the first connection plate 2300, the second connection plate 2400, and the connecting rod 2500.
  • the entire support plate 2000 structure is rotated to a certain angle.
  • the first rod body 2510 and the second rod body 2520 are both disposed on a side of the support plate 2000 away from the front panel, and the first connection plate 2300 and the second connection plate 2400 are disposed on a side of the support plate 2000 near the front panel.
  • the five-link 2500 mechanism is at the first dead point position.
  • the first plate 2100 and the first plate 2100, the first connection plate 2300, and the second connection The plate 2400 cannot be rotated, and the dead point position can only be opened by an external force near the front panel, which can ensure that the support plate 2000 is always a plate structure, which provides a stable support for the mobile phone.
  • the first connecting plate and the second plate 2200 can be folded.
  • the first connecting plate 2300 and the first connecting plate 2300 are rotated to the second dead point and the first connecting plate 2300.
  • the second connecting plate 2400 can form a finger receiving portion for inserting a finger into the finger receiving portion, and can fix the mobile phone on a human hand to prevent the user from being crowded and colliding during use, causing the mobile phone to fall.
  • the support plate 2000 not only plays a supporting role, but also plays a role of fixing the mobile phone, which greatly improves its functionality.
  • phase articulation between the two components described above may be provided with a shaft hole in one component, and a rotation shaft, a rotation shaft and a shaft hole matched with the shaft hole in the other component. Together, they form a rotating mechanism so that the two components can rotate relative to each other.
  • the material of the first connection plate 2300 and the second connection plate 2400 can be selected to have a certain deformability, such as soft plastic.
  • a certain deformability such as soft plastic.
  • the first end, the second end, the third end, and the fourth end of the embodiment are each provided with a recess 2600, and the opposite ends of the first rod body 2510 are respectively disposed in the recesses.
  • opposite ends of the second rod body 2520 are respectively placed in the recessed portion 2600 of the third end and the recessed portion 2600 of the fourth end.
  • the link 2500 mechanism is provided in the board body through the recessed portion, so that the link 2500 mechanism, the board body, and the connecting plate together form a board structure, which improves the integrity of the entire support plate 2000 and facilitates the installation of the support plate 2000.
  • the recessed area 1100 specifically includes a bottom wall and a side wall.
  • the bottom wall is provided with a ventilation structure 1110, and the ventilation structure 1110 may be a plurality of The ventilation hole and the ventilation structure 1110 may be provided with a ventilation grille on the bottom wall.
  • the design of the ventilation holes and the ventilation grille can enhance the heat dissipation effect of the mobile phone when the support plate 2000 is in a supported state or a folded state, thereby extending the service life of the mobile phone.
  • the device embodiments described above are only schematic, and the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, which may be located in One place, or can be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objective of the solution of this embodiment. Those of ordinary skill in the art can understand and implement without creative labor.
  • An embodiment of the present invention provides a non-transitory computer-readable storage storage medium, where the computer storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the electronic device is caused.
  • An embodiment of the present invention provides a computer program product, wherein the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, and when the program instructions When executed by an electronic device, the electronic device is caused to execute the method for determining a shadow effect in any of the foregoing method embodiments.
  • each embodiment can be implemented by means of software plus a necessary universal hardware platform, and of course, also by hardware.
  • the above-mentioned technical solution in essence or a part that contributes to the existing technology may be embodied in the form of a software product, and the computer software product may be stored in a computer-readable storage medium, the computer-readable record A medium includes any mechanism for storing or transmitting information in a form readable by a computer (eg, a computer).
  • machine-readable media include read-only memory (ROM), random-access memory (RAM), magnetic disk storage media, optical storage media, flash storage media, electrical, optical, acoustic, or other forms of propagation signals (e.g., carrier waves , Infrared signals, digital signals, etc.), the computer software product includes a number of instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute various embodiments or certain parts of the embodiments Methods.

Abstract

Provided by the embodiments of the present invention are a method and device for determining a shadow effect and an electronic device, the method comprising: obtaining a target picture, and decomposing the target picture into a first preset number of sub-pictures; determining a light intensity weighting center according to an image moment of the sub-pictures, and determining light source position information of the target picture on the basis of the light intensity weighting center and geometric center of the sub-pictures; and generating a shadow effect of a target object according to the light source position information and position information and contour information of the target object in the target picture. By means of the described method, device and electronic device, the position of a light source in a picture may be accurately and conveniently obtained, and other related factors are considered in the process of generating the shadow effect of a virtual object, so that the shadow effect of the virtual object is more lifelike, thereby improving the immersion feeling of the user.

Description

阴影效果的确定方法、装置及电子设备Method, device and electronic equipment for determining shadow effect 技术领域Technical field
本发明涉及图像处理技术领域,尤其涉及一种阴影效果的确定方法、装置及电子设备。The present invention relates to the technical field of image processing, and in particular, to a method, a device, and an electronic device for determining a shadow effect.
背景技术Background technique
增强现实(Augmented Reality,简称AR)技术,是实时地计算摄影机影像的位置及角度并加上相应图像、视频、3D模型,在屏幕上把虚拟对象放在真实世界并进行互动的一项技术。用户通过利用AR设备,能够感知到虚拟对象的存在。然而在实现本发明的过程中,发明人发现相关技术中,在对虚拟对象进行阴影效果渲染时,一般仅仅是根据虚拟对象的形状来确定其阴影形状,而在现实场景中由于各方因素的影响阴影形状一般会和其对象本体有一定的偏差,这就使得虚拟对象的阴影效果与真实世界不符。Augmented Reality (AR) technology is a technology that calculates the position and angle of a camera image in real time, adds corresponding images, videos, and 3D models, and places virtual objects on the screen to interact with the real world. By using AR devices, users can sense the existence of virtual objects. However, in the process of implementing the present invention, the inventors found that in the related art, when rendering a virtual object with a shadow effect, the shadow shape of the virtual object is generally determined only according to the shape of the virtual object. In a real scene, due to various factors, The influence of the shadow shape will generally deviate from its object body, which makes the shadow effect of the virtual object inconsistent with the real world.
此外,为了获得与现实场景相同的AR虚拟对象,往往通过手机相机直接拍摄获取,并且越来越多的场景开始直接通过手机屏幕播放AR视频。为了避免手持设备发生抖动而造成取景效果不佳,从而导致后续的图像处理问题,或者用户长时间手持手机观看视频导致体力不支,往往需要将手机安装于固定支架以保持稳定,专用相机支架固然效果颇佳,但是成本昂贵、体积较大,普通用户往往使用手机简易支架就能达到所需的取景效果和稳固支撑的效果,但通常的简易支架位于手机保护壳上、或通过强力胶粘贴在手机背部,越来越多的用户因为手机玻璃日益坚固、手机散热问题、手机美观度的原因而不愿意使用手机保护壳和胶粘的简易支架。In addition, in order to obtain the same AR virtual object as the real scene, it is often captured directly through a mobile phone camera, and more and more scenes start to play AR videos directly through the mobile phone screen. In order to avoid the poor framing effect caused by the shake of the handheld device, which leads to subsequent image processing problems, or the user's physical fatigue when watching the video while holding the phone for a long time, it is often necessary to install the phone in a fixed bracket to maintain stability. It is quite good, but it is expensive and bulky. Ordinary users often use the simple bracket of the mobile phone to achieve the desired framing effect and stable support effect. However, the simple bracket is usually located on the protective case of the mobile phone or pasted with strong glue. On the back of mobile phones, more and more users are reluctant to use mobile phone protective cases and sticky simple brackets due to the increasingly strong glass of mobile phones, heat dissipation problems of mobile phones, and the aesthetics of mobile phones.
发明内容Summary of the Invention
本发明实施例提供的阴影效果的确定方法、装置及电子设备,用以至 少解决相关技术中的上述问题。The method, device, and electronic device for determining a shadow effect provided by the embodiments of the present invention are used to solve at least the foregoing problems in related technologies.
本发明实施例一方面提供了一种阴影效果的确定方法,包括:An embodiment of the present invention provides a method for determining a shadow effect, including:
获取目标图片,将所述目标图片分解成第一预设数量的子图片;根据所述子图片的图像矩确定光强加权中心,基于所述子图片的所述光强加权中心和几何中心确定所述目标图片的光源位置信息;根据所述光源位置信息和所述目标图片上目标对象的位置信息、轮廓信息,生成所述目标对象的阴影效果。Obtain a target picture, decompose the target picture into a first preset number of sub-pictures; determine a light intensity weighting center according to the image moment of the sub picture, and determine based on the light intensity weighting center and the geometric center of the sub-picture Light source position information of the target picture; and generating a shadow effect of the target object according to the light source position information and position information and contour information of the target object on the target picture.
进一步地,所述根据所述光源位置信息和所述目标图片上目标对象的位置信息、轮廓信息,生成所述目标对象的阴影效果,包括:根据所述光源位置信息和所述目标图片上目标对象的位置信息,确定所述目标对象的阴影的中心位置;获取所述目标对象在所述目标图片上的周围环境信息,并依据所述周围环境信息确定对应的阴影环境调整因子;基于所述轮廓信息获取所述目标对象的全等图形,根据所述阴影环境调整因子对所述全等图形进行处理,得到所述目标对象的阴影形状;根据所述阴影的中心位置和所述阴影形状生成所述目标对象的阴影效果。Further, generating the shadow effect of the target object according to the light source position information and the position information and contour information of the target object on the target picture includes: according to the light source position information and the target on the target picture Position information of the object, determining a center position of the shadow of the target object; acquiring surrounding environment information of the target object on the target picture, and determining a corresponding shadow environment adjustment factor according to the surrounding environment information; based on the The contour information obtains the congruent graphics of the target object, and the congruent graphics are processed according to the shadow environment adjustment factor to obtain the shadow shape of the target object; generated according to the center position of the shadow and the shadow shape The shadow effect of the target object.
进一步地,所述轮廓信息通过如下步骤获取:通过预先训练的模型判断所述目标对象是否属于规则形状;若属于规则形状,则提取所述规则形状对应的特征信息,作为所述目标对象的轮廓信息;若不属于规则形状,则根据所述目标对象以及所述目标对象周围的像素值确定所述目标对象的轮廓信息。Further, the contour information is obtained by the following steps: judging whether the target object belongs to a regular shape through a pre-trained model; if it belongs to a regular shape, extracting feature information corresponding to the regular shape as the contour of the target object Information; if it does not belong to a regular shape, determine the outline information of the target object according to the target object and pixel values around the target object.
进一步地,所述方法还包括:根据各所述子图片的光线强度得到平均光强,作为所述目标图片对应的光线强度;根据所述光线强度对所述目标对象的阴影效果进行处理。Further, the method further comprises: obtaining an average light intensity according to the light intensity of each of the sub-pictures as the light intensity corresponding to the target picture; and processing the shadow effect of the target object according to the light intensity.
进一步地,所述基于所述子图片的所述光强加权中心和几何中心确定所述目标图片的光源位置信息,包括:根据所述子图片的光强加权中心与所述子图片的几何中心确定所述子图片的光线角度;确定各所述子图片对应的权重值;根据所述权重值对各所述子图片的光线角度的向量进行加权求和,得到所述目标图片对应的光线角度;根据所述光线角度和所述目标图片的像素值确定所述目标图片的光源位置信息。Further, determining the light source position information of the target picture based on the light intensity weighting center and the geometric center of the sub-picture includes: according to the light intensity weighting center of the sub-picture and the geometric center of the sub-picture Determining a light angle of the sub-picture; determining a weight value corresponding to each of the sub-pictures; and performing a weighted sum of a vector of light angles of each of the sub-pictures according to the weight value to obtain a light angle corresponding to the target picture Determining the light source position information of the target picture according to the light angle and the pixel value of the target picture.
本发明实施例的另一方面提供了一种阴影效果的确定装置,包括:Another aspect of the embodiments of the present invention provides a device for determining a shadow effect, including:
获取模块,用于获取目标图片,将所述目标图片分解成第一预设数量 的子图片;确定模块,用于根据所述子图片的图像矩确定光强加权中心,基于所述子图片的所述光强加权中心和几何中心确定所述目标图片的光源位置信息;生成模块,用于根据所述光源位置信息和所述目标图片上目标对象的位置信息、轮廓信息,生成所述目标对象的阴影效果。An obtaining module is configured to obtain a target picture and decompose the target picture into a first preset number of sub-pictures; a determining module is used to determine a light intensity weighting center according to an image moment of the sub-picture, and based on the sub-picture The light intensity weighting center and the geometric center determine light source position information of the target picture; a generating module is configured to generate the target object according to the light source position information and position information and contour information of the target object on the target picture Shadow effect.
进一步地,所述生成模块包括:第一确定单元,用于根据所述光源位置信息和所述目标图片上目标对象的位置信息,确定所述目标对象的阴影的中心位置;第二确定单元,用于获取所述目标对象在所述目标图片上的周围环境信息,并依据所述周围环境信息确定对应的阴影环境调整因子;处理单元,用于基于所述轮廓信息获取所述目标对象的全等图形,根据所述阴影环境调整因子对所述全等图形进行处理,得到所述目标对象的阴影形状;生成单元,用于根据所述阴影的中心位置和所述阴影形状生成所述目标对象的阴影效果。Further, the generating module includes: a first determining unit, configured to determine a center position of a shadow of the target object according to the light source position information and the position information of the target object on the target picture; a second determining unit, It is configured to obtain the surrounding environment information of the target object on the target picture, and determine a corresponding shading environment adjustment factor according to the surrounding environment information; a processing unit is configured to obtain a full range of the target object based on the contour information. Iso-graphics, and processing the congruent graphics according to the shadow environment adjustment factor to obtain the shadow shape of the target object; a generating unit for generating the target object according to the center position of the shadow and the shadow shape Shadow effect.
进一步地,所述生成模块还用于,通过预先训练的模型判断所述目标对象是否属于规则形状;若属于规则形状,则提取所述规则形状对应的特征信息,作为所述目标对象的轮廓信息;若不属于规则形状,则根据所述目标对象以及所述目标对象周围的像素值确定所述目标对象的轮廓信息。Further, the generating module is further configured to determine whether the target object belongs to a regular shape through a pre-trained model; if the target object belongs to a regular shape, extract feature information corresponding to the regular shape as contour information of the target object ; If it does not belong to a regular shape, determine the outline information of the target object according to the target object and pixel values around the target object.
进一步地,所述生成模块还用于,根据各所述子图片的光线强度得到平均光强,作为所述目标图片对应的光线强度;根据所述光线强度对所述目标对象的阴影效果进行处理。Further, the generating module is further configured to obtain an average light intensity according to the light intensity of each of the sub-pictures as the light intensity corresponding to the target picture; and process the shadow effect of the target object according to the light intensity. .
进一步地,所述确定模块还用于,根据所述子图片的光强加权中心与所述子图片的几何中心确定所述子图片的光线角度;确定各所述子图片对应的权重值;根据所述权重值对各所述子图片的光线角度的向量进行加权求和,得到所述目标图片对应的光线角度;根据所述光线角度和所述目标图片的像素值确定所述目标图片的光源位置信息。Further, the determining module is further configured to determine a light angle of the sub-picture according to a light intensity weighting center of the sub-picture and a geometric center of the sub-picture; determine a weight value corresponding to each of the sub-pictures; The weight value is a weighted sum of a vector of light angles of the sub-pictures to obtain a light angle corresponding to the target picture; a light source of the target picture is determined according to the light angle and a pixel value of the target picture location information.
本发明实施例的又一方面提供一种电子设备,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行上述阴影效果的确定方法。Another aspect of the embodiments of the present invention provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a memory that can be used by the at least one processor And an instruction that is executed by the at least one processor, so that the at least one processor can execute the foregoing method for determining a shadow effect.
进一步地,所述电子设备包括手机,上述阴影效果的确定方法中的目标图片通过该手机的摄像装置获取。所述手机包括具有显示屏的前面板和手机后盖;所述手机后盖的中下部设有一凹陷区,所述凹陷区内安装有与所述凹 陷区形状尺寸相适配的支撑板;所述支撑板的上端与所述凹陷区铰接,以使所述支撑板能够转动至与所述手机后盖呈一预设角度;所述支撑板的下端设置有一连接件,所述连接件一端与所述支撑板软连接,另一端具有与手机充电接口形状尺寸相适配的封堵部,所述封堵部与所述手机充电接口插接配合;Further, the electronic device includes a mobile phone, and the target picture in the method for determining a shadow effect is obtained through a camera device of the mobile phone. The mobile phone includes a front panel with a display screen and a mobile phone back cover; a middle and lower part of the mobile phone back cover is provided with a recessed area, and a support plate adapted to the shape and size of the recessed area is installed in the recessed area; The upper end of the support plate is hinged with the recessed area, so that the support plate can be rotated to a predetermined angle with the back cover of the mobile phone; a lower end of the support plate is provided with a connecting piece, and one end of the connecting piece and The support plate is soft-connected, and the other end is provided with a plugging portion adapted to the shape and size of the mobile phone charging interface, and the plugging portion is mated with the mobile phone charging interface;
进一步的,所述支撑板包括第一板体、第二板体、第一连接板、第二连接板以及连杆,所述第一板体、第一连接板、第二连接板和第二板体依次连接形成一板体;所述第一板体具有相对的第一端和第二端,所述第二板体具有相对的第三端和第四端,所述连杆包括第一杆体和第二杆体,所述第一杆体相对两端分别与所述第一端和所述第三端相铰接,所述第二杆体相对两端分别与所述第二端和所述第四端相铰接,其中所述第一杆体和所述第二杆体均设置在所述支撑板远离所述前面板的一侧;所述第一连接板和所述第二连接板位于所述第一板体和所述第二板体之间,所述第一连接板一侧与所述第一板体一侧相铰接,所述第二连接板一侧与所述第二板体一侧相铰接,所述第一连接板另一侧与所述第二连接板另一侧相铰接,所述第一连接板和所述第二连接板设置在所述支撑板靠近所述前面板的一侧;所述第一板体设有沿其厚度方向设置的第一部分,所述第一部分位于所述第一板体与所述连杆的铰接处和所述第一板体与所述第一连接板的铰接处之间;所述第二板体设有沿其厚度方向设置的第二部分,所述第二部分位于所述第二板体与连杆的铰接处和所述第二板体与所述第二连接板的铰接处之间;所述第一部分、第二部分、第一连接板、第二连接板以及连杆形成五杆体机构。Further, the support plate includes a first plate body, a second plate body, a first connection plate, a second connection plate, and a link, the first plate body, the first connection plate, the second connection plate, and the second The plates are sequentially connected to form a plate; the first plate has opposite first and second ends, the second plate has opposite third and fourth ends, and the link includes a first A rod body and a second rod body, opposite ends of the first rod body are hinged to the first end and the third end, respectively, and opposite ends of the second rod body are respectively connected to the second end and the fourth end End-to-phase hinge, wherein the first rod body and the second rod body are both disposed on a side of the support plate away from the front panel; the first connection plate and the second connection plate are located on the first Between the plate body and the second plate body, one side of the first connection plate is hinged to one side of the first plate body, and one side of the second connection plate is opposite to one side of the second plate body. Hinged, the other side of the first connection plate is hinged with the other side of the second connection plate, the first connection plate and the second connection plate The first plate is provided on a side of the support plate near the front plate; the first plate is provided with a first portion disposed along a thickness direction of the first plate, and the first portion is located at a hinge between the first plate and the connecting rod. And between the first plate body and the hinge of the first connecting plate; the second plate body is provided with a second portion provided along its thickness direction, and the second portion is located on the second plate Between the hinge between the body and the connecting rod and the hinge between the second plate and the second connecting plate; the first portion, the second portion, the first connecting plate, the second connecting plate, and the connecting rod form five Rod body mechanism.
进一步地,所述凹陷区包括底壁和侧壁,所述底壁和/或所述侧壁上设有通风结构,所述通风结构为多个通风孔或通风格栅。Further, the recessed area includes a bottom wall and a side wall, and the bottom wall and / or the side wall is provided with a ventilation structure, and the ventilation structure is a plurality of ventilation holes or ventilation grilles.
进一步地,所述连接件由橡胶制成。Further, the connecting member is made of rubber.
进一步地,所述第一端、第二端、第三端和第四端均设有一凹陷部,所述第一杆体的相对两端分别置于所述第一端的凹陷部和所述第三端的凹陷部内,所述第二杆体相对两端分别置于所述第三端的凹陷部和所述第四端的凹陷部内。Further, each of the first end, the second end, the third end, and the fourth end is provided with a recessed portion, and opposite ends of the first rod body are respectively disposed in the recessed portion of the first end and the first end. In the recessed portion at the three ends, the opposite ends of the second rod body are respectively placed in the recessed portion of the third end and the recessed portion of the fourth end.
由以上技术方案可见,本发明实施例提供的阴影效果的确定方法、装置及电子设备,能够精准便捷的获取图片中的光源位置,同时在生成虚拟对象阴影效果的过程中考虑其他先关因素,从而使得虚拟对象的阴影效果较为逼真,提升用户的沉浸感。同时,带有支撑板的手机,可以使得手机拍摄、播 放更加平稳,用户无需使用手机保护壳和粘贴件,不会影响散热,也使得手机外观更加美观,既改善了上述阴影效果确定方法中目标图片的获取质量,又可以脱离上述方法单独使用。It can be seen from the above technical solutions that the method, device, and electronic device for determining a shadow effect provided by the embodiments of the present invention can accurately and conveniently obtain the position of a light source in a picture, while considering other antecedent factors in the process of generating a shadow effect of a virtual object, Thus, the shadow effect of the virtual object is more realistic, and the immersion of the user is improved. At the same time, a mobile phone with a support plate can make the shooting and playback of the mobile phone more stable. The user does not need to use the protective case and stickers of the mobile phone. It will not affect the heat dissipation and make the mobile phone more beautiful. The quality of image acquisition can be used separately from the above method.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明实施例中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。In order to more clearly explain the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are merely These are some of the embodiments described in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to these drawings.
图1为本发明一个实施例提供的阴影效果的确定方法流程图;FIG. 1 is a flowchart of a method for determining a shadow effect according to an embodiment of the present invention; FIG.
图2为本发明一个实施例提供的子图片的光强加权中心和加权中心坐标位置图;FIG. 2 is a light intensity weighted center and a weighted center coordinate position map of a sub-picture provided by an embodiment of the present invention; FIG.
图3为本发明一个实施例提供的步骤S103的具体流程图;3 is a specific flowchart of step S103 provided by an embodiment of the present invention;
图4为本发明一个实施例提供的阴影效果的确定装置结构图;4 is a structural diagram of a device for determining a shadow effect according to an embodiment of the present invention;
图5为本发明一个实施例提供的阴影效果的确定装置结构图;5 is a structural diagram of a device for determining a shadow effect according to an embodiment of the present invention;
图6为执行本发明方法实施例提供的阴影效果的确定方法的电子设备的硬件结构示意图;6 is a schematic diagram of a hardware structure of an electronic device that executes a method for determining a shadow effect provided by an embodiment of a method of the present invention;
图7为本发明一个实施例提供的阴影效果的确定方法中获取目标图片的手机结构示意图;7 is a schematic structural diagram of a mobile phone that acquires a target picture in a method for determining a shadow effect according to an embodiment of the present invention;
图8为本发明一个实施例提供的阴影效果的确定方法中获取目标图片的手机支撑板的爆炸图;8 is an exploded view of a mobile phone support plate for obtaining a target picture in a method for determining a shadow effect according to an embodiment of the present invention;
图9为本发明一个实施例提供的用于阴影效果的确定方法中获取目标图片的手机支撑板的处于支撑状态下的示意图;FIG. 9 is a schematic diagram of a mobile phone support plate for obtaining a target picture in a method for determining a shadow effect according to an embodiment of the present invention in a supported state; FIG.
图10为图9的A部放大图;10 is an enlarged view of part A of FIG. 9;
图11为图9的B部放大图;11 is an enlarged view of a portion B of FIG. 9;
图12为本发明一个实施例提供的用于阴影效果的确定方法中获取目标图片的手机支撑板的处于折叠状态下的示意图。FIG. 12 is a schematic diagram of a mobile phone supporting plate for obtaining a target picture in a method for determining a shadow effect according to an embodiment of the present invention in a folded state.
具体实施方式detailed description
为了使本领域的人员更好地理解本发明实施例中的技术方案,下面将 结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本发明实施例一部分实施例,而不是全部的实施例。基于本发明实施例中的实施例,本领域普通技术人员所获得的所有其他实施例,都应当属于本发明实施例保护的范围。In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described The embodiments are only a part of the embodiments of the present invention, but not all the embodiments. Based on the embodiments in the embodiments of the present invention, all other embodiments obtained by those skilled in the art should belong to the protection scope of the embodiments of the present invention.
本发明实施例的执行主体为电子设备或服务器,所述电子设备包括但不限于手机、平板电脑、笔记本电脑、带摄像头的台式电脑等。下面结合附图,对本发明的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互结合。图1为本发明实施例提供的阴影效果的确定方法流程图。如图1所示,本发明实施例提供的阴影效果的确定方法,包括:The execution subject of the embodiment of the present invention is an electronic device or a server. The electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a desktop computer with a camera, and the like. Hereinafter, some embodiments of the present invention will be described in detail with reference to the drawings. In the case of no conflict, the following embodiments and features in the embodiments can be combined with each other. FIG. 1 is a flowchart of a method for determining a shadow effect according to an embodiment of the present invention. As shown in FIG. 1, a method for determining a shadow effect provided by an embodiment of the present invention includes:
S101,获取目标图片,将所述目标图片分解成第一预设数量的子图片。S101. Obtain a target picture, and decompose the target picture into a first preset number of sub-pictures.
具体地,目标图片可以是视频中的某一帧、也可以是从相机上捕捉的单个图片帧,本发明在此不做限定。获取的时机可以是基于用户的操作指令,也可以是当视频的场景满足预设的要求或条件。在视频中,当不同帧光源的位置不同时,目标对象对应的阴影效果也是不同的。Specifically, the target picture may be a certain frame in a video or a single picture frame captured from a camera, which is not limited in the present invention. The acquisition timing may be based on a user's operation instruction, or when the scene of the video meets a preset requirement or condition. In the video, when the positions of the light sources in different frames are different, the shadow effect corresponding to the target object is also different.
在本步骤中,获取目标图片之后,将该目标图片分解成第一预设数量个由预设尺寸组成的小正方形网格元素,每个小正方形网格元素作为一张子图片,其中,所述子图片由第二预设数量的像素组成。举例来说,可以把目标图片分解成C列R行(其中C、R都是整数,且C≥2,R≥2),得到多张子图片,每个子图片由p个像素组成。In this step, after obtaining the target picture, the target picture is decomposed into a first preset number of small square grid elements composed of a preset size, and each small square grid element is used as a sub-picture, where The sub-picture is composed of a second preset number of pixels. For example, the target picture can be decomposed into C columns and R rows (where C and R are integers, and C≥2, R≥2) to obtain multiple sub-pictures, each of which consists of p pixels.
作为本实施例的可选实施方式,由于光线信息不涉及颜色问题,因此对于彩色的图片,在进行分解之前,可以对目标图片进行灰度提取,也可以避免颜色会光线强度获取的影响。As an optional implementation manner of this embodiment, since the light information does not involve color problems, for a color picture, before the decomposition, the target picture can be extracted with grayscale, and the influence of the color on the light intensity acquisition can also be avoided.
S102,根据所述子图片的图像矩确定光强加权中心,基于所述子图片的所述光强加权中心和几何中心确定所述目标图片的光源位置信息。S102. Determine a light intensity weighting center according to the image moment of the sub-picture, and determine light source position information of the target picture based on the light intensity weighting center and the geometric center of the sub-picture.
首先,需要计算每一个子图片的图像矩,来确定其对应的光强加权中心。图像矩是一个从数字图形中计算出来的矩集,通常描述了该图像的全局特征,并提供了大量的关于该图像不同类型的几何特征信息,比如大小、位置、方向及形状等,例如:一阶矩与形状有关;二阶矩显示了曲线围绕直线平均值的扩展程度;三阶矩则是关于平均值的对称性测量;由二阶矩和三阶矩可以导出一组共七个不变矩,不变矩是图像的统计特征,满足平 移、伸缩、旋转均不变的不变形,在图像处理中,几何不变矩可以作为一个重要的特征来表示物体,可以据此特征来对图像进行分类等操作。上述一阶矩、二阶矩、三阶矩以及由二阶矩和三阶矩导出的七个不变矩在教科书上都有具体的计算公式,根据这些公式确定光强加权中心属于本领域的技术常识,本发明在此不做过多的赘述。First, the image moment of each sub-picture needs to be calculated to determine its corresponding light intensity weighting center. An image moment is a set of moments calculated from digital graphics. It usually describes the global features of the image and provides a lot of information about the different types of geometric features of the image, such as size, position, direction, and shape. For example: First-order moments are related to shape; second-order moments show the degree of expansion of a curve around a straight line average; third-order moments are a measure of the symmetry of the mean; second- and third-order moments can be used to derive a set of seven Moment invariant and invariant moment are the statistical characteristics of the image, which meet the invariant invariance of translation, expansion and rotation. In image processing, geometric invariant moment can be used as an important feature to represent an object. Classify images. The above-mentioned first, second, third, and seven invariant moments derived from the second and third moments have specific calculation formulas in textbooks. According to these formulas, determining the light intensity weighting center belongs to this field. Technical common sense, the present invention is not described in detail here.
如图2所示,通过图像矩确定了光强加权中心g,其在子图像中的坐标位置为(x g,y g)。 As shown in FIG. 2, the light intensity weighting center g is determined by the image moment, and its coordinate position in the sub-image is (x g , y g ).
其次,对于每个子图片,根据其光强加权中心与几何中心确定所述子图片的光线角度。具体地,如图2所示,确定子图片中几何中心c的坐标位置(x c,y c),并将该几何中心c的坐标位置与光强加权中心g的坐标位置进行比较,从几何中心c到加权中心g的向量
Figure PCTCN2018096691-appb-000001
的方向即是受到光线影响的结果,为我们提供了该子图片所在目标图片位置的局部光效指示。具体地,向量
Figure PCTCN2018096691-appb-000002
代表光线的方向,d代表向量cg的模
Figure PCTCN2018096691-appb-000003
α代表子图片的光线角度,由于tanα=(y g-y c)/(x g-x c),则α=Arctan((y g-y c)/(x g-x c)),即通过几何中心和加权中心的坐标计算得到该子图片的光线角度。
Secondly, for each sub-picture, the light angle of the sub-picture is determined according to its light intensity weighted center and geometric center. Specifically, as shown in FIG. 2, the coordinate position (x c , y c ) of the geometric center c in the sub-picture is determined, and the coordinate position of the geometric center c is compared with the coordinate position of the light intensity weighted center g. Vector from center c to weighted center g
Figure PCTCN2018096691-appb-000001
The direction of is the result of being affected by light, which provides us with a local light effect indication of the target picture location where the sub-picture is located. Specifically, vectors
Figure PCTCN2018096691-appb-000002
Represents the direction of the light, and d represents the modulus of the vector cg
Figure PCTCN2018096691-appb-000003
α represents the light angle of the sub-picture. Since tanα = (y g -y c ) / (x g -x c ), then α = Arctan ((y g -y c ) / (x g -x c )), that is, The light angle of the sub-picture is calculated by the coordinates of the geometric center and the weighted center.
再次,确定各子图片对应的权重值,根据权重值对各子图片的光线角度的向量进行加权求和,得到目标图片对应的光线角度。具体地,可以根据每个子图片对应的光线角度的向量模、和/或光线角度、和/或之前的经验确定每个子图片对应的权重值。Again, determine the weight value corresponding to each sub-picture, and perform weighted summation on the vector of the light angle of each sub-picture according to the weight value to obtain the light angle corresponding to the target picture. Specifically, a weight value corresponding to each sub-picture may be determined according to a vector mode of a light angle corresponding to each sub-picture, and / or a light angle, and / or previous experience.
作为本发明实施例的一种可选实施方式,可以根据各子图片对应的权重值和各子图片对应的光线角度的向量计算置信因子,当置信因子小于预设值时,则对上述权重值进行调整。具体地,所述置信因子为所述光线角度的向量和与所述权重值加和之比,置信因子能够表明权重值是否与向量趋势相匹配,置信因子越趋近于1,这说明权重值越合适。当置信因子小于预设值时,说明确定的权重值不合适,此时需要对权重值进行调整,调整之后再根据上述方法计算新的置信因子进行检验,直至新的置信因子能够大于预设阈值。As an optional implementation of the embodiment of the present invention, a confidence factor may be calculated according to a weight value corresponding to each sub-picture and a vector of a light angle corresponding to each sub-picture. When the confidence factor is less than a preset value, the weight value is Make adjustments. Specifically, the confidence factor is a ratio of the vector sum of the angle of the light rays to the sum of the weight values. The confidence factor can indicate whether the weight value matches the trend of the vector. The closer the confidence factor is to 1, this indicates that the weight value The more appropriate. When the confidence factor is less than the preset value, it means that the determined weight value is inappropriate. At this time, the weight value needs to be adjusted. After the adjustment, a new confidence factor is calculated and tested according to the above method until the new confidence factor can be greater than the preset threshold. .
根据所述权重值确定各子图片的光线角度的向量的长度,之后再对每个长度确定的向量进行加和,得到目标图片对应的光线角度的向量,根据该目标图片对应的光线角度的向量,即可得到目标图片对应的光线角度。The length of the vector of the light angle of each sub-picture is determined according to the weight value, and then the vectors determined by each length are added to obtain the vector of the light angle corresponding to the target picture, and the vector of the light angle corresponding to the target picture To get the light angle corresponding to the target picture.
最后,根据上述光线角度和目标图片的像素值确定所述目标图片的光源位置信息。具体地,获取目标图片中沿着光线角度以及光线角度附近的各点的像素值,从而得到沿着光线角度的亮度分布情况。由于像素点值越趋近于零,像素点的颜色越深;而像素点的越趋近于最大值255,则表示该像素点的颜色越亮,因此,可以通过对比这些点的像素值,将其中像素值最大的点推断为光源的坐标位置,可选地,可以将光源的坐标记作(x l,y l)。 Finally, the light source position information of the target picture is determined according to the light angle and the pixel value of the target picture. Specifically, pixel values along the ray angle and points near the ray angle in the target picture are acquired, so as to obtain the brightness distribution along the ray angle. The closer the pixel value is to zero, the darker the color of the pixel; the closer the pixel value is to the maximum value of 255, the brighter the color of the pixel. Therefore, by comparing the pixel values of these points, The point where the pixel value is the largest is inferred as the coordinate position of the light source, and optionally, the sitting mark of the light source may be (x l , y l ).
S103,根据所述光源位置信息和所述目标图片上目标对象的位置信息、轮廓信息,生成所述目标对象的阴影效果。S103: Generate a shadow effect of the target object according to the light source position information and the position information and contour information of the target object on the target picture.
本步骤中,根据光源位置和目标对象的位置能够确定阴影显示的位置,根据对象的轮廓信息来得到阴影的显示形状,两者结合即生成了目标对象的阴影效果。In this step, the position of the shadow display can be determined according to the position of the light source and the position of the target object, and the display shape of the shadow is obtained according to the contour information of the object. The combination of the two generates the shadow effect of the target object.
在进行本步骤之前,作为本实施例中的一些可选实施方式,可以通过如下步骤获取轮廓信息:Before performing this step, as some optional implementations in this embodiment, the contour information can be obtained by the following steps:
通过预先训练的模型判断所述目标对象是否属于规则形状;若属于规则形状,则提取所述规则形状对应的特征信息,作为所述目标对象的轮廓信息;若不属于规则形状,则根据所述目标对象以及所述目标对象周围的像素值确定所述目标对象的轮廓信息。Determine whether the target object belongs to a regular shape through a pre-trained model; if it belongs to a regular shape, extract feature information corresponding to the regular shape as contour information of the target object; if it does not belong to a regular shape, according to the The target object and pixel values around the target object determine contour information of the target object.
具体来说,目标对象可以是人、动物、物品、花草树木等,规则形状指的是一般的几何形状,例如圆形、矩形等,不规则形状包括但不限于人、动物的外形轮廓灯。在此之前,可以预先准备一些训练集,训练集中包括规则形状的对象和不规则形状的对象,利用训练集对模型进行训练,使得模型能够识别每个对象属于规则形状还是不规则形状,进一步地,对于规则形状的对象,模型还能够识别其对应的形状。Specifically, the target object may be a person, an animal, an article, a flower, a tree, or the like. The regular shape refers to a general geometric shape, such as a circle, a rectangle, or the like. The irregular shape includes, but is not limited to, a contour light of a person or an animal. Prior to this, some training sets can be prepared in advance. The training set includes regular-shaped objects and irregular-shaped objects. The training set is used to train the model so that the model can identify whether each object belongs to a regular shape or an irregular shape. Further, For models with regular shapes, the model can also identify their corresponding shapes.
当通过上述模型识别出目标对象属于规则形状时,则根据其对应的形状来提取相应的特征信息。例如,目标对象为圆形时,则提取的特征是半径;目标对象是矩形时,则提取的特征是长和宽。根据该特征信息就可以得到目标对象的轮廓。When it is identified through the above model that the target object belongs to a regular shape, corresponding feature information is extracted according to its corresponding shape. For example, when the target object is circular, the extracted features are radius; when the target object is rectangular, the extracted features are length and width. According to the characteristic information, the outline of the target object can be obtained.
当通过上述模型识别出目标对象不属于规则形状时,由于目标对象本身包括的像素值与其边缘的像素值是有很大不同的,因此可以围绕目标对象提取像素值发生突变的临界点,将这些点连接起来作为该不规则形状的 目标对象的轮廓信息。When it is identified through the above model that the target object does not belong to a regular shape, because the pixel value included in the target object itself is very different from the pixel values at its edges, the critical points where the pixel values change suddenly can be extracted around the target object. The points are connected as outline information of the irregularly shaped target object.
具体地,如图3所示,本步骤可以通过如下子步骤进行:Specifically, as shown in FIG. 3, this step may be performed through the following sub-steps:
S1031,根据所述光源位置信息和所述目标图片上目标对象的位置信息,确定所述目标对象的阴影的中心位置。S1031: Determine the center position of the shadow of the target object according to the light source position information and the position information of the target object on the target picture.
首先,获取目标对象在目标图片上的位置信息,一般为在目标图像上的坐标信息(x i,y i),同时,在根据步骤S102确定的光源坐标信息(x l,y l),可以计算得到目标对象的阴影相对于该光源的阴影中心位置。可选地,可以通过如下公式确定阴影中心位置。其中,x s为阴影中心的横坐标,y s为阴影中心的纵坐标。 First, the position information of the target object on the target picture is generally obtained as coordinate information (x i , y i ) on the target image. At the same time, the light source coordinate information (x l , y l ) determined according to step S102 can be The shadow position of the target object relative to the shadow center position of the light source is calculated. Alternatively, the shadow center position can be determined by the following formula. Among them, x s is the abscissa of the shadow center, and y s is the ordinate of the shadow center.
Figure PCTCN2018096691-appb-000004
Figure PCTCN2018096691-appb-000004
Figure PCTCN2018096691-appb-000005
Figure PCTCN2018096691-appb-000005
S1032,获取所述目标对象在所述目标图片上的周围环境信息,并依据所述周围环境信息确定对应的阴影环境调整因子。S1032: Acquire the surrounding environment information of the target object on the target picture, and determine a corresponding shading environment adjustment factor according to the surrounding environment information.
在实际场景中,目标对象周围的环境(例如周围的建筑物、周围设置的物品等)均会对其阴影形状产生影响,因此可以预先获取目标图片中目标对象周围的环境信息,例如周围环境与目标对象的相对位置、周围对象的形状信息等,根据这些信息确定对应的阴影环境调整因子,用于对目标对象的阴影形状进行调整。In an actual scene, the surrounding environment of the target object (such as surrounding buildings, surrounding objects, etc.) will affect its shadow shape, so the environmental information about the target object in the target picture, such as the surrounding environment and The relative position of the target object, the shape information of the surrounding objects, and so on, determine the corresponding shadow environment adjustment factor according to these information, and is used to adjust the shadow shape of the target object.
S1033,基于所述轮廓信息获取所述目标对象的全等图形,根据所述阴影环境调整因子对所述全等图形进行处理,得到所述目标对象的阴影形状。S1033: Obtain the congruent graphics of the target object based on the contour information, and process the congruent graphics according to the shadow environment adjustment factor to obtain the shadow shape of the target object.
基于上述得到的目标对象的轮廓信息,得到与该目标对象对应的全等图形。再根据步骤S1032中的阴影环境调整因子对该全等图形进行压缩或拉伸,得到目标对象的阴影形状。可选地,当该全等图形是规则图形时,可以将规则图形的半径或长宽分别乘以阴影环境调整因子,得到阴影形状;当该全等图形是不规则图形时,可以将该不规则图形整体乘以阴影环境调整因子,得到阴影形状。Based on the contour information of the target object obtained as described above, a congruent figure corresponding to the target object is obtained. Compressing or stretching the congruent graphics according to the shadow environment adjustment factor in step S1032 to obtain the shadow shape of the target object. Optionally, when the congruent graphic is a regular graphic, the radius or length and width of the regular graphic may be multiplied by the shadow environment adjustment factor to obtain a shadow shape; when the congruent graphic is an irregular graphic, the inconsistent graphic may be changed. Multiply the regular pattern by the shadow environment adjustment factor to get the shadow shape.
S1034,根据所述阴影的中心位置和所述阴影形状生成所述目标对象的阴影效果。S1034: Generate a shadow effect of the target object according to a center position of the shadow and the shadow shape.
具体地,首先确定阴影形状的中心点,将该阴影形状的中心点放在目标图像中上述目标对象的阴影的中心位置,从而确定了阴影在目标图片中的位置,生成了目标对象的阴影效果。Specifically, first, the center point of the shadow shape is determined, and the center point of the shadow shape is placed at the center position of the shadow of the target object in the target image, thereby determining the position of the shadow in the target picture, and generating the shadow effect of the target object. .
此外,由于光源的强度会对阴影光线的深浅产生影响,作为本发明实施例的一些可选实施方式,还可以根据各子图片的光线强度得到平均光强,作为目标图片对应的光线强度;根据所述光线强度对阴影形状对应的像素值进行调节,得到与光源强度相对应的阴影效果。In addition, since the intensity of the light source will affect the depth of the shadow light, as some optional implementations of the embodiments of the present invention, the average light intensity can also be obtained according to the light intensity of each sub-picture as the corresponding light intensity of the target picture; according to The light intensity adjusts the pixel value corresponding to the shape of the shadow to obtain a shadow effect corresponding to the intensity of the light source.
本发明实施例提供的阴影效果的确定方法,能够精准便捷的获取图片中的光源位置,同时在生成虚拟对象阴影效果的过程中考虑其他先关因素,从而使得虚拟对象的阴影效果较为逼真,提升用户的沉浸感。The method for determining a shadow effect provided by the embodiment of the present invention can accurately and conveniently obtain the position of a light source in a picture, and at the same time, consider other prerequisite factors in the process of generating a shadow effect of a virtual object, thereby making the shadow effect of the virtual object more realistic and improved. User immersion.
图4为本发明实施例提供的阴影效果的确定装置结构图。如图4所示,该装置具体包括:获取模块100,确定模块200和生成模块300。其中,FIG. 4 is a structural diagram of a device for determining a shadow effect according to an embodiment of the present invention. As shown in FIG. 4, the apparatus specifically includes: an obtaining module 100, a determining module 200, and a generating module 300. among them,
获取模块100,用于获取目标图片,将所述目标图片分解成第一预设数量的子图片;确定模块200,用于根据所述子图片的图像矩确定光强加权中心,基于所述子图片的所述光强加权中心和几何中心确定所述目标图片的光源位置信息;生成模块300,用于根据所述光源位置信息和所述目标图片上目标对象的位置信息、轮廓信息,生成所述目标对象的阴影效果。An obtaining module 100 is configured to obtain a target picture and decompose the target picture into a first preset number of sub-pictures; a determining module 200 is configured to determine a light intensity weighting center according to an image moment of the sub-picture, and based on the sub-picture The light intensity weighting center and the geometric center of the picture determine the light source position information of the target picture; a generating module 300 is configured to generate all the information according to the light source position information and the position information and contour information of the target object on the target picture. Describes the shadow effect of the target object.
本发明实施例提供的阴影效果的确定装置具体用于执行图1和图2所示实施例提供的所述方法,其实现原理、方法和功能用途等与图1和图2所示实施例类似,在此不再赘述。The apparatus for determining a shadow effect provided by an embodiment of the present invention is specifically configured to execute the method provided by the embodiment shown in FIG. 1 and FIG. 2, and its implementation principles, methods, and functional uses are similar to the embodiments shown in FIG. 1 and FIG. 2. , Will not repeat them here.
图5为本发明实施例提供的阴影效果的确定装置结构图。如图5所示,该装置具体包括:获取模块100,确定模块200和生成模块300。其中,FIG. 5 is a structural diagram of a device for determining a shadow effect according to an embodiment of the present invention. As shown in FIG. 5, the device specifically includes: an acquisition module 100, a determination module 200, and a generation module 300. among them,
获取模块100,用于获取目标图片,将所述目标图片分解成第一预设数量的子图片;确定模块200,用于根据所述子图片的图像矩确定光强加权中心,基于所述子图片的所述光强加权中心和几何中心确定所述目标图片的光源位置信息;生成模块300,用于根据所述光源位置信息和所述目标图片上目标对象的位置信息、轮廓信息,生成所述目标对象的阴影效果。An obtaining module 100 is configured to obtain a target picture and decompose the target picture into a first preset number of sub-pictures; a determining module 200 is configured to determine a light intensity weighting center according to an image moment of the sub-picture, and based on the sub-picture The light intensity weighting center and the geometric center of the picture determine the light source position information of the target picture; a generating module 300 is configured to generate all the information according to the light source position information and the position information and contour information of the target object on the target picture. Describes the shadow effect of the target object.
可选地,生成模块300包括:第一确定单元310、第二确定单元320、处理单元330和生成单元340,其中,Optionally, the generating module 300 includes a first determining unit 310, a second determining unit 320, a processing unit 330, and a generating unit 340.
第一确定单元310,用于根据所述光源位置信息和所述目标图片上目标对象的位置信息,确定所述目标对象的阴影的中心位置;第二确定单元320,用于获取所述目标对象在所述目标图片上的周围环境信息,并依据所述周围环境信息确定对应的阴影环境调整因子;处理单元330,用于基于所述轮廓信息获取所述目标对象的全等图形,根据所述阴影环境调整因子对所述全等图形进行处理,得到所述目标对象的阴影形状;生成单元340,用于根据所述阴影的中心位置和所述阴影形状生成所述目标对象的阴影效果。A first determining unit 310 is configured to determine a center position of a shadow of the target object according to the light source position information and the position information of the target object on the target picture; a second determining unit 320 is configured to acquire the target object The surrounding environment information on the target picture, and the corresponding shading environment adjustment factor is determined according to the surrounding environment information; the processing unit 330 is configured to obtain the congruent graphics of the target object based on the contour information, and according to the The shadow environment adjustment factor processes the congruent graphics to obtain a shadow shape of the target object; a generating unit 340 is configured to generate a shadow effect of the target object according to a center position of the shadow and the shadow shape.
可选地,生成模块300还用于,通过预先训练的模型判断所述目标对象是否属于规则形状;若属于规则形状,则提取所述规则形状对应的特征信息,作为所述目标对象的轮廓信息;若不属于规则形状,则根据所述目标对象以及所述目标对象周围的像素值确定所述目标对象的轮廓信息。Optionally, the generating module 300 is further configured to determine whether the target object belongs to a regular shape by using a pre-trained model; if the target object belongs to a regular shape, extract feature information corresponding to the regular shape as contour information of the target object ; If it does not belong to a regular shape, determine the outline information of the target object according to the target object and pixel values around the target object.
可选地,生成模块300还用于,根据各所述子图片的光线强度得到平均光强,作为所述目标图片对应的光线强度;根据所述光线强度对所述目标对象的阴影效果进行处理。Optionally, the generating module 300 is further configured to obtain an average light intensity according to the light intensity of each of the sub-pictures as the light intensity corresponding to the target picture; and process the shadow effect of the target object according to the light intensity. .
可选地,确定模块200还用于,根据所述子图片的光强加权中心与所述子图片的几何中心确定所述子图片的光线角度;确定各所述子图片对应的权重值;根据所述权重值对各所述子图片的光线角度的向量进行加权求和,得到所述目标图片对应的光线角度;根据所述光线角度和所述目标图片的像素值确定所述目标图片的光源位置信息。Optionally, the determining module 200 is further configured to determine a light angle of the sub-picture according to a light intensity weighting center of the sub-picture and a geometric center of the sub-picture; determine a weight value corresponding to each of the sub-pictures; The weight value is a weighted sum of a vector of light angles of the sub-pictures to obtain a light angle corresponding to the target picture; a light source of the target picture is determined according to the light angle and a pixel value of the target picture location information.
本发明实施例提供的阴影效果的确定装置具体用于执行图1-图3所示实施例提供的所述方法,其实现原理、方法和功能用途和图1-图3所示实施例类似,在此不再赘述。The apparatus for determining a shadow effect provided by the embodiment of the present invention is specifically configured to execute the method provided by the embodiment shown in FIG. 1 to FIG. 3, and the implementation principles, methods, and functional uses thereof are similar to the embodiment shown in FIG. 1-3, I will not repeat them here.
上述这些本发明实施例的阴影效果的确定装置可以作为其中一个软件或者硬件功能单元,独立设置在上述电子设备中,也可以作为整合在处理器中的其中一个功能模块,执行本发明实施例的阴影效果的确定方法。The above-mentioned apparatus for determining a shadow effect according to the embodiments of the present invention may be used as one of the software or hardware functional units, which may be independently provided in the above-mentioned electronic device, or may be used as one of the functional modules integrated in the processor to execute the embodiments of the present invention. How to determine the shadow effect.
图6为执行本发明方法实施例提供的阴影效果的确定方法的电子设备的硬件结构示意图。根据图6所示,该电子设备包括:6 is a schematic diagram of a hardware structure of an electronic device that executes a method for determining a shadow effect provided by an embodiment of a method of the present invention. According to FIG. 6, the electronic device includes:
一个或多个处理器610以及存储器620,图6中以一个处理器610为例。执行所述的阴影效果的确定方法的设备还可以包括:输入装置630和 输出装置630。One or more processors 610 and a memory 620. One processor 610 is taken as an example in FIG. 6. The apparatus for performing the method for determining a shadow effect may further include an input device 630 and an output device 630.
处理器610、存储器620、输入装置630和输出装置640可以通过总线或者其他方式连接,图6中以通过总线连接为例。The processor 610, the memory 620, the input device 630, and the output device 640 may be connected through a bus or other methods. In FIG. 6, the connection through the bus is taken as an example.
存储器620作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本发明实施例中的所述阴影效果的确定方法对应的程序指令/模块。处理器610通过运行存储在存储器620中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现所述阴影效果的确定方法。The memory 620 is a non-volatile computer-readable storage medium, and can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as the method for determining a shadow effect in the embodiment of the present invention. Corresponding program instructions / modules. The processor 610 executes various functional applications and data processing of the server by running non-volatile software programs, instructions, and modules stored in the memory 620, that is, a method for determining the shadow effect.
存储器620可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据本发明实施例提供的阴影效果的确定装置的使用所创建的数据等。此外,存储器620可以包括高速随机存取存储器620,还可以包括非易失性存储器620,例如至少一个磁盘存储器620件、闪存器件、或其他非易失性固态存储器620件。在一些实施例中,存储器620可选包括相对于处理器66远程设置的存储器620,这些远程存储器620可以通过网络连接至所述阴影效果的确定装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 620 may include a storage program area and a storage data area, wherein the storage program area may store an operating system and an application program required for at least one function; the storage data area may store a use of a determining device for a shadow effect according to an embodiment of the present invention Data created, etc. In addition, the memory 620 may include a high-speed random access memory 620, and may further include a non-volatile memory 620, such as at least one magnetic disk memory 620, a flash memory device, or other non-volatile solid-state memory 620. In some embodiments, the memory 620 may optionally include a memory 620 remotely disposed with respect to the processor 66, and these remote memories 620 may be connected to the shadow effect determining device through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
输入装置630可接收输入的数字或字符信息,以及产生与阴影效果的确定装置的用户设置以及功能控制有关的键信号输入。输入装置630可包括按压模组等设备。The input device 630 may receive inputted numeric or character information, and generate key signal inputs related to user settings and function control of the determination device of the shadow effect. The input device 630 may include a device such as a pressing module.
所述一个或者多个模块存储在所述存储器620中,当被所述一个或者多个处理器610执行时,执行所述阴影效果的确定方法。The one or more modules are stored in the memory 620, and when executed by the one or more processors 610, perform a method of determining the shadow effect.
本发明实施例的电子设备以多种形式存在,包括但不限于:The electronic devices in the embodiments of the present invention exist in various forms, including but not limited to:
(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机,以及低端手机等。(1) Mobile communication equipment: This type of equipment is characterized by mobile communication functions, and its main goal is to provide voice and data communication. Such terminals include: smart phones (such as iPhone), multimedia phones, feature phones, and low-end phones.
(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。(2) Ultra-mobile personal computer equipment: This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has the characteristics of mobile Internet access. Such terminals include: PDA, MID and UMPC devices, such as iPad.
(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具 和便携式车载导航设备。(3) Portable entertainment equipment: This type of equipment can display and play multimedia content. These devices include audio and video players (such as iPods), handheld game consoles, e-books, as well as smart toys and portable car navigation devices.
(4)服务器。(4) The server.
(5)其他具有数据交互功能的电子装置。(5) Other electronic devices with data interaction function.
具体的,本实施例中的电子设备可以是一种带有支撑结构的手机,参见图7-12,该手机可以用于上述实施例中的阴影效果的确定方法中的目标图片的获取。该手机通过在后盖设置支撑板,可以令手机平稳支撑,获取目标图像和视频时足够稳定,从而获取高质量的目标图片,为目标图片的后续处理打下基础。同时,手机自带支撑板避免了用户使用带支架的手机壳和外粘的支架,方便了手机散热,提高了美观度,解决了用户长时间手持手机导致的疲劳问题。Specifically, the electronic device in this embodiment may be a mobile phone with a support structure. Referring to FIGS. 7-12, the mobile phone may be used to obtain a target picture in the method for determining a shadow effect in the foregoing embodiment. The mobile phone is provided with a support plate on the back cover, which can make the mobile phone support stably, and is stable enough when acquiring target images and videos, thereby obtaining high-quality target pictures, and laying a foundation for subsequent processing of the target pictures. At the same time, the mobile phone's built-in support plate prevents the user from using a mobile phone case with a stand and an externally sticky stand, which facilitates the heat dissipation of the mobile phone, improves the aesthetics, and solves the fatigue caused by the user holding the mobile phone for a long time.
如图7所示,所述手机包括具有显示屏的前面板(图中未示出)和手机后盖1000;所述手机后盖1000的中下部设有一凹陷区1100,所述凹陷区1100内安装有与所述凹陷区1100形状尺寸相适配的支撑板2000;所述支撑板2000的上端与所述凹陷区1100相铰接,以使所述支撑板2000能够转动至与所述手机后盖1000呈一预设角度,具体的,本实施例的支撑板2000的上端可以具有转轴,凹陷部的上端具有与转轴相适配的轴孔,通过转轴和轴孔的配合以实现支撑板2000的可转动,当然其他结构较简单的转动机构也在本实施例的可选范围之内。As shown in FIG. 7, the mobile phone includes a front panel with a display screen (not shown in the figure) and a mobile phone back cover 1000; a middle and lower part of the mobile phone back cover 1000 is provided with a recessed area 1100, and the recessed area 1100 is inside A support plate 2000 adapted to the shape and size of the recessed area 1100 is installed; the upper end of the support plate 2000 is hinged to the recessed area 1100 so that the support plate 2000 can be rotated to the mobile phone back cover 1000 is a preset angle. Specifically, the upper end of the support plate 2000 in this embodiment may have a rotating shaft, and the upper end of the recessed portion has a shaft hole adapted to the rotating shaft. The cooperation between the rotating shaft and the shaft hole is used to realize the support plate 2000. It can be rotated, of course, other rotating mechanisms with simpler structures are also within the optional range of this embodiment.
另外,为了实现支撑板2000下端与手机的可拆卸连接,本实施例在所述支撑板2000的下端设置有一连接件3000,所述连接件3000一端与所述支撑板2000软连接,另一端具有与手机充电接口4000形状尺寸相适配的封堵部310,所述封堵部310与所述手机充电接口4000插接配合,该结构不仅实现了支撑板2000下端与手机的可拆卸连接,而且还能对充电接口4000起到保护作用,提高了支撑板2000的功能性。具体的,本实施例的所述连接件3000由橡胶制成,采用橡胶不仅具有良好的形变能力,而且成本较低,易于实现。In addition, in order to realize the detachable connection between the lower end of the support plate 2000 and the mobile phone, in this embodiment, a connection piece 3000 is provided at the lower end of the support plate 2000. One end of the connection piece 3000 is soft-connected to the support plate 2000 and the other end has A plugging portion 310 adapted to the shape and size of the mobile phone charging interface 4000. The plugging portion 310 is mated with the mobile phone charging interface 4000. This structure not only realizes the detachable connection between the lower end of the support plate 2000 and the mobile phone, but also It can also protect the charging interface 4000 and improve the functionality of the support plate 2000. Specifically, the connecting member 3000 in this embodiment is made of rubber. The use of rubber not only has good deformation ability, but also has low cost and is easy to implement.
本实施例在手机后盖的凹陷区内设有可转动的支撑板,可以对手机起到侧立支撑作用,满足用户的使用要求,无需在手机上套设手机壳,避免了手机壳对手机散热的影响。而支撑板的下端通过与手机充电接口的连接实现自身的固定,而且还能够起到保护充电接口的作用,提升了支撑板的功能性,另外,本实施例的支撑板的展开也十分方便,仅需要通过将封堵 部从手机充电接口拔出即可。In this embodiment, a rotatable support plate is provided in the recessed area of the back cover of the mobile phone, which can support the mobile phone side by side to meet the user's requirements. There is no need to set a mobile phone case on the mobile phone, which prevents the mobile phone case from affecting the mobile phone The effect of heat dissipation. The lower end of the support plate is fixed by connecting with the charging interface of the mobile phone, and it can also protect the charging interface and improve the functionality of the support plate. In addition, the expansion of the support plate in this embodiment is also very convenient. It only needs to be pulled out from the charging port of the mobile phone.
另外,现有的支撑板无法起到固定手机的作用。因此发明人对上述支撑板结构做出了进一步改进。In addition, the existing support plate cannot play the role of fixing the mobile phone. Therefore, the inventor made further improvements to the above-mentioned support plate structure.
结合附图8-12所示,本实施例的所述支撑板2000具体包括第一板体2100、第二板体2200、第一连接板2300、第二连接板2400以及连杆2500,所述第一板体2100、第一连接板2300、第二连接板2400和第二板体2200依次连接形成一板体;所述第一板体2100具有相对的第一端和第二端(即图示中的上端和下端),所述第二板体2200具有相对的第三端和第四端(即图示中的上端和下端),所述连杆2500包括第一杆体2510和第二杆体2520,所述第一杆体2510的相对两端分别与所述第一端和所述第三端相铰接,所述第二杆体2520相对两端分别与所述第二端和所述第四端相铰接,其中所述第一杆体2510和所述第二杆体2520均设置在所述支撑板远离所述前面板的一侧。As shown in FIGS. 8-12, the support plate 2000 in this embodiment specifically includes a first plate body 2100, a second plate body 2200, a first connection plate 2300, a second connection plate 2400, and a connecting rod 2500. The first plate body 2100, the first connection plate 2300, the second connection plate 2400, and the second plate body 2200 are sequentially connected to form a plate body. The first plate body 2100 has opposite first ends and second ends (i.e., FIG. (The upper and lower ends shown), the second plate body 2200 has opposite third and fourth ends (ie, the upper and lower ends in the figure), and the link 2500 includes a first rod body 2510 and a second rod body 2520, opposite ends of the first rod body 2510 are hinged to the first end and the third end, respectively, and opposite ends of the second rod body 2520 are respectively connected to the second end and the fourth end Phase articulation, wherein the first rod body 2510 and the second rod body 2520 are both disposed on a side of the support plate away from the front panel.
需要说明的是,本实施例的连杆2500的数量也可以为一个,一个连杆2500的两端分别与第一端和第二端相连接,或者,一个连杆2500的两端分别与第三端和第四端相连接,又或者,一个连杆2500的一端与第一板体2100一侧的中间相连,另一端与第二板体2200一侧的中间相连,此时,第一连接板2300和第二连接板2400为分体结构,即第一连接板2300和第二连接板2400均由两个板状件构成,一个连杆2500的上方为第一连接板2300和第二连接板2400的一个板状件,连杆2500的下方为第一连接板2300和第二连接板2400的另一板状件。It should be noted that the number of the connecting rods 2500 in this embodiment may also be one, and two ends of one connecting rod 2500 are respectively connected to the first and second ends, or two ends of one connecting rod 2500 are respectively connected to the first and second ends. The three ends are connected to the fourth end, or one end of a link 2500 is connected to the middle of one side of the first plate 2100, and the other end is connected to the middle of one side of the second plate 2200. At this time, the first connection The plate 2300 and the second connection plate 2400 are separate structures, that is, the first connection plate 2300 and the second connection plate 2400 are each composed of two plate-shaped members. Above a link 2500 is the first connection plate 2300 and the second connection One plate-like member of the plate 2400, and below the link 2500 is another plate-like member of the first connection plate 2300 and the second connection plate 2400.
具体的,本实施例的所述第一连接板2300和所述第二连接板2400位于所述第一板体2100和所述第二板体2200之间,所述第一连接板2300一侧与所述第一板体2100一侧相铰接,所述第二连接板2400一侧与所述第二板体2200一侧相铰接,所述第一连接板2300另一侧与所述第二连接板2400另一侧相铰接,其中所述第一连接板2300和所述第二连接板2400设置在所述支撑板2000靠近所述前面板的一侧。Specifically, the first connection plate 2300 and the second connection plate 2400 in this embodiment are located between the first plate body 2100 and the second plate body 2200, and one side of the first connection plate 2300 One side of the first plate body 2100 is hinged, one side of the second connection plate 2400 is hinged with one side of the second plate body 2200, and the other side of the first connection plate 2300 is connected to the second plate The other side of the connection plate 2400 is hinged, wherein the first connection plate 2300 and the second connection plate 2400 are disposed on a side of the support plate 2000 near the front panel.
如图9-11所示,本实施例的所述第一板体2100设有沿其厚度方向设置的第一部分2110,所述第一部分2110位于所述第一板体2100与所述连杆2500的铰接处和所述第一板体2100与所述第一连接板2300的铰接处之间;所述第二板体2200设有沿其厚度方向设置的第二部分2210,所 述第二部分2210位于所述第二板体2200与连杆2500的铰接处和所述第二板体2200与所述第二连接板2400的铰接处之间;所述第一部分2110、第二部分2210、第一连接板2300、第二连接板2400以及连杆2500形成五杆体机构。As shown in FIGS. 9-11, the first plate body 2100 in this embodiment is provided with a first portion 2110 disposed along a thickness direction thereof, and the first portion 2110 is located in the first plate body 2100 and the connecting rod 2500. Between the hinge portion of the first plate body 2100 and the hinge portion of the first connection plate 2300; the second plate body 2200 is provided with a second portion 2210 disposed along the thickness direction of the second plate body 2200, and the second portion 2210 is located between the hinge between the second plate body 2200 and the connecting rod 2500 and the hinge between the second plate body 2200 and the second connecting plate 2400; the first portion 2110, the second portion 2210, the first portion A connecting plate 2300, a second connecting plate 2400, and a connecting rod 2500 form a five-bar mechanism.
上述结构通过第一部分2110、第二部分2210、第一连接板2300、第二连接板2400以及连杆2500形成五杆体机构,在需要支撑时,将整个支撑板2000结构转动至一定角度,而由于第一杆体2510和第二杆体2520均设置在支撑板2000远离所述前面板的一侧,第一连接板2300和第二连接板2400设置在支撑板2000靠近所述前面板的一侧,因此在支撑板2000支撑面给到向远离前面板方向的力时,五连杆2500机构处于第一死点位置,第一板体2100和第一板体2100、第一连接板2300和第二连接板2400无法转动,只能通过向靠近前面板方向的外力打开死点位置,能够保证支撑板2000始终为一个板体结构,对手机起到稳定的支撑作用;而当通过向靠近前面板方向的外力打开死点位置时,可以将第一连板体和第二板体2200折叠,此时第一连接板2300和第一连接板2300转动至第二死点位置,第一连接板2300和第二连接板2400可以形成一个手指收容部,用于将手指插入到手指收容部内,可以将手机固定在人手上,避免用户在使用过程中出现拥挤和碰撞,而造成手机摔落,该结构的支撑板2000不仅起到支撑作用,还起到手机的固定作用,大大提高了其功能性。The above structure forms a five-bar mechanism through the first portion 2110, the second portion 2210, the first connection plate 2300, the second connection plate 2400, and the connecting rod 2500. When support is needed, the entire support plate 2000 structure is rotated to a certain angle. The first rod body 2510 and the second rod body 2520 are both disposed on a side of the support plate 2000 away from the front panel, and the first connection plate 2300 and the second connection plate 2400 are disposed on a side of the support plate 2000 near the front panel. When the support surface of the support plate 2000 gives a force away from the front panel, the five-link 2500 mechanism is at the first dead point position. The first plate 2100 and the first plate 2100, the first connection plate 2300, and the second connection The plate 2400 cannot be rotated, and the dead point position can only be opened by an external force near the front panel, which can ensure that the support plate 2000 is always a plate structure, which provides a stable support for the mobile phone. When the external force is used to open the dead point position, the first connecting plate and the second plate 2200 can be folded. At this time, the first connecting plate 2300 and the first connecting plate 2300 are rotated to the second dead point and the first connecting plate 2300. The second connecting plate 2400 can form a finger receiving portion for inserting a finger into the finger receiving portion, and can fix the mobile phone on a human hand to prevent the user from being crowded and colliding during use, causing the mobile phone to fall. The support plate 2000 not only plays a supporting role, but also plays a role of fixing the mobile phone, which greatly improves its functionality.
需要说明的是,上述的两个构件之间“相铰接”的实现方式可以是在一个构件上设有轴孔,另一构件上设有与所述轴孔相配合的转轴,转轴和轴孔共同形成一个转动机构,以使得两个构件可以相对转动。It should be noted that the implementation of the "phase articulation" between the two components described above may be provided with a shaft hole in one component, and a rotation shaft, a rotation shaft and a shaft hole matched with the shaft hole in the other component. Together, they form a rotating mechanism so that the two components can rotate relative to each other.
有利的,可以将第一连接板2300和第二连接板2400的材质选用为具有一定形变能力的材料,例如软质塑料,在第一连接板2300和第二连接板2400形成一个手指收容部时,手指插入其中可以提高舒适度。Advantageously, the material of the first connection plate 2300 and the second connection plate 2400 can be selected to have a certain deformability, such as soft plastic. When the first connection plate 2300 and the second connection plate 2400 form a finger receiving portion, , Inserting fingers into it can improve comfort.
再结合附图8所示,本实施例的所述第一端、第二端、第三端和第四端均设有一凹陷部2600,所述第一杆体2510的相对两端分别置于所述第一端的凹陷部2600和所述第三端的凹陷部2600内,所述第二杆体2520相对两端分别置于所述第三端的凹陷部2600和所述第四端的凹陷部2600内。In combination with FIG. 8, the first end, the second end, the third end, and the fourth end of the embodiment are each provided with a recess 2600, and the opposite ends of the first rod body 2510 are respectively disposed in the recesses. Within the recessed portion 2600 of the first end and the recessed portion 2600 of the third end, opposite ends of the second rod body 2520 are respectively placed in the recessed portion 2600 of the third end and the recessed portion 2600 of the fourth end.
上述结构将连杆2500机构通过凹陷部设置在板体内,使得连杆2500 机构和板体及连接板共同形成一个板体结构,提高了整个支撑板2000的整体性,便于支撑板2000的安装。In the above structure, the link 2500 mechanism is provided in the board body through the recessed portion, so that the link 2500 mechanism, the board body, and the connecting plate together form a board structure, which improves the integrity of the entire support plate 2000 and facilitates the installation of the support plate 2000.
更有利的,本实施例还对凹陷区1100的结构进行改进,所述凹陷区1100具体包括底壁和侧壁,所述底壁上设有通风结构1110,所述通风结构1110可以是多个通风孔,通风结构1110也可以是在所述底壁设有通风格栅。通风孔和通风格栅的设计可以在支撑板2000处于支撑状态或者折叠状态下,加强手机的散热效果,进而延长了手机的使用寿命。More advantageously, this embodiment further improves the structure of the recessed area 1100. The recessed area 1100 specifically includes a bottom wall and a side wall. The bottom wall is provided with a ventilation structure 1110, and the ventilation structure 1110 may be a plurality of The ventilation hole and the ventilation structure 1110 may be provided with a ventilation grille on the bottom wall. The design of the ventilation holes and the ventilation grille can enhance the heat dissipation effect of the mobile phone when the support plate 2000 is in a supported state or a folded state, thereby extending the service life of the mobile phone.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only schematic, and the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, which may be located in One place, or can be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objective of the solution of this embodiment. Those of ordinary skill in the art can understand and implement without creative labor.
本发明实施例提供了一种非暂态计算机可读存存储介质,所述计算机存储介质存储有计算机可执行指令,其中,当所述计算机可执行指令被电子设备执行时,使所述电子设备上执行上述任意方法实施例中的阴影效果的确定方法。An embodiment of the present invention provides a non-transitory computer-readable storage storage medium, where the computer storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the electronic device is caused The method for determining a shadow effect in any of the foregoing method embodiments is performed above.
本发明实施例提供了一种计算机程序产品,其中,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,其中,当所述程序指令被电子设备执行时,使所述电子设备执行上述任意方法实施例中的阴影效果的确定方法。An embodiment of the present invention provides a computer program product, wherein the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, and when the program instructions When executed by an electronic device, the electronic device is caused to execute the method for determining a shadow effect in any of the foregoing method embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,所述计算机可读记录介质包括用于以计算机(例如计算机)可读的形式存储或传送信息的任何机制。例如,机器可读介质包括只读存储器(ROM)、随机存取存储器(RAM)、磁盘存储介质、光存储介质、闪速存储介质、电、光、声或其他形式的传播信号(例如,载波、红外信号、数字信号等)等,该计算机软件产品包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执 行各个实施例或者实施例的某些部分所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary universal hardware platform, and of course, also by hardware. Based on such an understanding, the above-mentioned technical solution in essence or a part that contributes to the existing technology may be embodied in the form of a software product, and the computer software product may be stored in a computer-readable storage medium, the computer-readable record A medium includes any mechanism for storing or transmitting information in a form readable by a computer (eg, a computer). For example, machine-readable media include read-only memory (ROM), random-access memory (RAM), magnetic disk storage media, optical storage media, flash storage media, electrical, optical, acoustic, or other forms of propagation signals (e.g., carrier waves , Infrared signals, digital signals, etc.), the computer software product includes a number of instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute various embodiments or certain parts of the embodiments Methods.
最后应说明的是:以上实施例仅用以说明本发明实施例的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。In the end, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than limiting them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some of the technical features are equivalently replaced; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and range.

Claims (10)

  1. 一种阴影效果的确定方法,其特征在于,包括:A method for determining a shadow effect, including:
    获取目标图片,将所述目标图片分解成第一预设数量的子图片;Acquiring a target picture, and decomposing the target picture into a first preset number of sub-pictures;
    根据所述子图片的图像矩确定光强加权中心,基于所述子图片的所述光强加权中心和几何中心确定所述目标图片的光源位置信息;Determining a light intensity weighting center according to the image moment of the sub-picture, and determining light source position information of the target picture based on the light intensity weighting center and the geometric center of the sub-picture;
    根据所述光源位置信息和所述目标图片上目标对象的位置信息、轮廓信息,生成所述目标对象的阴影效果。Generating the shadow effect of the target object according to the light source position information and the position information and contour information of the target object on the target picture.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述光源位置信息和所述目标图片上目标对象的位置信息、轮廓信息,生成所述目标对象的阴影效果,包括:The method according to claim 1, wherein generating the shadow effect of the target object based on the light source position information and the position information and contour information of the target object on the target picture comprises:
    根据所述光源位置信息和所述目标图片上目标对象的位置信息,确定所述目标对象的阴影的中心位置;Determining the center position of the shadow of the target object according to the light source position information and the position information of the target object on the target picture;
    获取所述目标对象在所述目标图片上的周围环境信息,并依据所述周围环境信息确定对应的阴影环境调整因子;Acquiring the surrounding environment information of the target object on the target picture, and determining a corresponding shading environment adjustment factor according to the surrounding environment information;
    基于所述轮廓信息获取所述目标对象的全等图形,根据所述阴影环境调整因子对所述全等图形进行处理,得到所述目标对象的阴影形状;Obtaining the congruent graphics of the target object based on the contour information, and processing the congruent graphics according to the shadow environment adjustment factor to obtain the shadow shape of the target object;
    根据所述阴影的中心位置和所述阴影形状生成所述目标对象的阴影效果。A shadow effect of the target object is generated according to a center position of the shadow and the shadow shape.
  3. 根据权利要求2所述的方法,其特征在于,所述轮廓信息通过如下步骤获取:The method according to claim 2, wherein the contour information is obtained by the following steps:
    通过预先训练的模型判断所述目标对象是否属于规则形状;Judging whether the target object belongs to a regular shape through a pre-trained model;
    若属于规则形状,则提取所述规则形状对应的特征信息,作为所述目标对象的轮廓信息;If it belongs to a regular shape, extracting feature information corresponding to the regular shape as contour information of the target object;
    若不属于规则形状,则根据所述目标对象以及所述目标对象周围的像素值确定所述目标对象的轮廓信息。If it does not belong to a regular shape, the outline information of the target object is determined according to the target object and pixel values around the target object.
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, further comprising:
    根据各所述子图片的光线强度得到平均光强,作为所述目标图片对应的光线强度;Obtaining an average light intensity according to the light intensity of each of the sub-pictures, as the light intensity corresponding to the target picture;
    根据所述光线强度对所述目标对象的阴影效果进行处理。And processing the shadow effect of the target object according to the light intensity.
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述基于所述子图片的所述光强加权中心和几何中心确定所述目标图片的光源位置信 息,包括:The method according to any one of claims 1-4, wherein determining the light source position information of the target picture based on the light intensity weighted center and geometric center of the sub-picture includes:
    根据所述子图片的光强加权中心与所述子图片的几何中心确定所述子图片的光线角度;Determining a light angle of the sub-picture according to a light-weighted center of the sub-picture and a geometric center of the sub-picture;
    确定各所述子图片对应的权重值;Determining a weight value corresponding to each of the sub-pictures;
    根据所述权重值对各所述子图片的光线角度的向量进行加权求和,得到所述目标图片对应的光线角度;Performing weighted summation on a vector of light angles of each of the sub-pictures according to the weight value to obtain a light angle corresponding to the target picture;
    根据所述光线角度和所述目标图片的像素值确定所述目标图片的光源位置信息。Determining light source position information of the target picture according to the light angle and the pixel value of the target picture.
  6. 一种阴影效果的确定装置,其特征在于,包括:A device for determining a shadow effect, comprising:
    获取模块,用于获取目标图片,将所述目标图片分解成第一预设数量的子图片;An obtaining module, configured to obtain a target picture and decompose the target picture into a first preset number of sub-pictures;
    确定模块,用于根据所述子图片的图像矩确定光强加权中心,基于所述子图片的所述光强加权中心和几何中心确定所述目标图片的光源位置信息;A determining module, configured to determine a light intensity weighting center according to the image moment of the sub-picture, and determine light source position information of the target picture based on the light intensity weighting center and the geometric center of the sub-picture;
    生成模块,用于根据所述光源位置信息和所述目标图片上目标对象的位置信息、轮廓信息,生成所述目标对象的阴影效果。A generating module is configured to generate a shadow effect of the target object according to the light source position information and the position information and contour information of the target object on the target picture.
  7. 根据权利要求1所述的装置,其特征在于,所述生成模块包括:The apparatus according to claim 1, wherein the generating module comprises:
    第一确定单元,用于根据所述光源位置信息和所述目标图片上目标对象的位置信息,确定所述目标对象的阴影的中心位置;A first determining unit, configured to determine a center position of a shadow of the target object according to the light source position information and the position information of the target object on the target picture;
    第二确定单元,用于获取所述目标对象在所述目标图片上的周围环境信息,并依据所述周围环境信息确定对应的阴影环境调整因子;A second determining unit, configured to obtain surrounding environment information of the target object on the target picture, and determine a corresponding shading environment adjustment factor according to the surrounding environment information;
    处理单元,用于基于所述轮廓信息获取所述目标对象的全等图形,根据所述阴影环境调整因子对所述全等图形进行处理,得到所述目标对象的阴影形状;A processing unit, configured to obtain the congruent graphics of the target object based on the contour information, and process the congruent graphics according to the shadow environment adjustment factor to obtain the shadow shape of the target object;
    生成单元,用于根据所述阴影的中心位置和所述阴影形状生成所述目标对象的阴影效果。A generating unit is configured to generate a shadow effect of the target object according to a center position of the shadow and the shadow shape.
  8. 根据权利要求7所述的装置,其特征在于,所述生成模块还用于,通过预先训练的模型判断所述目标对象是否属于规则形状;若属于规则形状,则提取所述规则形状对应的特征信息,作为所述目标对象的轮廓信息;若不属于规则形状,则根据所述目标对象以及所述目标对象周围的像素值确定所述目标对象的轮廓信息。The device according to claim 7, wherein the generating module is further configured to determine whether the target object belongs to a regular shape by using a pre-trained model; if the target object belongs to a regular shape, extract features corresponding to the regular shape The information is used as the outline information of the target object; if it does not belong to a regular shape, the outline information of the target object is determined according to the target object and pixel values around the target object.
  9. 根据权利要求6所述的装置,其特征在于,所述生成模块还用于,根据各所述子图片的光线强度得到平均光强,作为所述目标图片对应的光线强度;根据所述光线强度对所述目标对象的阴影效果进行处理。The device according to claim 6, wherein the generating module is further configured to obtain an average light intensity according to the light intensity of each of the sub-pictures as the light intensity corresponding to the target picture; and according to the light intensity And processing a shadow effect of the target object.
  10. 一种电子设备,其特征在于,包括:至少一个处理器;以及,An electronic device, comprising: at least one processor; and
    与所述至少一个处理器通信连接的存储器;其中,A memory connected in communication with the at least one processor; wherein,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1至5中任一项所述的阴影效果的确定方法。The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any one of claims 1 to 5. Method for determining the shadow effect.
PCT/CN2018/096691 2018-07-23 2018-07-23 Method and device for determining shadow effect and electronic device WO2020019133A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/096691 WO2020019133A1 (en) 2018-07-23 2018-07-23 Method and device for determining shadow effect and electronic device
CN201810960587.9A CN108986203A (en) 2018-07-23 2018-08-22 The determination method, apparatus and electronic equipment of hatching effect

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/096691 WO2020019133A1 (en) 2018-07-23 2018-07-23 Method and device for determining shadow effect and electronic device

Publications (1)

Publication Number Publication Date
WO2020019133A1 true WO2020019133A1 (en) 2020-01-30

Family

ID=64547350

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/096691 WO2020019133A1 (en) 2018-07-23 2018-07-23 Method and device for determining shadow effect and electronic device

Country Status (2)

Country Link
CN (1) CN108986203A (en)
WO (1) WO2020019133A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111462295A (en) * 2020-03-27 2020-07-28 咪咕文化科技有限公司 Shadow processing method, device and storage medium in augmented reality snap
CN112532879A (en) * 2020-11-26 2021-03-19 维沃移动通信有限公司 Image processing method and device

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111833283B (en) * 2020-06-23 2024-02-23 维沃移动通信有限公司 Data processing method and device and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123743A (en) * 2014-06-23 2014-10-29 联想(北京)有限公司 Image shadow adding method and device
CN104966313A (en) * 2015-06-12 2015-10-07 浙江大学 Geometric shadow map method for triangle reconstruction
US20160125642A1 (en) * 2014-10-31 2016-05-05 Google Inc. Efficient Computation of Shadows for Circular Light Sources

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2946738B1 (en) * 2009-06-10 2011-08-19 Electricite De France AID FOR SPORTS COMPETITIONS OF PERSONS WITH POOR OR NON-INDICATOR.
CN103292740B (en) * 2013-05-24 2016-04-13 贵阳嘉瑜光电科技咨询中心 A kind of 3-D scanning instrument measurement method and device thereof
JP2017515111A (en) * 2014-04-22 2017-06-08 ビーエーエスエフ ソシエタス・ヨーロピアBasf Se Detector for optically detecting at least one object
US9778099B2 (en) * 2014-08-05 2017-10-03 Maxim Integrated Products, Inc. System and method of estimating spectral contributions in ambient light and correcting field of view errors
CN104363676B (en) * 2014-10-28 2017-10-20 许敏 A kind of LED operation shadowless lamp systems of the permanent photocontrol of fully-automatic intelligent
CN104463198A (en) * 2014-11-19 2015-03-25 上海电机学院 Method for carrying out illumination estimation on real illumination environment
CN105976431B (en) * 2016-05-23 2019-01-22 北京信息科技大学 A kind of three-dimensional surface reconstructing method based on rotation light field
CN107134005A (en) * 2017-05-04 2017-09-05 网易(杭州)网络有限公司 Illumination adaptation method, device, storage medium, processor and terminal
CN107566751B (en) * 2017-09-30 2019-11-26 北京金山安全软件有限公司 Image processing method, image processing apparatus, electronic device, and medium
CN107749075B (en) * 2017-10-26 2021-02-12 太平洋未来科技(深圳)有限公司 Method and device for generating shadow effect of virtual object in video
CN107870323A (en) * 2017-11-06 2018-04-03 深圳市杉川机器人有限公司 De-jittering method and device
CN108010118B (en) * 2017-11-28 2021-11-30 杭州易现先进科技有限公司 Virtual object processing method, virtual object processing apparatus, medium, and computing device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123743A (en) * 2014-06-23 2014-10-29 联想(北京)有限公司 Image shadow adding method and device
US20160125642A1 (en) * 2014-10-31 2016-05-05 Google Inc. Efficient Computation of Shadows for Circular Light Sources
CN104966313A (en) * 2015-06-12 2015-10-07 浙江大学 Geometric shadow map method for triangle reconstruction

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111462295A (en) * 2020-03-27 2020-07-28 咪咕文化科技有限公司 Shadow processing method, device and storage medium in augmented reality snap
CN111462295B (en) * 2020-03-27 2023-09-05 咪咕文化科技有限公司 Shadow processing method, device and storage medium in augmented reality shooting
CN112532879A (en) * 2020-11-26 2021-03-19 维沃移动通信有限公司 Image processing method and device

Also Published As

Publication number Publication date
CN108986203A (en) 2018-12-11

Similar Documents

Publication Publication Date Title
US11270419B2 (en) Augmented reality scenario generation method, apparatus, system, and device
WO2020019132A1 (en) Method and apparatus for rendering virtual object on the basis of light information, and electronic device
WO2020029178A1 (en) Light and shadow rendering method and device for virtual object in panoramic video, and electronic apparatus
WO2020173442A1 (en) Computer application method and apparatus for generating three-dimensional face model, computer device, and storage medium
WO2020019133A1 (en) Method and device for determining shadow effect and electronic device
US10171785B2 (en) Color balancing based on reference points
WO2022068479A1 (en) Image processing method and apparatus, and electronic device and computer-readable storage medium
TW202123178A (en) Method for realizing lens splitting effect, device and related products thereof
CN107749075B (en) Method and device for generating shadow effect of virtual object in video
WO2022262618A1 (en) Screen saver interaction method and apparatus, electronic device, and storage medium
JP2021006977A (en) Content control system, content control method, and content control program
CN112766215A (en) Face fusion method and device, electronic equipment and storage medium
CN107743637A (en) Method and apparatus for handling peripheral images
US20120327114A1 (en) Device and associated methodology for producing augmented images
WO2020019134A1 (en) Illumination information optimization method and apparatus, and electronic device
WO2020019131A1 (en) Method and apparatus for determining light ray information, and electronic device
CN111292234A (en) Panoramic image generation method and device
CN107566761A (en) A kind of image processing method and electronic equipment
CN105430513A (en) Method and device for displaying voting information
CN115908151A (en) Data processing method and device, computer equipment and storage medium
CN112561787A (en) Image processing method, image processing device, electronic equipment and storage medium
CN109167992A (en) A kind of image processing method and device
CN114630085B (en) Image projection method, image projection device, storage medium and electronic equipment
CN114938430B (en) Picture display method and device under full-true scene, electronic equipment and readable storage medium
US20170221504A1 (en) Photorealistic CGI Generated Character

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18927987

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.06.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18927987

Country of ref document: EP

Kind code of ref document: A1