Translation Method, Device, Electronic Device and Storage Medium

By capturing and translating multiple images in real-time and stitching them together, the method addresses the limitations of electronic devices in translating panoramic images, enhancing user experience through seamless and accurate translation.

CN114283274BActive Publication Date: 2025-07-15GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111601609.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2025-07-15
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

When taking panoramic images, existing electronic devices are limited by the camera range, resulting in inaccurate OCR recognition, poor translation results, and poor user experience, making real-time translation display and overall image display impossible.

Method used

By acquiring the acquisition order of multiple images, the images are translated and stitched in sequence to form an overall translated image to improve the user experience.

Benefits of technology

Real-time translation processing and overall display of panoramic images are realized, improving user experience, avoiding the forgetting of translation results and the accuracy of stitching images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114283274B_ABST
    Figure CN114283274B_ABST
Patent Text Reader

Abstract

The present application discloses a translation method, apparatus, electronic device, and storage medium, which relate to the technical field of electronic devices. The method is applied to an electronic device, and the method includes: obtaining at least two to-be-translated images collected by a camera of the electronic device, and obtaining the image acquisition sequence corresponding to the at least two to-be-translated images; respectively performing translation processing on the at least two to-be-translated images to obtain translated images corresponding to the at least two to-be-translated images respectively; and splicing the translated images corresponding to the at least two to-be-translated images in the image acquisition sequence to obtain a target translated image. The present application performs real-time translation processing on multiple collected images, and splices the multiple translated images after translation to form an overall translated image, so as to realize the overall display of the translation result and improve the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of electronic devices, and more particularly, to a translation method, apparatus, electronic device, and storage medium. Background Art

[0002] With the development of science and technology, electronic devices are used more and more widely and have more and more functions, and have become one of the necessities in people's daily lives. Currently, the shooting function of electronic devices can be used for shooting and translating images. However, limited by the shooting range of electronic devices, the shooting and translation effect of electronic devices for images is poor, and the user experience is not good. Summary of the Invention

[0003] In view of the above problems, this application proposes a translation method, apparatus, electronic device, and storage medium to solve the above problems.

[0004] In a first aspect, an embodiment of this application provides a translation method applied to an electronic device. The method includes: obtaining at least two images to be translated collected by a camera of the electronic device, and obtaining an image acquisition order corresponding to the at least two images to be translated; respectively performing translation processing on the at least two images to be translated to obtain translated images corresponding to the at least two images to be translated respectively; and splicing the translated images corresponding to the at least two images to be translated in the image acquisition order to obtain a target translation image.

[0005] In a second aspect, an embodiment of this application provides a translation apparatus applied to an electronic device. The apparatus includes: a first image acquisition module, configured to obtain at least two images to be translated collected by a camera of the electronic device, and obtain an image acquisition order corresponding to the at least two images to be translated; a second image acquisition module, configured to respectively perform translation processing on the at least two images to be translated to obtain translated images corresponding to the at least two images to be translated respectively; and a third image acquisition module, configured to splice the translated images corresponding to the at least two images to be translated in the image acquisition order to obtain a target translation image.

[0006] In a third aspect, an embodiment of this application provides an electronic device, including a memory and a processor, the memory is coupled to the processor, and the memory stores instructions that, when executed by the processor, cause the processor to execute the above method.

[0007] In a fourth aspect, an embodiment of this application provides a computer-readable storage medium, in which program code is stored, and the program code can be called by a processor to execute the above method.

[0008] The translation method, device, electronic device, and storage medium provided by the embodiments of the present application acquire at least two to-be-translated images collected by the camera of the electronic device, and obtain the image acquisition sequence corresponding to the at least two to-be-translated images. Then, perform translation processing on the at least two to-be-translated images respectively to obtain the translated images corresponding to the at least two to-be-translated images respectively. According to the image acquisition sequence, splice the translated images corresponding to the at least two to-be-translated images to obtain the target translation image. Thus, by performing real-time translation processing on the collected multiple images and splicing the multiple translated images after translation to form an overall translation image, the overall display of the translation result can be realized, and the user experience can be improved. Description of the Drawings

[0009] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained according to these drawings.

[0010] Figure 1 Shows a schematic flowchart of the translation method provided by an embodiment of the present application;

[0011] Figure 2 Shows a schematic flowchart of the translation method provided by an embodiment of the present application;

[0012] Figure 3 Shows a schematic flowchart of the translation method provided by an embodiment of the present application;

[0013] Figure 4 Shows the Figure 3 Schematic flowchart of step S350 of the translation method shown;

[0014] Figure 5 Shows a schematic flowchart of the translation method provided by an embodiment of the present application;

[0015] Figure 6 Shows a schematic flowchart of the translation method provided by an embodiment of the present application;

[0016] Figure 7 Shows a schematic flowchart of the translation method provided by an embodiment of the present application;

[0017] Figure 8 Shows a block diagram of the translation device provided by an embodiment of the present application;

[0018] Figure 9 Shows a block diagram of the electronic device for executing the translation method according to the embodiment of the present application;

[0019] Figure 10 It shows a storage unit for storing or carrying program code for implementing the translation method according to the embodiments of the present application. Detailed implementation manners

[0020] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.

[0021] In the business scenario of augmented reality (AR) translation, due to the limited shooting range of the electronic device, a panoramic image usually cannot be directly obtained. Currently, when translating the text in a panoramic image, the first solution is to first splice the captured images into a panoramic image, then use optical character recognition (OCR) to extract the text in the panoramic image, and finally translate the extracted text to obtain a translation result; the second solution is to perform real-time translation display on the text within the current shooting range, and multiple translation displays are required for the panoramic image.

