Scaling object to be processed from VR image based on motion vector of user in target direction determined from six-degrees-of-freedom data of VR headset
The present disclosure provides an image processing method and apparatus, a device, and a medium. The method is applied in a virtual reality headset and includes: obtaining six-degree-of-freedom data of the virtual reality headset and a virtual reality image corresponding to the six-degree-of-freedom data; determining a motion vector of a user in a target direction based on the six-degree-of-freedom data; determining a to-be-processed object from the virtual reality image; and scaling the to-be-processed object based on the motion vector. In the present disclosure, stereoscopic scaling of a VR image displayed by a VR device is implemented to achieve a stereoscopic scaling effect of the image, thereby satisfying use requirements for a user.
1 . An image processing method, applied in a virtual reality headset and comprising:
obtaining six-degree-of-freedom data of the virtual reality headset and a virtual reality image corresponding to the six-degree-of-freedom data;
determining a motion vector of a user in a target direction based on the six-degree-of-freedom data;
performing a depth information extraction processing on the virtual reality image to obtain depth information;
performing a semantic segmentation processing on the virtual reality image to obtain a segmentation result;
determining a to-be-processed object from the virtual reality image based on the depth information and the segmentation result; and
scaling the to-be-processed object based on the motion vector.
2 . The method according to claim 1 , wherein said scaling the to-be-processed object based on the motion vector comprises:
performing macroblock segmentation on the virtual reality image based on the to-be-processed object to obtain a plurality of first macroblocks;
determining, from the plurality of first macroblocks, one or more target macroblocks corresponding to the motion vector; and
scaling the one or more target macroblocks based on the motion vector.
3 . The method according to claim 2 , wherein said determining, from the plurality of first macroblocks, the one or more target macroblocks corresponding to the motion vector comprises:
performing macroblock segmentation on a virtual reality image corresponding to the motion vector to obtain a plurality of second macroblocks;
determining one or more second macroblocks corresponding to the motion vector; and
determining the one or more target macroblocks from the plurality of first macroblocks based on the one or more second macroblocks.
4 . The method according to claim 2 , wherein the to-be-processed object is composed of the one or more target macroblocks.
5 . The method according to claim 1 , further comprising, prior to said scaling the to-be-processed object based on the motion vector:
adjusting a magnitude of the motion vector based on depth information of the to-be-processed object and a scaling coefficient of the to-be-processed object.
6 . An electronic device, comprising:
a processor;
a memory configured to store a computer program,
wherein the processor is configured to invoke and execute the computer program stored in the memory to:
obtain six-degree-of-freedom data of a virtual reality headset and a virtual reality image corresponding to the six-degree-of-freedom data;
determine a motion vector of a user in a target direction based on the six-degree-of-freedom data;
perform a depth information extraction processing on the virtual reality image to obtain depth information;
perform a semantic segmentation processing on the virtual reality image to obtain a segmentation result;
determine a to-be-processed object from the virtual reality image based on the depth information and the segmentation result;
scale the to-be-processed object based on the motion vector.
7 . The electronic device according to claim 6 , wherein the processor is further configured to invoke and execute the computer program stored in the memory to:
perform macroblock segmentation on the virtual reality image based on the to-be-processed object to obtain a plurality of first macroblocks;
determine, from the plurality of first macroblocks, one or more target macroblocks corresponding to the motion vector; and
scale the one or more target macroblocks based on the motion vector.
8 . The electronic device according to claim 7 , wherein the processor is further configured to invoke and execute the computer program stored in the memory to:
perform macroblock segmentation on a virtual reality image corresponding to the motion vector to obtain a plurality of second macroblocks;
determine one or more second macroblocks corresponding to the motion vector; and
determine the one or more target macroblocks from the plurality of first macroblocks based on the one or more second macroblocks.
9 . The electronic device according to claim 7 , wherein the to-be-processed object is composed of the one or more target macroblocks.
10 . The electronic device according to claim 6 , wherein the processor is further configured to invoke and execute the computer program stored in the memory to, prior to said scaling the to-be-processed object based on the motion vector;
adjust a magnitude of the motion vector based on the depth information and a scaling coefficient of the to-be-processed object.
11 . A non-transitory computer-readable storage medium, configured to store a computer program, wherein the computer program enables a computer to:
obtain six-degree-of-freedom data of a virtual reality headset and a virtual reality image corresponding to the six-degree-of-freedom data;
determine a motion vector of a user in a target direction based on the six-degree-of-freedom data;
perform a depth information extraction processing on the virtual reality image to obtain depth information;
perform a semantic segmentation processing on the virtual reality image to obtain a segmentation result;
determine a to-be-processed object from the virtual reality image based on the depth information and the segmentation result; and
scale the to-be-processed object based on the motion vector.
12 . The non-transitory computer-readable storage medium according to claim 11 , wherein the computer program further enables the computer to:
perform macroblock segmentation on the virtual reality image based on the to-be-processed object to obtain a plurality of first macroblocks;
determine, from the plurality of first macroblocks, one or more target macroblocks corresponding to the motion vector; and
scale the one or more target macroblocks based on the motion vector.
13 . The non-transitory computer-readable storage medium according to claim 12 , wherein the computer program further enables the computer to:
perform macroblock segmentation on a virtual reality image corresponding to the motion vector to obtain a plurality of second macroblocks;
determine one or more second macroblocks corresponding to the motion vector; and
determine the one or more target macroblocks from the plurality of first macroblocks based on the one or more second macroblocks.
14 . The non-transitory computer-readable storage medium according to claim 12 , wherein the to-be-processed object is composed of the one or more target macroblocks.
15 . The non-transitory computer-readable storage medium according to claim 11 , wherein the computer program further enables the computer to, prior to said scaling the to-be-processed object based on the motion vector:
adjust a magnitude of the motion vector based on the depth information and a scaling coefficient of the to-be-processed object.