Multi-view distance measurement method and electronic device
In a multi-view distance measurement method, an appropriate relative pose is selected from a plurality of preset relative poses based on driving information. Then relative poses of cameras are adjusted, so that a distance measurement capability of the camera matches a region of interest, to implement distance measurement.
1 . A method comprising:
determining a region of interest based on driving information, wherein the driving information comprises at least one of a speed, a gear, a traveling environment, or a driving mode;
determining a first relative pose from a plurality of relative poses based on the driving information, the region of interest, and correspondences between a plurality of detectable regions and the relative poses, wherein the relative poses are preset, wherein the correspondences are preset on an electronic device, and wherein a first detectable region of the detectable regions and corresponding to the first relative pose comprises the region of interest;
adjusting at least one of a first pose of a first camera of the electronic device or a second pose of a second camera of the electronic device to the first relative pose;
obtaining a first image from the first camera;
obtaining a second image from the second camera; and
determining a first distance based on the first image, the second image, and the first relative pose,
wherein the first distance is between an object and the electronic device.
2 . The method of claim 1 , wherein after adjusting the first pose or the second pose and before determining the first distance, the method further comprises updating the first relative pose.
3 . The method of claim 2 , wherein updating the first relative pose comprises updating the first relative pose by using a matrix corresponding to the first relative pose as a projection matrix to optimize calibration of the first relative pose.
4 . The method of claim 1 , wherein adjusting the first pose or the second pose comprises changing a first spatial position of the first camera with respect to the second camera or changing a second spatial position of the second camera with respect to the first camera.
5 . The method of claim 1 , wherein adjusting the first pose or the second pose comprises rotating or changing an orientation of the first camera or the second camera.
6 . The method of claim 1 , wherein the plurality of relative poses are relative camera poses that define spatial relationships between the first camera and the second camera.
7 . The method of claim 6 , wherein each of the relative camera poses corresponds to a transformation matrix that is pre-stored in the electronic device.
8 . The method of claim 1 , wherein adjusting at least one of the first pose of the first camera or the second pose of the second camera to the first relative pose comprises changing a baseline distance between the first camera and the second camera.
9 . A method comprising:
adjusting, when a speed of an electronic device is within a first range, relative poses of a first camera and a second camera to a first pose, wherein the first pose belongs to a plurality of relative poses, and wherein the relative poses are preset; and
adjusting, when the speed of the electronic device is within a second range, the relative poses to a second pose,
wherein the second pose belongs to the relative poses, and
wherein when a lower limit of the first range is greater than an upper limit of the second range, a first distance between a first detectable region corresponding to the first pose and the electronic device is greater than a second distance between a second detectable region corresponding to the second pose and the electronic device.
10 . The method of claim 9 , wherein adjusting the relative poses to the first pose comprises adjusting a first baseline distance between the first camera and the second camera to a second baseline distance, wherein adjusting the relative poses to the second pose comprises adjusting the first baseline distance to a third baseline distance, and wherein the second baseline distance is greater than the third baseline distance.
11 . The method of claim 10 further comprising:
adjusting, when the speed of the electronic device is within a third range, the relative poses to a third pose, wherein the third pose belongs to the relative poses, and wherein adjusting the relative poses to the third pose comprises adjusting a fourth baseline distance between the first camera and a third camera to a fifth baseline distance; and
selecting a first pair of the first camera and the second camera or a second pair of the first camera and the third camera based on the speed.
12 . The method of claim 9 , wherein adjusting the first pose or the second pose comprises changing a spatial position of the first camera or a spatial position of the second camera with respect to the first camera.
13 . The method of claim 9 , wherein adjusting the at least one of the first pose or the second pose comprises rotating or changing an orientation of the first camera or the second camera.
14 . The method of claim 9 , wherein the first pose is different from the second pose.
15 . An electronic device comprising:
at least two cameras comprising:
a first camera; and
a second camera;
a memory configured to store instructions; and
one or more processors coupled to the memory and configured to execute the instructions to cause the electronic device to:
determine a region of interest based on driving information, wherein the driving information comprises at least one of a speed, a gear, a traveling environment, or a driving mode;
determine a first relative pose from a plurality of relative poses based on the driving information, the region of interest, and correspondences between a plurality of detectable regions and the relative poses, wherein the relative poses are preset, wherein the correspondences are preset on an electronic device, and wherein a first detectable region of the detectable regions and corresponding to the first relative pose comprises the region of interest;
adjust at least one of a first pose of the first camera or a second pose of the second camera to the first relative pose;
obtain a first image from the first camera;
obtain a second image from the second camera; and
determine a first distance based on the first image, the second image, and the first relative pose,
wherein the first distance is between an object and the electronic device.
16 . The electronic device of claim 15 , wherein the one or more processors are further configured to execute the instructions to cause the electronic device to update the first relative pose after adjusting the at least one of the first pose or the second pose and before determining the first distance.
17 . The electronic device of claim 16 , wherein the one or more processors are further configured to execute the instructions to cause the electronic device to update the first relative pose by using a matrix corresponding to the first relative pose as a projection matrix to optimize calibration of the first relative pose.
18 . The electronic device of claim 15 , wherein adjusting the first pose or the second pose comprises changing a spatial position of the first camera with respect to the second camera or changing a second spatial position of the second camera with respect to the first camera.
19 . The electronic device of claim 15 , wherein adjusting the first pose or the second pose comprises rotating or changing an orientation of the first camera or the second camera.
20 . The electronic device of claim 15 , further comprising a camera pose adjustment apparatus configured to physically adjust at least one of the first pose of the first camera or the second pose of the second camera, wherein the camera pose adjustment apparatus comprises at least one of a guide rail with detents, a motor, or an actuator.