[0022] The inventor has found through research that the first solution has the following defects: First, due to the resolution of the synthesized panoramic image, the OCR recognition is inaccurate, which in turn affects the final display of the translation result; Second, the spliced images are large, resulting in a square-level increase in the computational requirements; Third, the customer's experience is not direct. Even after each translation is completed, it needs to be shot before starting to output, without the obvious feeling of seeing what is shot. The second solution has the following defects: In a panoramic image with a large range, after multiple translations, it is easy to forget the content that has been translated before, affecting the overall understanding.

[0023] In view of the above problems, the inventor has found through long-term research and proposed a translation method, device, electronic device, and storage medium provided by the embodiments of the present application. By performing real-time translation processing on multiple captured images and splicing the translated multiple images to form an overall translation image, the overall display of the translation result can be achieved, improving the user experience. Among them, the specific translation method will be described in detail in the subsequent embodiments.

[0024] Please refer to Figure 1 , Figure 1 It shows a schematic flowchart of a translation method provided by an embodiment of the present application. This translation method is used to perform real-time translation processing on multiple captured images and splice the translated multiple images to form an overall translation image, so as to achieve the overall display of the translation result and improve the user experience. In a specific embodiment, this translation method is applied to, for exampleFigure 8 The translation device 200 shown and the electronic device 100 configured with the translation device 200( Figure 9 ). Taking the electronic device as an example, the specific process of this embodiment will be described below. Of course, it can be understood that the electronic devices to which this embodiment is applied may include smart phones, tablet computers, wearable electronic devices, etc., and are not limited herein. The following will be directed to Figure 1 the process shown for a detailed elaboration. The translation method may specifically include the following steps:

[0025] Step S110: Obtain at least two images to be translated collected by the camera of the electronic device, and obtain the image acquisition sequence corresponding to the at least two images to be translated.

[0026] In this embodiment, the electronic device may include a camera. Among them, the camera may include a front camera, may include a rear camera, may include a telescopic camera, or may also include a rotating camera, etc., and is not limited herein.

[0027] In some embodiments, the electronic device may control the camera to perform image acquisition to obtain the images to be translated. Among them, the electronic device may control the camera to maintain the acquisition direction and perform image acquisition in sequence to obtain at least two images to be translated, the electronic device may control the camera to rotate and perform image acquisition in sequence to obtain at least two images to be translated, the electronic device may control the camera to telescope and perform image acquisition in sequence to obtain at least two images to be translated, etc., and are not limited herein. As an implementable manner, when the electronic device wants to capture a panoramic image of a certain object and the imaging range of the camera of the electronic device cannot cover the object, the camera may be controlled to capture at least two images to be translated for the object. Among them, the at least two images to be translated include the panoramic image of the object, and each of the at least two images to be translated includes a partial image of the object.

[0028] In this embodiment, the electronic device may acquire at least two images to be translated collected by the camera of the electronic device, and acquire the image acquisition order corresponding to the at least two images to be translated. As a way, each time the camera of the electronic device acquires an image to be translated, the electronic device may acquire the acquired image to be translated and record the acquisition order corresponding to the acquired image to be translated. Until the acquisition is completed, the electronic device may acquire at least two images to be translated collected by the camera and acquire the image acquisition order corresponding to the at least two images to be translated. As another way, when determining that the acquisition is completed, the electronic device may acquire at least two images to be translated collected by the camera at once and acquire the image acquisition order corresponding to the at least two images to be translated. For example, when receiving an acquisition completion instruction, the electronic device may acquire at least two images to be translated collected by the camera and acquire the image acquisition order corresponding to the at least two images to be translated.

[0029] Step S120: Perform translation processing on each of the at least two images to be translated to obtain translated images respectively corresponding to the at least two images to be translated.

[0030] In this embodiment, after the electronic device acquires at least two images to be translated, it may perform translation processing on each of the at least two images to be translated to obtain translated images respectively corresponding to the at least two images to be translated.

[0031] In some embodiments, after the electronic device acquires at least two images to be translated, it may perform OCR text recognition on each of the at least two images to be translated to obtain the text information included in each of the at least two images to be translated, and then translate the text information included in each of the at least two images to be translated to obtain the translated text included in each of the at least two images to be translated. Based on the at least two images to be translated and the translated text included in each of the at least two images to be translated, translated images respectively corresponding to the at least two images to be translated are generated.

[0032] In some embodiments, the translated image may be generated by replacing the text to be translated in the image to be translated with the translated text; the translated image may be generated by covering the text to be translated in the image to be translated with the translated text; the translated image may be generated by suspending the translated text on the text to be translated in the image to be translated; the translated image may be generated by displaying the translated text on one side of the text to be translated in the image to be translated, etc., which is not limited herein.

[0033] Step S130: Stitch the translated images respectively corresponding to the at least two images to be translated in accordance with the image acquisition order to obtain a target translated image.

[0034] In this embodiment, after the electronic device obtains the translated images corresponding to at least two images to be translated, it can splice the translated images corresponding to the at least two images to be translated according to the image acquisition order corresponding to the at least two images to be translated, so as to obtain a target translated image, that is, the translated panoramic image. Thus, when the user obtains the translation result, it can be changed from the previous partial display to the overall display, solving the problem of forgetting due to long-term partial display. It can be understood that in the generated target translated image, the splicing position of the translated image with a forward acquisition order is forward (left), the splicing position of the translated image with a backward acquisition order is backward (right), and the splicing positions of the translated images with adjacent acquisition orders are adjacent.

[0035] Among them, it can be understood that the acquisition order corresponding to the at least two images to be translated is the same as the acquisition order corresponding to the translated images corresponding to the at least two images to be translated. Therefore, the acquisition order corresponding to the at least two images to be translated can be regarded as the acquisition order corresponding to the translated images corresponding to the at least two images to be translated. That is, after the electronic device obtains the translated images corresponding to the at least two images to be translated, it can splice the translated images corresponding to the at least two images to be translated based on the pre-acquired acquisition order to obtain a target translated image.

