Image processing methods, apparatus, computer-readable storage media and devices
By generating intermediate images using preset reading rules and fusing them with reference images, the inefficiency and memory consumption problems caused by pixel supplementation in existing technologies are solved, achieving efficient image reading and memory saving.
Patent Information
- Application Number
- CN202211289560.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-20
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-10-20
AI Technical Summary
Existing technologies require pixel padding to fit the data access width of the DSP when reading images, resulting in low efficiency and high memory consumption.
The image is read by a preset reading rule, an intermediate image is generated, and then fused with a reference image of the same size to avoid pixel padding and directly obtain the reading result.
It improves image reading efficiency, saves memory space, and increases memory utilization.
Smart Images

Figure CN115546086B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and more specifically, to an image processing method, an image processing apparatus, a computer-readable storage medium, and an electronic device. Background Technology
[0002] Digital signal processors (DSPs) can implement Single Instruction Multiple Data (SIMD) and Very Long Instruction Word (VLIW). DSPs support data access, storage, and computation modes with a total bit width of 1024 bits, including 128-8 bits, 64-16 bits, and 32-32 bits.
[0003] When using a DSP to read images, based on the bit width supported by the DSP, it is known that the DSP can read a maximum of 128 pixels at a time. However, the total number of pixels in an image is usually more than 128. Therefore, it is necessary to read the image line by line in units of 128 pixels by the DSP.
[0004] When the width of an image is not equal to 128 or a multiple of 128, it is usually necessary to pad the image with pixels so that the number of pixels in each row of the image is equal to 128 or a multiple of 128, thereby enabling line-by-line reading of the image. However, this method is relatively inefficient.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute related technology known to those skilled in the art. Summary of the Invention
[0006] The purpose of this application is to provide an image processing method, an image processing apparatus, a computer-readable storage medium, and an electronic device. This method reads a first image using preset reading rules to obtain an intermediate image. Based on the fusion of the intermediate image and a reference image of the same size, a second image is obtained. Compared to related technologies, this method eliminates the need to supplement the first image; the second image is obtained by fusing the read intermediate image with the corresponding reference image, thus improving image reading efficiency. Furthermore, since supplementing the first image is unnecessary, this application also saves memory space and improves memory utilization.
[0007] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0008] According to one aspect of this application, an image processing method is provided, the method comprising:
[0009] Data from the first image is read according to a preset reading rule to obtain the intermediate image;
[0010] Obtain the reference image corresponding to the intermediate image;
[0011] The intermediate image and the reference image are merged to obtain the second image.
[0012] According to one aspect of this application, an image processing apparatus is provided, the apparatus comprising:
[0013] An image reading unit is used to read data from a first image according to a preset reading rule to obtain an intermediate image;
[0014] An image acquisition unit is used to acquire a reference image corresponding to the intermediate image;
[0015] The image fusion unit is used to fuse the intermediate image and the reference image to obtain the second image.
[0016] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.
[0017] According to one aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the method of any one of the above.
[0018] According to one aspect of this application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of any of the above by executing the executable instructions.
[0019] The exemplary embodiments of this application may have some or all of the following beneficial effects:
[0020] In an example embodiment of the image processing method provided in this application, a first image can be read using a preset reading rule to obtain an intermediate image. Based on the fusion of the intermediate image and a reference image of the same size, the reading result, i.e., the second image, can be obtained. Compared with related technologies, there is no need to supplement the first image; the reading result (i.e., the second image) can be obtained by fusing the read intermediate image and the corresponding reference image, thus improving the efficiency of image reading. Furthermore, since there is no need to supplement the first image, this application can also save memory space and improve memory utilization.
[0021] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0023] Figure 1 This diagram illustrates the image processing methods of related technologies.
[0024] Figure 2 A flowchart illustrating an image processing method according to an embodiment of this application is shown schematically;
[0025] Figure 3 A schematic diagram a illustrates an image reading process according to an embodiment of this application;
[0026] Figure 4 A schematic diagram b illustrates an image reading process according to an embodiment of this application;
[0027] Figure 5 A schematic diagram c illustrates an image reading process according to an embodiment of this application;
[0028] Figure 6 A schematic diagram d illustrates an image reading process according to an embodiment of this application;
[0029] Figure 7 A schematic diagram e illustrates an image reading process according to an embodiment of this application;
[0030] Figure 8 A schematic diagram f illustrates an image reading process according to an embodiment of this application;
[0031] Figure 9 A schematic diagram of a reference image according to an embodiment of this application is shown;
[0032] Figure 10 A flowchart illustrating another embodiment of an image processing method according to this application is shown schematically;
[0033] Figure 11 This illustration schematically shows a structural diagram of an image processing apparatus according to an embodiment of the present application;
[0034] Figure 12 The schematic diagram illustrates the structure of a computer system suitable for implementing the electronic devices of the present application. Detailed Implementation
[0035] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of the embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this application.
[0036] Please see Figure 1 , Figure 1 A schematic diagram illustrating the image processing methods of related technologies is provided. For example... Figure 1 As shown, in related technologies, if image 110 needs to be read by a DSP, and the number of consecutive reads is 4, based on the size of image 110 (6*4), the number of pixels in a single row of image 110 is 6. Therefore, it is impossible to read a single row of pixels based on the number of consecutive reads. Generally, the number of pixels in a single row can be equal to or a multiple of the number of consecutive reads by padding image 110. That is, pad each row of image 110 with 2 pixels so that the number of pixels in a single row of the padded image 110 is 8. Figure 1 As shown, the pixels in region 111 can be understood as pixels used to supplement image 110. After obtaining the supplemented image, all pixel data in image 110 can be obtained by reading each row twice consecutively. It should be noted that the value of the pixels used to supplement image 110 can be set to any value, such as 0, and this embodiment of the application does not limit it.
[0037] but, Figure 1 The method shown has a low efficiency problem. Specifically, if the number of pixels in a single row of the image to be read is not equal to or a multiple of the number of consecutive reads, pixel padding is required. This not only leads to low efficiency but also consumes a lot of memory resources. This application proposes a simplified process that eliminates the pixel padding step, thereby improving image reading efficiency. This is described in detail below.
[0038] Please see Figure 2 , Figure 2 A flowchart illustrating an image processing method according to an embodiment of this application is shown schematically. Figure 2 As shown, the method includes the following steps.
[0039] Step S210: Read the data in the first image according to the preset reading rules to obtain the intermediate image.
[0040] Step S220: Obtain a reference image corresponding to the intermediate image.
[0041] Step S230: Fuse the intermediate image and the reference image to obtain the second image.
[0042] Implementation Figure 2 The method shown reads a first image using preset reading rules to obtain an intermediate image. Based on the fusion of the intermediate image and a reference image of the same size, the read result, i.e., the second image, can be obtained. Compared to related technologies, there is no need to pad the first image; the read result (i.e., the second image) can be obtained by fusing the read intermediate image and the corresponding reference image, thus improving image reading efficiency. Furthermore, since there is no need to pad the first image, this application can also save memory space and improve memory utilization.
[0043] The steps described above in this example implementation will now be explained in more detail.
[0044] In step S210, data from the first image is read according to a preset reading rule to obtain an intermediate image.
[0045] Specifically, the preset reading rules can be used to limit the reading method of data in the first image. For example, the preset reading rules can limit the maximum number of consecutive reads, the reading rate, etc., which are not limited in this embodiment. In addition, the first image can be understood as the image to be processed, and the size of the intermediate image is larger than the size of the first image. The intermediate image contains the pixel data of the first image.
[0046] As an optional embodiment, the preset reading rule includes a number of consecutive reads. Data in the first image is read according to the preset reading rule to obtain an intermediate image, including: determining the number of line-by-line reads based on the number of consecutive reads and the size parameter corresponding to the first image; and reading the first image line by line based on the number of line-by-line reads to obtain the intermediate image; wherein the size of the intermediate image is larger than the size of the first image. This allows for direct line-by-line reading of the first image based on the number of consecutive reads, without needing to pad the row data of the first image to match or be a multiple of the number of consecutive reads, thus improving image processing efficiency and saving memory space.
[0047] Specifically, the number of consecutive reads can be represented as a positive integer, such as 128, 64, 32, etc. The number of consecutive reads is related to the bit width; for example, 8 bits correspond to 128, 16 bits to 64, and 32 bits to 32. The number of line-by-line reads is determined based on the number of consecutive reads (e.g., 128) and the size parameter of the first image, including: calculating the number of line-by-line reads based on the expression W / / 128+1. Here, / / indicates rounding down the result of division, W represents the width of the first image, the size parameter of the first image can be represented as W*H, and H represents the height of the first image. The width of the intermediate image generated based on the above method can be represented as (W / / 128+1)*128; the height can be represented as H.
[0048] As an optional embodiment, an intermediate image is obtained by reading the first image line by line based on the number of line-by-line reads. This includes: for each line of data in the first image, reading the current line according to the number of line-by-line reads, and writing the read data into the corresponding line in the intermediate image, until all lines of data in the first image have been read, to obtain an intermediate image containing all the data in the first image. This method obtains an intermediate image containing all the data in the first image. Only further fusion of the intermediate image and a reference image of the same size is needed to obtain the image processing result, i.e., the second image. Compared with related technologies, this method eliminates the need for pixel padding of the first image, thus improving image processing efficiency.
[0049] Please see Figure 3 , Figure 3 A schematic diagram a illustrates an image reading process according to an embodiment of this application. (See diagram a.) Figure 3 As shown, if the first image is a 6*5 image and the number of consecutive reads is 4, based on the expression W / / 4+1, the number of row-by-row reads corresponding to each row in the first image can be determined to be 2. Therefore, the first row of the first image can be read for the first time, taking 4 consecutive pixels (i.e., ...). Figure 3The pixel data in region 310 is read and then written to the corresponding position in the intermediate image (i.e., the corresponding position in region 311).
[0050] Further, please refer to Figure 4 , Figure 4 A schematic diagram (b) illustrates an image reading process according to an embodiment of this application. (See diagram b.) Figure 4 As shown, in Figure 3 Based on this, the Gather instruction, used to read non-contiguous data, can be used to perform a second round of processing on the first row of the first image, processing four consecutive pixels (i.e., ...) Figure 4 The pixel data in region 410 and region 420 of the first image are read. The read pixel data can be sequentially written to the corresponding positions in the intermediate image (i.e., the corresponding positions in region 411 and region 421). It should be noted that after the first reading of four consecutive pixels from the first row of the first image, only two pixels remain to be read. Since the maximum number of consecutive reads is four, the first two pixels from the second row of the first image are taken as the result of the second reading of four consecutive pixels from the first row. Accordingly, the pixel data in region 410 can be written to region 411, and the pixel data in region 420 can be written to region 421.
[0051] Further, please refer to Figure 5 , Figure 5 A schematic diagram c illustrates an image reading process according to an embodiment of this application. (See diagram c.) Figure 5 As shown, in Figure 4 Based on this, the first four consecutive pixels of data can be processed from the second row of the first image (i.e., Figure 5 The pixel data in region 510 is read and then written to the corresponding position in the intermediate image (i.e., the corresponding position in region 511).
[0052] Further, please refer to Figure 6 , Figure 6 A schematic diagram d illustrates an image reading process according to an embodiment of this application. (See diagram d.) Figure 6 As shown, in Figure 5 Based on this, the Gather instruction, used to read non-contiguous data, can be used to perform a second round of processing on the second row of the first image, processing four consecutive pixels (i.e., ...) Figure 6The pixel data in region 610 and region 620 of the first image are read. The read pixel data can be sequentially written to the corresponding positions in the intermediate image (i.e., the corresponding positions in region 611 and region 621). It should be noted that after the first reading of four consecutive pixels from the second row of the first image, only two pixels remain to be read. Since the maximum number of consecutive reads is four, the first two pixels from the third row of the first image are taken as the result of the second reading of four consecutive pixels from the second row. Accordingly, the pixel data in region 610 can be written to region 611, and the pixel data in region 620 can be written to region 621.
[0053] By following this pattern, the data for each row of the first image can be read.
[0054] Further, please refer to Figure 7 , Figure 7 A schematic diagram e illustrates an image reading process according to an embodiment of this application. For example... Figure 7 As shown, the last row of the first image can be processed with the first four consecutive pixels (i.e., Figure 7 The pixel data in region 710 is read and then written to the corresponding position in the intermediate image (i.e., the corresponding position in region 711).
[0055] Further, please refer to Figure 8 , Figure 8 A schematic diagram f illustrates an image reading process according to an embodiment of this application. (See diagram f.) Figure 8 As shown, in Figure 7 Based on this, the Gather instruction, used to read non-contiguous data, can be used to perform a second round of processing on the last row of the first image, processing four consecutive pixels (i.e., ...) Figure 7 The pixel data in region 710 and region 720 of the first image are read. The read pixel data can be sequentially written to the corresponding positions in the intermediate image (i.e., the corresponding positions in region 711 and region 721). It should be noted that after reading the first four consecutive pixels from the last row of the first image, only two pixels remain to be read in the second row, and there is no next row. Since the consecutive reading count is four, the first two pixels from the first row of the first image are taken as the result of the second four consecutive pixel reading from the last row. Accordingly, the pixel data in region 710 can be written to region 711, and the pixel data in region 720 can be written to region 721.
[0056] As an optional embodiment, the preset reading rule includes a number of consecutive reads. Reading data from the first image according to the preset reading rule to obtain an intermediate image includes: determining the number of consecutive reads at each multiplier to obtain a set of consecutive reading parameters; determining the size parameters corresponding to the first image; if a specific value in the size parameters does not belong to the set of consecutive reading parameters, then reading data from the first image according to the preset reading rule to obtain an intermediate image. This can improve the processing efficiency of the first image when a specific value in the size parameters does not belong to the set of consecutive reading parameters.
[0057] Specifically, if the number of consecutive reads is 128, the set of consecutive read parameters can include 128, 256, 384, etc. Furthermore, the size parameters corresponding to the first image can include at least width and height. The specific value in the size parameters can refer to the width, or it can be other values; this embodiment does not limit the specific values.
[0058] In step S220, a reference image corresponding to the intermediate image is obtained.
[0059] Specifically, the reference image can be understood as a pre-set image used to reduce invalid pixels in the intermediate image to obtain the reading result of the first image, i.e., the second image. The reference image may or may not be the same size as the intermediate image; this embodiment does not limit this.
[0060] As an optional embodiment, obtaining a reference image corresponding to the intermediate image includes: determining image fill values; and generating a reference image of the same size as the intermediate image based on the image fill values. This allows for the acquisition of a reference image of the same size as the intermediate image, which can be used to reduce redundant pixels in the intermediate image to obtain the final second image, thereby improving the accuracy of the acquired second image.
[0061] Specifically, determining the image fill value includes: in response to image processing requirements (e.g., reading requirements, binarization requirements, etc.), determining the image fill value corresponding to the image processing requirements (e.g., 0 and 1). Optionally, determining the image fill value includes: determining the image fill value at each pixel position according to a preset fill method (e.g., constant fill, mirror fill).
[0062] In addition, generating a reference image of the same size as the intermediate image based on the image fill value includes: determining the pixel positions that need to be set to 0 based on the difference between the intermediate image and the first image, setting the pixel positions in the reference image other than the pixel positions that need to be set to 0 as the image fill value, and setting the pixel positions that need to be set to 0 to 0.
[0063] Please see Figure 9 , Figure 9 A schematic diagram of a reference image according to an embodiment of this application is shown. Figure 9 As shown, based on Figures 3-8 Using the same intermediate image size, a reference image of the same size can be generated. Figure 9 In the first image, the pixel values of columns 1 through 6 are all set to 1, and the pixel values of columns 7 and 8 are all set to 0. This eliminates redundant pixels in columns 7 and 8 of the intermediate image, resulting in a second image of the same size as the first image.
[0064] It should be noted that the pixel values of the first to sixth columns can also be set to other values (such as 3, 8, 10, etc.) based on image processing requirements, and this application embodiment does not limit this.
[0065] Furthermore, the size of the reference image can vary with the size of the reference image. The number of pixels in the reference image that need to be set to 0 depends on the difference between the size of the first image and the size of the reference image. This application does not limit the number of pixels in the reference image that need to be set to 0.
[0066] As an optional embodiment, generating a reference image of the same size as the intermediate image based on image fill values includes: determining the weight value corresponding to each pixel in the reference image; and generating a reference image of the same size as the intermediate image based on the image fill values and the weight values. This allows a specific reference image to be obtained through the weight values corresponding to each pixel. By fusing this reference image with the intermediate image, the final result required for image processing can be obtained without first reading and processing the image data, thus further improving image processing efficiency.
[0067] Specifically, the weight values corresponding to each pixel in the reference image can be the same or different, and this application embodiment does not limit this. The weight values corresponding to each pixel depend on the image processing requirements. In addition, generating a reference image of the same size as the intermediate image based on the image fill value and each weight value includes: multiplying the image fill value by each weight value to obtain the value of each pixel position in the reference image.
[0068] In step S230, the intermediate image and the reference image are fused to obtain the second image.
[0069] Specifically, the second image has the same size as the first image. If the corresponding pixel in the reference image is set to 1 and the other pixels are set to 0, the resulting second image is identical to the first image, thus enabling fast reading of the first image.
[0070] As an optional embodiment, fusing the intermediate image and the reference image to obtain the second image includes: performing pixel-wise multiplication of the intermediate image and the reference image to obtain the second image. This simplifies the image processing flow and allows for more efficient acquisition of the second image without the need for pixel padding.
[0071] Specifically, the pixel values at the same pixel position in the intermediate image and the reference image can be multiplied to obtain the pixel value at the corresponding pixel position. For example, multiplying the value of pixel position (1,1) in the intermediate image (e.g., 3) with the value of pixel position (1,1) in the reference image (e.g., 1) can yield the value of pixel position (1,1) in the second image (e.g., 3).
[0072] Please see Figure 10 , Figure 10 A flowchart illustrating another embodiment of an image processing method according to this application is shown schematically. Figure 10 As shown, the image processing method includes steps S1000 to S1040.
[0073] Step S1000: Determine the number of consecutive reads at each multiplier, obtain the set of consecutive read parameters, and determine the size parameters corresponding to the first image.
[0074] Step S1010: If a specific value in the size parameter does not belong to the continuous reading parameter set, then determine the number of line-by-line readings based on the number of continuous readings and the size parameter corresponding to the first image.
[0075] Step S1020: For each row of data in the first image, read the current row according to the number of row-by-row reads, and write the read data into the corresponding row in the intermediate image until the reading of each row of data in the first image is completed, so as to obtain an intermediate image containing each row of data.
[0076] Step S1030: Determine the image fill value and generate a reference image of the same size as the intermediate image based on the image fill value.
[0077] Step S1040: Perform pixel-wise multiplication of the intermediate image and the reference image to obtain the second image.
[0078] It should be noted that steps S1000 to S1040 are related to... Figure 2 For the specific implementation details of steps S1000 to S1040, please refer to the examples shown. Figure 2 The steps and their embodiments shown are not repeated here.
[0079] It is evident that implementation Figure 10The method shown reads a first image using preset reading rules to obtain an intermediate image. Based on the fusion of the intermediate image and a reference image of the same size, the read result, i.e., the second image, can be obtained. Compared to related technologies, there is no need to pad the first image; the read result (i.e., the second image) can be obtained by fusing the read intermediate image and the corresponding reference image, thus improving image reading efficiency. Furthermore, since there is no need to pad the first image, this application can also save memory space and improve memory utilization.
[0080] Please see Figure 11 , Figure 11 A schematic block diagram of an image processing apparatus according to one embodiment of this application is shown. Figure 11 As shown, the image processing apparatus 1100 may include the following units.
[0081] The image reading unit 1101 is used to read data from the first image according to a preset reading rule to obtain an intermediate image;
[0082] Image acquisition unit 1102 is used to acquire a reference image corresponding to the intermediate image;
[0083] The image fusion unit 1103 is used to fuse the intermediate image and the reference image to obtain the second image.
[0084] It is evident that implementation Figure 11 The illustrated device can read a first image using preset reading rules to obtain an intermediate image. Based on the fusion of the intermediate image and a reference image of the same size, a second image can be obtained. Compared with related technologies, there is no need to supplement the first image; the second image can be obtained by fusing the read intermediate image and the corresponding reference image, thus improving the efficiency of image reading. Furthermore, since there is no need to supplement the first image, this application can also save memory space and improve memory utilization.
[0085] As an optional embodiment, the preset reading rule includes a number of consecutive reads. The image reading unit 1101 reads data in the first image according to the preset reading rule to obtain an intermediate image, including: determining the number of line-by-line reads based on the number of consecutive reads and the size parameter corresponding to the first image; and reading the first image line by line based on the number of line-by-line reads to obtain an intermediate image; wherein the size of the intermediate image is greater than the size of the first image.
[0086] As can be seen, by implementing this optional embodiment, the first image can be read line by line by the number of consecutive reads, without having to pad the line data of the first image to match the number of consecutive reads or to a multiple of the number of consecutive reads, which can improve image processing efficiency and save memory space.
[0087] As an optional embodiment, the image reading unit 1101 reads the first image line by line based on the number of line-by-line reads to obtain an intermediate image, including: for each line of data in the first image, reading the current line according to the number of line-by-line reads, and writing the read data into the corresponding line in the intermediate image, until the reading of each line of data in the first image is completed, so as to obtain an intermediate image containing each line of data.
[0088] As can be seen, by implementing this optional embodiment, an intermediate image containing all the data in the first image can be obtained. Only by further fusing the intermediate image and a reference image of the same size is it possible to obtain the image processing result, namely the second image. Compared with related technologies, there is no need to perform pixel supplementation on the first image, which improves the image processing efficiency.
[0089] As an optional embodiment, the preset reading rule includes the number of consecutive reads. The image reading unit 1101 reads data in the first image according to the preset reading rule to obtain an intermediate image, including: determining the number of consecutive reads at each multiple to obtain a set of consecutive reading parameters; determining the size parameters corresponding to the first image; if a specific value in the size parameters does not belong to the set of consecutive reading parameters, then reading data in the first image according to the preset reading rule to obtain an intermediate image.
[0090] As can be seen, implementing this optional embodiment can improve the processing efficiency of the first image when a specific value in the size parameter does not belong to the set of continuously read parameters.
[0091] As an optional embodiment, the image acquisition unit 1102 acquires a reference image corresponding to the intermediate image, including: determining the image fill value; and generating a reference image of the same size as the intermediate image based on the image fill value.
[0092] As can be seen, by implementing this optional embodiment, a reference image of the same size as the intermediate image can be obtained to reduce the redundant pixels in the intermediate image and obtain the final second image, which can improve the accuracy of the obtained second image.
[0093] As an optional embodiment, the image acquisition unit 1102 generates a reference image of the same size as the intermediate image based on the image fill value, including: determining the weight value corresponding to each pixel in the reference image; and generating a reference image of the same size as the intermediate image based on the image fill value and each weight value.
[0094] As can be seen, by implementing this optional embodiment, a specific reference image can be obtained through the weight value corresponding to each pixel. By fusing the reference image with the intermediate image, the final result required for image processing can be obtained. There is no need to read the image data first and then process the data, which can further improve the efficiency of image processing.
[0095] As an optional embodiment, the image fusion unit 1103 fuses the intermediate image and the reference image to obtain a second image, including: performing pixel-wise multiplication of the intermediate image and the reference image to obtain the second image.
[0096] As can be seen, implementing this optional embodiment can simplify the image processing flow and obtain the second image more efficiently without the need for pixel padding.
[0097] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0098] Since the functional modules of the image processing apparatus in the example embodiments of this application correspond to the steps of the example embodiments of the image processing apparatus described above, for details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the image processing apparatus described above.
[0099] Please see Figure 12 , Figure 12 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0100] It should be noted that, Figure 12 The computer system 1200 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0101] like Figure 12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1202 or programs loaded from storage section 1208 into random access memory (RAM) 1203. The RAM 1203 also stores various programs and data required for system operation. The CPU 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0102] The following components are connected to I / O interface 1205: an input section 1206 including a keyboard, mouse, etc.; an output section 1207 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN card, modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to I / O interface 1205 as needed. Removable media 1211, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1210 as needed so that computer programs read from them can be installed into storage section 1208 as needed.
[0103] In particular, according to embodiments of this application, the processes described below with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1209, and / or installed from removable medium 1211. When the computer program is executed by central processing unit (CPU) 1201, it performs the various functions defined in the methods and apparatus of this application.
[0104] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to implement the methods described in the above embodiments.
[0105] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0106] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0107] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0108] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the claims.
Claims
1. An image processing method, characterized by, The method comprises: reading data in the first image according to a preset reading rule to obtain an intermediate image; the preset reading rule comprises a continuous reading number, wherein reading data in the first image according to the preset reading rule to obtain an intermediate image comprises: determining a row-by-row reading number based on the continuous reading number and a size parameter corresponding to the first image; performing row-by-row reading on the first image based on the row-by-row reading number to obtain an intermediate image; wherein the size corresponding to the intermediate image is greater than the size corresponding to the first image; obtaining a reference image corresponding to the intermediate image comprises: determining an image padding value; and generating a reference image with the same size as the intermediate image based on the image padding value; fusing the intermediate image and the reference image to obtain a second image comprises: pixel-by-pixel aligning and multiplying the intermediate image and the reference image to obtain a second image; wherein performing row-by-row reading on the first image based on the row-by-row reading number to obtain an intermediate image comprises: for each row of data in the first image, performing current row reading according to the row-by-row reading number, and writing the read data to the corresponding row in the intermediate image, until the reading of each row of data in the first image is completed, to obtain an intermediate image containing the rows of data; generating a reference image with the same size as the intermediate image based on the image padding value comprises: determining the pixel positions that need to be set to 0 based on the difference between the intermediate image and the first image, setting the pixel positions other than the pixel positions that need to be set to 0 in the reference image to the image padding value, and setting the pixel positions that need to be set to 0 to 0.
2. The method of claim 1, wherein, The preset reading rule comprises a continuous reading number, and reading data in the first image according to the preset reading rule to obtain an intermediate image comprises: determining the continuous reading number under each multiple to obtain a continuous reading parameter set; determining a size parameter corresponding to the first image; if a specific value in the size parameter does not belong to the continuous reading parameter set, reading data in the first image according to the preset reading rule to obtain an intermediate image.
3. The method of claim 1, wherein, Generating a reference image with the same size as the intermediate image based on the image padding value comprises: determining a weight value corresponding to each pixel position in the reference image; generating a reference image with the same size as the intermediate image based on the image padding value and the weight values.
4. An image processing apparatus characterized by comprising: The method comprises: an image reading unit configured to read data in a first image according to a preset reading rule to obtain an intermediate image; the preset reading rule comprises a continuous reading number, wherein reading data in the first image according to the preset reading rule to obtain an intermediate image comprises: determining a row-by-row reading number based on the continuous reading number and a size parameter corresponding to the first image; performing row-by-row reading on the first image based on the row-by-row reading number to obtain an intermediate image; wherein the size corresponding to the intermediate image is greater than the size corresponding to the first image; an image acquisition unit configured to obtain a reference image corresponding to the intermediate image, comprising: determining an image padding value; and generating a reference image with the same size as the intermediate image based on the image padding value; The image fusion unit is configured to fuse the intermediate image and the reference image to obtain a second image by pixel-by-pixel multiplication of the intermediate image and the reference image. The intermediate image is obtained by reading the first image row by row according to the number of times of row-by-row reading, including: for each row of data in the first image, reading the current row according to the number of times of row-by-row reading, and writing the read data into the corresponding row in the intermediate image until the reading of each row of data in the first image is completed to obtain the intermediate image containing the rows of data. The reference image with the same size as the intermediate image is generated based on the image padding value, including: determining the pixel position that needs to be set to 0 based on the difference between the intermediate image and the first image, setting the pixel position other than the pixel position that needs to be set to 0 in the reference image to the image padding value, and setting the pixel position that needs to be set to 0 to 0.
5. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1-3.
6. An electronic device, comprising: The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of any one of claims 1-3. The computer program is executed by the processor to implement the method of
Citation Information
Patent Citations
Access method of memory
CN101599167A
Method for displaying user-defined symbols and graphs on liquid crystal module on basis of RA8870 controller
CN102522067A