Method and device for processing image data and related product
By adopting the separate design of bare core code and operating system in electronic devices, the problem of large power consumption and poor user experience when the equipment is balanced with timely response and long-term standby is solved, and the equipment is promptly responded and energy saving in shutdown.
Patent Information
- Application Number
- CN202510088300.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-05-23
AI Technical Summary
When existing electronic devices achieve a balance between timely response and long-term standby, they face the problems of large power consumption and poor user experience. Especially when it is necessary to maintain a long-term working state, traditional solutions such as increasing battery energy density and improving program algorithms have not fundamentally alleviated this contradiction.
By introducing the separate design of bare core code and operating system in the device, the bare core code runs on the first processor, and the operating system runs on the second processor, and the bare core code is responsible for quickly collecting and saving image data. The operating system takes over data processing after completing initialization, realizing the separation of acquisition and processing, reducing user waiting time, and stopping the work of bare core code and the first processor when unnecessary to save energy.
It realizes the timely response of the device to user operations in the shutdown state, and at the same time, it maintains the shutdown state in normal times to save energy, improving the overall power consumption and user experience of the device.
Smart Images

Figure CN120029960A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of energy management technology. More specifically, the present disclosure relates to a device for processing image data. Background Art
[0002] With the development of technology, electronic devices are becoming more and more portable and more powerful. However, at the same time, due to weight and volume restrictions, the batteries of such electronic devices are also severely limited, and due to the enhancement of functions, the power consumption of electronic devices in the working state will inevitably increase significantly. At the same time, such electronic devices are also required to be able to respond to user needs in a timely manner. For example, a dictionary pen needs to be able to scan as soon as the pen is picked up, that is, when the user wants to query a word in a book, the dictionary pen can complete the image acquisition, text recognition and text translation of the word to be translated without the user having to wait for a long time. However, it takes a long time for electronic devices to start from shutdown to working state, and the user experience is poor, which requires the dictionary pen to maintain a working state for a long time. Taking a 1500mah battery as an example, the current of a traditional dictionary pen in the working state is about 200ma. If it is always in the working state, the battery can only standby for 7.5 hours with a full charge. Here comes the contradiction between timely response and long standby time.
[0003] Common solutions to this contradiction are to increase battery energy density, use hardware with lower power consumption, and improve program algorithms. However, the improvements of these methods are relatively limited and do not fundamentally alleviate this contradiction. In actual applications, users still need to charge frequently.
[0004] In view of this, there is an urgent need to provide a technical solution for managing the status of a device so as to reduce the overall power consumption of the device and achieve timely response to user needs, such as realizing the "pick-up-and-scan" function of a dictionary pen, and ultimately achieving a balance between timely response and long standby time. Summary of the invention
[0005] In order to at least solve one or more of the technical problems mentioned above, the present disclosure proposes a method, device and technical solutions of related products for processing image data in multiple aspects.
[0006] In a first aspect, the present disclosure provides a method for processing image data for a device, wherein the device includes a camera, and the method includes: in response to detecting a power-on signal of the device, starting a bare core code in a first processor and an operating system in a second processor, wherein a startup speed of the bare core code is faster than a startup speed of the operating system, and after the operating system is started, the bare core code ends its work; after the bare core code is started, controlling the camera to collect image data through the bare core code, and saving the image data to a memory; after the operating system is started, the operating system communicates with the bare core code, and obtains the image data from the memory through the operating system.
[0007] In some embodiments, the device also includes a sensor. After the bare core code is started, controlling the camera to collect image data through the bare core code includes: initializing the camera through the bare core code after the bare core code is started; in response to the bare core code detecting a sensing signal of the sensor, controlling the initialized camera to collect image data through the bare core code.
[0008] In some embodiments, after the operating system is started, the operating system communicates with the bare core code so that the operating system obtains the image data from the memory, including: after the operating system is started, the image processing application is initialized by the operating system; the operating system sends a work end notification to the bare core code; upon receiving a confirmation notification based on the feedback of the work end notification, the operating system takes over the camera from the bare core code and obtains the image data from the memory.
[0009] In a second aspect, the present disclosure provides an apparatus for processing image data of a device, the device including a camera, and the apparatus including: a startup module, a collection module and an acquisition module; the startup module is configured to simultaneously start a bare core code in a first processor and an operating system in a second processor in response to detecting a power-on signal of the device, wherein the startup speed of the bare core code is faster than the startup speed of the operating system, and after the operating system is started, the bare core code ends its work; the acquisition module is configured to control the camera to collect image data through the bare core code after the bare core code is started, and save the image data to a memory; the acquisition module is configured to communicate with the bare core code after the operating system is started, and acquire the image data from the memory through the operating system.
[0010] In a third aspect, the present disclosure provides an electronic device, comprising: a processor; and a memory, which stores program instructions for the device to process image data, and when the program instructions are executed by the processor, the electronic device executes the method described in any one of the embodiments of the present disclosure.
[0011] In a fourth aspect, the present disclosure provides a computer-readable storage medium storing program instructions for a device to process image data, and when the program instructions are executed by a processor, the method described in any one of the embodiments of the present disclosure is implemented.
[0012] Through the method for processing image data for a device as provided above, the disclosed embodiment uses bare core code and an operating system, wherein the bare core code runs on a first processor and the operating system runs on a second processor, thereby realizing the separation of the functions of collecting image data and text recognition and text translation, so that the former can complete initialization faster, and the latter is also initialized while the former is initialized, thereby reducing the user's waiting time, so that the device can respond to user operations in a timely manner when it is in a shutdown state, and therefore can be kept in a shutdown state at ordinary times to save energy; by saving the image data to the memory through the bare core code and the operating system obtaining the image data from the memory, it is possible to realize the reading and writing operations of the image data from two different processors at the same time, thereby improving the data transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] By reading the detailed description below with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0014] Figure 1 An exemplary flow chart showing a method for processing image data for a device according to an embodiment of the present disclosure;
[0015] Figure 2 An exemplary flow chart showing a method for controlling a camera to collect image data using bare core code according to an embodiment of the present disclosure;
[0016] Figure 3 An exemplary flow chart showing a method for an operating system to communicate and acquire image data according to an embodiment of the present disclosure;
[0017] Figure 4 An exemplary flow chart showing a method for processing image data for a device according to some other embodiments of the present disclosure;
[0018] Figure 5An exemplary structural block diagram of an apparatus for processing image data in a device according to an embodiment of the present disclosure is shown;
[0019] Figure 6 An exemplary structural block diagram of an electronic device for processing image data according to an execution device of an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0021] It should be understood that the terms "include" and "comprising" used in the specification and claims of the present disclosure indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0022] It should also be understood that the terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. As used in this disclosure and claims, the singular forms of "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in this disclosure and claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations.
[0023] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0024] The specific implementation of the present disclosure is described in detail below with reference to the accompanying drawings.
[0025] In the present disclosure, by designing a device based on a mutually separated operating system and bare core code, a balance between timely response and long standby time of the device can be achieved.
[0026] Generally, programs run on the operating system, and the programs interact with the underlying hardware through the operating system. The operating system can provide system services and resource management functions for programs running on the operating system, such as time services, memory management, and IO management, and it is convenient for program developers to implement complex business logic. However, the operating system occupies a lot of resources and needs a long time of initialization before it can enter the working state. At this time, the programs running on the operating system can run.
[0027] The bare core code does not require an operating system and can run directly on the hardware. Its functions are relatively simple, it takes up few resources, takes little initialization time, and can quickly enter the working state. Due to this feature, the bare core code can run certain functions that require quick startup and timely response. For example, the function of collecting image data in the "pick up and scan" function of the dictionary pen. Generally speaking, when a user uses a dictionary pen in a closed state to shoot an image containing text to be translated, the process of shooting the image to collect image data should respond in time, and this part of the function can run on the bare core code; and the subsequent text recognition and text translation functions, the user has expected that it will take a certain amount of time, so this part of the function can appropriately extend the response time, so this part can run on the operating system.
[0028] When the operating system is initialized, the device has two working processors, and the processor is the main energy-consuming electronic device of the device. In order to further reduce the overall power consumption of the device, the application on the operating system can also have related applications for controlling the camera. When the operating system is initialized, a certain mechanism can be used to stop the bare core code and the processor it runs on to reduce energy consumption.
[0029] Figure 1 An exemplary flow chart of a method for processing image data for a device according to an embodiment of the present disclosure is shown.
[0030] like Figure 1 As shown, a method for processing image data for a device, the device includes a camera, and the method includes: in response to detecting a power-on signal of the device, simultaneously starting a bare core code in a first processor and an operating system in a second processor, wherein the bare core code starts faster than the operating system, and after the operating system starts, the bare core code ends its work; after the bare core code starts, the camera is controlled by the bare core code to collect image data, and the image data is saved to a memory; after the operating system starts, the operating system communicates with the bare core code, and obtains the image data from the memory through the operating system.
[0031] Specifically, the device includes one or more cameras, which can be used to collect image data.
[0032] The method 100 for processing image data for a device according to the embodiment of the present disclosure includes the following steps:
[0033] Step S110, in response to detecting a power-on signal of the device, simultaneously starting the bare core code in the first processor and the operating system in the second processor.
[0034] The user can trigger the power on through the button of the device. The button can be a button with a single function or a button with multiple functions. The function of the button is determined by the time the button is pressed. For electronic devices, it is preferred to trigger the power on through a button with multiple functions. When the button is pressed for a long time (such as 2 seconds), the EC chip (Embedded Controller) of the device and the port connected to the button will change in high and low levels due to the pressing of the button. When the EC chip determines that the level change reaches the preset value (for example, the low level time caused by pressing the button reaches the threshold of 2 seconds, and it is currently in the off state), the level change caused by pressing the button can trigger the EC chip to start. If the EC chip can work normally, the EC chip can send a power on signal to the chipset of the device and start each power supply circuit.
[0035] The device includes at least two processors, a first processor and a second processor. The bare core code can run on the first processor, and the operating system can run on the second processor. Since the number of functions and the storage size of the bare core code are smaller than those of the operating system, the startup speed of the bare core code is faster than the startup speed of the operating system. Therefore, when the bare core code and the operating system are started at the same time, if both the bare core code and the operating system can successfully complete the startup, the bare core code completes the startup before the operating system. The choice of operating system is not limited, and it can be a desktop operating system, a mobile terminal operating system, a server operating system, or an embedded operating system. The choice of the first processor and the second processor is not limited, and the architecture of the processor can be x86, ARM, MIPS, Power-PC, and Rsic-V.
[0036] When the power-on signal of the device is detected, the device starts to start, and at the same time starts the bare core code running on the first processor and the operating system running on the second processor. The bare core code will complete the startup before the operating system. After the operating system is started, the application of the operating system can be initialized. The application can be a program running on the operating system, such as an image processing application. After the application is initialized, it can perform specific tasks, such as the image processing application can perform image processing tasks on image data.
[0037] After the operating system is started, the bare core code ends its work. At this time, the operating system running on the second processor continues to work, and the first processor can stop working to save energy.
[0038] Step S120, after the bare core code is started, the bare core code is used to control the camera to collect image data and save the image data to the memory.
[0039] After the bare core code is started, the bare core code is used to control the camera to capture images containing text to be translated to collect image data. For the dictionary pen, images containing text to be translated can be captured to collect image data. After capturing, the captured image data can be saved in the memory using the data structure of the ring buffer. The ring buffer can improve the utilization of memory space by recycling the memory space. The ring buffer can include a read pointer and a write pointer, which respectively indicate the starting position of the most recently read image data and the starting position of the most recently written image data. The read pointer and the write pointer realize the separation of reading and writing of image data. When there is only one read pointer and one write pointer, it is possible to avoid locking the read and write operations, thereby improving the efficiency of the read and write operations.
[0040] Step S130, after the operating system is started, the operating system communicates with the bare core code, and the image data is obtained from the memory through the operating system.
[0041] The startup speed of the bare core code is faster than that of the operating system. Therefore, after the operating system is started, since the bare core code has also been started, the operating system can communicate with the bare core code, thereby obtaining relevant information of the image data saved to the memory by the bare core code, such as the starting address of the image data and the size of the image data, so that the operating system can obtain the image data from the memory.
[0042] In addition, by saving the image data to the memory through the bare core code and the operating system obtaining the image data from the memory, it is possible to simultaneously perform image data reading and writing operations from two different processors, thereby improving data transmission efficiency.
[0043] Figure 2 An exemplary flow chart of a method for controlling a camera to collect image data using bare core code according to an embodiment of the present disclosure is shown.
[0044] like Figure 2 As shown, in some embodiments, the device also includes a sensor, wherein, after the bare core code is started, controlling the camera to collect image data through the bare core code includes: after the bare core code is started, initializing the camera through the bare core code; in response to the bare core code detecting a sensing signal of the sensor, controlling the initialized camera to collect image data through the bare core code.
[0045] Specifically, the method 200 of the bare core code controlling the camera to collect image data in the disclosed embodiment includes the following steps:
[0046] Step S210, after the bare core code is started, the camera is initialized by the bare core code.
[0047] After the bare core code is started, the bare core code can interact with the camera and the pen tip for data. At this point, the camera can be initialized to put it in working state for subsequent image data collection. Initializing the camera includes hardware initialization and software initialization.
[0048] Step S220, in response to the bare core code detecting the sensing signal of the sensor, the bare core code controls the initialized camera to collect image data.
[0049] After the camera is initialized, the bare core code can detect the sensor's sensing signal. Taking the pen-lifting and scanning function of the dictionary pen as an example, when a word on a book needs to be translated, the user may hold the grip of the dictionary pen, and the pressure sensor of the grip is in a pressed state. At this time, the pressure sensor of the grip generates a sensing signal in a pressed state. Alternatively, the user may bring the pen tip close to the book, and the distance sensor on the pen tip senses a distance less than a threshold, generating a sensing signal reaching a specific distance. Alternatively, the user may click a micro switch, and the micro switch sensing signal is generated by pressing the micro switch. Here, the sensor and its sensing signal are not restricted.
[0050] The device responds to the sensing signal, and the bare core code controls the initialized camera to shoot the image, thereby collecting image data. The collected image data will be saved in the memory. The image data can be saved in common image file formats, such as tif format, gif format, jpg format, png format, bayer RAW format, YUYV format, etc. In this embodiment, the format of the image data is bayer RAW format or YUYV format. When shooting images, the camera can have auxiliary shooting functions, such as autofocus function and white balance function, which can improve the clarity of the captured image when collecting images, thereby improving the quality of the collected image data.
[0051] Figure 3 An exemplary flow chart showing a method for an operating system to communicate and acquire image data according to an embodiment of the present disclosure.
[0052] like Figure 3As shown, in some embodiments, after the operating system is started, the operating system communicates with the bare core code so that the operating system obtains image data from the memory, including: after the operating system is started, the image processing application is initialized by the operating system; the operating system sends a work end notification to the bare core code; when receiving a confirmation notification based on the feedback of the work end notification, the operating system takes over the camera from the bare core code and obtains image data from the memory.
[0053] Specifically, the method 300 for the operating system to communicate and obtain image data according to the embodiment of the present disclosure includes the following steps:
[0054] Step S310: after the operating system is started, the image processing application is initialized through the operating system.
[0055] After the operating system is started, the image processing application that can run on the operating system is initialized, including but not limited to allocating memory space for the image processing application, creating an application context (Context), reading resources from the disk, obtaining the initialized image processing application, and putting the image processing application in a working state.
[0056] Image processing applications can be used to process image data, including text recognition and text translation. Image processing applications can implement their functions as a single application, or they can implement their functions through a batch program that executes multiple applications in a certain order. The batch program can be a bat script or a shell script.
[0057] Step S320: The operating system sends a work completion notification to the bare core code.
[0058] Since the operating system is initialized later than the bare core code, the bare core code has already been initialized after the operating system is initialized. After both the bare core code and the operating system are initialized, the operating system can try to establish communication with the bare core code. The operating system can send a work end notification to the bare core code and wait for feedback from the bare core code. The bare core code and the operating system can transmit data through shared memory and mailbox.
[0059] The end-of-work notification is used to notify the bare core code to end the control of the camera of the device and stop the bare core code and the first processor on which the bare core code runs. After stopping the work, the first processor can be powered off to save energy.
[0060] Step S330, when receiving a confirmation notification based on the feedback of the work completion notification, the operating system takes over the camera from the bare core code and obtains the image data from the memory.
[0061] After the bare core code receives the end-of-work notification sent by the operating system, the bare core code ends the control of the device's camera and sends a confirmation notification to the operating system as feedback of the end-of-work notification, so that the operating system knows that the bare core code has ended the control of the device's camera. At this point, the operating system starts to control the device's camera and determines whether there is image data in the memory that has not been read by the operating system. And obtains the image data from the memory.
[0062] When there is image data in the memory that has not been read by the operating system, it means that at least one image data generated by the image captured by the camera under the control of the bare core code in the memory has not been processed by the operating system, and the operating system can read the image data in subsequent operations. When there is no image data in the memory that has not been read by the operating system, it means that the image data generated by the image captured by all the cameras under the control of the bare core code in the memory have been processed by the operating system.
[0063] In some embodiments, the operating system takes over the camera from the bare core code, including: the operating system detects in real time whether the sensor generates a sensing signal; when the operating system detects the sensing signal of the sensor, the operating system controls the initialized camera to collect image data.
[0064] Specifically, after the operating system takes over the camera from the bare core code, it performs operations on the camera similar to those of the bare core code. Due to the effects of step S320 and step S330, the operating system now controls the camera instead of the bare core code, captures the image, and collects image data.
[0065] First, the operating system detects in real time whether the sensor generates a sensing signal.
[0066] After the operating system takes over the camera from the bare core code, the operating system can detect the sensing signal of the sensor. Taking the pen-lifting and scanning function of the dictionary pen as an example, when a word on a book needs to be translated, the user may hold the grip of the dictionary pen, and the pressure sensor of the grip is in a pressed state. At this time, the pressure sensor of the grip generates a sensing signal in a pressed state. Alternatively, the user may bring the pen tip close to the book, and the distance sensor on the pen tip senses a distance less than a threshold, generating a sensing signal reaching a specific distance. Alternatively, the user may click a micro switch, and a sensing signal of the micro switch is generated by pressing the micro switch. Here, the sensor and its sensing signal are not restricted.
[0067] Then, when the operating system detects the sensing signal of the sensor, the operating system controls the initialized camera to collect image data.
[0068] In response to the sensing signal, the operating system of the device controls the initialized camera to shoot an image, thereby collecting image data, and the collected image data will be stored in the memory.
[0069] In short, after the device is started, when the bare core code completes initialization and the operating system has not yet completed initialization, the camera is controlled to capture images through the bare core code, and when the operating system completes initialization, the camera is controlled to capture images through the operating system.
[0070] Figure 4 An exemplary flow chart of a method for processing image data for a device according to some other embodiments of the present disclosure is shown.
[0071] like Figure 4 As shown, in some embodiments, after the operating system obtains the image data from the memory, the method further includes: performing text recognition and text translation on the image data using an image processing application through the operating system to obtain a translation result; and outputting the translation result in a visual or audible manner through the operating system.
[0072] Specifically, the method 400 for processing image data for a device according to the embodiment of the present disclosure further includes the following steps:
[0073] Step S410: Using an image processing application through the operating system to perform text recognition and text translation on the image data to obtain a translation result.
[0074] The image processing application running on the operating system can perform text recognition and text translation on the image data read from the memory.
[0075] The technology of acquiring image data and performing text recognition to convert printed or handwritten text into machine-readable text is generally called optical character recognition (OCR). The core of OCR technology is to extract text from images and convert it into data that can be processed by computers through image processing and pattern recognition technology.
[0076] As for the background technology of the present disclosure, the dictionary pen collects images containing text to be translated through a camera, obtains the text to be translated, and translates the text. Here, the translation may include translation between different languages, such as translation between Chinese and English, translation between Chinese and Japanese, translation between Chinese and Korean, and translation between the same language, such as translation between simplified Chinese and traditional Chinese.
[0077] The text to be translated can be translated through the built-in translation model of the device to obtain the translation result, or it can be uploaded to the server and then the translation result can be obtained from the server. The translation result can be stored in the device in a digital form.
[0078] Step S420: Output the translation result in a visual or audible manner through the operating system.
[0079] After the translation result is obtained, it can be output to the user in a visual or audible manner to inform the user of the translation result, such as displaying the text of the translation result on an LED screen or playing the sound of the translation result through a speaker.
[0080] In some embodiments, the power-on signal is generated by a pen switch of the device.
[0081] Specifically, the pen tip of the device is provided with a pen tip switch, for example, a button or a micro switch. The pen tip switch can generate a power-on signal. When the device is in the off state, by clicking the pen tip switch, a power-on signal is generated, so that the bare core code and the operating system are started at the same time.
[0082] Figure 5 An exemplary structural block diagram of an apparatus for processing image data in a device according to an embodiment of the present disclosure is shown.
[0083] like Figure 5 As shown, a device for processing image data of a device, the device includes a camera, and the device includes: a startup module, a collection module and an acquisition module; the startup module is configured to respond to detecting a power-on signal of the device, and simultaneously start the bare core code in the first processor and the operating system in the second processor, wherein the startup speed of the bare core code is faster than the startup speed of the operating system, and after the operating system startup is completed, the bare core code ends its work; the acquisition module is configured to control the camera to collect image data through the bare core code after the bare core code startup is completed, and save the image data to the memory; the acquisition module is configured to communicate with the bare core code after the operating system startup is completed, and obtain the image data from the memory through the operating system.
[0084] Specifically, the device includes one or more cameras, which can be used to collect image data.
[0085] An apparatus 500 for processing image data of a device may include: a start module 510, a collection module 520 and an acquisition module 530. The apparatus 500 may be arranged in a device such as a dictionary pen, and is used to process image data of the device.
[0086] The startup module 510 can be used to start the bare core code in the first processor and the operating system in the second processor simultaneously in response to detecting a power-on signal of the device, wherein the startup speed of the bare core code is faster than the startup speed of the operating system. After the operating system startup is completed, the bare core code ends its work.
[0087] The device includes at least two processors, a first processor and a second processor. The bare core code can run on the first processor, and the operating system can run on the second processor. Since the number of functions and the storage size of the bare core code are smaller than those of the operating system, the startup speed of the bare core code is faster than the startup speed of the operating system. Therefore, when the bare core code and the operating system are started at the same time, if both the bare core code and the operating system can successfully complete the startup, the bare core code completes the startup before the operating system. The choice of operating system is not limited, and it can be a desktop operating system, a mobile terminal operating system, a server operating system, or an embedded operating system. The choice of the first processor and the second processor is not limited, and it can be an x86 architecture processor or an ARM architecture processor.
[0088] When the power-on signal of the device is detected, the device starts to start, and the startup module 510 starts the bare core code running on the first processor and the operating system running on the second processor at the same time. The bare core code will complete the startup before the operating system. After the operating system is started, the application of the operating system can be initialized. The application can be a program running on the operating system, such as an image processing application. After completing the initialization, the application can perform a specific task, such as the image processing application can perform an image processing task on the image data.
[0089] After the operating system is started, the bare core code ends its work. At this time, the operating system running on the second processor continues to work, and the first processor can stop working to save energy.
[0090] The acquisition module 520 can be used to control the camera to acquire image data through the bare core code after the bare core code is started, and save the image data to the memory.
[0091] After the bare core code is started, the acquisition module 520 controls the camera through the bare core code to capture images containing the text to be translated to collect image data. For the dictionary pen, an image containing the text to be translated can be captured to collect image data. After capturing, the acquisition module 520 can save the captured image data in the memory using the data structure of the ring buffer.
[0092] The acquisition module 530 may be used to communicate between the operating system and the bare core code after the operating system is started, and to acquire the image data from the memory through the operating system.
[0093] The startup speed of the bare core code is faster than that of the operating system. Therefore, after the operating system is started, since the bare core code has also been started, the operating system can communicate with the bare core code, so that the acquisition module 530 can obtain relevant information of the image data saved to the memory by the bare core code, such as the starting address of the image data and the size of the image data, so that the operating system can obtain the image data from the memory.
[0094] Figure 6 An exemplary structural block diagram of an electronic device for processing image data according to an execution device of an embodiment of the present disclosure is shown.
[0095] like Figure 6 As shown, an electronic device includes: a processor; and a memory storing program instructions for the device to process image data. When the program instructions are executed by the processor, the electronic device executes any one of the methods according to the embodiments of the present disclosure.
[0096] Specifically, the electronic device 600 can be implemented as various types of devices, including but not limited to mainframes, personal computers (PCs), mobile devices, etc. The electronic device 600 includes a processor 610 and a memory 620. The processor 610 controls the operation of the electronic device 600 by executing program instructions stored in the memory 620. The processor 610 can be implemented using, including but not limited to, a central processing unit (CPU), a graphics processing unit (GPU), an application processor (AP), an artificial intelligence processor chip (IPU), etc. The memory 620 can be used to store various data and instructions processed in the electronic device 600, including a method for processing image data for the device in the embodiment of the present disclosure. The memory 620 may include at least one of a volatile memory or a non-volatile memory. The non-volatile memory may include a read-only memory (ROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), etc. The volatile memory may include a dynamic RAM (DRAM), a static RAM (SRAM), a synchronous DRAM (SDRAM), etc. In addition, the memory 620 may also include at least one of a hard disk drive (HDD), a solid state drive (SSD), a high-density flash memory (CF), a secure digital (SD) card, a micro secure digital (Micro-SD) card, a mini secure digital (Mini-SD) card, an extreme digital (xD) card, a cache, or a memory stick.
[0097] A computer-readable storage medium stores program instructions for processing image data for a device. When the program instructions are executed by a processor, any method according to the embodiments of the present disclosure is implemented.
[0098] Specifically, in order to solve the above technical problems, the present embodiment further provides a readable storage medium, on which program instructions are stored. When the program instructions are executed, the above method for processing image data for a device is executed. Other details of the readable storage medium, such as circuit structure, reading method, working principle, encoding method, etc., can be set by those skilled in the art according to common knowledge, and will not be described in detail here. Since the above readable storage medium stores program instructions capable of executing the above-mentioned method for processing image data for a device, it can also solve the problem of the difficulty in balancing timely response and long standby in the prior art.
[0099] Through the method for processing image data for a device as provided above, the disclosed embodiment uses bare core code and an operating system, wherein the bare core code runs on a first processor and the operating system runs on a second processor, thereby realizing the separation of the functions of collecting image data and text recognition and text translation, so that the former can complete initialization faster, and the latter is also initialized while the former is initialized, thereby reducing the user's waiting time, so that the device can respond to user operations in a timely manner when it is in a shutdown state, and therefore can be kept in a shutdown state at ordinary times to save energy; by saving image data to memory through bare core code, and the operating system obtaining image data from the memory, it is possible to realize the reading and writing operations of image data from two different processors at the same time, thereby improving data transmission efficiency; by taking over the camera from the bare core code after the operating system is initialized, and stopping the operation of the bare core code and the first processor, it is possible to reduce unnecessary energy loss.
[0100] Although multiple embodiments of the present disclosure have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art may think of many changes, modifications, and alternatives without departing from the thought and spirit of the present disclosure. It should be understood that in the process of practicing the present disclosure, various alternatives to the embodiments of the present disclosure described herein may be adopted. The attached claims are intended to define the scope of protection of the present disclosure, and therefore cover equivalents or alternatives within the scope of these claims.
Claims
1. A method for processing image data for a device, the device comprising a camera, the method comprising: In response to detecting a power-on signal of the device, simultaneously starting the bare core code in the first processor and the operating system in the second processor, wherein the bare core code starts faster than the operating system, and after the operating system starts, the bare core code ends its work; After the bare core code is started, the bare core code is used to control the camera to collect image data, and the image data is saved in the memory; After the operating system is started, the operating system communicates with the bare core code, and the image data is obtained from the memory through the operating system.
2. The method according to claim 1, wherein the device further comprises a sensor, wherein: After the bare core code is started, controlling the camera to collect image data through the bare core code includes: After the bare core code is started, initializing the camera through the bare core code; In response to the bare core code detecting the sensing signal of the sensor, the bare core code controls the initialized camera to collect image data.
3. The method according to claim 1 or 2, wherein: After the operating system is started, the operating system communicates with the bare core code, and obtaining the image data from the memory through the operating system includes: After the operating system is started, initializing the image processing application through the operating system; The operating system sends a work completion notification to the bare core code; Upon receiving a confirmation notification based on the feedback of the work completion notification, the operating system takes over the camera from the bare core code and obtains the image data from the memory.
4. The method according to claim 3, wherein: The operating system taking over the camera from the bare core code includes: The operating system detects in real time whether the sensor generates a sensing signal; When the operating system detects the sensing signal of the sensor, the operating system controls the initialized camera to collect image data.
5. The method according to claim 3, after the operating system obtains the image data from the memory, the method further comprises: Using the image processing application to perform text recognition and text translation on the image data through the operating system to obtain a translation result; The translation result is outputted in a visual or audible manner through the operating system.
6. The method according to claim 1, wherein: The power-on signal is generated by a pen switch of the device.
7. A device for processing image data of a device, the device comprising a camera, the device comprising: Startup module, collection module and acquisition module; The startup module is configured to start the bare core code in the first processor and the operating system in the second processor simultaneously in response to detecting a power-on signal of the device, wherein the startup speed of the bare core code is faster than the startup speed of the operating system, and after the startup of the operating system is completed, the bare core code ends its work; The acquisition module is configured to control the camera to acquire image data through the bare core code after the bare core code is started, and save the image data to the memory; The acquisition module is configured to, after the operating system is started, enable the operating system to communicate with the bare core code, and acquire the image data from the memory through the operating system.
8. An electronic device, comprising: processor; and a memory storing program instructions for the device to process image data, wherein when the program instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 6.
9. A computer-readable storage medium storing program instructions for a device to process image data, wherein when the program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.