[0036] In some embodiments, after obtaining the translated images corresponding to the at least two images to be translated, the electronic device can obtain the feature information of the translated images corresponding to the at least two images to be translated, and splice the translated images corresponding to the at least two images to be translated based on the feature information of the translated images corresponding to the at least two images to be translated according to the acquisition order, so as to obtain a target translated image.

[0037] In some embodiments, after the electronic device obtains the translated images corresponding to the at least two images to be translated, it can determine the same image area in two adjacent translated images with adjacent acquisition orders from the translated images corresponding to the at least two images to be translated, and superimpose the same image area in the two adjacent translated images to obtain the image after splicing the two adjacent translated images. Based on the above method, the splicing of the translated images corresponding to the at least two images to be translated can be realized, and a target translated image can be obtained.

[0038] As an implementable manner, superimposing the same image regions in two adjacent translated images may include: deleting the same image regions in one of the two adjacent translated images, and splicing the remaining image regions with the other translated image; or, covering the same image regions in one of the two adjacent translated images on the same image regions of the other translated image, so as to splice the two adjacent translated images.

[0039] A translation method provided by an embodiment of the present application obtains at least two images to be translated collected by a camera of an electronic device, obtains the image acquisition order corresponding to the at least two images to be translated, respectively performs translation processing on the at least two images to be translated, obtains the translated images respectively corresponding to the at least two images to be translated, and splices the translated images respectively corresponding to the at least two images according to the image acquisition order to obtain a target translated image, so as to perform real-time translation processing on the collected multiple images and splice the multiple translated images to form an overall translated image, thereby realizing the overall display of the translation result and improving the user experience.

[0040] Please refer to Figure 2 , Figure 2 which shows a schematic flowchart of the translation method provided by an embodiment of the present application. This method is applied to the above-mentioned electronic device. The following will elaborate in detail on the Figure 2 shown process. The translation method may specifically include the following steps:

[0041] Step S210: Obtain at least two images to be translated collected by the camera of the electronic device, and obtain the image acquisition order corresponding to the at least two images to be translated.

[0042] For the specific description of step S210, please refer to step S110 and will not be elaborated here.

[0043] Step S220: Respectively identify the at least two images to be translated to obtain the to-be-translated texts included in the at least two images to be translated respectively.

[0044] In some embodiments, after obtaining at least two images to be translated, the at least two images to be translated can be respectively identified to obtain the to-be-translated texts included in the at least two images to be translated respectively. As an implementable manner, after the electronic device obtains at least two images to be translated, it can perform text recognition on the at least two images to be translated based on the OCR text recognition technology to obtain the to-be-translated texts included in the at least two images to be translated respectively.

[0045] Step S230: Translate the text to be translated included in each of the at least two images to be translated, and obtain the translated text included in each of the at least two images to be translated.

[0046] In some embodiments, after the electronic device obtains the text to be translated included in each of the at least two images to be translated, it may translate the text to be translated included in each of the at least two images to be translated respectively, and obtain the translated text included in each of the at least two images to be translated. As an implementable manner, the language set by the electronic device may be obtained. After obtaining the text to be translated included in each of the at least two images to be translated, the text to be translated included in each of the at least two images to be translated may be translated from its corresponding initial language to the language set by the electronic device, and the translated text included in each of the at least two images to be translated is obtained.

[0047] As a manner, the electronic device may be set with a language, where the language set by the electronic device may represent the language used by the user, that is, the language set by the electronic device may be obtained. For example, if the language set by the electronic device is Chinese, it may be considered that the language used by the user is Chinese. Another example, if the language set by the electronic device is English, it may be considered that the language used by the user is English.

[0048] As another manner, the location where the electronic device is located may be obtained, and the language set by the electronic device may be determined according to the location where the electronic device is located. Among them, when it is determined based on the location where the electronic device is located that the location where the electronic device is located is China, it may be determined that the language set by the electronic device is Chinese; when it is determined based on the location where the electronic device is located that the location where the electronic device is located is the UK, it may be determined that the language set by the electronic device is English.

[0049] In some embodiments, the electronic device may call a translation software to translate the text to be translated and obtain the translated text.

[0050] Step S240: Based on the at least two images to be translated and the translated text included in each of the at least two images to be translated, obtain the translated image corresponding to each of the at least two images to be translated.

[0051] In some embodiments, when the electronic device obtains the translated text included in each of the at least two images to be translated, it may obtain the translated image corresponding to each of the at least two images to be translated based on the at least two images to be translated and the translated text included in each of the at least two images to be translated.

[0052] As an implementable manner, when the electronic device obtains the translated text included in each of at least two images to be translated, it can respectively replace the text to be translated included in each of the at least two images to be translated with the translated text included in each, and obtain the translated images corresponding to each of the at least two images to be translated.

[0053] As another implementable manner, when the electronic device obtains the translated text included in each of at least two images to be translated, it can respectively superimpose the translated text included in each of the at least two images to be translated on the text to be translated included in each, and obtain the translated images corresponding to each of the at least two images to be translated.

[0054] As yet another implementable manner, when the electronic device obtains the translated text included in each of at least two images to be translated, it can respectively set the translated text included in each of the at least two images to be translated on one side of the text to be translated included in each, and obtain the translated images corresponding to each of the at least two images to be translated.

[0055] Step S250: According to the image acquisition order, splice the translated images corresponding to each of the at least two images to be translated to obtain a target translated image.

[0056] For the specific description of step S250, please refer to step S130 and will not be elaborated here.

