Image processing method and electronic device
By storing the first identification image in the target storage unit and identifying it by the target application, the problem of the user requiring the device to control the direction of the information identification code is solved, which simplifies the operation process and improves the user experience.
Patent Information
- Application Number
- CN202311182304.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-14
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2043-09-14
AI Technical Summary
When the electronic device collects and records the image with the information identification code, the user needs to control the device toward the information identification code, resulting in complex operations and poor user experience.
The first recognized image is stored in the target storage unit, and the scanning service of the target application recognizes the stored image, avoiding relying on real-time image acquisition, and reducing the requirements for user operations.
Reduce the requirements for the orientation of the device when collecting the second recognition image, simplify the operation process, and improve the user experience.
Smart Images

Figure CN117077703B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and more particularly, to an image processing method and electronic device. Background Art
[0002] With the development of information technology, the application of information identification codes is becoming more and more widespread. An information identification code can be an image formed according to coding rules, such as a QR code, a barcode, etc. By identifying the information identification code, the information carried by the information identification code can be obtained.
[0003] The electronic device recognizes an image containing an information identification code and can determine the target application corresponding to the information identification code. The electronic device can enable the target application's code scanning service, allowing the target application to capture the image, recognize the information identification code recorded in the image, and access the link address indicated by the information identification code. This makes it simple for a user to scan the target application's information identification code using the target application.
[0004] However, after the electronic device captures and records the image with the information identification code, when the target application needs to re-capture the image of the information identification code, the user needs to control the orientation of the electronic device so that the camera of the electronic device is facing the information identification code, which greatly restricts the user operation and the user experience is still low. Summary of the Invention
[0005] The present application provides an image processing method and an electronic device, which reduce restrictions on user operations and improve user experience when a user uses an electronic device to scan a code.
[0006] In a first aspect, an image processing method is provided, the method comprising: starting a scanning service of a target application, the target application being an application corresponding to a target information identification code in a first identification image, the scanning service of the target application being used to collect a second identification image, storing the second identification image in a target storage unit, and identifying the information identification code in the image stored in the target storage unit; and storing the first identification image in the target storage unit.
[0007] The image processing method provided by the embodiment of the present application stores a first recognition image in a target storage unit, and the target application is used to store a collected second recognition image in the target storage unit and identify the information identification code in the image stored in the target storage unit, so that the target application identifies the target information identification code in the first recognition image. The recognition result of the target application scanning service no longer depends on the image collected by the scanning service, thereby reducing the requirements for user operations of the target application scanning service during the image acquisition process.
[0008] In a possible implementation, storing the first recognition image in the target storage unit includes replacing the second recognition image in the target storage unit with the first recognition image.
[0009] By replacing the second identification image collected by the target application's scanning service with the first identification image, the second identification image can be prevented from affecting the subsequent processing of the target application's scanning service, ensuring that the target application's scanning service performs subsequent processing based on the first identification image required by the user, thereby improving the accuracy of the subsequent processing results of the target application's scanning service.
[0010] In one possible implementation, the method is applied to an electronic device, and the method further includes: in response to a user's scanning operation, using a first camera of the electronic device to capture an image to obtain a first recognition image; recognizing the first recognition image to determine a target application; the scanning service of the target application is used to capture a second recognition image using a second camera of the electronic device, and the orientation of the first camera is different from the orientation of the second camera.
[0011] When the orientation of the first camera for collecting the first identification image is different from the orientation of the second camera for collecting the second identification image, if the scanning service of the target application recognizes the second identification image, the user needs to make the first camera face the scene where the target information identification code is located to obtain the first identification image, and then adjust the direction of the electronic device so that the second camera faces the scene where the target information identification code is located to obtain the second identification image, which complicates the user operation.
[0012] By storing the first identification image in the target storage unit, the target application's recognition of the information identification code does not depend on the content recorded in the second identification image. Therefore, during the process of acquiring the second identification image, the second camera does not have to face the scene where the target information identification code is located, which reduces the requirements for the direction of the second camera, thereby reducing the complexity of user operations and improving user experience.
[0013] In a possible implementation, the code scanning service of the target application is used to pre-process the captured initial image to obtain the second recognition image.
[0014] The storage location of the second recognition image obtained by preprocessing the code scanning service of the target application and the location of the target storage unit are easier to determine, making the image processing method easier to implement.
[0015] In a possible implementation, the first recognition image is an encrypted image; storing the first recognition image in a target storage unit includes: decrypting the first recognition image, and storing the decrypted first recognition image in the target storage unit.
[0016] The first identification image is stored in an encrypted manner, which reduces the possibility of other applications stealing the first identification image and improves the security of the execution process of the image processing method.
[0017] In a possible implementation, decrypting the first identification image includes: decrypting the first identification image in response to the acquisition of the second identification image.
[0018] After the second identification image is stored in the target storage unit, the target application's code scanning program recognizes the image stored in the target storage unit. In response to the acquisition of the second identification image, the first identification image is decrypted. This can reduce the length of time the decrypted first identification image is stored in the electronic device, reduce the risk of misuse of the decrypted first identification image, and improve security.
[0019] In one possible implementation, the method further includes: capturing an image based on a user's code scanning operation to obtain a first identification image; decrypting the first identification image and identifying the decrypted first identification image to determine a target application corresponding to the target information identification code. Decrypting the first identification image and storing the decrypted first identification image in a target storage unit includes: decrypting the first identification image again and storing the decrypted first identification image in the target storage unit.
[0020] In the case where the first identification image is collected based on the user's scanning operation, the collected first initial image is encrypted to obtain the first identification image. Afterwards, the first identification image is decrypted, and the decrypted first identification image is identified to determine the target application corresponding to the target information identification code in the first identification image. After the scanning service of the target application is turned on, the first identification image is decrypted again, and the decrypted first identification image is stored in the target identification unit. In the case where the first identification image is collected based on the user's scanning operation, the first identification image can still be an encrypted image, thereby improving security. In the case where the first identification image needs to be provided to the scanning service of the target application, the first identification image is decrypted, thereby further reducing the possibility of other applications misappropriating the first identification image and improving security.
[0021] In a possible implementation, the method further includes: acquiring the first recognition image according to a code scanning operation of the user; and deleting the first recognition image when the code scanning service of the target application is closed.
[0022] The storage of the first recognition image in the electronic device occupies the electronic device's storage space. If the target application's code scanning service is disabled, the target application's code scanning service no longer uses the first recognition image for processing results, and the first recognition image can be deleted. Consequently, deleting the first recognition image has no impact on the target application's code scanning service processing and reduces the storage space occupied by the electronic device.
[0023] In a second aspect, an image processing device is provided, comprising a unit for executing any one of the methods in the first aspect. The device may be an electronic device or a chip within an electronic device. The image processing device may include an acquisition unit and a processing unit.
[0024] When the device is a terminal device, the processing unit may be a processor, and the acquisition unit may be a communication interface; the terminal device may also include a memory, which is used to store computer program code. When the processor executes the computer program code stored in the memory, the terminal device executes any one of the methods in the first aspect.
[0025] When the apparatus is a chip within a terminal device, the processing unit may be a processing unit within the chip, and the acquisition unit may be an interface, a pin, or a circuit. The chip may further include a storage unit, which may be a memory, for example, a memory within the chip (e.g., a register, a cache, etc.), or a memory located external to the chip (e.g., a read-only memory, a random access memory, etc.). The memory may be used to store computer program code. When the processor executes the computer program code stored in the memory, the chip performs any of the methods in the first aspect.
[0026] In one possible implementation, a memory is used to store computer program code; a processor executes the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor is used to perform: starting a scanning service of a target application, the target application is an application corresponding to a target information identification code in a first recognition image, the scanning service of the target application is used to collect a second recognition image, store the second recognition image in a target storage unit, and recognize the information identification code in the image stored in the target storage unit; and store the first recognition image in the target storage unit.
[0027] According to a third aspect, a chip is provided, comprising a processor, which implements any one of the methods in the first aspect when executing instructions.
[0028] According to a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program code, and the computer program code is used to implement any one of the methods in the first aspect.
[0029] In a fifth aspect, a computer program product is provided, comprising: a computer program code, wherein the computer program code is used to implement any one of the methods in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a schematic diagram of a hardware system of an electronic device applicable to the present application;
[0031] Figure 2 is a schematic diagram of a software system for an electronic device applicable to the present application;
[0032] Figure 3 is a schematic flow chart of an image processing method;
[0033] Figure 4 is a schematic flow chart of an image processing method provided in an embodiment of the present application;
[0034] Figure 5 is a schematic flow chart of another image processing method provided in an embodiment of the present application;
[0035] Figure 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0036] Figure 7 is a schematic diagram of a graphical user interface provided in an embodiment of the present application;
[0037] Figure 8 This is a schematic diagram of a code scanning operation provided in an embodiment of the present application;
[0038] Figure 9 is a schematic diagram of a camera provided in an embodiment of the present application;
[0039] Figure 10 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0040] Figure 11 is a schematic diagram of another graphical user interface provided in an embodiment of the present application;
[0041] Figure 12 This is a schematic structural diagram of an image processing device provided by this application. DETAILED DESCRIPTION
[0042] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
[0043] Figure 1 A hardware system of an electronic device suitable for the present application is shown.
[0044] The method provided in the embodiments of the present application can be applied to various electronic devices capable of network communication, such as mobile phones, tablet computers, wearable devices, laptop computers, netbooks, and personal digital assistants (PDAs). The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.
[0045] Figure 1 : The figure shows a schematic diagram of the structure of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0046] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0047] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0048] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0049] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0050] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface. The USB interface 130 is an interface that complies with the USB standard specification and can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices.
[0051] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0052] The wireless communication function of the electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 can receive electromagnetic waves from antenna 1, filter, amplify and process the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation through antenna 1.
[0053] The wireless communication module 160 can provide wireless communication solutions for application on the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0054] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0055] Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.
[0056] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0057] For example, the GPU can process the image captured by the camera 193, and the display screen 194 can display the image obtained after the GPU processing.
[0058] The electronic device 100 implements a code scanning function through a camera 193, including a GPU, an application processor, a display screen 194, a mobile communication module 150 or a wireless communication module 160, antenna 1, antenna 2, and the like. After the user performs a code scanning operation, the camera 193 can capture an image. When the camera is facing the scene where the information identification code is located, the image captured by the camera 193 can record the information identification code. The GPU can process the image captured by the camera 193 to obtain the identification information recorded in the information identification code. The display screen 194 can display the image captured by the camera 193, or it can also display the image processed by the GPU. Based on the identification information, the application processor can use the mobile communication module 150 or the wireless communication module 160, and antenna 1 and / or antenna 2 to access the link address indicated by the identification information to receive access information. The application processor can also generate an access interface based on the received access information. The display screen 194 can display this access interface.
[0059] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0060] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0061] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0062] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0063] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 or some functional modules of the audio module 170 can be provided in the processor 110.
[0064] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.
[0065] During the process of implementing the code scanning function of the electronic device, when the camera 193 completes image acquisition, or the GPU completes all or part of the processing of the acquired image, the speaker 170A can output a prompt sound to remind the user that the image acquisition is completed, so that the user can adjust the orientation and position of the electronic device and no longer point the camera 193 of the electronic device towards the scene where the information identification code is located, which is convenient for user use.
[0066] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be located on display screen 194. There are many types of pressure sensors 180A, such as resistive, inductive, and capacitive. A capacitive pressure sensor can include at least two parallel plates made of conductive material. When force acts on pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the intensity of the pressure based on this change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch intensity based on pressure sensor 180A. Electronic device 100 can also calculate the touch location based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch location but with different touch intensities can correspond to different operation instructions. For example, when a touch operation with an intensity less than a first pressure threshold is applied to a short message application icon, a command to view short messages is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to a short message application icon, a command to create a new short message is executed.
[0067] The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., the x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake.
[0068] Accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in various directions (typically the x-, y-, and z-axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. Accelerometer 180E can also be used to identify the posture of electronic device 100, serving as an input parameter for applications such as landscape / portrait switching and pedometers.
[0069] The detection results of the gyro sensor 180B and the acceleration sensor 180E can indicate the posture of the electronic device and changes in the posture. According to the detection results of the gyro sensor 180B and the acceleration sensor 180E, the user's operation on the electronic device can be determined.
[0070] The touch sensor 180K is also called a "touch panel." The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, in a location different from that of the display screen 194.
[0071] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.
[0072] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
[0073] With the development of information technology, the application of information identification codes is becoming more and more widespread. An information identification code can be an image formed according to coding rules, such as a QR code, a barcode, etc. By identifying the information identification code, the information carried by the information identification code can be obtained.
[0074] When a user needs to scan an information identification code, the user finds the icon of the application (APP) corresponding to the information identification code on the desktop displayed by the electronic device and instructs the electronic device to run the application. Then, the user finds the icon of the scanning function on the application interface displayed by the electronic device and instructs the electronic device to use the application to identify and process the collected image. The electronic device uses the application to collect and identify the collected image to determine the link address corresponding to the information identification code recorded in the collected image. The electronic device uses the application to access the link address so that the client interface displays the function or service corresponding to the information identification code.
[0075] For example, when paying in a store, there is generally a QR code carrying payment information on the cash register. When the user needs to make a payment, the user needs to open the application corresponding to the QR code and use the scanning service of the application corresponding to the QR code to scan the QR code carrying the payment information, obtain the payment information carried in the QR code, and then use the payment information to pay the corresponding amount.
[0076] For example, shared bicycles are generally equipped with QR codes. If users want to unlock and use shared bicycles, they need to turn on the scanning service of the application corresponding to the shared bicycle in their electronic device. Using the scanning service, they can scan the QR code set on the shared bicycle, obtain the information carried in the QR code, and then unlock and use the shared bicycle according to the information carried in the QR code.
[0077] The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100.
[0078] Figure 2 This is a block diagram of the software structure of the electronic device 100 according to an embodiment of the present application. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer, the application framework layer, the system library of the Android runtime, and the kernel layer. The application layer may include a series of application packages.
[0079] like Figure 2 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, code scanning and other applications.
[0080] The application framework (FWK) layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0081] The code scanning application can sense the user's code scanning operation.
[0082] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, a perception service, a camera service, and the like.
[0083] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.
[0084] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0085] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.
[0086] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including answering, hanging up, etc.).
[0087] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0088] The notification manager enables applications to display notification information in the status bar, which can be used to convey informational messages and disappear automatically after a short stay without user interaction.
[0089] The perception service can be a service corresponding to the code scanning application. When a user's code scanning operation is detected, the code scanning application can send the code scanning operation information to the perception service.
[0090] The Android runtime includes the core library and the virtual machine. The Android runtime is responsible for scheduling and management of the Android system.
[0091] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0092] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0093] The system library can include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library, 2D graphics engine, etc.
[0094] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
[0095] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files.
[0096] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0097] The 2D graphics engine is a drawing engine for 2D graphics and may include an always-on (AO) service, an image pre-processing module, a code detection module, and the like.
[0098] When receiving the code scanning operation information, the perception service can forward the code scanning operation information to the AO service.
[0099] The AO service can send collection instruction information to the camera service based on the code scanning operation information.
[0100] The AO service can also initialize the code recognition module based on the code scanning operation information.
[0101] Upon receiving the capture instruction, the camera service can send driver information to the system library. The driver information instructs the system library to use the camera in the kernel layer to drive the camera to capture images. For example, the camera service can send driver information to the AO service.
[0102] The driver information may also instruct the system library to initialize the image pre-processing module.
[0103] The kernel layer is the layer between hardware and software. The kernel layer can include driver modules such as display driver, camera driver, audio driver, and sensor driver.
[0104] The initial image captured by the camera can be transmitted to the image preprocessing module through the camera driver. The image preprocessing module is used to preprocess the initial image to obtain a preprocessed image.
[0105] The code recognition module is used to recognize the pre-processed image to obtain the identification information carried by the information identification code recorded in the pre-processed image.
[0106] The AO service is used to send identification information to the awareness service.
[0107] The perception service is also used to send identification information to the code scanning application, so that the code scanning application can perform subsequent processing based on the identification information to complete the code scanning function.
[0108] When a large number of applications are installed in an electronic device, it takes a long time for the user to find the application corresponding to the information identification code on the desktop. The user also needs to spend time finding the scanning service icon on the application interface to activate the scanning service of the application, which complicates the user operation. In addition, the user takes a long time to complete the operation, resulting in a poor user experience.
[0109] In order to simplify user operations and reduce the complexity of user operations, electronic devices can perform Figure 3 The image processing method shown.
[0110] Step S301: Obtain the user's code scanning operation.
[0111] In response to the code scanning operation, the electronic device is instructed to perform S302 to S304.
[0112] Step S302: Capture a first image, in which an information identification code is recorded.
[0113] Step S303: Identify the first image to obtain identification information recorded by the information identification code, where the identification information includes a target application identifier.
[0114] Step S304: Determine the target application corresponding to the target application identifier according to the correspondence between the application identifier and the application.
[0115] Step S305: Enable the code scanning function of the target application.
[0116] Step S306: using the target program to capture the second image, identifying the information identification code in the second image, and accessing the link address indicated by the information identification code.
[0117] Through the image processing method shown in steps S301 to S305, the user's operation can be simplified.
[0118] After the electronic device determines the target application in S305, it uses the target application to capture the second image, allowing the target application to obtain the second image containing the information identification code. The second image must contain the information identification code. This means that during the capture of both the first and second images, the user must control the orientation of the electronic device to ensure that both the first and second images contain the information identification code, placing significant demands on user operation.
[0119] In order to shorten the time required from when an electronic device starts scanning a code to when the electronic device uses a target application to determine a link address, thereby improving user experience, an embodiment of the present application provides an image processing method.
[0120] The following combination Figure 4 The image processing method provided in the embodiments of the present application is described in detail.
[0121] Figure 4 is a schematic flow chart of the image processing method provided in the embodiment of the present application. The electronic device can be used to perform Figure 4 The method described above may include: Figure 1 Electronic devices shown.
[0122] Figure 4 The image processing method shown includes steps S410 to S430, which are described in detail below.
[0123] Step S410, start the scanning service of the target application, the target application is the application corresponding to the target information identification code in the first recognition image, the scanning service of the target application is used to collect the second recognition image, store the second recognition image in the target storage unit, and identify the information identification code in the image stored in the target storage unit.
[0124] Before performing S410 , the electronic device may acquire a first recognition image.
[0125] The first recognition image may be an image stored in the electronic device, an image sent by another electronic device to the electronic device, or an image captured by the electronic device. Alternatively, the first recognition image may be a frame of image in a video.
[0126] Before performing S410 , the electronic device may also obtain a target application corresponding to the target information identification code in the first recognition image.
[0127] The electronic device may store at least one image including an information identification code and an application corresponding to the information identification code in each image. The at least one image including an information identification code may include a first identification image. The information identification code in the first identification image is a target information identification code, and the application corresponding to the target information identification code is a target application.
[0128] Alternatively, the first recognition image obtained by any method is recognized to determine the target application corresponding to the target information identification code in the first recognition image.
[0129] The information identification code is a coded pattern that carries information, and can specifically be a barcode or a QR code.
[0130] A barcode, also known as a barcode, is a graphic identifier that arranges multiple black bars and spaces of varying widths according to certain coding rules to express a set of information.
[0131] A QR code is a black and white graphic that records data symbols and information using specific geometric shapes distributed in a regular pattern on a two-dimensional plane. Compared to traditional barcodes, QR codes can carry more information and represent a wider range of data types.
[0132] The information carried by the information identification code can also be understood as the information recorded by the information identification code.
[0133] In some embodiments, performing image recognition on the first recognition image may be recognizing an icon recorded in the first recognition image.
[0134] Different applications may correspond to different images. The application corresponding to the icon recorded in the first recognition image may be used as the target application corresponding to the target information identification code in the first recognition image.
[0135] That is, according to the correspondence between icons and applications, the target application corresponding to the target information identification code in the first recognition image can be understood as the application corresponding to the image recorded in the first recognition image.
[0136] It should be understood that an application icon may be recorded in the center of the information identification code or other preset positions. By identifying the icon recorded in the preset position of the target information identification code, the target application corresponding to the target information identification code can be determined.
[0137] In other embodiments, recognizing the first recognition image may also be recognizing the target information recognition code in the first recognition image. Through recognition, the recognition information recorded by the target information recognition code can be obtained.
[0138] The recognition of the information identification code can also be understood as the decoding of the information identification code, that is, the process of parsing the information identification code and converting the information identification code into readable text, numbers or other identifiable data.
[0139] The identification information can be a string of characters. The identification information can represent a link address. The link address can also be called a URL.
[0140] After the identification information is obtained, the target program indicated by the identification information can be determined according to the target key character in the identification information. The target key character can be one of a plurality of preset key characters recorded in the electronic device.
[0141] That is, after obtaining the identification information, it can be determined whether the identification information includes the preset key characters.
[0142] If the identification information does not contain the same character as the preset key character, that is, if the identification information does not contain the preset key character, the default application may be used as the target application.
[0143] If the identification information contains characters identical to the preset key characters, i.e., if the identification information contains the preset key characters, the characters identical to the preset key characters, i.e., the preset key characters in the identification information, can be used as the target key characters. Based on the correspondence between the key characters and the target application, the application corresponding to the target key characters can be determined as the target application.
[0144] The target key character may be located at a preset position or a preset position range of the identification information. The target key character may be a combination of multiple characters.
[0145] That is, according to the correspondence between key characters and applications, the target application corresponding to the target information identification code in the first recognition image may be the application corresponding to the target key characters in the identification information carried by the target information identification code.
[0146] Scanning a code is a function that identifies information identification codes. Enabling the target application's scanning service can be understood as starting the target application's function to identify information identification codes. This can also be called invoking or calling the scanning service. The scanning service can be referred to as a scanning module.
[0147] After the target application's code scanning service is enabled, the target application can perform image acquisition and recognition.
[0148] Step S420: storing the first recognized image in a target storage unit.
[0149] By storing the first recognized image in the target storage unit, there is no need to adjust the image processing process of the target application's code scanning service, so that the image processing method is more consistent with the processing flow of the target application's code scanning service and has stronger adaptability.
[0150] The target storage unit is used to store data. Storing the first recognition image in the target storage unit can also be understood as transmitting or transferring the first recognition image to the target storage unit.
[0151] The code scanning service of the target application can be used to collect the second identification image, store the second identification image in the target storage unit, and identify the information identification code of the image stored in the target storage unit.
[0152] At S420 , the first recognition image is stored in the target storage unit, which may be replacing the second recognition image in the target storage unit with the first recognition image.
[0153] By replacing the second identification image collected by the target application's scanning service with the first identification image, the second identification image can be prevented from affecting the subsequent processing of the target application's scanning service, ensuring that the target application's scanning service performs subsequent processing based on the first identification image required by the user, thereby improving the accuracy of the subsequent processing results of the target application's scanning service.
[0154] When the first recognition image is an image stored in the electronic device or an image received by the electronic device, the second recognition image is replaced by the first recognition image. Without changing the processing process of the scanning service of the target application, the scanning service of the target application can process images from more sources, thereby improving the wide application of the image processing method.
[0155] In some embodiments, before performing S410, in response to a code scanning operation by a user, an image can be captured using a first camera of the electronic device to obtain a first recognition image.
[0156] According to the processing flow of the code scanning service of the target application, the second recognition image can be collected by the second camera of the electronic device.
[0157] The first camera and the second camera can be the same or different cameras. For example, the orientation of the first camera and the orientation of the second camera can be different. For example, the first camera can be a front-facing camera and the second camera can be a rear-facing camera; or the second camera can be a front-facing camera and the first camera can be a rear-facing camera.
[0158] A front-facing camera is a camera located on the same side of an electronic device as the display screen. The front-facing camera can be located above the display screen or elsewhere. A rear-facing camera is a camera located on the side of the electronic device opposite the display screen. The front-facing camera faces in the opposite direction to the rear-facing camera.
[0159] When the first camera and the second camera are facing different directions, if the scanning service of the target application recognizes the second recognition image, the user needs to make the first camera face the scene where the target information recognition code is located to obtain the first recognition image, and then adjust the direction of the electronic device so that the second camera faces the scene where the target information recognition code is located to obtain the second recognition image, which complicates the user operation.
[0160] By storing the first identification image in the target storage unit used to store the second identification image, the subsequent processing of the target application's code scanning service no longer depends on the second identification image, but is instead performed based on the first identification image. Therefore, during the acquisition of the second identification image, the second camera does not necessarily need to be pointed toward the scene where the target identification code is located. Even if the user does not point the second camera toward the target information identification code during the acquisition of the second identification image, the target application can still obtain the identification information recorded in the target information identification code by recognizing the first identification image in the target storage unit, thereby reducing the complexity of user operations and improving the user experience.
[0161] The second recognized image may be the second initial image output by the second camera, or may be a second pre-processed image obtained by pre-processing the second initial image. In other words, the second recognized image may be a pre-processed image. The pre-processing of the second recognized image may be all or part of the pre-processing corresponding to the target application's code scanning service.
[0162] The storage location of the second recognition image obtained by preprocessing the code scanning service of the target application and the location of the target storage unit are easier to determine, making the image processing method easier to implement.
[0163] The image obtained during the preprocessing of the second initial image captured by the camera, or the image obtained after the preprocessing, is replaced with the first recognized image, so that the node for replacing the image captured by the target application code scanning service is more flexible.
[0164] The first recognition image may be a first initial image output by the first camera, or the first recognition image may be a first preprocessed image obtained by preprocessing the first initial image. The first recognition image may be an image obtained through full or partial preprocessing.
[0165] Replacing the pre-processed second recognition image with the pre-processed first recognition image can avoid adverse effects on image quality caused by repeated pre-processing of an image during the image processing process.
[0166] The first identification image may also be an encrypted image.
[0167] In the case that the first recognition image is an encrypted image, at S420 , the first recognition image may be decrypted and the decrypted first recognition image may be stored in the target storage unit.
[0168] The encrypted first identification image is stored in the electronic device, and the first identification image is decrypted and stored in the target storage unit, thereby reducing the possibility of information in the first identification image being stolen by other applications and improving the security of image processing.
[0169] Based on the user's code scanning operation, a first initial recognition image may be captured. The first initial recognition image is encrypted to obtain a first recognition image. The first initial recognition image may be the first initial image output by the first camera, or the first recognition image may be a first pre-processed image obtained by pre-processing the first initial image. The encrypted first recognition image may also be referred to as an encrypted image.
[0170] Before S410, identifying the first identification image can be understood as decrypting the first identification image and identifying the decrypted first identification image. By identifying the decrypted first identification image, identification information can be obtained.
[0171] In S420 , the first recognition image is stored in the target storage unit, which can be understood as decrypting the first recognition image again and storing the decrypted first recognition image in the target storage unit.
[0172] The first initial identification image captured by the user's scanning operation is encrypted to obtain a first identification image. The first identification image can be stored in the electronic device. When the first identification image is needed, it is decrypted to prevent other programs in the electronic device from using the image without the user's consent, thereby improving security.
[0173] By decrypting the first identification image and identifying it, the target application corresponding to the target information identification code in the first identification image can be determined. After the target application's code scanning service is enabled, if the first identification image is needed again, the first identification image can be decrypted again, further reducing the possibility of other applications misusing the first identification image and improving security.
[0174] In the scenario where the first identification image replaces the second identification image, in order to make the time for storing the decrypted first identification image in the target storage unit more reasonable, the first identification image can be decrypted again in response to the acquisition of the second identification image.
[0175] In response to the acquisition of the second recognition image, it can be understood that the code scanning service of the target application starts to acquire the second recognition image, or the code scanning service of the target application completes the acquisition of the second recognition image.
[0176] When the target application's code scanning service starts to collect the second identification image, the first identification image is decrypted again. The decryption of the first identification image and the collection of the second identification image can be performed in parallel, thereby improving the timeliness of image processing.
[0177] In order to improve security, after identification is performed based on the first decrypted first identification image and the target application is determined, the first decrypted first identification image can be deleted; when the first decrypted second identification image is stored in the target storage unit, the first decrypted second identification image can be deleted.
[0178] During the process from S410 to S420 , the encrypted first recognition image may be stored in the electronic device.
[0179] The encrypted first recognition image is stored in the electronic device for a long time, resulting in a waste of storage resources in the electronic device. If the target application's code scanning service fails to process the replaced image, the target application's code scanning service may need to collect the second recognition image again, and the first recognition image may need to be decrypted again and stored in the target storage unit.
[0180] Therefore, if the encrypted first recognition image is deleted prematurely, subsequent processing of the target application's code scanning service may not proceed normally.
[0181] In order to reduce the storage resource occupation of the encrypted first identification image and ensure the normal subsequent processing of the target application's scanning service, the first identification image collected based on the user's scanning operation can be deleted when the scanning service of the target application is closed.
[0182] The image processing method provided in the embodiment of the present application enables the target application's scanning service and stores the captured image in the target storage unit, so that the target application indicated by the target information identification code in the captured image can identify the captured image and access the link address indicated by the target information identification code, making it easier for the target application to access the link address indicated by the target information identification code, reducing the requirements for user operation, and improving the user experience.
[0183] The following combination Figure 5 , taking the first recognition image as an example, which is an encrypted image Figure 4 The image processing method shown is described below.
[0184] Figure 5 This is a schematic flowchart of an image processing method provided in an embodiment of the present application. Figure 6 The electronic device shown can be used to perform Figure 5 The method described.
[0185] Figure 6 The electronic device shown includes an application layer, an application framework layer, a system library, a kernel layer, and hardware.
[0186] Figure 5 The image processing method shown includes steps S501 to S516, and these steps are described in detail below.
[0187] Step S501: Obtain the user's code scanning operation.
[0188] Figure 7 A graphical user interface (GUI) of an electronic device is shown. The GUI is a desktop 710 of the electronic device. A user clicking a scan code icon 711 on the desktop 710 may be a scan code operation. When the electronic device detects that the user has clicked the scan code icon 711 on the desktop 710, the electronic device has acquired the user's scan code operation.
[0189] Figure 8 Another user's code scanning operation is shown. Figure 8As shown in (a) of FIG, a user holds an electronic device, and the electronic device is in an unlocked state. For example, the unlocked electronic device may display desktop 810, or the electronic device may display an application program interface. The user's code scanning operation may be a wrist-flip operation of the user while the electronic device is unlocked.
[0190] The user's wrist-flipping operation may be a user operation that causes the angle of the orientation of the electronic device's display screen to change by more than a preset angle within a preset time length, or the user's wrist-flipping operation may be a user operation that causes the angle of the orientation of the electronic device's display screen to change by more than a preset angle and the speed at which the angle of the display screen changes exceeds a preset speed.
[0191] Accelerometers can be used to identify the posture of an electronic device, thereby determining the angle of change in the display screen's orientation. Gyroscopes can be used to detect the angular velocity of an electronic device around three axes, thereby determining the angular velocity of the display screen's orientation change.
[0192] When the electronic device is in an unlocked state and detects a wrist-turning operation by the user, the electronic device obtains the code scanning operation by the user.
[0193] Figure 6 In the electronic device shown, the application layer includes a code scanning application, which is used to detect the user's code scanning operation.
[0194] In response to the user's code scanning operation, the electronic device may perform S502, S506 and step S507.
[0195] Step S502: Capture a first initial image using a camera.
[0196] When the code scanning operation is a user clicking the code scanning icon 711, the electronic device can use Figure 9 The rear camera 910 shown in (a) captures a first initial image.
[0197] The user can control the orientation of the electronic device so that the rear camera of the electronic device faces the scene where the information identification code is located, so that the information identification code is recorded in the first initial image captured by the rear camera 910.
[0198] When the code scanning operation is performed by the electronic device in the unlocked state and the user's wrist flip operation is detected, the electronic device can use Figure 9 The front camera 920 shown in (b) captures a first initial image. Figure 9 (a) and (b) in the figure can be understood as the rear view and front view of the electronic device, respectively. The front camera 920 and the display screen 930 are located on the same side, and the rear camera 910 and the display screen 930 are located on the opposite side.
[0199] like Figure 8 As shown in (b), after the user performs a wrist flip operation, the front camera of the electronic device can face the direction in which the information identification code is recorded. Thus, the electronic device uses the front camera to capture a first initial image, in which the information identification code is recorded.
[0200] It should be understood that the information identification code recorded in the first initial image can be referred to as a target information identification code.
[0201] When the code scanning application obtains the user's code scanning operation, it can send the code scanning operation information to the perception service in the application framework layer.
[0202] The perception service is the service corresponding to the barcode scanning application. It forwards the barcode scanning operation information to the always-on (AO) service in the system library. The AO service is also called the AO module.
[0203] The "service" in the embodiments of the present application can be understood as a functional module.
[0204] The AO service can initialize the first image preprocessing module based on the code scanning operation information, send the first acquisition instruction information to the camera service in the application framework layer, and perform S506 and S507. The first acquisition instruction information can be used to instruct the camera service to acquire the first initial image.
[0205] The camera service may send first driver information to the system library according to the first acquisition instruction information, and the system library may forward the first driver information to the camera driver of the kernel layer.
[0206] The camera driver may drive the camera to capture the first initial image according to the first driving information.
[0207] When the code scanning operation is a user clicking the code scanning icon 711, the first acquisition instruction information can be used to instruct the camera service to use the rear camera to capture the first initial image. The first drive information can instruct the camera driver to drive the rear camera to capture the first initial image.
[0208] When the code scanning operation is a wrist-flipping operation detected by the user while the electronic device is unlocked, the first capture instruction information may be used to instruct the camera service to capture the first initial image using the front camera. The first drive information may instruct the camera driver to drive the front camera to capture the first initial image.
[0209] Step S503: pre-process the first initial image to obtain a first pre-processed image.
[0210] The first initial image may be an image output by a sensor of a camera.
[0211] The first initial image output by the camera can be transmitted to the first image preprocessing module in the system library through the camera driver. The initialized first image preprocessing module can preprocess the first initial image.
[0212] The system library includes a hardware abstraction layer (HAL). The HAL is an interface layer between the operating system kernel and the hardware circuitry, abstracting the hardware. The HAL includes the first and second image preprocessing modules in the system library, as well as the AO service. The AO service can be always running, while the first and second image preprocessing modules can run after initialization.
[0213] The first image preprocessing module may include preprocessing nodes such as an image front end (IFE) and an image processing engine (IPE).
[0214] IFE is used to perform color correction, downsampling, demosaicing, and statistics on automatic focus (AF), automatic exposure (AE), and automatic white balance (AWB) data on the input image.
[0215] IPE is used to perform cropping, noise reduction, color processing (such as chromatic aberration correction, chroma suppression, etc.), detail enhancement (such as skin color enhancement, etc.) on the input image.
[0216] The first initial image processed by the first image preprocessing module may be referred to as a first preprocessed image.
[0217] The AO service can also initialize the encryption model and decryption model in the system library based on the scan code operation information.
[0218] Step S504: encrypt the first pre-processed image to obtain an encrypted image, and delete the first pre-processed image.
[0219] The encryption module is used to encrypt the first pre-processed image to obtain an encrypted image. Exemplarily, the AO service may utilize the encryption module to encrypt the first pre-processed image.
[0220] The AO service can store encrypted images.
[0221] Immediately deleting the first pre-processed image can prevent the first pre-processed image from being stolen by other applications, thereby improving security.
[0222] After transmitting the first pre-processed image to the encryption model, for example, during the encryption model encrypting the first pre-processed image, or after the encryption model completes encrypting the first pre-processed image, the AO service may delete the first pre-processed image.
[0223] Step S505: decrypt the encrypted image to obtain a first decrypted image.
[0224] The decryption module is used to decrypt the encrypted image to obtain a first decrypted image.
[0225] The encrypted image can be transmitted to the decryption module so that the decryption module can decrypt the encrypted image. Exemplarily, the AO module can transmit the encrypted image to the decryption module.
[0226] Step S506: Initialize the code detection module.
[0227] The code detection module is used to detect whether there is an information identification code in the image.
[0228] Step S507: Initialize the code recognition module.
[0229] The code recognition module is used to identify the information identification code to obtain the information recorded in the information identification code.
[0230] After initialization, the code detection module and the code recognition module can run in the system library. The HAL in the system library can include the code detection module and the code recognition module.
[0231] It should be understood that step S506 and step S507 can be performed in series or in parallel, and step S506 and step S507 can be performed in series or in parallel with steps S502 to S505.
[0232] When the user's code scanning operation is obtained, the code detection module and the code recognition module can be initialized, so that the initialization of the code detection module is completed before S507 is completed, and the initialization of the code detection module is completed before S508. This avoids the extra time taken by the code detection module and the initialization process of the code detection module, shortens the time required for image processing, and improves image processing efficiency.
[0233] When the electronic device obtains the first decrypted image and the code detection model is completed, S508 may be performed.
[0234] Step S508: Using a code detection model, determine whether an information identification code is recorded in the first decrypted image.
[0235] The code detection model is used to determine whether an information identification code is recorded in the input image.
[0236] If it is determined that the information identification code is not recorded in the first decrypted image, the process may return to S502 to S505 and then proceed to S508 again.
[0237] If it is determined that the information identification code is recorded in the first decrypted image, S509 may be performed.
[0238] Step S509: using a code recognition module to recognize the first decrypted image to obtain recognition information.
[0239] The identification information may be a set of character strings, which are used to represent the link address.
[0240] When the first decrypted image is input into the code recognition module, the AO service may delete the first decrypted image. For example, when the identification information is obtained through identification, the AO service may delete the first decrypted image.
[0241] Recognizing the first decrypted image can be understood as recognizing the information identification code in the first decrypted image, thereby determining the identification information.
[0242] The identification information obtained by identifying the information identification code in the first decrypted image may also be referred to as target identification information.
[0243] Step S510 : determining a target application corresponding to a target key character in the identification information according to a correspondence between key characters and applications.
[0244] The AO service may determine, based on the identification information, whether the identification information contains the key characters recorded in the corresponding relationship between the key characters and the application.
[0245] If the key characters are not present in the identification information, the default application can be used as the target application. If the key characters are not present in the identification information, it can be determined that the interface corresponding to the link address indicated by the identification information is a preset interface recorded in the electronic device, and multiple applications can access the link address indicated by the identification information. Therefore, the default application can be used as the target application.
[0246] In the case that the target key characters exist in the identification information, the AO service may determine the target application corresponding to the target key characters according to the correspondence between the key characters and the application.
[0247] Step S511: Determine whether a target interface corresponding to the target application is recorded.
[0248] The AO service may determine, based on the correspondence between the application and the interface, whether the correspondence records a target interface corresponding to the target application.
[0249] The correspondence between applications and interfaces can also be expressed as the correspondence between keywords and interfaces.
[0250] The interface corresponding to the default application may be a preset interface recorded in the electronic device.
[0251] If the target interface corresponding to the target application is recorded in the correspondence between the application and the interface, that is, the electronic device has recorded the target interface corresponding to the target application, S512 can be performed. If the target application is not recorded in the correspondence between the application and the interface, that is, the electronic device has not recorded the target interface corresponding to the target application, S513 can be performed.
[0252] When there are no key characters in the identification information, the interface recorded in the electronic device is the target interface.
[0253] Step S512: According to the target interface, the target application is used to access the link address indicated by the identification information.
[0254] The AO service may send the identification information to the target application, so that the target application utilizes the target interface and the link address indicated by the target interface access identification information.
[0255] In some embodiments, the AO service can send identification information to the target application through the perception service and the forwarding of the code scanning application.
[0256] Step S513: Start the code scanning service of the target application.
[0257] The barcode scanning program of the target application is used to collect data using a camera to obtain a second pre-processed image.
[0258] The AO service can send a code scanning instruction to the target application. The code scanning instruction instructs the target application to start the code scanning service. In some embodiments, the AO service can send the code scanning instruction to the target application through forwarding by the perception service and the code scanning application. In other words, the AO service can send the code scanning operation information to the perception service, the perception service can forward the code scanning operation information to the code scanning application, and the code scanning application can forward the code scanning operation information to the perception service.
[0259] The target application sends second acquisition instruction information to the camera service according to the code scanning instruction information. The second acquisition instruction information is used to instruct the camera service to acquire an image.
[0260] The camera service information sends the second driver information to the system library based on the second acquisition instruction information. The system library can forward the second driver information to the camera driver of the kernel layer. The system library can initialize the second image preprocessing module based on the second driver information.
[0261] The camera driver may drive the camera to capture the second initial image according to the second driving information. For example, the second driving information may be used to instruct the camera driver to drive the rear camera so that the rear camera captures the second initial image.
[0262] The camera captures the second initial image and transmits it to the system library via the camera driver. The second image preprocessing module is used to preprocess the second initial image.
[0263] When the target application receives the code scanning instruction information, the target application can generate the following Figure 10 The electronic device may display the code scanning interface 1010 as shown. The code scanning interface 1010 includes a preview box 1011. The preview box 1011 may include the result output by the second image pre-processing module.
[0264] The first image preprocessing module and the second image preprocessing module may be the same or different modules. Compared with the first image preprocessing module, the second image preprocessing module may include more or fewer preprocessing nodes.
[0265] Exemplarily, the second image pre-processing module may include one or more nodes in IFE, IPE, distortion correction module, etc. The one or more nodes are arranged in series and process the image output by the previous node in sequence.
[0266] The first image preprocessing module and the second image preprocessing module can also be understood as an image pipeline.
[0267] The distortion correction module can be used to analyze and process the distortion of the image and restore it to a preset geometric shape. The preset geometric shape can be determined based on one or more common shapes of the information identification code.
[0268] The second image preprocessing module is used to preprocess the second initial image to obtain a second preprocessed image.
[0269] Step S514: decrypt the encrypted image to obtain a second decrypted image.
[0270] When the system library receives the second driving information, or when the second image pre-processing module processes the second initial image, the AO service may use the decryption module to decrypt the stored encrypted image to obtain a second decrypted image.
[0271] For example, when the second initial image is transmitted to a preset node, the AO service may use the decryption module to decrypt the stored encrypted image. The preset node may be any pre-processing node in the second image pre-processing module.
[0272] The AO service may send decryption instruction information to the decryption module, wherein the decryption instruction information is used to instruct the decryption module to decrypt the encrypted image to obtain a second decrypted image.
[0273] It should be understood that the target application may use the camera to capture multiple images before acquiring the image containing the information identification code. The second initial images captured by the camera are sequentially processed by the second image preprocessing model to obtain multiple second preprocessed images. These multiple second preprocessed images can be transmitted to the target application via the camera service.
[0274] The AO service may, upon detecting that the second image pre-processing module outputs the second pre-processed image, send decryption instruction information to the decryption module. The AO service may replace the second pre-processed image with the second decrypted image. Alternatively, the AO service may use the second decrypted image to replace the second pre-processed image output by the second image pre-processing module after the decryption module outputs the second decrypted image.
[0275] When the target application captures an image with the information identification code, it can send a stop message to the camera service. This stop message can instruct the camera service to stop capturing images. Based on the stop message, the camera service can control the camera driver to stop capturing the second initial image and instruct the system library to stop running the second image pre-processing module.
[0276] Step S515: Replace the second pre-processed image with the second decrypted image.
[0277] The AO service may replace the image input or output by any module in the second image pre-processing module with the second decrypted image. In other words, the image output by any node in the second image pre-processing module may be understood as the second pre-processed image. Alternatively, the AO service may replace the second initial image with the second decrypted image.
[0278] The second pre-processed image may be stored in the target storage unit. Replacing the second pre-processed image with the second decrypted image may be understood as deleting the second pre-processed image in the target storage unit and storing the second decrypted image in the target storage unit.
[0279] After replacing the second pre-processed image with the second decrypted image, the AO service may delete the second decrypted image in other storage units except the target storage unit.
[0280] Deleting the second decrypted image in a timely manner can prevent other applications from misappropriating the second decrypted image, thereby improving system security.
[0281] Step S516: Use the target application to identify the second decrypted image to access the link address indicated by the identification information recorded in the second decrypted image.
[0282] If the image output by the last node of the second image pre-processing module is replaced with the second decrypted image, the second decrypted image can be transmitted to the target application via the camera service.
[0283] If the image input by any node in the second image preprocessing module is replaced with the second decrypted image, the second decrypted image is processed by the node and subsequent nodes in the second image preprocessing module, and the resulting image can be transmitted to the target application through the camera service.
[0284] That is, the second decrypted image transmitted to the target application may be the second decrypted image output by the decryption module, or may be an image obtained after being fully or partially pre-processed by the second pre-processing module.
[0285] The target application identifies the received second decrypted image and can access the link address represented by the identification information recorded by the information identification code in the second decrypted image. For example, the target application can access the link address according to the interface recorded in the target application.
[0286] In progress Figure 5 During the execution of the method shown, the first initial image, the second initial image, the first pre-processed image, the second pre-processed image, and the second decrypted image are all data generated during the image processing process. After being transmitted to the next processing node, these data may be deleted.
[0287] The encrypted image will be used in all steps except step S505 and step S514. If the target application's code scanning service fails to process the replaced image, the target application's code scanning service may need to collect and pre-process the second initial image again, and the encrypted image may need to be decrypted again and stored in the target storage unit. Therefore, the time point when the encrypted image is deleted is Figure 5 The implementation of the image processing method shown has important implications. If the encrypted first recognition image is deleted prematurely, subsequent processing of the target application may not proceed normally.
[0288] When the target application obtains an image with an information identification code recorded thereon, or obtains identification information, the target application may close the code scanning service. When the target application closes the code scanning service, the target application may send a capture stop message to the camera service.
[0289] The camera service sends a stop acquisition message to the system library. Based on the stop acquisition message, the second image preprocessing module in the system library may no longer run. Based on the stop acquisition message, the system library may stop driving the camera driver, so that the camera no longer acquires images.
[0290] The system library can also delete the encrypted image based on the acquisition stop information.
[0291] The target application accesses the link address to obtain access information. Based on the access information, the target application can generate an access interface. The electronic device can display the access interface.
[0292] Taking the payment scenario as an example, after S516, the target application can generate the following information based on the access information: Figure 11 Access interface 1020 is shown.
[0293] Through the image processing method provided in the embodiment of the present application, the electronic device collects images based on the user's code scanning operation and identifies the target application corresponding to the information identification code in the image. By opening the code scanning service of the application and transmitting the collected image to the image preprocessing module used by the code scanning service, the target application can perform subsequent processing based on the image collected according to the user's code scanning operation. In other words, the subsequent processing of the target application no longer depends on the image collected by the code scanning service, so that in the process of image collection by the code scanning service, the camera does not have to face the scene where the information identification code is located, which reduces the requirements for user operation and improves the user experience.
[0294] In particular, when the front camera is used to capture images based on the user's scanning operation, the target application's scanning service generally uses the rear camera to capture images. That is to say, after the front camera captures the scene where the information identification code is located, the rear camera is not facing the scene where the information identification code is located. If the target application's scanning service performs subsequent processing based on the image captured by the scanning service, the user is required to adjust the orientation of the electronic device so that the direction of the electronic device is adjusted from the front camera facing the scene where the target information identification code is located to the rear camera facing the scene where the target information identification code is located. The user operation is complicated and takes time, resulting in a longer overall image processing time. The electronic device cannot enable the target application to directly access the link address represented by the image in one step based on the image captured by the front camera.
[0295] The image captured by the front camera replaces the image captured by the rear camera used by the scanning service, so that the user does not need to adjust the direction of the electronic device during the image processing so that the rear camera faces the scene where the target information identification code is located. The scanning service of the target application can perform subsequent processing based on the image captured by the front camera, so that the target application can access the link address represented by the identification information carried by the target information identification code. The user operation is simpler, the user experience is improved, and the time required for the target application to obtain the image recorded with the information identification code is shortened, thereby improving image processing efficiency.
[0296] Based on the log of the electronic device, it can be determined whether the electronic device has executed the application Figure 4 or Figure 5 The image processing method shown.
[0297] It should be understood that the above examples are intended to help those skilled in the art understand the embodiments of the present application, and are not intended to limit the embodiments of the present application to the specific numerical values or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or variations based on the above examples, and such modifications or variations also fall within the scope of the embodiments of the present application.
[0298] Combined with the above Figures 1 to 11 The image processing method of the embodiment of the present application is described in detail. Figure 12 , describing the device embodiments of the present application in detail. It should be understood that the image processing device in the embodiments of the present application can execute the various image processing methods in the aforementioned embodiments of the present application, that is, the specific working processes of the following various products can refer to the corresponding processes in the aforementioned method embodiments.
[0299] Figure 12 Schematic diagram of an image processing device provided in an embodiment of the present application.
[0300] It should be understood that the image processing apparatus 1200 may execute Figure 5 The image processing method shown.
[0301] The image processing apparatus 1200 includes an acquiring unit 1210 and a processing unit 1220 .
[0302] The acquiring unit 1210 is configured to acquire a first recognition image.
[0303] The processing unit 1220 is used to start the scanning service of the target application, where the target application is the application corresponding to the target information identification code in the first identification image. The scanning service of the target application is used to collect the second identification image, store the second identification image in the target storage unit, and identify the information identification code in the image stored in the target storage unit.
[0304] The processing unit 1220 is further configured to store the first recognition image in the target storage unit.
[0305] Optionally, the processing unit 1220 is specifically configured to replace the second recognition image in the target storage unit with the first recognition image.
[0306] Optionally, the image processing device 1200 is located in an electronic device.
[0307] The acquisition unit 1210 is specifically configured to, in response to a code scanning operation by a user, capture an image using the first camera of the electronic device to obtain the first recognition image.
[0308] The processing unit 1220 is further configured to identify the first recognition image to determine the target application.
[0309] The second recognition image is captured by a second camera of the electronic device, and a direction of the first camera is different from a direction of the second camera.
[0310] Optionally, the code scanning service of the target application is used to pre-process the collected initial image to obtain the second recognition image.
[0311] Optionally, the first identification image is an encrypted image.
[0312] The processing unit 1220 is specifically configured to decrypt the first recognition image and store the decrypted first recognition image in the target storage unit.
[0313] Optionally, the processing unit 1220 is specifically configured to decrypt the first recognition image in response to the acquisition of the second recognition image.
[0314] Optionally, the acquisition unit 1210 is specifically configured to capture a first initial recognition image in response to a code scanning operation by a user.
[0315] The acquiring unit 1210 is further configured to encrypt the first initial recognition image to obtain the first recognition image.
[0316] The processing unit 1220 is specifically configured to decrypt the first identification image and identify the decrypted first identification image to determine a target application corresponding to the target information identification code.
[0317] The processing unit 1220 is further configured to decrypt the first recognition image again and store the decrypted first recognition image in the target storage unit.
[0318] Optionally, the acquisition unit 1210 is specifically configured to acquire the first recognition image according to a code scanning operation of the user.
[0319] The processing unit 1220 is further configured to delete the first recognition image when the code scanning service of the target application is closed.
[0320] It should be noted that the image processing device 1200 is implemented in the form of a functional unit. The term "unit" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.
[0321] For example, a "unit" may be a software program, a hardware circuit, or a combination of the two that implements the aforementioned functionality. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (e.g., a shared processor, a dedicated processor, or a group of processors) and memory for executing one or more software or firmware programs, combined logic circuits, and / or other suitable components that support the described functionality.
[0322] Therefore, the units of each example described in the embodiments of this application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0323] The present application provides a chip including one or more processors, which can implement the image processing method in the method embodiment.
[0324] A processor can be a general-purpose processor or a special-purpose processor. For example, a processor can be a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices such as discrete gates, transistor logic devices, or discrete hardware components.
[0325] The processor can be used to control the chip, execute software programs, and process data of the software programs.
[0326] The chip may also include a communication unit for implementing signal input (reception) and output (transmission). The communication unit may be the input and / or output circuit of the chip, or the communication unit 1205 may be the communication interface of the chip. The chip may be used as a component of a terminal device or other electronic device.
[0327] The chip may include one or more memories on which programs are stored. The programs can be executed by a processor to generate instructions, so that the processor executes the image processing method described in the above method embodiment according to the instructions.
[0328] Optionally, data may be stored in the memory. Optionally, the processor may read data stored in the memory, which may be stored at the same storage address as the program or at a different storage address than the program.
[0329] The processor and memory may be provided separately or integrated together; for example, they may be integrated into a system on chip (SOC) of an electronic device.
[0330] Exemplarily, the memory can be used to store the relevant programs of the image processing method provided in the embodiments of the present application, and the processor can be used to call the relevant programs of the image processing method stored in the memory to execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. For example, the code scanning service of the target application is started, the target application is the application corresponding to the target information identification code in the first recognition image, the code scanning service of the target application is used to collect the second recognition image, store the second recognition image in the target storage unit, and recognize the information identification code in the image stored in the target storage unit; the first recognition image is stored in the target storage unit.
[0331] The chip can be provided in an electronic device.
[0332] The processor executing each step in the above-mentioned image processing method can also be understood as the processor using other elements or components in the electronic device to execute each step. For example, the processor capturing an image can be understood as the processor using a camera in the electronic device to capture an image.
[0333] The present application also provides a computer program product, which, when executed by a processor, implements the image processing method described in any method embodiment of the present application.
[0334] The computer program product may be stored in a memory. The computer program product may be, for example, a program that is converted into an executable target file that can be executed by a processor after undergoing processes such as preprocessing, compiling, assembling, and linking.
[0335] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer, implements the image processing method described in any method embodiment of the present application. The computer program can be a high-level language program or an executable target program.
[0336] The computer-readable storage medium is, for example, a memory. Exemplarily, the computer-readable storage medium may be an internal memory of the electronic device 100. The memory may be a volatile memory or a non-volatile memory, or the memory may include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0337] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image processing method described in any method embodiment of the present application. The computer program can be a high-level language program or an executable target program.
[0338] In the description of this application, the terms "first," "second," etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, or a specific order or precedence. Those skilled in the art will understand the specific meanings of the above terms in this application based on the specific circumstances.
[0339] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items.
[0340] The term "and / or" in this document simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. A and B can be singular or plural. Furthermore, the character " / " in this document generally indicates an "or" relationship between the related objects, but it can also indicate an "and / or" relationship. Please refer to the context for specific understanding.
[0341] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0342] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0343] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0344] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for example, the division of the units is merely a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection of some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0345] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0346] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0347] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. An image processing method, characterized in that: Applied to an electronic device, the electronic device includes a front camera and a rear camera, and the method includes: When the electronic device is in an unlocked state, receiving a wrist-flip operation by a user; In response to the wrist-flipping operation, capturing an image through the front camera to obtain a first initial image; Preprocessing the first initial image to obtain a first recognition image; Identifying the target information identification code of the first identification image to obtain identification information; Determine the target application corresponding to the identification information and enable the code scanning service of the target application; In response to starting the code scanning service, capturing an image through the rear camera to obtain a second initial image; preprocessing the second initial image to obtain a second recognition image, and storing the second recognition image in a target storage unit; replacing the second recognition image stored in the target storage unit with the first recognition image; Recognizing the first recognition image stored in the target storage unit through the code scanning service to obtain the recognition information; The link address indicated by the identification information is accessed through the target application.
2. The method according to claim 1, characterized in that The method further comprises: encrypting the first recognition image to obtain an encrypted first recognition image, and deleting the first recognition image; The replacing the second identification image stored in the target storage unit with the first identification image includes: decrypting the encrypted first identification image, and replacing the second identification image stored in the target storage unit with the decrypted first identification image.
3. The method according to claim 2, characterized in that The decrypting the encrypted first identification image includes: decrypting the encrypted first identification image in response to the acquisition of the second identification image.
4. The method according to claim 2 or 3, characterized in that The identifying the target information identification code of the first identification image to obtain identification information includes: decrypting the encrypted first identification image and identifying the decrypted first identification image to obtain identification information; Decrypting the encrypted first identification image and replacing the second identification image stored in the target storage unit with the decrypted first identification image includes: decrypting the encrypted first identification image again and replacing the second identification image stored in the target storage unit with the decrypted first identification image again.
5. The method according to any one of claims 1 to 3, characterized in that The method further comprises: When the code scanning service of the target application is closed, the first recognition image is deleted.
6. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the electronic device executes the method according to any one of claims 1 to 5.
7. A chip, characterized in that: The method comprises a processor, and when the processor executes instructions, the method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Starting method for payment application and mobile terminal
CN106327185A
Image antitheft chain method and device and electronic equipment
CN107302706A
Information identification code scanning method and device
CN109992176A
Code scanning interface display method and device, mobile terminal and storage medium
CN112613475A