US-12620246-B2 - Recognition method and apparatus, and electronic device
Abstract
A recognition method and apparatus, and an electronic device are provided. The recognition method includes: adjusting shooting parameters of a camera in a case that a collected first image includes a light reflecting region, where the shooting parameters include at least one of an aperture and a focus; collecting a second image according to adjusted shooting parameters; and recognizing the target image to obtain a corresponding recognition result, where the target image includes the second image, or the target image is obtained based on the first image and the second image.
Inventors
- Yimin Li
Assignees
- VIVO MOBILE COMMUNICATION CO., LTD.
Dates
- Publication Date
- 20260505
- Application Date
- 20230529
- Priority Date
- 20201127
Claims (15)
- 1 . A recognition method, performed by an electronic device comprising a camera, comprising: shooting, by the camera, a first image of a target object; determining a clear region and an unclear region of the first image, the unclear region of the first image comprising a light reflecting region; calculating new physical shooting parameters of the camera to remove or reduce light reflection of feature information corresponding to the light reflecting region, wherein the physical shooting parameters comprise at least one of an aperture or a focus of the camera; reconfiguring the camera according to the new physical shooting parameters, and shooting, by the camera, a second image corresponding to the unclear region of the first image, wherein the second image has removed or reduced light reflection relative to the unclear region of the first image; merging the second image with the first image to obtain a target image having removed or reduced light reflection of the feature information; recognizing the target image to obtain a corresponding recognition result; and displaying the recognition result along with the target image on a display panel.
- 2 . The method according to claim 1 , wherein the target image comprises the first image and the second image, and the recognizing the target image to obtain a corresponding recognition result comprises: recognizing the first image to obtain a first recognition result; recognizing the second image to obtain a second recognition result; determining recognition content of a common region of the first image and the second image based on the first recognition result and the second recognition result; and performing merging processing on the first recognition result and the second recognition result based on the recognition content of the common region to obtain the recognition result corresponding to the target image.
- 3 . The method according to claim 2 , wherein the determining recognition content of a common region of the first image and the second image based on the first recognition result and the second recognition result comprises: obtaining character information and position information of a first character in the first recognition result; obtaining character information and position information of a second character in the second recognition result; and using the first character or the second character as the recognition content of the common region of the first image and the second image when the character information and the position information of the first character are the same as the character information and the position information of the second character.
- 4 . The method according to claim 2 , wherein the performing merging processing on the first recognition result and the second recognition result based on the recognition content of the common region to obtain the recognition result corresponding to the target image comprises: performing the merging processing on the first recognition result and the second recognition result based on the recognition content of the common region to obtain a merged recognition result; obtaining first content associated with the first recognition result and second content associated with the second recognition result; and checking the merged recognition result based on the first content and the second content to obtain the recognition result corresponding to the target image.
- 5 . The method according to claim 1 , wherein after the shooting, by the camera, a second image corresponding to the unclear region of the first image, and before the recognizing the target image to obtain a corresponding recognition result, the method further comprises: performing tiling processing on the second image when the second image comprises a curved region, wherein the target image comprises the second image after the tiling processing, or the target image is obtained based on the first image and the second image after the tiling processing.
- 6 . An electronic device, comprising: a camera; a memory storing computer-readable instructions; and a processor coupled to the memory and configured to execute the computer-readable instructions, wherein the computer-readable instructions, when executed by the processor, cause the processor to perform operations comprising: obtaining a first image of a target object shot by the camera; determining a clear region and an unclear region of the first image, the unclear region of the first image comprising a light reflecting region; calculating new physical shooting parameters of the camera to remove or reduce light reflection of feature information corresponding to the light reflecting region, wherein the physical shooting parameters comprise at least one of an aperture or a focus of the camera; reconfiguring the camera according to the new physical shooting parameters, and obtaining a second image shot by the camera and corresponding to the unclear region of the first image, wherein the second image has removed or reduced light reflection relative to the unclear region of the first image; merging the second image with the first image to obtain a target image having removed or reduced light reflection of the feature information; recognizing the target image to obtain a corresponding recognition result; and displaying the recognition result along with the target image on a display panel.
- 7 . The electronic device according to claim 6 , wherein the target image comprises the first image and the second image, and the recognizing the target image to obtain a corresponding recognition result comprises: recognizing the first image to obtain a first recognition result; recognizing the second image to obtain a second recognition result; determining recognition content of a common region of the first image and the second image based on the first recognition result and the second recognition result; and performing merging processing on the first recognition result and the second recognition result based on the recognition content of the common region to obtain the recognition result corresponding to the target image.
- 8 . The electronic device according to claim 7 , wherein the determining recognition content of a common region of the first image and the second image based on the first recognition result and the second recognition result comprises: obtaining character information and position information of a first character in the first recognition result; obtaining character information and position information of a second character in the second recognition result; and using the first character or the second character as the recognition content of the common region of the first image and the second image when the character information and the position information of the first character are the same as the character information and the position information of the second character.
- 9 . The electronic device according to claim 7 , wherein the performing merging processing on the first recognition result and the second recognition result based on the recognition content of the common region to obtain the recognition result corresponding to the target image comprises: performing the merging processing on the first recognition result and the second recognition result based on the recognition content of the common region to obtain a merged recognition result; obtaining first content associated with the first recognition result and second content associated with the second recognition result; and checking the merged recognition result based on the first content and the second content to obtain the recognition result corresponding to the target image.
- 10 . The electronic device according to claim 6 , wherein after the obtaining a second image shot by the camera and corresponding to the unclear region of the first image, and before the recognizing the target image to obtain a corresponding recognition result, the operations further comprise: performing tiling processing on the second image when the second image comprises a curved region, wherein the target image comprises the second image after the tiling processing, or the target image is obtained based on the first image and the second image after the tiling processing.
- 11 . A non-transitory computer-readable medium, storing instructions that, when executed by a processor of an electronic device comprising a camera, cause the processor to perform operations comprising: obtaining a first image of a target object by the camera; determining a clear region and an unclear region of the first image, the unclear region of the first image comprising a light reflecting region; calculating new physical shooting parameters of the camera to remove or reduce light reflection of feature information corresponding to the light reflecting region, wherein the physical shooting parameters comprise at least one of an aperture or a focus of the camera; reconfiguring the camera according to the new physical shooting parameters, and obtaining a second image shot by the camera and corresponding to the unclear region of the first image, wherein the second image has removed or reduced light reflection relative to the unclear region of the first image; merging the second image with the first image to obtain a target image having removed or reduced light reflection of the feature information; recognizing the target image to obtain a corresponding recognition result; and displaying the recognition result along with the target image on a display panel.
- 12 . The non-transitory computer-readable medium according to claim 11 , wherein the target image comprises the first image and the second image, and the recognizing the target image to obtain a corresponding recognition result comprises: recognizing the first image to obtain a first recognition result; recognizing the second image to obtain a second recognition result; determining recognition content of a common region of the first image and the second image based on the first recognition result and the second recognition result; and performing merging processing on the first recognition result and the second recognition result based on the recognition content of the common region to obtain the recognition result corresponding to the target image.
- 13 . The non-transitory computer-readable medium according to claim 12 , wherein the determining recognition content of a common region of the first image and the second image based on the first recognition result and the second recognition result comprises: obtaining character information and position information of a first character in the first recognition result; obtaining character information and position information of a second character in the second recognition result; and using the first character or the second character as the recognition content of the common region of the first image and the second image when the character information and the position information of the first character are the same as the character information and the position information of the second character.
- 14 . The non-transitory computer-readable medium according to claim 12 , wherein the performing merging processing on the first recognition result and the second recognition result based on the recognition content of the common region to obtain the recognition result corresponding to the target image comprises: performing the merging processing on the first recognition result and the second recognition result based on the recognition content of the common region to obtain a merged recognition result; obtaining first content associated with the first recognition result and second content associated with the second recognition result; and checking the merged recognition result based on the first content and the second content to obtain the recognition result corresponding to the target image.
- 15 . The non-transitory computer-readable medium according to claim 11 , wherein after the obtaining a second image shot by the camera and corresponding to the unclear region of the first image, and before the recognizing the target image to obtain a corresponding recognition result, the operations further comprise: performing tiling processing on the second image when the second image comprises a curved region, wherein the target image comprises the second image after the tiling processing, or the target image is obtained based on the first image and the second image after the tiling processing.
Description
CROSS-REFERENCE TO RELATED APPLICATIONS This application is a continuation of International Application No. PCT/CN2021/132368, filed on Nov. 23, 2021, which claims priority to Chinese Patent Application No. 202011361267.5, filed on Nov. 27, 2020. The entire contents of each of the above-identified applications are expressly incorporated herein by reference. TECHNICAL FIELD This application belongs to the field of communication technologies, and specifically relates to a recognition method and apparatus, and an electronic device. BACKGROUND Currently, in a process of converting physical documents such as some prints into electronic documents, scanning recognition is generally adopted to improve efficiency of document conversion. However, in some special scanning scenarios, scanned images of scanned documents include light reflecting regions, resulting in unclear parts in recognition results due to the presence of light reflecting regions in the process of recognizing the scanned images. It can be seen that there is a problem of poor recognition of content of images that includes light reflecting regions. SUMMARY A recognition method and apparatus, and an electronic device are provided. According to a first aspect, the embodiments of this application provide a recognition method, including. adjusting shooting parameters of a camera in a case that a collected first image includes a light reflecting region, where the shooting parameters include at least one of an aperture and a focus;collecting a second image according to adjusted shooting parameters; andrecognizing the target image to obtain a corresponding recognition result, wherethe target image includes the second image, or the target image is obtained based on the first image and the second image. According to a second aspect, the embodiments of this application provide a recognition apparatus, including: an adjustment module, configured to adjust shooting parameters of a camera in a case that a collected first image includes a light reflecting region, where the shooting parameters include at least one of an aperture and a focus;a collecting module, configured to collect a second image according to adjusted shooting parameters; anda recognition module, configured to recognize the target image to obtain a corresponding recognition result, wherethe target image includes the second image, or the target image is obtained based on the first image and the second image. According to a third aspect, the embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and runnable on the processor, the program or instructions, when being executed by the processor, implementing the steps of the method according to the first aspect. According to a fourth aspect, the embodiments of this application provide a readable storage medium storing a program or instructions, the program or instructions, when being executed by a processor, implementing the steps of the method according to the first aspect. According to a fifth aspect, the embodiments of this application provide a chip, including a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to run a program or instructions to implement the method according to the first aspect. According to a sixth aspect, the embodiments of this application provide a program product stored in a non-volatile storage medium, and the program product is executed by at least one processor to implement the steps of the method according to the first aspect. According to a seventh aspect, the embodiments of this application provide a communication device configured to perform the steps of the method according to the first aspect. In the embodiments of this application, in a case that the collected first image includes the light reflecting region, the shooting parameters may be adjusted to remove or reduce light reflection of feature information corresponding to the light reflecting region, to collect a corresponding second image. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a flowchart of a recognition method provided in an embodiment of the present application; FIG. 2a is a schematic operation diagram 1 provided in an embodiment of the present application; FIG. 2b is a schematic operation diagram 2 provided in an embodiment of the present application; FIG. 2c is a schematic operation diagram 3 provided in an embodiment of the present application; FIG. 3 is a structural diagram of a recognition apparatus provided in an embodiment of the present application; FIG. 4 is a structural diagram of an electronic device provided in an embodiment of the present application; and FIG. 5 is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION The following describes the embodiments of this application with reference to the accompa