[0057] The translation method provided by an embodiment of the present application acquires at least two images to be translated collected by the camera of the electronic device, acquires the image acquisition order corresponding to the at least two images to be translated, respectively identifies the at least two images to be translated, obtains the text to be translated included in each of the at least two images to be translated, respectively translates the text to be translated included in each of the at least two images to be translated, obtains the translated text included in each of the at least two images to be translated, based on the at least two images to be translated and the translated text included in each of the at least two images to be translated, obtains the translated images corresponding to each of the at least two images to be translated, and according to the image acquisition order, splice the translated images corresponding to each of the at least two images to be translated to obtain a target translated image. Compared with Figure 1 the translation method shown, this embodiment also translates the text to be translated in the image to be translated to obtain the translated text, and obtains the translated image based on the image to be translated and the translated text, thereby improving the accuracy and efficiency of image translation.

[0058] Please refer to Figure 3 , Figure 3 shows a schematic flowchart of the translation method provided by an embodiment of the present application. This method is applied to the above-mentioned electronic device. Next, it will be directed to Figure 3The following is a detailed description of the process shown. The translation method may specifically include the following steps:

[0059] Step S310: Obtain at least two images to be translated collected by the camera of the electronic device, and obtain the image acquisition sequence corresponding to the at least two images to be translated.

[0060] Step S320: Perform translation processing on the at least two images to be translated respectively to obtain the translated images corresponding to the at least two images to be translated respectively.

[0061] For the specific descriptions of steps S310 - S320, please refer to steps S110 - S120, which will not be elaborated here.

[0062] Step S330: From the at least two images to be translated, obtain two images to be translated with adjacent image acquisition sequences.

[0063] In this embodiment, after the electronic device obtains at least two images to be translated and the acquisition sequence corresponding to the at least two images to be translated, it can obtain two images to be translated with adjacent acquisition sequences from the at least two images to be translated.

[0064] For example, assume that the at least two images to be translated include image to be translated 1, image to be translated 2, image to be translated 3, and image to be translated 4 in sequence according to the acquisition sequence. Then, two images to be translated with adjacent acquisition sequences can be composed of image to be translated 1 and image to be translated 2, can be composed of image to be translated 2 and image to be translated 3, or can also be composed of image to be translated 3 and image to be translated 4.

[0065] Step S340: Determine the same feature points as target feature points from the two adjacent images to be translated.

[0066] Among them, since the two adjacent images to be translated are sequentially acquired by the camera of the electronic device according to the acquisition sequence, there are the same image regions in the two adjacent images to be translated, and there are the same feature points in the same image regions. In this embodiment, when obtaining the two adjacent images to be translated, the same image regions can be determined from the two adjacent images to be translated, and the same feature points in the same image regions can be determined as target feature points.

[0067] In some implementation manners, when the electronic device obtains two adjacent images to be translated, it can compare the two adjacent images to be translated to determine whether there are the same image regions in the two adjacent images to be translated. Among them, when it is determined that there are the same image regions in the two adjacent images to be translated, the same feature points in the same image regions of the two adjacent images to be translated can be determined as target feature points.

[0068] As an implementable manner, when the electronic device obtains two adjacent images to be translated, it may adopt the speeded up robust feature (SURF) detection method to detect the two adjacent images to be translated, so as to respectively detect the feature points in the two adjacent images to be translated, and determine the same feature points in the two adjacent images to be translated as the target feature points.

[0069] Step S350: Based on the target feature points, perform image stitching on the translated images corresponding to the two adjacent images to be translated respectively.

[0070] In some embodiments, when determining the target feature points, image stitching may be performed on the translated images corresponding to the two adjacent images to be translated respectively based on the target feature points. It can be understood that in this way, based on the target feature points in the images to be translated, image stitching of the translated images is performed, which can avoid the problem of inaccurate determination of feature points caused by the deformation of the translated images and improve the image stitching effect. As a way, after performing image registration, image copying, image fusion (removing cracks), etc. on the translated images corresponding to the two adjacent images to be translated respectively based on the target feature points, image stitching of the translated images corresponding to the two adjacent images to be translated can be achieved. Repeat the above steps until the translated images corresponding to at least two images to be translated are all stitched.

[0071] Please refer to Figure 4 , Figure 4 which shows Figure 3 a schematic flowchart of step S350 of the translation method shown in the present application. The following will elaborate in detail on the Figure 4 shown process. The method may specifically include the following steps:

[0072] Step S351: Obtain the positions of the target feature points in the translated images corresponding to the two adjacent images to be translated respectively.

[0073] Among them, since the sizes of the images to be translated and the translated images are the same, after determining the target feature points in the images to be translated, the target feature points can be corresponding to the translated images, and the translated images can be stitched according to the positions of the target feature points on them.

[0074] In some embodiments, when determining target feature points in two adjacent images to be translated, the positions of the target feature points in the respective translated images corresponding to the two adjacent images to be translated can be obtained. As an implementable manner, when determining target feature points in two adjacent images to be translated, feature points corresponding to the target feature points can be searched for in the respective translated images corresponding to the two adjacent images to be translated, and the positions of the found feature points corresponding to the target feature points in the respective translated images corresponding to the two adjacent images to be translated are obtained.

[0075] Step S352: Based on the positions of the target feature points in the respective translated images corresponding to the two adjacent images to be translated, perform image stitching on the respective translated images corresponding to the two adjacent images to be translated.

[0076] In some embodiments, when an electronic device determines the positions of target feature points in the respective translated images corresponding to two adjacent images to be translated, it can perform image stitching on the respective translated images corresponding to the two adjacent images to be translated based on the positions of the target feature points in the respective translated images corresponding to the two adjacent images to be translated. As an implementable manner, when determining the positions of target feature points in the respective translated images corresponding to two adjacent images to be translated, the positions where the target feature points are located in the two adjacent images to be translated can be made to coincide, and after processes such as image registration, image copying, and image fusion (removing cracks), a complete stitched image is obtained.

