CN-121985216-A - Micro-distance mode switching method and device
Abstract
The embodiment of the application provides a method and a device for switching a macro mode, which relate to the field of terminals and can improve the accuracy of switching the macro mode so as to improve user experience. The method is applied to electronic equipment and comprises the steps of collecting a first view-finding picture by using a first camera lens, judging whether the first view-finding picture belongs to a first scene or not, wherein the first scene comprises a multi-depth-of-field scene, the multi-depth-of-field scene indicates that a plurality of shot objects in the depth range of the first view-finding picture are different from the electronic equipment in distance, determining object distances according to phase difference PD data of the first view-finding picture when the first view-finding picture belongs to the first scene, measuring the object distances according to a laser device when the first view-finding picture does not belong to the first scene, and switching to a second camera to collect a second view-finding picture in a micro-distance mode when the object distances are smaller than or equal to a first preset threshold value.
Inventors
- LIU ZHAN
Assignees
- 荣耀终端股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20241025
Claims (13)
- 1. The micro-distance mode switching method is applied to electronic equipment, and the electronic equipment comprises a first camera, a second camera and a laser device, and is characterized by comprising the following steps: in response to a first operation, acquiring a first view using the first camera; Judging whether the first view-finding picture belongs to a first scene or not, wherein the first scene comprises a multi-depth-of-field scene which indicates that a plurality of shot objects in the depth-of-field range of the first view-finding picture are different in distance from the electronic equipment; Determining an object distance according to phase difference PD data of the first view finding picture when the first view finding picture belongs to the first scene, and switching to the second camera to acquire a second view finding picture in a macro mode when the object distance is smaller than or equal to a first preset threshold value; And under the condition that the first view finding picture does not belong to the first scene, measuring the object distance according to the laser device, and under the condition that the object distance is smaller than or equal to a first preset threshold value, switching to the second camera to acquire a second view finding picture in a macro mode.
- 2. The method of claim 1, wherein the step of determining the position of the substrate comprises, The first scene further includes one or more of a high Wen Changjing, a glass scene, and a low-reflectivity scene; The high-temperature scene represents a scene that the temperature of the electronic equipment is higher than a preset temperature, and the laser device is in an unavailable state under the condition that the electronic equipment is in the high-temperature scene; the glass scene represents a scene of the first camera of the electronic equipment, which shoots in front of or behind glass; the low-reflectivity scene represents a scene in which the laser reflectivity of the subject is lower than a preset threshold.
- 3. The method of claim 1, wherein in the event that the viewfinder view does not belong to the first scene, the method further comprises: Judging whether the first view finding picture belongs to a second scene or not, wherein the second scene comprises a PD (potential difference) weak scene, and the PD weak scene comprises a weak texture scene and/or a Moire scene; And under the condition that the first view finding picture belongs to the second scene, measuring an object distance according to the laser device, and under the condition that the object distance is smaller than or equal to a first preset threshold value, switching to the second camera to acquire a second view finding picture in a macro mode.
- 4. The method of claim 1, wherein the determining whether the first viewing frame belongs to a first scene, the first scene comprising a multi-depth scene, comprises: Performing the following processing on each of the consecutive N frame images of the first view; the first view finding picture is a first frame or an Nth frame image in the continuous N frames of images; Acquiring phase difference PD data of each frame of image, wherein the PD data of each frame of image comprises M PD values corresponding to M image blocks respectively, and M is an integer greater than 1; judging whether the M PD values meet a first preset condition or not, wherein the first preset condition comprises at least two of the following conditions that the difference value between the maximum value and the minimum value in the M PD values is larger than a first preset threshold value, the standard deviation of the M PD values is larger than a second preset threshold value, and the quartile range of the M PD values is larger than a third preset threshold value; and under the condition that M PD values of each frame of the continuous N frames of images meet the preset condition, determining that the first view finding picture belongs to a multi-depth scene.
- 5. The method of claim 2, wherein the determining whether the first viewing frame belongs to a first scene, the first scene comprising a glass scene, the method comprising: performing the following processing on each of N consecutive frame images of the first viewfinder, wherein N is an integer greater than 1; Acquiring PD data of each frame of image, wherein the PD data of each frame of image comprises M PD values corresponding to M image blocks respectively and one PD value corresponding to the whole of the M image blocks, wherein M is an integer larger than 1; Judging whether the M PD values and one PD value meet a second preset condition or not, wherein the second preset condition comprises that the difference value between the maximum value and the minimum value in the M PD values is smaller than a fourth preset threshold value, the distance value obtained by converting the M PD values is larger than a preset distance, and the distance value obtained by converting the one PD value is larger than the preset distance; Measuring an object distance based on the laser device while displaying each frame of the image; and when the M PD values and the PD value corresponding to each frame of the continuous N frames of images meet the second preset condition, and N object distances respectively measured based on the laser device are smaller than preset distances when the continuous N frames of images are displayed, and the difference value between the N object distances is smaller than the preset difference value, judging that the first view finding picture is a glass scene.
- 6. The method of claim 2, wherein the determining whether the first viewing frame belongs to a first scene, the first scene comprising a low reflectivity scene, the method comprising: performing the following processing on each of N consecutive frame images of the first viewfinder, wherein N is an integer greater than 1; Acquiring PD data of each frame of image, wherein the PD data of each frame of image comprises M PD values corresponding to M image blocks respectively and one PD value corresponding to the whole of the M image blocks, wherein M is an integer larger than 1; judging whether the M PD values and one PD value meet a third preset condition or not, wherein the third preset condition comprises that distance values obtained by converting the M PD values are smaller than a preset distance, and the distance value obtained by converting the one PD value is smaller than the preset distance; Measuring an object distance based on the laser device while displaying each frame of the image; And judging that the first view finding picture is a scene with lower laser reflectivity under the condition that the M PD values and one PD value corresponding to each frame of the continuous N frame of images meet the third preset condition and the state jump or the continuous invalid state of the laser device occurs when the continuous N frame of images are displayed.
- 7. The method of claim 3, wherein the determining whether the first viewing frame belongs to a second scene, the second scene comprising a PD vulnerable scene, the method comprising: performing the following processing on each of N consecutive frame images of the first viewfinder, wherein N is an integer greater than 1; Acquiring PD data of each frame of image, wherein the PD data of each frame of image comprises M PD values corresponding to M image blocks respectively, and M is an integer greater than 1; Judging whether the M PD values meet a fourth preset condition or not, wherein the fourth preset condition comprises that the confidence degree of S PD values in the M PD values is smaller than a preset confidence degree, and S is an integer larger than 2/M; And under the condition that the M PD values corresponding to each frame of the continuous N frames of images meet the fourth preset condition, judging that the first framing picture is a PD weak scene.
- 8. The method according to claim 7, wherein in a case where the M PD values corresponding to each of the consecutive N frame images do not satisfy the fourth preset condition, the method further comprises: determining M arrays, wherein each array in the M arrays comprises PD values of image blocks with the same display positions in the continuous N-frame images; Judging whether the M arrays meet a fifth preset condition or not, wherein the fifth preset condition comprises that the difference value between the maximum value and the minimum value in Q arrays in the M arrays is larger than a preset threshold value, and Q is an integer larger than 2/M; And under the condition that the M groups meet the fifth preset condition, judging that the first view finding picture is a PD weak scene.
- 9. The method of claim 4, wherein the acquiring the phase difference PD data for each frame image comprises: dividing the preset area of each frame of image into M image blocks; And calculating the PD value corresponding to each image block in the M image blocks according to a phase difference detection algorithm.
- 10. The method according to any one of claims 4 to 9, wherein after acquiring the phase difference PD data of each frame image, the method further comprises: Filtering unavailable data in M PD values corresponding to the M image blocks respectively, and/or And smoothing the M PD values according to a time domain smoothing algorithm.
- 11. An electronic device comprising a wireless communication module, a memory, and one or more processors, the wireless communication module, the memory being coupled to the processors; wherein the memory is for storing computer program code comprising computer instructions which, when executed by the processor, cause the electronic device to perform the method of any of claims 1-10.
- 12. A computer-readable storage medium comprising computer instructions; The computer instructions, when run on an electronic device, cause the electronic device to perform the method of any one of claims 1-10.
- 13. The chip system is characterized by comprising one or more interface circuits and one or more processors, wherein the interface circuits and the processors are interconnected through lines; the chip system is applied to an electronic device comprising a communication module and a memory, the interface circuit being adapted to receive a signal from the memory and to send the signal to the processor, the signal comprising computer instructions stored in the memory, the electronic device performing the method according to any of claims 1-10 when the processor executes the computer instructions.
Description
Micro-distance mode switching method and device Technical Field The embodiment of the application relates to the field of terminals, in particular to a micro-distance mode switching method and device. Background As macro photography technology matures, it becomes possible to implement macro photography on electronic devices (e.g., cell phones). The micro-distance shooting can shoot micro objects in an ultra-short distance, and extremely good shooting experience is brought to users. In the related art, a macro switching strategy of the electronic equipment is that for equipment without a laser device, the macro switching can be judged based on a distance value (namely, object distance) obtained by image phase detection and conversion, and for equipment with the laser device, the macro switching can be judged based on a distance value (namely, object distance) of laser ranging. However, the selection of the macro switching mode based on whether the laser device is included may result in inaccurate macro mode switching in a specific scene, and it is difficult to ensure the macro switching effect in the specific scene. Disclosure of Invention The embodiment of the application provides a micro-distance mode switching method and device, which can improve the accuracy of micro-distance mode switching and further improve the user experience. In order to achieve the above purpose, the embodiment of the present application adopts the following technical scheme: A first aspect provides a macro mode switching method, which is applied to electronic equipment, wherein the electronic equipment comprises a first camera, a second camera and a laser device, and the method comprises the steps of responding to a first operation, acquiring a first view-finding picture by using a first camera, judging whether the first view-finding picture belongs to the first scene or not, wherein the first scene comprises a multi-depth-of-field scene, the multi-depth-of-field scene represents that a plurality of objects in a depth range of the first view-finding picture are different from the electronic equipment, determining an object distance according to phase difference PD data of the first view-finding picture when the first view-finding picture belongs to the first scene, switching to the second camera to acquire the second view-finding picture in a macro mode when the object distance is smaller than or equal to a first preset threshold, and measuring the object distance according to the laser device when the first view-finding picture does not belong to the first scene, and switching to the second camera to acquire the second view-finding picture in the macro mode when the object distance is smaller than or equal to the first preset threshold. According to the method provided by the embodiment of the application, whether the first view-finding picture acquired by the first camera (for example, the main camera) belongs to a first scene (for example, a multi-depth-of-field scene) can be judged, the object distance can be determined according to the phase difference PD data of the first view-finding picture under the condition that the first view-finding picture belongs to the multi-depth-of-field scene, the second view-finding picture is acquired in a micro-distance mode by switching to the second camera under the condition that the object distance is smaller than or equal to a first preset threshold value, the object distance can be measured according to the laser device under the condition that the first view-finding picture does not belong to the multi-depth-of-field scene, and the second view-finding picture can be acquired in a micro-distance mode by switching to the second camera under the condition that the object distance is smaller than or equal to the first preset threshold value. Therefore, the problem that the laser ranging is inaccurate under the multi-depth-of-field scene to cause the error switching to the macro mode can be avoided, and the macro mode switching accuracy under the multi-depth-of-field scene can be improved, so that the user experience is improved. In one possible implementation manner, the first scene further comprises one or more of a high Wen Changjing, a glass scene and a low-reflectivity scene, wherein the high-temperature scene represents a scene that the temperature of the electronic device is higher than a preset temperature, the laser device is in an unavailable state when the electronic device is in the high-temperature scene, the glass scene represents a scene that the first camera of the electronic device shoots before or after glass, and the low-reflectivity scene represents a scene that the laser reflectivity of the shot object is lower than a preset threshold. Therefore, the problem that the laser ranging is inaccurate under high Wen Changjing, glass scenes and low-reflectivity scenes to cause the error switching to the macro mode can be avoided, and the macro mode switching accuracy under high