Image processing method, image processing device, electronic equipment and readable medium
By using the reduction processing unit to generate an intermediate image in the image processing and controlling the amount of cached data according to the write speed of the memory, the problem of high chip cost caused by excessive image data cache is solved, and the effect of reducing chip cost is achieved.
Patent Information
- Application Number
- CN202411630025.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, excessive image data cache leads to the problem of high chip cost.
By receiving the image to be processed and its processing parameters, the reduction processing unit generates intermediate images and processing parameters, and determines the amount of image to be cached based on the write speed and read speed of the memory, thereby controlling the amount of written data and reducing the cached data quantity.
This reduces the amount of image data that needs to be cached during image processing and reduces the cost of the chip.
Smart Images

Figure CN119417697A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an image processing method, an image processing device, an electronic device and a readable medium. Background Art
[0002] In current actual image processing applications, for example, image scaling processing often requires a large amount of memory space to cache image data during processing, but too much memory will cause the hardware chip area to be too large and the cost to be high in hardware implementation. Especially in the application of some low-cost hardware chips, too much image data cache will occupy too much memory space, which will make the cost difficult to bear. Therefore, a method is urgently needed to solve the above technical problems. Summary of the invention
[0003] To this end, the present invention provides an image processing method, an image processing device, an electronic device and a readable medium to solve the problem of high chip cost caused by excessive image data cache in the prior art.
[0004] In order to achieve the above object, the present invention provides an image processing method in a first aspect, comprising:
[0005] Receive an image to be processed and image processing parameters of the image to be processed, wherein the image processing parameters include original image parameters of the image to be processed and target image parameters of a target image to be output; input the image to be processed and the image processing parameters to be processed into a reduction processing unit to obtain an intermediate image of the image to be processed and intermediate image processing parameters of the intermediate image; when a writing speed of a memory is lower than a reading speed, determine the amount of image data to be cached in the memory according to the intermediate image; during writing the intermediate image and the intermediate image processing parameters into the memory, determine the amount of written data of the intermediate image and the intermediate image processing parameters in the memory; when the amount of written data reaches the amount of image data to be cached, input the intermediate image and the intermediate image processing parameters from the memory into an enlargement processing unit to obtain the target image of the image to be processed.
[0006] Optionally, the memory includes a dual-port static memory and a single-port static memory; during writing the intermediate image and the intermediate image processing parameters into the memory, determining the amount of data written into the intermediate image and the intermediate image processing parameters into the memory, comprising: determining a first clock domain and a second clock domain of the dual-port static memory; writing the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain; writing the intermediate image and the intermediate image processing parameters from the dual-port static memory into the single-port static memory based on the second clock domain; determining the amount of data written into the intermediate image and the intermediate image processing parameters into the single-port static memory;
[0007] When the amount of written data reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the memory to the enlargement processing unit, including: when the amount of written data in the single-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the dual-port static memory and the single-port static memory to the enlargement processing unit.
[0008] Optionally, the memory includes a dual-port static memory; during writing the intermediate image and the intermediate image processing parameters into the memory, determining the amount of data written into the intermediate image and the intermediate image processing parameters into the memory comprises: determining a first clock domain of the dual-port static memory; writing the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain; determining the amount of data written into the intermediate image and the intermediate image processing parameters into the dual-port static memory;
[0009] When the amount of written data reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the memory to the enlargement processing unit, including: determining the second clock domain of the dual-port static memory; when the amount of written data in the dual-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the dual-port static memory to the enlargement processing unit based on the second clock domain.
[0010] Optionally, the image to be processed and the processing parameters of the image to be processed are input into a reduction processing unit to obtain an intermediate image of the image to be processed and intermediate image processing parameters of the intermediate image, including: calculating the horizontal scaling ratio of the image to be processed according to the original horizontal parameters in the original image parameters and the target horizontal parameters in the target image parameters; calculating the vertical scaling ratio of the image to be processed according to the original vertical parameters in the original image parameters and the target vertical parameters in the target image parameters; and when the horizontal scaling ratio and the vertical scaling ratio are both greater than or equal to 1, determining the image to be processed as an intermediate image, and determining the processing parameters of the image to be processed as intermediate image processing parameters.
[0011] Optionally, the method also includes: when the horizontal scaling ratio is less than 1, adjusting the original horizontal parameters of the image to be processed to the target horizontal parameters; when the vertical scaling ratio is less than 1, adjusting the original vertical parameters of the image to be processed to the target vertical parameters; based on the target horizontal parameters and the target vertical parameters, generating the intermediate image, and determining the target horizontal parameters and the target vertical parameters as the intermediate image processing parameters.
[0012] Optionally, based on the intermediate image, the amount of image data to be cached in the memory is determined, including: obtaining a time interval to be cached of the intermediate image, wherein the time interval to be cached is determined based on a reception time and an output time of a historical image, the historical image is any historical image in an image sequence to which the image to be processed belongs, and the output time is a time when the historical image is output to an output end; based on the time interval to be cached, the horizontal scaling ratio and the vertical scaling ratio, the amount of image data to be cached in the memory is determined.
[0013] Optionally, inputting the intermediate image and the intermediate image processing parameters from the memory into an enlargement processing unit to obtain a target image of the image to be processed includes:
[0014] Calculating a horizontal scaling ratio of the intermediate image according to an original horizontal parameter in the original image parameters and a target horizontal parameter in the target image parameters; calculating a vertical scaling ratio of the intermediate image according to an original vertical parameter in the original image parameters and a target vertical parameter in the target image parameters; and adjusting the original horizontal parameter of the intermediate image to the target horizontal parameter when the horizontal scaling ratio is greater than 1;
[0015] When the vertical scaling ratio is greater than 1, the original vertical parameters of the intermediate image are adjusted to the target vertical parameters; and a target image is generated based on the target horizontal parameters and the target vertical parameters.
[0016] A second aspect of the present invention provides an image processing device, comprising: a reduction processing unit, a memory, an enlargement processing unit and a processing unit;
[0017] The reduction processing unit is used to: receive an image to be processed and image processing parameters of the image to be processed, and output an intermediate image of the image to be processed and the intermediate image processing parameters of the intermediate image;
[0018] The processing unit is used to: control the memory to receive the intermediate image and the intermediate image processing parameters of the intermediate image; determine the amount of image data to be cached in the memory according to the intermediate image when the writing speed of the memory is lower than the reading speed; determine the amount of written data of the intermediate image and the intermediate image processing parameters in the memory during writing the intermediate image and the intermediate image processing parameters into the memory; and control the memory to input the intermediate image and the intermediate image processing parameters into the enlargement processing unit when the written data amount reaches the amount of image data to be cached;
[0019] The enlargement processing unit is used to receive the intermediate image and the intermediate image processing parameters, and output the target image of the image to be processed.
[0020] A third aspect of the present invention provides an electronic device, comprising:
[0021] One or more processors; a memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned image processing method; one or more I / O interfaces connected between the processor and the memory and configured to implement information exchange between the processor and the memory.
[0022] A fourth aspect of the present invention provides a computer-readable medium having a computer program stored thereon, wherein the program implements the above-mentioned image processing method when executed by a processor.
[0023] The present invention has the following advantages:
[0024] An embodiment of the present invention realizes that, by receiving an image to be processed and image processing parameters of the image to be processed, an intermediate image and intermediate image processing parameters are obtained after the image to be processed is processed by a reduction processing unit based on the image processing parameters, and further, according to the writing speed and the reading speed of the memory, it is determined whether the intermediate image and the intermediate image processing parameters need to be input into the enlargement processing unit for processing, and according to the amount of image data to be cached in the memory and the amount of data written to the memory, it is determined whether the intermediate image and the intermediate image processing parameters need to be input into the enlargement processing unit, thereby achieving the control of the amount of data written to the memory based on the amount of image data to be cached in the memory, reducing the amount of image data that needs to be cached during the image processing process, so as to reduce the chip cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention, but do not constitute a limitation of the present invention.
[0026] Figure 1 is a flow chart of an image processing method provided by an embodiment of the present invention;
[0027] Figure 2 is a flow chart of an image reduction process provided by an embodiment of the present invention;
[0028] Figure 3 is a schematic diagram of a memory output data provided by an embodiment of the present invention;
[0029] Figure 4 is a schematic diagram of another memory output data provided by an embodiment of the present invention;
[0030] Figure 5 is a flow chart of an image magnification process provided by an embodiment of the present invention;
[0031] Figure 6 is a processing flow chart of an image processing method provided by an embodiment of the present invention;
[0032] Figure 7 is a structural schematic diagram of an image processing device provided by an embodiment of the present invention;
[0033] Figure 8 It is a block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0035] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0036] The terms used in the present invention are only used to describe specific embodiments and are not intended to limit the present invention. As used in the present invention, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0037] When the terms “comprising” and / or “made of…” are used in the present invention, it specifies the existence of the stated features, integers, steps, operations, elements and / or components, but does not exclude the existence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0038] The embodiments of the present invention may be described with reference to plan views and / or cross-sectional views by way of ideal schematic views of the present invention. Therefore, the exemplary illustrations may be modified according to manufacturing techniques and / or tolerances.
[0039] Unless otherwise defined, all terms (including technical and scientific terms) used in the present invention have the same meaning as those commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present invention, and will not be interpreted as having an idealized or overly formal meaning unless the present invention clearly defines it as such.
[0040] In a first aspect, an embodiment of the present invention provides an image processing method. Figure 1 , Figure 1 A flowchart of an image processing method provided according to an embodiment of the present invention is shown, which specifically includes the following steps:
[0041] Step 102: receiving an image to be processed and image processing parameters of the image to be processed, wherein the image processing parameters include original image parameters of the image to be processed and target image parameters of a target image to be output.
[0042] In current practical applications, image processing usually involves image scaling. Before scaling an image, the user is required to provide image parameters of the unprocessed original image and expected image parameters after processing, so that during the image scaling process, the original image is scaled according to the original image parameters and the expected target image parameters to obtain the scaled image.
[0043] The image to be processed refers to the image that needs to be scaled. The target image refers to the image after the image to be processed is scaled. The processing parameters of the image to be processed specifically include the original image parameters of the image to be processed and the target image parameters of the target image to be output. The original image parameters refer to the image parameters of the image to be processed, that is, the image parameters before the image scaling is performed. The target image parameters refer to the image parameters of the target image, that is, the image parameters after the image scaling is completed.
[0044] For example, if image A needs to be scaled from a resolution of 1600×1200 to a resolution of 800×300 to obtain image A', then image A is the image to be processed, 1600×1200 resolution is the original image parameter of image A, image A' is the target image to be output, and 800×300 resolution is the target image parameter of image A'.
[0045] By receiving the image to be processed and the image processing parameters of the image to be processed, it is helpful to perform image scaling on the image to be processed in a subsequent process and obtain a target image of the image to be processed.
[0046] Step 104: input the image to be processed and the processing parameters of the image to be processed into a reduction processing unit to obtain an intermediate image of the image to be processed and the intermediate image processing parameters of the intermediate image.
[0047] After receiving the image to be processed and the processing parameters of the image to be processed, the image to be processed and the processing parameters of the image to be processed can be input into the reduction processing unit, and the reduction processing unit determines whether it is necessary to reduce the image to be processed, and obtains the intermediate image of the image to be processed and the intermediate image processing parameters of the intermediate image.
[0048] Among them, the reduction processing unit is used to reduce the image to be processed or keep the original image parameters of the image to be processed unchanged (that is, the image to be processed is not reduced). The intermediate image refers to the image obtained after the image to be processed is reduced or the image to be processed is not processed. The intermediate image processing parameters refer to the image parameters corresponding to the intermediate image. In practical applications, if the intermediate image is an image after the image to be processed is reduced, the intermediate image processing parameters are the image parameters of the reduced image; if the image to be processed is not reduced, that is, the intermediate image is the image to be processed, then the intermediate image processing parameters are the processing parameters of the image to be processed, including the original image parameters of the image to be processed and the target image parameters of the target image.
[0049] Using the above example, image A needs to be scaled from a resolution of 1600×1200 to a resolution of 800×300 to obtain image A'. Image A, the original image parameter of image A (resolution of 1600×1200) and the target image parameter (resolution of 800×300) can be input into the reduction processing unit for reduction, and image A' can be obtained, and the image parameter of image A' is a resolution of 800×300. In the process of processing image A to obtain image A', there is no need to reduce or enlarge image A, and image A' is the intermediate image, and the image parameter (resolution of 800×300) is the intermediate image processing parameter of image A'.
[0050] For another example, it is necessary to enlarge image B from a resolution of 800×300 to a resolution of 1600×1200 to obtain image B'. To obtain image B' from image B, it is not necessary to reduce it, but only to enlarge image B. Therefore, after image B, image B's original image parameters of 800×300 resolution and target image parameters of 1600×1200 resolution are input into the reduction processing unit, the reduction processing unit will not reduce image B. Therefore, the intermediate image obtained at this time is still image B, and the intermediate image processing parameters are image B's original image parameters of 800×300 resolution and target image parameters of 1600×1200 resolution.
[0051] The image processing method provided by the present invention can be specifically implemented by a reduction processing unit, an enlargement processing unit and a memory. It should be noted that in one or more embodiments provided by the present invention, the memory is used to cache image data generated during the image processing of the image to be processed, which may specifically include intermediate images and intermediate image processing parameters of the intermediate images. The memory may specifically include a dual-port static memory and a single-port static memory, or may only include a dual-port static memory. The specific configuration of the memory may be determined according to the actual application situation, and the present invention is not limited here. The static memory is specifically a static random access memory (SRAM).
[0052] The following combination Figure 2 , with memory including dual-port static memory (i.e. Figure 2 The dual-port SRAM shown in Figure 1) and the single-port static memory (i.e. Figure 2 The image reduction process is explained using the single-port SRAM shown in Figure 1 as an example. Figure 2 , Figure 2 FIG. 4 shows a flowchart of an image reduction process provided according to an embodiment of the present invention. Figure 2 As shown, after receiving the image to be processed and the image processing parameters to be processed of the image to be processed ( Figure 2After the image to be processed and the processing parameters of the image to be processed are input into the reduction processing unit, the reduction processing unit performs reduction processing on the image to be processed according to the processing parameters of the image to be processed, and an intermediate image with a reduced image size and intermediate image processing parameters of the intermediate image can be obtained. The intermediate image and the intermediate image processing parameters are written into the dual-port static memory, and after the dual-port static memory performs cross-clock domain processing, they are written into the single-port static memory and cached in the single-port static memory. Furthermore, the intermediate image and the intermediate image processing parameters are input into the enlargement processing unit. Since the intermediate image is already an image that has been reduced, the enlargement processing unit does not need to enlarge the intermediate image. The intermediate image is used as the target image and the intermediate image processing parameters are output as the target image parameters.
[0053] In practical applications, different images have different image processing requirements, such as reduction requirements or enlargement requirements. After receiving the image to be processed and the processing parameters of the image to be processed, the image to be processed and the processing parameters of the image to be processed can be input into the reduction processing unit together. Therefore, the reduction processing unit can determine whether it is necessary to reduce the image to be processed according to the processing parameters of the image to be processed. The specific implementation method is as follows:
[0054] In a specific embodiment of the present invention, the image to be processed and the processing parameters of the image to be processed are input into a reduction processing unit to obtain an intermediate image of the image to be processed and the intermediate image processing parameters of the intermediate image, including:
[0055] Calculating a horizontal scaling ratio of the image to be processed according to an original horizontal parameter in the original image parameters and a target horizontal parameter in the target image parameters;
[0056] Calculating a vertical scaling ratio of the image to be processed according to an original vertical parameter in the original image parameters and a target vertical parameter in the target image parameters;
[0057] When the horizontal scaling ratio and the vertical scaling ratio are both greater than or equal to 1, the image to be processed is determined as an intermediate image, and the processing parameters of the image to be processed are determined as intermediate image processing parameters.
[0058] In practical applications, an image specifically includes a horizontal direction and a vertical direction. In order to ensure the accuracy of the image after scaling, the image to be processed may be scaled in the horizontal direction and in the vertical direction respectively.
[0059] Among them, the original image parameters specifically include the original horizontal parameters and the original vertical parameters; the original horizontal parameters refer to the original image parameters of the image to be processed in the horizontal direction; the original vertical parameters refer to the original image parameters of the image to be processed in the vertical direction; the target image parameters specifically include the target horizontal parameters and the target vertical parameters; the target horizontal parameters refer to the target image parameters in the horizontal direction of the target image; the target vertical parameters refer to the target image parameters in the vertical direction of the target image. The horizontal scaling ratio refers to the reduction ratio or enlargement ratio of the image to be processed in the horizontal direction, specifically the ratio between the target horizontal parameter and the original horizontal parameter; the vertical scaling ratio refers to the reduction ratio or enlargement ratio of the image to be processed in the vertical direction, specifically the ratio between the target vertical parameter and the original vertical parameter.
[0060] Specifically, after obtaining the image to be processed and the processing parameters of the image to be processed, the reduction processing unit calculates the ratio between the target horizontal parameter and the original horizontal parameter as the horizontal scaling ratio of the image to be processed, according to the original horizontal parameter in the original image parameters and the target horizontal parameter in the target image parameters, and calculates the ratio between the target vertical parameter and the original vertical parameter as the vertical scaling ratio of the image to be processed, according to the original vertical parameter in the original image parameters and the target vertical parameter in the target image parameters. If the calculated horizontal scaling ratio and vertical scaling ratio are both greater than or equal to 1, it means that the image to be processed needs to be enlarged or not processed. At this time, the reduction processing unit does not need to reduce the image to be processed, and determines the image to be processed as an intermediate image, and determines the processing parameters of the image to be processed as intermediate image processing parameters.
[0061] Using the above example, it is necessary to enlarge the image B from 800×300 resolution to 1600×1200 resolution to obtain image B'. That is, the original horizontal parameter of image B is 800 pixels, the original vertical parameter is 300 pixels, the target horizontal parameter is 1600 pixels, and the target vertical parameter is 1200 pixels. Based on this, the horizontal scaling ratio is calculated to be 1600÷800=2, and the vertical scaling ratio is 1200÷300=4. Since both the horizontal scaling ratio and the vertical scaling ratio are greater than 1, the reduction processing unit does not need to reduce image B.
[0062] Furthermore, in a specific embodiment provided by the present invention, the method further comprises:
[0063] When the horizontal scaling ratio is less than 1, adjusting the original horizontal parameter of the image to be processed to the target horizontal parameter;
[0064] When the vertical scaling ratio is less than 1, adjusting the original vertical parameters of the image to be processed to the target vertical parameters;
[0065] Based on the target horizontal parameter and the target vertical parameter, the intermediate image is generated, and the target horizontal parameter and the target vertical parameter are determined as the intermediate image processing parameters.
[0066] Specifically, if the calculated horizontal scaling ratio is less than 1, the original horizontal parameters of the image to be processed are adjusted to the target horizontal parameters. If the calculated vertical scaling ratio is less than 1, the original vertical parameters of the image to be processed are adjusted to the target vertical parameters. Thus, an intermediate image whose image parameters are the target horizontal parameters and the target vertical parameters respectively can be obtained.
[0067] For example, it is necessary to scale image A from a resolution of 1600×1200 to a resolution of 800×300 to obtain image A'. That is, the original horizontal parameter of image A is 1600 pixels, the original vertical parameter is 1200 pixels, the target horizontal parameter is 800 pixels, and the target vertical parameter is 300 pixels. Based on this, it can be calculated that the horizontal scaling ratio of image A is 800÷1600=0.5, and the vertical scaling ratio is 300÷1200=0.25. Since both the horizontal scaling ratio and the vertical scaling ratio are less than 1, it means that image A needs to be reduced, specifically, image A is reduced from 1600 pixels to 800 pixels in the horizontal direction, and from 1200 pixels to 300 pixels in the vertical direction, so as to obtain image A' with a resolution of 800×300.
[0068] The image processing method provided by the present invention can calculate the image scaling ratio of the image to be processed by using the original image parameters and the target image parameters of the image to be processed in the reduction processing unit. In order to further ensure the accuracy of image scaling of the image to be processed, the scaling process of the image to be processed is specifically subdivided into scaling in the horizontal direction and in the vertical direction. By respectively calculating the horizontal scaling ratio and the vertical scaling ratio of the image to be processed, it is determined whether the image to be processed needs to be scaled, thereby improving the accuracy of scaling the image to be processed.
[0069] Step 106: When the writing speed of the memory is lower than the reading speed, determine the amount of image data to be cached in the memory according to the intermediate image.
[0070] In practical applications, during the image scaling process, image data will be generated and needs to be cached. At this time, the generated image data can be stored in the memory for caching. However, in the process of caching image data, if there is too much cached image data, it will occupy too much memory space of the memory, resulting in too large chip area for video transmission, increasing chip cost.
[0071] Based on this, the image processing method provided by the present invention can determine the time when the intermediate image is input from the memory to the enlargement processing unit by the write speed and read speed of the memory. By determining the time when the intermediate image is input from the memory to the enlargement processing unit, the amount of data cached in the memory of the intermediate image can be reduced, thereby reducing the memory space occupied by the image data and reducing the chip cost.
[0072] The amount of image data to be cached refers to the upper limit of the amount of image data that can be cached in the memory for intermediate images and intermediate image processing parameters, and is used to indicate that the intermediate images and intermediate image processing parameters are input from the memory to the enlargement processing unit.
[0073] Specifically, after the reduction processing unit outputs the intermediate image of the image to be processed and the intermediate image processing parameters of the intermediate image, the write speed and the read speed of the memory can be determined, and the amount of image data to be cached in the memory can be determined according to the write speed and the read speed of the memory, so that in the subsequent process, the moment to input the intermediate image and the intermediate image processing parameters into the enlargement processing unit can be determined according to the amount of image data to be cached in the memory.
[0074] In actual applications, if the writing speed and reading speed of the memory are the same, it means that during the image scaling process, no image data that needs to be cached will be generated; if the writing speed and reading speed of the memory are different, image data that needs to be cached will be generated and cached to the memory.
[0075] Based on this, if the writing speed of the memory is lower than the reading speed, that is, the writing speed of the memory is slower than the reading speed, part of the image data (that is, the intermediate image and the intermediate image processing parameters) can be written to the memory before reading. In order to reduce the occupation of the memory space of the intermediate image and the intermediate image processing parameters, the amount of image data to be cached in the memory of the intermediate image and the intermediate image processing parameters can be determined, that is, the upper limit of the amount of image data that can be cached in the memory of the intermediate image and the intermediate image processing parameters, so that the reading time of the intermediate image and the intermediate image processing parameters from the memory can be determined according to the amount of image data to be cached.
[0076] In a specific implementation manner provided by the present invention, determining the amount of image data to be cached in the memory according to the intermediate image includes:
[0077] Obtaining a time interval to be cached of the intermediate image, wherein the time interval to be cached is determined according to a reception time and an output time of a historical image, the historical image being any historical image in an image sequence to which the image to be processed belongs, and the output time being a time when the historical image is output to an output terminal;
[0078] The amount of image data to be cached in the memory is determined according to the time interval to be cached, the horizontal scaling ratio and the vertical scaling ratio.
[0079] The time interval to be cached refers to the time difference between the time when any image in the image sequence to be processed is received by the input receiving end and the time when it is output to the output end.
[0080] Specifically, after the reduction processing unit outputs the intermediate image and the intermediate image processing parameters, the cache time interval of the intermediate image is obtained, and the amount of cached image data required to be cached by the memory is determined based on the cache time interval, the horizontal scaling ratio and the vertical scaling ratio of the image to be processed.
[0081] It should be noted that since the frame rate of the image sequence to which the images to be processed belong is the same, the time required for each frame of image to be input to the receiving end and output to the output end is the same. Therefore, the time interval to be cached for each frame of image is the same, and the time interval to be cached can be directly obtained and used.
[0082] The image processing method provided by the present invention can determine the amount of image data to be cached in the memory through the intermediate image when the writing speed of the memory is lower than the reading speed, so as to determine whether the intermediate image and the intermediate image processing parameters need to be input into the enlargement processing unit according to the amount of image data to be cached in the subsequent process.
[0083] Step 108: During the process of writing the intermediate image and the intermediate image processing parameters into the memory, determine the amount of data written into the memory for the intermediate image and the intermediate image processing parameters.
[0084] In practical applications, after the amount of image data to be cached in the memory is determined, the intermediate images and intermediate image processing parameters can be input into the memory. During the period of inputting the intermediate images and intermediate image processing parameters into the memory, the amount of data written into the memory by the intermediate images and intermediate image processing parameters is determined, which is helpful for judging whether the amount of data written into the memory by the intermediate images and intermediate image processing parameters reaches the amount of image data to be cached in the memory.
[0085] Step 110: When the amount of written data reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the memory into an enlargement processing unit to obtain a target image of the image to be processed.
[0086] Specifically, when the amount of data written into the memory of the intermediate image and the intermediate image processing parameters reaches the amount of data of the image to be cached, the intermediate image and the intermediate image processing parameters are input from the memory to the enlargement processing unit, and the enlargement processing unit processes the intermediate image to obtain the target image of the image to be processed.
[0087] Further, see Figure 3 , Figure 3 FIG. 2 shows a schematic diagram of a memory output data provided according to an embodiment of the present invention. Figure 3 As shown, the write speed of the memory is lower than the read speed of the memory. Figure 3 The ellipse shown in the figure is the amount of image data to be cached in the memory. Since the writing speed of the memory is lower than the reading speed of the memory, the intermediate image and the intermediate image processing parameters written into the memory can be read after the intermediate image and the intermediate image processing parameters are written into the memory for a period of time. As described above, when the amount of data written into the intermediate image and the intermediate image processing parameters in the memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters can be read from the memory to the enlargement processing unit. Since the amount of image data to be cached is determined according to the cache time interval of the intermediate image, when the amount of data written into the memory of the intermediate image and the intermediate image processing parameters reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are read into the enlargement processing unit, so that when the writing of the intermediate image and the intermediate image processing parameters in the memory is completed, the reading of the intermediate image and the intermediate image processing parameters into the enlargement processing unit is completed, so that in the transmission process of the intermediate image and the intermediate image processing parameters, the amount of data cached into the memory is only the amount of image data to be cached, which greatly reduces the amount of cached data in the memory, saves chip area, and reduces chip cost.
[0088] The following is an explanation of the specific processing process of the memory.
[0089] In a specific implementation of the present invention, the memory includes a dual-port static memory;
[0090] During writing the intermediate image and the intermediate image processing parameters into the memory, determining the amount of data written into the memory for the intermediate image and the intermediate image processing parameters comprises:
[0091] Determining a first clock domain of the dual-port static memory;
[0092] Writing the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain;
[0093] Determining the amount of data written into the dual-port static memory for the intermediate image and the intermediate image processing parameters;
[0094] When the amount of written data reaches the amount of image data to be cached, inputting the intermediate image and the intermediate image processing parameter from the memory to the enlargement processing unit includes:
[0095] Determining a second clock domain of the dual-port static memory;
[0096] When the amount of written data in the dual-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the dual-port static memory to the enlargement processing unit based on the second clock domain.
[0097] The first clock domain and the second clock domain are two clock domains used by the dual-port static memory to transmit the intermediate image and the intermediate image processing parameters. The first clock domain is specifically used to write the intermediate image and the intermediate image processing parameters into the dual-port static memory, and the second clock domain is specifically used to input the intermediate image and the intermediate image processing parameters from the memory into the amplification processing unit. For example, the frequency of the first clock domain may be 60 MHz, and the frequency of the second clock domain may be 100 MHz.
[0098] Specifically, in the case where the memory includes a dual-port static memory, the dual-port static memory can be used for both cross-clock domain processing and caching intermediate images and intermediate image processing parameters. After the reduction processing unit outputs the intermediate image and the intermediate image processing parameters, the first clock domain of the dual-port static memory is determined, and the intermediate image and the intermediate image processing parameters are written into the dual-port static memory based on the first clock domain, and the amount of data written into the intermediate image and the intermediate image processing parameters in the dual-port static memory is determined. The second clock domain of the dual-port static memory is determined, and when the amount of data written into the intermediate image and the intermediate image processing parameters in the dual-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the dual-port static memory into the enlargement processing unit based on the second clock domain.
[0099] Furthermore, in order to further save chip area, two memories may be deployed to implement the above process.
[0100] Based on this, in a specific implementation manner provided by the present invention, the memory includes a dual-port static memory and a single-port static memory;
[0101] During writing the intermediate image and the intermediate image processing parameters into the memory, determining the amount of data written into the memory for the intermediate image and the intermediate image processing parameters comprises:
[0102] Determine a first clock domain and a second clock domain of the dual-port static memory;
[0103] Writing the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain;
[0104] writing the intermediate image and the intermediate image processing parameter from the dual-port static memory to the single-port static memory based on the second clock domain;
[0105] Determining the amount of data written into the single-port static memory for the intermediate image and the intermediate image processing parameters;
[0106] When the amount of written data reaches the amount of image data to be cached, inputting the intermediate image and the intermediate image processing parameter from the memory to the enlargement processing unit includes:
[0107] When the amount of written data in the single-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input into the enlargement processing unit from the dual-port static memory and the single-port static memory.
[0108] Specifically, in the case where the memory includes a dual-port static memory and a single-port static memory, the dual-port static memory can be used for cross-clock domain processing, and the single-port static memory can be used for caching intermediate images and intermediate image processing parameters. After the reduction processing unit outputs the intermediate image and the intermediate image processing parameters, the first clock domain and the second clock domain of the dual-port static memory are determined, and based on the first clock domain, the intermediate image and the intermediate image processing parameters are written into the dual-port static memory, and based on the second clock domain, the intermediate image and the intermediate image processing parameters are written into the single-port static memory. The amount of data written into the intermediate image and the intermediate image processing parameters in the single-port static memory is determined, and when the amount of data written into the intermediate image and the intermediate image processing parameters in the single-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the dual-port static memory and the single-port static memory into the enlargement processing unit.
[0109] By deploying dual-port static memory and single-port static memory, the dual-port static memory is used for cross-clock domain processing, and the single-port static memory is used to cache intermediate images and intermediate image processing parameters, which can further save chip area and reduce chip cost.
[0110] Furthermore, if the writing speed of the memory is faster than the reading speed, in order to reduce the image data cached in the memory as much as possible, the intermediate image and the intermediate image processing parameters can be input into the enlargement processing unit at the same time as the intermediate image and the intermediate image processing parameters are written into the memory by the reduction processing unit. Since the enlargement processing unit starts to read data from the memory when the intermediate image and the intermediate image processing parameters are written into the memory, after the intermediate image and the intermediate image processing parameters are written into the memory, the data that the enlargement processing unit needs to read is specifically the amount of image data to be cached in the memory, thereby reducing the amount of data of the intermediate image and the intermediate image processing parameters cached in the memory.
[0111] See also Figure 4 , Figure 4 FIG. 2 shows a schematic diagram of another memory outputting data according to an embodiment of the present invention. Figure 4 As shown, the write speed of the memory is higher than the read speed of the memory. Figure 4 The ellipse shown in the figure is the amount of image data to be cached in the memory. Since the writing speed of the memory is higher than the reading speed of the memory, the intermediate image and the intermediate image processing parameters in the memory can be read when the intermediate image and the intermediate image processing parameters are written into the memory. In this way, since the amount of image data to be cached is determined according to the cache time interval of the intermediate image, when the intermediate image and the intermediate image processing parameters are written into the memory, the amount of image data that the enlargement processing unit needs to read again is the amount of image data to be cached in the memory. Therefore, in the transmission process of the intermediate image and the intermediate image processing parameters, the amount of data cached in the memory is only the amount of image data to be cached, which greatly reduces the amount of cached data in the memory, saves chip area, and reduces chip cost.
[0112] After the intermediate image and the intermediate image processing parameters are input from the memory to the enlargement processing unit, the enlargement processing unit can enlarge the intermediate image or output the target image without processing it.
[0113] The following combination Figure 5 , with memory including dual-port static memory (i.e. Figure 5 The dual-port SRAM shown in Figure 1) and the single-port static memory (i.e. Figure 5 The image magnification process is explained using the single-port SRAM shown in Figure 1 as an example. Figure 5 , Figure 5 FIG. 4 shows a flow chart of an image magnification process provided according to an embodiment of the present invention. Figure 5 As shown, after receiving the image to be processed and the image processing parameters to be processed of the image to be processed ( Figure 5(not shown), the image to be processed and the processing parameters of the image to be processed are input into the reduction processing unit, and the reduction processing unit determines not to perform reduction processing on the image to be processed according to the processing parameters of the image to be processed, and outputs the image to be processed as an intermediate image, and outputs the processing parameters of the image to be processed as intermediate image processing parameters. Specifically, the intermediate image and the intermediate image processing parameters are written into the dual-port static memory, and after the dual-port static memory performs cross-clock domain processing, the intermediate image and the intermediate image processing parameters are input into the enlargement processing unit; at the same time, because the reading speed is lower than the writing speed, the dual-port static memory writes the extra data into the single-port static memory and caches it in the single-port static memory; in Figure 4 When the writing time in the data is completed, the single-port static memory caches the data of the image data to be cached, and the single-port static memory continues to output the data to the enlargement processing unit. Then, the enlargement processing unit enlarges the intermediate image according to the intermediate image processing parameters, obtains the target image of the enlarged image size, and outputs the target image.
[0114] After reading the intermediate image and the intermediate image processing parameters, the enlargement processing unit can determine whether it is necessary to enlarge the intermediate image according to the intermediate image and the intermediate image processing parameters. The specific implementation method is as follows:
[0115] In a specific embodiment of the present invention, the intermediate image and the intermediate image processing parameters are input from the memory into the enlargement processing unit to obtain the target image of the image to be processed, including:
[0116] Calculating a horizontal scaling ratio of the intermediate image according to an original horizontal parameter in the original image parameters and a target horizontal parameter in the target image parameters;
[0117] Calculating a vertical scaling ratio of the intermediate image according to an original vertical parameter in the original image parameters and a target vertical parameter in the target image parameters;
[0118] When the horizontal scaling ratio is greater than 1, adjusting the original horizontal parameter of the intermediate image to the target horizontal parameter;
[0119] When the vertical scaling ratio is greater than 1, adjusting the original vertical parameters of the intermediate image to the target vertical parameters;
[0120] A target image is generated based on the target horizontal parameter and the target vertical parameter.
[0121] Similar to the above-mentioned reduction processing method, specifically, after acquiring the intermediate image and the intermediate image processing parameters, the enlargement processing unit calculates the image scaling ratio of the intermediate image according to the original image parameters and the target image parameters in the intermediate image processing parameters. Specifically, the horizontal scaling ratio of the intermediate image is calculated according to the original horizontal parameter and the target horizontal parameter, and the vertical scaling ratio of the intermediate image is calculated according to the original vertical parameter and the target vertical parameter. If the calculated horizontal scaling ratio is greater than 1, the original horizontal parameter of the intermediate image is adjusted to the target horizontal parameter, and if the calculated vertical scaling ratio is greater than 1, the original vertical parameter of the intermediate image is adjusted to the target vertical parameter, thereby obtaining a target image whose image parameters are the target horizontal parameter and the target vertical parameter, respectively.
[0122] If the calculated horizontal scaling ratio and vertical scaling ratio are both less than or equal to 1, it means that there is no need to enlarge the intermediate image. At this time, the enlargement processing unit does not need to enlarge the intermediate image, and thus determines that the intermediate image is the target image.
[0123] For example, it is necessary to enlarge the image B from a resolution of 800×300 to a resolution of 1600×1200 to obtain image B'. That is, the original horizontal parameter of image B is 800 pixels, the original vertical parameter is 300 pixels, the target horizontal parameter is 1600 pixels, and the target vertical parameter is 1200 pixels. Based on this, the horizontal scaling ratio is calculated to be 1600÷800=2, and the vertical scaling ratio is 1200÷300=4. Since both the horizontal scaling ratio and the vertical scaling ratio are greater than 1, it means that image B needs to be enlarged, specifically, image B is enlarged from 800 pixels to 1600 pixels in the horizontal direction and from 300 pixels to 1200 pixels in the vertical direction, so as to obtain image B' with a resolution of 1600×1200.
[0124] The image processing method provided by the present invention comprises: receiving an image to be processed and image processing parameters of the image to be processed, wherein the image processing parameters include original image parameters of the image to be processed and target image parameters of a target image to be output; inputting the image to be processed and the image processing parameters into a reduction processing unit to obtain an intermediate image of the image to be processed and intermediate image processing parameters of the intermediate image; determining the amount of image data to be cached in the memory according to the intermediate image when a writing speed of the memory is lower than a reading speed; determining the amount of written data of the intermediate image and the intermediate image processing parameters in the memory during writing the intermediate image and the intermediate image processing parameters into the memory; and inputting the intermediate image and the intermediate image processing parameters from the memory into an enlargement processing unit to obtain the target image of the image to be processed when the written data amount reaches the amount of image data to be cached.
[0125] An embodiment of the present invention realizes that, by receiving an image to be processed and image processing parameters of the image to be processed, an intermediate image and intermediate image processing parameters are obtained after the image to be processed is processed by a reduction processing unit based on the image processing parameters, and further, according to the writing speed and the reading speed of the memory, it is determined whether the intermediate image and the intermediate image processing parameters need to be input into the enlargement processing unit for processing, and according to the amount of image data to be cached in the memory and the amount of data written to the memory, it is determined whether the intermediate image and the intermediate image processing parameters need to be input into the enlargement processing unit, thereby achieving the control of the amount of data written to the memory based on the amount of image data to be cached in the memory, reducing the amount of image data that needs to be cached during the image processing process, so as to reduce the chip cost.
[0126] The specific implementation details of the above embodiment are described below with an example.
[0127] The following combination Figure 6 , taking the image reduction scene as an example, the image processing method provided by the embodiment of the present invention is further explained. Figure 6 A processing flow chart of an image processing method provided according to an embodiment of the present invention is shown, which specifically includes the following steps:
[0128] Step 602: receiving an image to be processed and image processing parameters of the image to be processed.
[0129] Specifically, image A and original image parameters of image A with a resolution of 1600×1200 are received, and target image parameters of image A′ to be output with a resolution of 800×300 are received.
[0130] Step 604: input the image to be processed and the processing parameters of the image to be processed into a reduction processing unit to obtain an intermediate image of the image to be processed and the intermediate image processing parameters of the intermediate image.
[0131] Specifically, image A and the original image parameters of image A with a resolution of 1600×1200, and the target image parameters of image A' to be output with a resolution of 800×300 are input into the reduction processing unit. The reduction processing unit calculates the horizontal scaling ratio of image A as 800÷1600=0.5 and the vertical scaling ratio as 300÷1200=0.25. Since both the horizontal scaling ratio and the vertical scaling ratio are less than 1, it means that image A needs to be reduced, specifically, image A is reduced from 1600 pixels to 800 pixels in the horizontal direction and from 1200 pixels to 300 pixels in the vertical direction, so as to obtain image A' with a resolution of 800×300. Image A' is determined as an intermediate image, and the resolution of 800×300 is determined as the intermediate image processing parameter.
[0132] Step 606: When the writing speed of the single-port static memory is lower than the reading speed, determine the amount of image data to be cached in the single-port static memory according to the intermediate image.
[0133] Specifically, the time interval to be cached of the image A' is obtained, and the amount of image data to be cached in the single-port static memory is determined according to the time interval to be cached, the horizontal scaling ratio, and the vertical scaling ratio.
[0134] Step 608: Determine the first clock domain and the second clock domain of the dual-port static memory.
[0135] Step 610: Write the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain, and write the intermediate image and the intermediate image processing parameters from the dual-port static memory to the single-port static memory based on the second clock domain.
[0136] Step 612: Determine the amount of data written into the single-port static memory for the intermediate image and the intermediate image processing parameters.
[0137] Step 614: When the amount of written data in the single-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input into the enlargement processing unit from the dual-port static memory and the single-port static memory to obtain the target image of the image to be processed.
[0138] Specifically, the enlargement processing unit does not enlarge the image A', but determines the image A' as the target image and outputs it.
[0139] Step 616: When the write speed of the single-port static memory is higher than or equal to the read speed, determine the first clock domain and the second clock domain of the dual-port static memory.
[0140] Step 618: Write the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain, and write the intermediate image and the intermediate image processing parameters from the dual-port static memory to the single-port static memory based on the second clock domain.
[0141] Step 620: Input the intermediate image and the intermediate image processing parameters from the dual-port static memory and the single-port static memory into an enlargement processing unit to obtain a target image of the image to be processed.
[0142] An embodiment of the present invention realizes that the amount of image data to be cached in the single-port static memory can be determined by the intermediate image according to the difference between the writing speed and the reading speed of the single-port static memory, so as to determine the time when the intermediate image and the intermediate image processing parameters need to be input into the amplification processing unit according to the amount of image data to be cached, thereby reducing the amount of cached data in the single-port static memory, saving chip area, and reducing chip cost. Cross-clock domain processing is also performed based on the dual-port static memory, further saving chip area and reducing cost.
[0143] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.
[0144] In a second aspect, an embodiment of the present invention provides an image processing device. Figure 7 A schematic diagram of the structure of an image processing device provided according to an embodiment of the present invention is shown, the image processing device comprising: a reduction processing unit 702, a memory 704, an enlargement processing unit 706 and a processing unit 708;
[0145] The reduction processing unit 702 is used to: receive an image to be processed and an image processing parameter of the image to be processed, and output an intermediate image of the image to be processed and the intermediate image processing parameter of the intermediate image;
[0146] The processing unit 708 is used to: control the memory to receive the intermediate image and the intermediate image processing parameters of the intermediate image; determine the amount of image data to be cached in the memory according to the intermediate image when the writing speed of the memory is lower than the reading speed; determine the amount of written data of the intermediate image and the intermediate image processing parameters in the memory during writing the intermediate image and the intermediate image processing parameters into the memory; and control the memory to input the intermediate image and the intermediate image processing parameters into the enlargement processing unit when the written data amount reaches the amount of image data to be cached;
[0147] The enlargement processing unit 706 is used to receive the intermediate image and the intermediate image processing parameters, and output the target image of the image to be processed.
[0148] Optionally, the memory 704 includes a dual-port static memory and a single-port static memory;
[0149] The processing unit 708 is used for:
[0150] Determine a first clock domain and a second clock domain of the dual-port static memory;
[0151] Writing the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain;
[0152] writing the intermediate image and the intermediate image processing parameter from the dual-port static memory to the single-port static memory based on the second clock domain;
[0153] Determining the amount of data written into the single-port static memory for the intermediate image and the intermediate image processing parameters;
[0154] The processing unit 708 is used for:
[0155] When the amount of written data in the single-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input into the enlargement processing unit from the dual-port static memory and the single-port static memory.
[0156] Optionally, the memory 704 includes a dual-port static memory;
[0157] The processing unit 708 is used for:
[0158] Determining a first clock domain of the dual-port static memory;
[0159] Writing the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain;
[0160] Determining the amount of data written into the dual-port static memory for the intermediate image and the intermediate image processing parameters;
[0161] The processing unit 708 is used for:
[0162] Determining a second clock domain of the dual-port static memory;
[0163] When the amount of written data in the dual-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the dual-port static memory to the enlargement processing unit based on the second clock domain.
[0164] Optionally, the reduction processing unit 702 is used to:
[0165] Calculating a horizontal scaling ratio of the image to be processed according to an original horizontal parameter in the original image parameters and a target horizontal parameter in the target image parameters;
[0166] Calculating a vertical scaling ratio of the image to be processed according to an original vertical parameter in the original image parameters and a target vertical parameter in the target image parameters;
[0167] When the horizontal scaling ratio and the vertical scaling ratio are both greater than or equal to 1, the image to be processed is determined as an intermediate image, and the processing parameters of the image to be processed are determined as intermediate image processing parameters.
[0168] Optionally, the reduction processing unit 702 is further configured to:
[0169] When the horizontal scaling ratio is less than 1, adjusting the original horizontal parameter of the image to be processed to the target horizontal parameter;
[0170] When the vertical scaling ratio is less than 1, adjusting the original vertical parameters of the image to be processed to the target vertical parameters;
[0171] Based on the target horizontal parameter and the target vertical parameter, the intermediate image is generated, and the target horizontal parameter and the target vertical parameter are determined as the intermediate image processing parameters.
[0172] Optionally, the processing unit 708 is configured to:
[0173] Obtaining a time interval to be cached of the intermediate image, wherein the time interval to be cached is determined according to a reception time and an output time of a historical image, the historical image being any historical image in an image sequence to which the image to be processed belongs, and the output time being a time when the historical image is output to an output terminal;
[0174] The amount of image data to be cached in the memory is determined according to the time interval to be cached, the horizontal scaling ratio and the vertical scaling ratio.
[0175] Optionally, the amplification processing unit 706 is used to:
[0176] Calculating a horizontal scaling ratio of the intermediate image according to an original horizontal parameter in the original image parameters and a target horizontal parameter in the target image parameters;
[0177] Calculating a vertical scaling ratio of the intermediate image according to an original vertical parameter in the original image parameters and a target vertical parameter in the target image parameters;
[0178] When the horizontal scaling ratio is greater than 1, adjusting the original horizontal parameter of the intermediate image to the target horizontal parameter;
[0179] When the vertical scaling ratio is greater than 1, adjusting the original vertical parameters of the intermediate image to the target vertical parameters;
[0180] A target image is generated based on the target horizontal parameter and the target vertical parameter.
[0181] The image processing device provided by the present invention includes: a reduction processing unit, a memory, an enlargement processing unit and a processing unit; the reduction processing unit is used to: receive an image to be processed and image processing parameters of the image to be processed, and output an intermediate image of the image to be processed and intermediate image processing parameters of the intermediate image; the processing unit is used to: control the memory to receive the intermediate image and the intermediate image processing parameters of the intermediate image; when the writing speed of the memory is lower than the reading speed, determine the amount of image data to be cached in the memory according to the intermediate image; during the period of writing the intermediate image and the intermediate image processing parameters into the memory, determine the amount of written data of the intermediate image and the intermediate image processing parameters in the memory; when the written data amount reaches the amount of image data to be cached, control the memory to input the intermediate image and the intermediate image processing parameters into the enlargement processing unit; the enlargement processing unit is used to: receive the intermediate image and the intermediate image processing parameters, and output the target image of the image to be processed.
[0182] An embodiment of the present invention realizes that, by receiving an image to be processed and image processing parameters of the image to be processed, an intermediate image and intermediate image processing parameters are obtained after the image to be processed is processed by a reduction processing unit based on the image processing parameters, and further, according to the writing speed and the reading speed of the memory, it is determined whether the intermediate image and the intermediate image processing parameters need to be input into the enlargement processing unit for processing, and according to the amount of image data to be cached in the memory and the amount of data written to the memory, it is determined whether the intermediate image and the intermediate image processing parameters need to be input into the enlargement processing unit, thereby achieving the control of the amount of data written to the memory based on the amount of image data to be cached in the memory, reducing the amount of image data that needs to be cached during the image processing process, so as to reduce the chip cost.
[0183] The functions or modules included in the device provided in the embodiment of the present invention can be used to execute the method described in the first aspect method embodiment above. Its specific implementation and technical effects can refer to the description of the above method embodiment. For the sake of brevity, they will not be repeated here.
[0184] It should be noted that all modules involved in this embodiment are logic modules. In practical applications, a logic unit may be a physical unit, or a part of a physical unit, or may be implemented as a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other units in this embodiment.
[0185] Reference Figure 8 , an embodiment of the present invention provides an electronic device, comprising:
[0186] One or more processors 801;
[0187] A memory 802 having one or more programs stored thereon, which, when executed by one or more processors, enables the one or more processors to implement any one of the above-mentioned image processing methods;
[0188] One or more I / O interfaces 803 are connected between the processor and the memory and are configured to implement information exchange between the processor and the memory.
[0189] Among them, the processor 801 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 802 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) 803 is connected between the processor 801 and the memory 802, and can realize information interaction between the processor 801 and the memory 802, including but not limited to a data bus (Bus), etc.
[0190] In some embodiments, the processor 801 , the memory 802 , and the I / O interface 803 are connected to each other via a bus, and further connected to other components of the computing device.
[0191] This embodiment further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the image processing method provided by this embodiment is implemented. To avoid repeated description, the specific steps of the image processing method are not repeated here.
[0192] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the invented method described above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0193] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0194] Those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present embodiment and to form different embodiments.
[0195] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.
Claims
1. An image processing method, characterized in that: include: Receiving an image to be processed and image processing parameters of the image to be processed, wherein the image processing parameters include original image parameters of the image to be processed and target image parameters of a target image to be output; Inputting the image to be processed and the processing parameters of the image to be processed into a reduction processing unit to obtain an intermediate image of the image to be processed and the intermediate image processing parameters of the intermediate image; When the writing speed of the memory is lower than the reading speed, determining the amount of image data to be cached in the memory according to the intermediate image; During writing the intermediate image and the intermediate image processing parameters into the memory, determining the amount of data written into the memory for the intermediate image and the intermediate image processing parameters; When the amount of written data reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the memory to an enlargement processing unit to obtain a target image of the image to be processed.
2. The method according to claim 1, characterized in that The memory includes a dual-port static memory and a single-port static memory; During writing the intermediate image and the intermediate image processing parameters into the memory, determining the amount of data written into the memory for the intermediate image and the intermediate image processing parameters comprises: Determine a first clock domain and a second clock domain of the dual-port static memory; Writing the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain; writing the intermediate image and the intermediate image processing parameter from the dual-port static memory to the single-port static memory based on the second clock domain; Determining the amount of data written into the single-port static memory for the intermediate image and the intermediate image processing parameters; When the amount of written data reaches the amount of image data to be cached, inputting the intermediate image and the intermediate image processing parameter from the memory to the enlargement processing unit includes: When the amount of written data in the single-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input into the enlargement processing unit from the dual-port static memory and the single-port static memory.
3. The method according to claim 1, characterized in that The memory includes a dual-port static memory; During writing the intermediate image and the intermediate image processing parameters into the memory, determining the amount of data written into the memory for the intermediate image and the intermediate image processing parameters comprises: Determining a first clock domain of the dual-port static memory; Writing the intermediate image and the intermediate image processing parameters into the dual-port static memory based on the first clock domain; Determining the amount of data written into the dual-port static memory for the intermediate image and the intermediate image processing parameters; When the amount of written data reaches the amount of image data to be cached, inputting the intermediate image and the intermediate image processing parameter from the memory to the enlargement processing unit includes: Determining a second clock domain of the dual-port static memory; When the amount of written data in the dual-port static memory reaches the amount of image data to be cached, the intermediate image and the intermediate image processing parameters are input from the dual-port static memory to the enlargement processing unit based on the second clock domain.
4. The method according to claim 1, characterized in that Inputting the image to be processed and the processing parameters of the image to be processed into a reduction processing unit to obtain an intermediate image of the image to be processed and the intermediate image processing parameters of the intermediate image, including: Calculating a horizontal scaling ratio of the image to be processed according to an original horizontal parameter in the original image parameters and a target horizontal parameter in the target image parameters; Calculating a vertical scaling ratio of the image to be processed according to an original vertical parameter in the original image parameters and a target vertical parameter in the target image parameters; When the horizontal scaling ratio and the vertical scaling ratio are both greater than or equal to 1, the image to be processed is determined as an intermediate image, and the processing parameters of the image to be processed are determined as intermediate image processing parameters.
5. The method according to claim 4, characterized in that The method further comprises: When the horizontal scaling ratio is less than 1, adjusting the original horizontal parameter of the image to be processed to the target horizontal parameter; When the vertical scaling ratio is less than 1, adjusting the original vertical parameters of the image to be processed to the target vertical parameters; Based on the target horizontal parameter and the target vertical parameter, the intermediate image is generated, and the target horizontal parameter and the target vertical parameter are determined as the intermediate image processing parameters.
6. The method according to claim 4, characterized in that Determining the amount of image data to be cached in the memory according to the intermediate image includes: Obtaining a time interval to be cached of the intermediate image, wherein the time interval to be cached is determined according to a reception time and an output time of a historical image, the historical image being any historical image in an image sequence to which the image to be processed belongs, and the output time being a time when the historical image is output to an output terminal; The amount of image data to be cached in the memory is determined according to the time interval to be cached, the horizontal scaling ratio and the vertical scaling ratio.
7. The method according to claim 1, characterized in that Inputting the intermediate image and the intermediate image processing parameters from the memory into the enlargement processing unit to obtain the target image of the image to be processed, comprising: Calculating a horizontal scaling ratio of the intermediate image according to an original horizontal parameter in the original image parameters and a target horizontal parameter in the target image parameters; Calculating a vertical scaling ratio of the intermediate image according to an original vertical parameter in the original image parameters and a target vertical parameter in the target image parameters; When the horizontal scaling ratio is greater than 1, adjusting the original horizontal parameter of the intermediate image to the target horizontal parameter; When the vertical scaling ratio is greater than 1, adjusting the original vertical parameters of the intermediate image to the target vertical parameters; A target image is generated based on the target horizontal parameter and the target vertical parameter.
8. An image processing device, characterized in that: include: a reduction processing unit, a memory, an enlargement processing unit, and a processing unit; The reduction processing unit is used to: receive an image to be processed and image processing parameters of the image to be processed, and output an intermediate image of the image to be processed and the intermediate image processing parameters of the intermediate image; The processing unit is used for: Controlling the memory to receive the intermediate image and the intermediate image processing parameter of the intermediate image; When the writing speed of the memory is lower than the reading speed, determining the amount of image data to be cached in the memory according to the intermediate image; During writing the intermediate image and the intermediate image processing parameters into the memory, determining the amount of data written into the memory for the intermediate image and the intermediate image processing parameters; When the amount of written data reaches the amount of image data to be cached, controlling the memory to input the intermediate image and the intermediate image processing parameter into the enlargement processing unit; The enlargement processing unit is used to receive the intermediate image and the intermediate image processing parameters, and output the target image of the image to be processed.
9. An electronic device, characterized in that: include: one or more processors; A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7; One or more I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.
10. A computer-readable medium, characterized in that A computer program is stored thereon, and when the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.