[0077] The translation method provided in an embodiment of the present application acquires at least two images to be translated collected by a camera of an electronic device, obtains the image acquisition order corresponding to the at least two images to be translated, performs translation processing on the at least two images to be translated respectively to obtain the respective translated images corresponding to the at least two images to be translated, acquires two adjacent images to be translated from the at least two images to be translated, determines the same feature points as target feature points from the two adjacent images to be translated, and performs image stitching on the respective translated images corresponding to the two adjacent images to be translated based on the target feature points. Compared with Figure 1 the shown translation method, this embodiment also performs stitching of the translated images according to the target feature points determined in the images to be translated, thereby improving the accuracy of image stitching.

[0078] Please refer to Figure 5 , Figure 5 which shows a schematic flowchart of the translation method provided in an embodiment of the present application. This method is applied to an electronic device, and the following will elaborate in detail on the Figure 5 shown process. The translation method may specifically include the following steps:

[0079] Step S410: Obtain at least two images to be translated collected by the camera of the electronic device, and obtain the image acquisition sequence corresponding to the at least two images to be translated.

[0080] Step S420: Perform translation processing on the at least two images to be translated respectively to obtain the translated images corresponding to the at least two images to be translated respectively.

[0081] For the specific descriptions of steps S410 - S420, please refer to steps S110 - S120, which will not be elaborated here.

[0082] Step S430: Obtain the number of images corresponding to the at least two images to be translated.

[0083] In some embodiments, the number of images corresponding to the at least two images to be translated can be obtained. As a way, the electronic device may include a counter, and then the number of images corresponding to the at least two images to be translated can be obtained through the counter. For example, assuming that the electronic device collects 10 images to be translated, the number of images corresponding to the at least two images to be translated can be determined to be 10; assuming that the electronic device collects 20 images to be translated, the number of images corresponding to the at least two images to be translated can be determined to be 20, etc., which will not be elaborated here.

[0084] Step S440: When the number of images is greater than the number threshold, splice the translated images corresponding to the at least two images to be translated according to the image acquisition sequence to obtain a target translated image.

[0085] In some embodiments, the electronic device can preset and store a number threshold, which is used as a judgment basis for the number of images corresponding to the images to be translated. Therefore, in this embodiment, when determining the number of images corresponding to at least two images to be translated, the number of images can be compared with the number threshold to determine whether the number of images is greater than the number threshold.

[0086] Among them, when the judgment result indicates that the number of images is greater than the number threshold, it can be considered that the number of images to be translated is large, the text to be translated included in the images to be translated is long, and the translated text obtained after translating the text to be translated in the images to be translated is long. If the translated images corresponding to at least two images to be translated are displayed separately, the user is likely to forget the previously translated content. Therefore, when the number of images is greater than the number threshold, the translated images corresponding to the at least two images to be translated can be spliced according to the image acquisition sequence to obtain a target translated image, so as to realize the overall display of the translated text and avoid the problem of forgetting when the translated text is long.

[0087] Step S450: When the number of images is less than or equal to the quantity threshold, respectively output the translated images corresponding to each of the at least two images to be translated.

[0088] Among them, when the judgment result indicates that the number of images is less than or equal to the quantity threshold, it can be considered that the number of images to be translated is small, the text to be translated included in the images to be translated is short, and the translated text obtained after translating the text to be translated in the translated images is short. If the translated images corresponding to at least two images to be translated are respectively displayed, the user can remember the previously translated content. Therefore, when the number of images is less than or equal to the quantity threshold, the translated images corresponding to each of the at least two images to be translated can be respectively output. For example, the translated images corresponding to each of the at least two images to be translated can be sequentially displayed according to the acquisition order, or the translated images corresponding to each of the at least two images to be translated can be simultaneously displayed after being reduced, etc., which is not limited herein.

[0089] In some embodiments, when it is determined that the number of images is greater than the quantity threshold, first selection information can be output, where the first selection information is used to prompt the user to select to perform image splicing on the translated images corresponding to each of the at least two images to be translated according to the image acquisition order to obtain a target translated image, or to select to respectively output the translated images corresponding to each of the at least two images to be translated.

[0090] The translation method provided by an embodiment of the present application acquires at least two images to be translated collected by the camera of an electronic device, acquires the image acquisition order corresponding to the at least two images to be translated, respectively performs translation processing on the at least two images to be translated to obtain the translated images corresponding to each of the at least two images to be translated, acquires the number of images corresponding to the at least two images to be translated. When the number of images is greater than the quantity threshold, perform image splicing on the translated images corresponding to each of the at least two images to be translated according to the image acquisition order to obtain a target translated image. When the number of images is less than or equal to the quantity threshold, respectively output the translated images corresponding to each of the at least two images to be translated. Compared with Figure 1 the shown translation method, this embodiment also determines the processing method for the translated images according to the number of images corresponding to the at least two images to be translated, thereby improving the rationality and diversity of processing.

[0091] Please refer to Figure 6 , Figure 6 which shows a schematic flowchart of the translation method provided by an embodiment of the present application. This method is applied to an electronic device. The following will elaborate in detail on the Figure 6 shown process. The translation method can specifically include the following steps:

[0092] Step S510: Obtain at least two images to be translated collected by the camera of the electronic device, and obtain the image acquisition sequence corresponding to the at least two images to be translated.

[0093] Step S520: Perform translation processing on the at least two images to be translated respectively to obtain the translated images corresponding to the at least two images to be translated respectively.

[0094] For the specific descriptions of steps S510 - S520, please refer to steps S110 - S120, which will not be elaborated here.

[0095] Step S530: Obtain the text length of the text to be translated included in the at least two images to be translated.

[0096] In some embodiments, the text length of the text to be translated included in the at least two images to be translated can be obtained. As a way, the electronic device can detect the text length of the text to be translated included in each of the at least two images to be translated, and add up all the detected text lengths to obtain the text length of the text to be translated included in the at least two images to be translated. As another way, the electronic device can remove duplicates from the text to be translated that are repeated in the at least two images to be translated, detect the text length of the de-duplicated text to be translated included in each of the at least two images to be translated, and add up all the detected text lengths to obtain the text length of the text to be translated included in the at least two images to be translated.

[0097] Step S540: When the text length is greater than the length threshold, splice the translated images corresponding to the at least two images to be translated in the image acquisition sequence to obtain a target translated image.

[0098] In some embodiments, the electronic device can preset and store a length threshold, which is used as a judgment basis for the text length of the text to be translated included in the at least two images to be translated. Therefore, in this embodiment, when determining the text length of the text to be translated included in the at least two images to be translated, the text length can be compared with the length threshold to determine whether the text length is greater than the length threshold.

[0099] Among them, when the judgment result indicates that the text length is greater than the length threshold, it can be considered that the text to be translated included in the image to be translated is relatively long, and the translated text obtained after translating the text to be translated in the image to be translated is relatively long. If the translated images corresponding to at least two images to be translated are respectively displayed, it is easy for the user to forget the content that has been translated before. Therefore, when the text length is greater than the length threshold, the translated images corresponding to at least two images to be translated can be spliced according to the image acquisition order to obtain a target translated image, so as to realize the overall display of the translated text and avoid the problem of forgetting when the translated text is relatively long.

[0100] Step S550: When the text length is less than or equal to the length threshold, output the translated images corresponding to at least two images to be translated respectively.

[0101] Among them, when the judgment result indicates that the text length is less than or equal to the length threshold, it can be considered that the text to be translated included in the image to be translated is relatively short, and the translated text obtained after translating the text to be translated in the image to be translated is relatively short. If the translated images corresponding to at least two images to be translated are respectively displayed, the user can remember the content that has been translated before. Therefore, when the text length is less than or equal to the length threshold, the translated images corresponding to at least two images to be translated can be output respectively. For example, the translated images corresponding to at least two images to be translated can be displayed in sequence according to the acquisition order, or the translated images corresponding to at least two images to be translated can be reduced and displayed simultaneously, etc., which are not limited herein.

[0102] In some embodiments, when it is determined that the text length is greater than the length threshold, second selection information can be output, where the first selection information is used to prompt the user to select to splice the translated images corresponding to at least two images to be translated according to the image acquisition order to obtain a target translated image, or to select to output the translated images corresponding to at least two images to be translated respectively.

[0103] The translation method provided by an embodiment of the present application acquires at least two images to be translated collected by the camera of the electronic device, obtains the image acquisition order corresponding to at least two images to be translated, performs translation processing on at least two images to be translated respectively to obtain the translated images corresponding to at least two images to be translated respectively, obtains the text length of the text to be translated included in at least two images to be translated. When the text length is greater than the length threshold, splice the translated images corresponding to at least two images to be translated according to the image acquisition order to obtain a target translated image. When the text length is less than or equal to the length threshold, output the translated images corresponding to at least two images to be translated respectively. Compared with Figure 1According to the translation method shown above, in this embodiment, the processing method for the translated image is further determined according to the text lengths of at least two images to be translated, thereby improving the rationality and diversity of the processing.

[0104] Please refer to Figure 7 , Figure 7 which shows a schematic flowchart of the translation method provided by an embodiment of the present application. This method is applied to an electronic device. The following will elaborate in detail on the Figure 7 flow shown above. The translation method may specifically include the following steps:

[0105] Step S610: Obtain at least two images to be translated collected by the camera of the electronic device, and obtain the image acquisition order corresponding to the at least two images to be translated.

[0106] Step S620: Perform translation processing on the at least two images to be translated respectively to obtain the translated images corresponding to the at least two images to be translated respectively.

[0107] Step S630: According to the image acquisition order, splice the translated images corresponding to the at least two images to be translated respectively to obtain a target translated image.

[0108] Among them, for the specific descriptions of steps S610 - S630, please refer to steps S110 - S130, which will not be elaborated here.

[0109] Step S640: Display the target translated image.

[0110] In some embodiments, when the electronic device obtains the target translated image, it can display the target translated image. Based on this, the user can intuitively see the overall translated image, and the visual experience is better.

[0111] As a method, when the electronic device obtains the target translated image, it can superimpose and display the target translated image on the currently displayed content, can display the target translated image covering the currently displayed content, can exit the currently displayed content and display the target translated image, etc., which are not limited here.

[0112] Step S650: In response to a target instruction for the target translated image, store the target translated image in the local of the electronic device.

[0113] In some embodiments, during the process of the electronic device displaying the target translated image, it may detect whether an instruction for the target translated image is received. Among them, when the target instruction for the target translated image is detected, it can be considered that the user expects to save the target translated image. Then, in response to the target instruction for the target translated image, the target translated image can be stored locally in the electronic device so that the user can quickly obtain the target translated image next time.

[0114] As a way, the target instruction can be generated when a target touch operation is detected, can be generated when target voice information is detected, can be generated when the display duration of the target translated image reaches a preset duration, etc., which is not limited here.

[0115] The translation method provided by an embodiment of the present application obtains at least two to-be-translated images collected by the camera of the electronic device, and obtains the image acquisition order corresponding to the at least two to-be-translated images. Respectively perform translation processing on the at least two to-be-translated images to obtain the translated images corresponding to the at least two to-be-translated images respectively. According to the image acquisition order, splice the translated images corresponding to the at least two to-be-translated images to obtain a target translated image, display the target translated image, and in response to the target instruction for the target translated image, store the target translated image locally in the electronic device. Compared with Figure 1 the shown translation method, this embodiment also displays and stores the target translated image to improve the reach effect of the translation.

[0116] Please refer to Figure 8 , Figure 8 which shows the module block diagram of the translation device provided by the embodiment of the present application. The translation device 200 is applied to the above-mentioned electronic device. Below, the Figure 8 shown block diagram will be elaborated. The translation device 200 includes: a first image acquisition module 210, a second image acquisition module 220, and a third image acquisition module 230, where:

[0117] The first image acquisition module 210 is configured to acquire at least two to-be-translated images collected by the camera of the electronic device, and acquire the image acquisition order corresponding to the at least two to-be-translated images.

[0118] The second image acquisition module 220 is configured to respectively perform translation processing on the at least two to-be-translated images to obtain the translated images corresponding to the at least two to-be-translated images respectively.

[0119] Further, the second image acquisition module includes: a to-be-translated text acquisition sub-module, a translated text acquisition sub-module, and a translated image acquisition sub-module, where:

[0120] The to-be-translated text acquisition sub-module is used to respectively identify the at least two to-be-translated images, and acquire the to-be-translated text included in each of the at least two to-be-translated images.

[0121] The translated text acquisition sub-module is used to respectively translate the to-be-translated text included in each of the at least two to-be-translated images, and acquire the translated text included in each of the at least two to-be-translated images.

[0122] The translated image acquisition sub-module is used to acquire the translated image corresponding to each of the at least two to-be-translated images based on the at least two to-be-translated images and the translated text included in each of the at least two to-be-translated images.

[0123] Further, the translated image acquisition sub-module includes: a translated image acquisition unit, wherein:

[0124] The translated image acquisition unit is used to respectively replace the to-be-translated text included in each of the at least two to-be-translated images with the translated text included in each, and acquire the translated image corresponding to each of the at least two to-be-translated images.

[0125] The third image acquisition module 230 is used to splice the translated images corresponding to each of the at least two to-be-translated images in the image acquisition order to obtain a target translated image.

[0126] Further, the third image acquisition module 230 includes: a to-be-translated image acquisition sub-module, a target feature point determination sub-module, and an image splicing sub-module, wherein:

[0127] The to-be-translated image acquisition sub-module is used to obtain two adjacent to-be-translated images in the image acquisition order from the at least two to-be-translated images.

[0128] The target feature point determination sub-module is used to determine the same feature points as target feature points from the two adjacent to-be-translated images.

[0129] The image splicing sub-module is used to splice the translated images corresponding to the two adjacent to-be-translated images based on the target feature points.

[0130] Further, the image splicing sub-module includes: a position acquisition unit and an image splicing unit, wherein:

[0131] The position acquisition unit is used to acquire the positions of the target feature points in the translated images corresponding to the two adjacent to-be-translated images.

[0132] An image stitching unit, configured to perform image stitching on the translated images corresponding to two adjacent images to be translated respectively based on the positions of the target feature points in the translated images corresponding to the two adjacent images to be translated respectively.

[0133] Further, the third image obtaining module 230 includes: an image quantity obtaining sub-module, a third image obtaining sub-module, and a translated image output sub-module, where:

[0134] The image quantity obtaining sub-module is configured to obtain the quantity of images corresponding to the at least two images to be translated.

[0135] The third image obtaining sub-module is configured to, when the quantity of images is greater than a quantity threshold, perform image stitching on the translated images corresponding to the at least two images to be translated respectively according to the image acquisition order, to obtain a target translated image.

[0136] The translated image output sub-module is configured to, when the quantity of images is less than or equal to the quantity threshold, output the translated images corresponding to the at least two images to be translated respectively.

[0137] Further, the third image obtaining module 230 includes: a text length obtaining sub-module, a third image obtaining sub-module, and a translated image output sub-module, where:

[0138] The text length obtaining sub-module is configured to obtain the text length of the text to be translated included in the at least two images to be translated.

[0139] The third image obtaining sub-module is configured to, when the text length is greater than a length threshold, perform image stitching on the translated images corresponding to the at least two images to be translated respectively according to the image acquisition order, to obtain a target translated image.

[0140] The translated image output sub-module is configured to, when the text length is less than or equal to the length threshold, output the translated images corresponding to the at least two images to be translated respectively.

[0141] Further, the translation device 200 further includes: an image display module and an image saving module, where:

[0142] The image display module is configured to display the target translated image.

[0143] The image saving module is configured to store the target translated image in the local of the electronic device in response to a target instruction for the target translated image.

[0144] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0145] In several embodiments provided in the present application, the coupling between modules can be electrical, mechanical, or other forms of coupling.

[0146] In addition, in each embodiment of the present application, each functional module can be integrated in a processing module, or each module can exist physically alone, or two or more modules can be integrated in one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules.

[0147] Please refer to Figure 9 , which shows a structural block diagram of an electronic device 100 provided by an embodiment of the present application. The electronic device 100 can be an electronic device such as a smart phone, a tablet computer, an e-book, etc. that can run application programs. The electronic device 100 in the present application can include one or more of the following components: a processor 110, a memory 120, and one or more application programs, where one or more application programs can be stored in the memory 120 and configured to be executed by one or more processors 110, and one or more programs are configured to execute the methods described in the foregoing method embodiments.

[0148] Among them, the processor 110 can include one or more processing cores. The processor 110 connects various parts within the entire electronic device 100 using various interfaces and lines, and by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and by calling data stored in the memory 120, it executes various functions of the electronic device 100 and processes data. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 110 can integrate one or several combinations of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the content to be displayed; the modem is used to process wireless communication. It can be understood that the above modem can also not be integrated into the processor 110 and can be implemented separately through a communication chip.

[0149] The memory 120 may include a Random Access Memory (RAM), or may also include a Read-Only Memory. The memory 120 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data created during the use of the electronic device 100 (such as a phone book, audio and video data, chat record data, etc.).

[0150] Please refer to Figure 10 which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. Program code is stored in the computer-readable medium 300, and the program code can be called by a processor to execute the method described in the above method embodiments.

[0151] The computer-readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 300 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 300 has a storage space for the program code 310 for executing any method step in the above method. These program codes can be read out from or written into one or more computer program products. The program code 310 can be compressed in an appropriate form, for example.

[0152] In summary, for the translation method, device, electronic device, and storage medium provided by the embodiments of the present application, at least two to-be-translated images collected by the camera of the electronic device are obtained, and the image acquisition order corresponding to the at least two to-be-translated images is obtained. The at least two to-be-translated images are respectively subjected to translation processing to obtain translated images corresponding to the at least two to-be-translated images respectively. According to the image acquisition order, the translated images corresponding to the at least two to-be-translated images are image-stitched to obtain a target translated image. Thus, through real-time translation processing of multiple collected images and stitching of the translated multiple images to form an overall translated image, the overall display of the translation result can be realized, and the user experience can be improved.

[0153] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present application.

Claims

1. A translation method, characterized in that, Applied to an electronic device, the method includes: Obtain at least two images to be translated collected by a camera of the electronic device, and obtain the image acquisition order corresponding to the at least two images to be translated; Perform translation processing on the at least two images to be translated respectively to obtain translated images corresponding to the at least two images to be translated respectively; According to the image acquisition order, based on the feature information of the translated images corresponding to the at least two images to be translated respectively, splice the translated images corresponding to the at least two images to be translated respectively to obtain a target translated image; Wherein, the splicing the translated images corresponding to the at least two images to be translated respectively according to the image acquisition order based on the feature information of the translated images corresponding to the at least two images to be translated respectively includes: Obtain two adjacent images to be translated in the image acquisition order from the at least two images to be translated; Determine the same feature points as target feature points from the two adjacent images to be translated; Based on the target feature points, splice the translated images corresponding to the two adjacent images to be translated respectively.

2. The method according to claim 1, characterized in that The performing translation processing on the at least two images to be translated respectively to obtain translated images corresponding to the at least two images to be translated respectively includes: Identify the at least two images to be translated respectively to obtain the text to be translated included in the at least two images to be translated respectively; Translate the text to be translated included in the at least two images to be translated respectively to obtain the translated text included in the at least two images to be translated respectively; Based on the at least two images to be translated and the translated text included in the at least two images to be translated respectively, obtain the translated images corresponding to the at least two images to be translated respectively.

3. The method according to claim 2, wherein The obtaining the translated images corresponding to the at least two images to be translated respectively based on the at least two images to be translated and the translated text included in the at least two images to be translated respectively includes: Replace the text to be translated included in the at least two images to be translated respectively with the translated text included in the at least two images to be translated respectively to obtain the translated images corresponding to the at least two images to be translated respectively.

4. The method according to claim 1, wherein The splicing the translated images corresponding to the two adjacent images to be translated respectively based on the target feature points includes: Obtain the positions of the target feature points in the translated images corresponding to the two adjacent images to be translated respectively; Based on the positions of the target feature points in the translated images corresponding to the two adjacent images to be translated respectively, splice the translated images corresponding to the two adjacent images to be translated respectively.

5. The method according to any one of claims 1-4, characterized in that, The splicing the translated images corresponding to the at least two images to be translated respectively according to the image acquisition order to obtain a target translated image includes: Obtain the number of images corresponding to the at least two images to be translated; When the number of images is greater than a threshold, splice the translated images corresponding to the at least two images to be translated respectively according to the image acquisition order to obtain a target translated image; or When the number of the images is less than or equal to the number threshold, output the translated images corresponding to the at least two images to be translated respectively.

6. The method according to any one of claims 1-4, characterized in that, The step of performing image stitching on the translated images corresponding to the at least two images to be translated respectively according to the image acquisition order to obtain a target translated image includes: Obtain the text lengths of the texts to be translated included in the at least two images to be translated; When the text length is greater than the length threshold, perform image stitching on the translated images corresponding to the at least two images to be translated respectively according to the image acquisition order to obtain a target translated image; or When the text length is less than or equal to the length threshold, output the translated images corresponding to the at least two images to be translated respectively.

7. The method according to any one of claims 1-4, characterized in that, After performing image stitching on the translated images corresponding to the at least two images to be translated respectively according to the image acquisition order to obtain a target translated image, it further includes: Display the target translated image; In response to a target instruction for the target translated image, store the target translated image in the local of the electronic device.

8. A translation device, characterized in that, Applied to an electronic device, the apparatus includes: A first image acquisition module, configured to acquire at least two images to be translated collected by a camera of the electronic device, and acquire the image acquisition order corresponding to the at least two images to be translated; A second image acquisition module, configured to perform translation processing on the at least two images to be translated respectively to obtain the translated images corresponding to the at least two images to be translated respectively; A third image acquisition module, configured to acquire two adjacent images to be translated in the image acquisition order from the at least two images to be translated; determine the same feature points as target feature points from the two adjacent images to be translated; and perform image stitching on the translated images corresponding to the two adjacent images to be translated respectively based on the target feature points to obtain a target translated image.

9. An electronic device, characterized in that, Comprising a memory and a processor, the memory is coupled to the processor, and the memory stores instructions, and when the instructions are executed by the processor, the processor executes the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program codes, and the program codes can be called by the processor to execute the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Translation device and translation system

    CN110245362A

  • Camera with translation function, and method of displaying text

    JP2010103694A

  • Machine translation method and electronic device

    WO2021052458A1