Image processing method, device and equipment
By using a low-overhead cache matrix in image processing to cache and interpolate input images, the problem of low image processing efficiency in the existing technology is solved, and more efficient data utilization and processing efficiency are achieved.
Patent Information
- Application Number
- CN202411444994.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-01-21
AI Technical Summary
In the case where the bus bit width is large, the existing image processing method leads to low data utilization, thereby reducing image processing efficiency.
Through a low -expense and high -speed cache matrix, the input image is cached and interpolation processing is performed to improve the utilization rate of data, thereby improving image processing efficiency.
Improve the efficiency of image processing, through the use of cache matrix, optimize the processing process of data, and reduce waste of bus bandwidth.
Smart Images

Figure CN119338665A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device and equipment. Background Art
[0002] In the field of image processing technology, affine algorithms and projection algorithms can be used to implement functions such as image rotation, scaling, and distortion correction.
[0003] The existing hardware implementation scheme of image affine or image projection first uses a dedicated circuit to complete the coordinate operation of mapping each output point to the input image one by one, then completes the reading of the input pixel data at the corresponding position through DMA, and finally obtains the output pixel value through interpolation operation. However, since the input pixels used to calculate a single pixel output point are relatively small, this method will greatly waste the bus width when the bus width is large, making the data utilization rate low, which in turn leads to the problem of low image processing efficiency.
[0004] Therefore, how to improve the efficiency of image processing is a problem that technical personnel in this field need to solve urgently. Summary of the invention
[0005] Based on the above problems, the embodiments of the present application provide a method, apparatus and device for image processing, which improve data utilization through a low-overhead cache matrix, thereby improving image processing efficiency.
[0006] In a first aspect, an embodiment of the present application provides an image processing method, comprising:
[0007] Obtaining task information; the task information includes command information and preset performance indicators;
[0008] Mapping based on an image processing algorithm obtains input point coordinates of the input image corresponding to output point coordinates of the output image; the image processing algorithm includes an affine algorithm and a projection algorithm;
[0009] Cache the input image into a Cache matrix consisting of n Caches based on the input point coordinates; n is any value from 4 to 128;
[0010] Filtering the input pixel values corresponding to the input point coordinates;
[0011] Performing interpolation processing on the input pixel value based on an interpolation algorithm to obtain an output pixel value;
[0012] Write the output pixel value out to main memory.
[0013] Optionally, the mapping based on the image processing algorithm to obtain the input point coordinates of the input image corresponding to the output point coordinates of the output image includes:
[0014] Divide the output image into at least one square block;
[0015] Based on an image processing algorithm, the output point coordinates in each of the square blocks are mapped to obtain the input point coordinates of the corresponding input image.
[0016] Optionally, the filtering of the input pixel value corresponding to the input point coordinates includes:
[0017] Based on the input point coordinates, grouping the output points in each of the square blocks corresponding to the same n×n segmented input image;
[0018] Based on the mapping relationship between the output point coordinates and the input point coordinates, the input pixel values corresponding to the output points in each group are read respectively.
[0019] Optionally, the method further includes:
[0020] Based on a preset time interval, regularly collect operating status data, and calculate operating performance indicators based on the operating status data;
[0021] Comparing the operating performance index with the preset performance index and obtaining a comparison result; the comparison result includes whether the performance meets the standard or not;
[0022] Image processing is performed according to the comparison result.
[0023] Optionally, performing image processing according to the comparison result includes:
[0024] When the comparison result shows that the performance meets the standard, continue to check whether the task corresponding to the current task information is completed;
[0025] If not completed, continue to regularly collect the operating status data based on the preset time interval, calculate the operating performance index, and determine the comparison result;
[0026] If completed, determine whether all slices have been completed;
[0027] If all slices are completed, the feedback image is completed interrupt;
[0028] If all slices have not been completed, a prompt will be given that the task corresponding to the current task information has been completed, and the remaining slice tasks will continue.
[0029] Optionally, performing image processing according to the comparison result includes:
[0030] When the comparison result shows that the performance does not meet the standard, a feedback is given that the performance does not meet the standard interruption;
[0031] The acquisition software analyzes the running status data and provides feedback based on the performance non-compliance interrupt; the kill instruction supports the task kill at any time;
[0032] The current task is canceled based on the kill instruction.
[0033] Optionally, the method further includes:
[0034] The acquisition software analyzes the operation status data and feeds back a slice size adjustment instruction based on the performance non-compliance interruption;
[0035] The output image is re-sliced based on the slice resizing instructions.
[0036] Optionally, writing the output pixel value to a main memory comprises:
[0037] Merging the output pixel values corresponding to the output points of the same square block to restore the square output block with the same size as the square block;
[0038] Write the square output block out to main memory.
[0039] In a second aspect, an embodiment of the present application provides an image processing device, including:
[0040] A register conversion module, used to obtain task information; the task information includes command information and performance indicators;
[0041] A mapping module, used for mapping based on an image processing algorithm to obtain input point coordinates of an input image corresponding to output point coordinates of an output image; the image processing algorithm includes an affine algorithm and a projection algorithm;
[0042] A read memory module, used for caching the input image into a cache matrix consisting of n caches based on the input point coordinates; wherein n is any value from 4 to 128;
[0043] A screening module, used for screening the input pixel values corresponding to the input point coordinates;
[0044] An interpolation processing module, used to perform interpolation processing on the input pixel value based on an interpolation algorithm to obtain an output pixel value;
[0045] A write memory module is used to write the output pixel value to the main memory.
[0046] In a third aspect, an embodiment of the present application provides an image processing device, including:
[0047] Memory for storing computer programs;
[0048] A processor is used to implement the steps of the image processing method described above when executing the computer program.
[0049] It can be seen from the above technical solutions that compared with the prior art, the present application has the following advantages:
[0050] The present application first obtains task information. The task information includes command information and preset performance indicators. Then, based on the image processing algorithm mapping, the input point coordinates of the input image corresponding to the output point coordinates of the output image are obtained. The image processing algorithm includes an affine algorithm and a projection algorithm. Then, based on the input point coordinates, the input image is cached in a cache matrix composed of n caches. Where n is any value from 4 to 128. Then, the input pixel values corresponding to the input point coordinates are screened. Finally, the input pixel values are interpolated based on the interpolation algorithm to obtain the output pixel values, and the output pixel values are written to the main memory. In this way, the utilization of data is improved through a low-overhead cache matrix, thereby improving the efficiency of image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A schematic diagram of a circuit scheme provided in an embodiment of the present application;
[0052] Figure 2 A flowchart of an image processing method provided in an embodiment of the present application;
[0053] Figure 3 A flowchart of software and hardware collaboration provided in an embodiment of the present application;
[0054] Figure 4 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] As mentioned above, existing image processing methods have the problem of low processing efficiency. Specifically, most existing image processing methods use DMA to complete the reading of input pixel data at the corresponding position. Since the commonly used bilinear interpolation algorithm only requires four input point pixels to obtain a single pixel output point, the utilization rate of DMA reading data is low when the bus width is relatively large, which greatly wastes the bus bandwidth. In addition, this calculation method also does not take advantage of the fact that each output point is still spatially adjacent after being mapped to the input, resulting in the problem that the output of adjacent points still needs to be re-obtained, further exacerbating the waste of bus bandwidth and resulting in low image processing efficiency.
[0056] To solve the above problems, the present application provides an image processing method, comprising: first obtaining task information. The task information includes command information and preset performance indicators. Then, based on the image processing algorithm mapping, the input point coordinates of the input image corresponding to the output point coordinates of the output image are obtained. The image processing algorithm includes an affine algorithm and a projection algorithm. Then, based on the input point coordinates, the input image is cached into a cache matrix composed of n caches. Wherein, n is any value from 4 to 128. Then, the input pixel value corresponding to the input point coordinate is screened. Finally, the input pixel value is interpolated based on the interpolation algorithm to obtain the output pixel value, and the output pixel value is written to the main memory.
[0057] In this way, data utilization is improved through a low-overhead cache matrix, thereby improving image processing efficiency.
[0058] It should be noted that the image processing method, device and equipment provided by the present application can be applied to the field of image processing technology. The above is only an example and does not limit the application field of the image processing method, device and equipment provided by the present application.
[0059] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0060] Figure 1 A schematic diagram of a circuit scheme provided in an embodiment of the present application. Figure 1As shown, the circuit scheme includes a control processor and a control bus in the software part; a read memory, a cache matrix, a control calculation logic, a performance monitoring module, a register conversion module and a write memory in the hardware part; and a storage body for storing input images and output images. The control processor is used to send data content to the hardware through the control bus. The read memory is used to read the input image from the storage body. Specifically, the read data request of each cache in the cache matrix can be converted into the form of a standard bus interface, and the data fed back by the main memory is returned to the specified cache; the cache matrix is used to cache the input image; the control calculation logic is composed of four sub-modules, namely, Index Calculate, Request Block Divide, Data Mux and Interpolation Data Packet, which are used to calculate the mapping coordinates from the output to the input according to the affine or projection protocol, and read the corresponding input pixel value from the cache matrix, and obtain the output pixel value according to a specific interpolation algorithm; the performance monitoring module is used to regularly check the hardware operation status and perform statistics and feedback on the performance indicators; the register conversion module is used to classify, store, convert and send the control signal sent by the software through the control bus; the write memory is used to write out the output image. Specifically, the write data request may be converted into a standard bus interface format and written to the main memory.
[0061] Figure 2 A flowchart of an image processing method provided in an embodiment of the present application. Figure 2 As shown, an image processing method provided by an embodiment of the present application may include:
[0062] S201: Acquire task information; the task information includes command information and preset performance indicators.
[0063] In actual applications, users can control the software to send task information to the hardware through the control bus, and the hardware starts the image processing process after obtaining the task information. Specifically, the task information includes command information and preset performance indicators. The preset performance indicators include cache hit rate and pixel per cycle, etc.
[0064] S202: Mapping based on an image processing algorithm obtains input point coordinates of the input image corresponding to output point coordinates of the output image; the image processing algorithm includes an affine algorithm and a projection algorithm.
[0065] In practical applications, the image size of the input image and the image size of the output image are known. The control calculation logic in the hardware can select the pixel points on the output image in order from top to bottom and from left to right, and map the output point coordinates corresponding to the pixel points to the input point coordinates of the input image based on the image processing algorithm. Taking the four pixel points of the output image as an example, assuming that the output point coordinates are (0, 0), (0, 1), (1, 0) and (1, 1), the input image may be distorted relative to the output image. The image processing process is to dedistort the input image. Therefore, although the output image and the input image have the same size, the coordinates of the corresponding feature pixel points are not exactly the same. For example, the output point coordinate (0, 0) may be mapped to the input point coordinate on the input image (1, 1), and the output point coordinate (0, 1) may be mapped to the input point coordinate on the input image (1, 0), and so on. The output point coordinates can be well mapped to the input point coordinates of the input image through the image processing algorithm, wherein the image processing algorithm includes an affine algorithm and a projection algorithm.
[0066] In addition, since the methods for obtaining the coordinates of the input points of the input image are not the same, the embodiment of the present application can illustrate a possible acquisition method.
[0067] In one embodiment, the mapping based on the image processing algorithm to obtain the input point coordinates of the input image corresponding to the output point coordinates of the output image includes:
[0068] Divide the output image into at least one square block;
[0069] Based on an image processing algorithm, the output point coordinates in each of the square blocks are mapped to obtain the corresponding input point coordinates of the input image.
[0070] In practical applications, the size of the output image is generally large. In order to improve the parallel capability of the output pixels, the embodiment of the present application can use Index Calculate to divide the output image into a number of a-column × a-row square blocks in the horizontal direction and then in the vertical direction, and then perform parallel processing in square blocks. Based on the image processing algorithm, the output point coordinates in each a-column × a-row square block are mapped to obtain the corresponding input point coordinates of the input image. Such processing can also reduce the impact of the anisotropy of the input coordinate changes after mapping. Where a is a positive integer, which can be reasonably set by the user.
[0071] S203: Cache the input image into a cache matrix consisting of n caches based on the input point coordinates; n is any value from 4 to 128.
[0072] In actual applications, the read memory in the hardware will read the input image corresponding to the input point coordinates from the storage body storing the input image based on the command information sent by the software, and cache the input image into a cache matrix composed of n caches. Specifically, the cache matrix can be composed of 4 to 128 read-only caches. For example, if n=16, these 16 read-only caches are responsible for caching and reading the input images of the 16mth, 16m+1, ..., 16m+15th (where m=0, 1, 2...) rows.
[0073] S204: Filter the input pixel values corresponding to the input point coordinates.
[0074] In practical applications, since the input point coordinates and input pixel values of each pixel point in the input image are known, the input pixel data (input pixel value) involved in the interpolation can be screened out through the correspondence between the input point coordinates and the input pixel values in combination with the interpolation algorithm used in this image processing. It can be understood that the output pixel coordinate has a unique input pixel coordinate mapped to it in the input image, and the input coordinate is a fixed-point decimal, and the integer input coordinates near the input pixel coordinate and its corresponding input pixel value are determined. Therefore, taking the interpolation algorithm as bilinear interpolation as an example, an output point requires at most four input points for interpolation, so when determining the input point coordinate corresponding to the output point coordinate, the input pixel value corresponding to and near the input point coordinate is obtained, and the input pixel data required to participate in the interpolation is screened out, that is, the four input pixel values corresponding to the input point coordinate (or used to calculate the output pixel value) are read.
[0075] In addition, since the methods of filtering input pixel values are different, the embodiment of the present application can illustrate a possible reading method.
[0076] In one embodiment, the filtering of the input pixel value corresponding to the input point coordinates includes:
[0077] Based on the input point coordinates, grouping the output points in each of the square blocks corresponding to the same n×n segmented input image;
[0078] Based on the mapping relationship between the output point coordinates and the input point coordinates, the input pixel values corresponding to the output points in each group are read respectively.
[0079] In practical applications, the Cache matrix is composed of n Caches, and the window size of the hardware reading data from the read-only Cache each time is limited. Therefore, the embodiment of the present application can also use the Request Block Divide module in the hardware to group the output points in the square blocks divided by the output image, and then complete the data reading required for each group in multiple rounds, thereby improving the reading efficiency. Specifically, taking n=16 as an example, based on the mapping relationship between the output point coordinates and the input point coordinates, the grouping basis can be to map the output points in each square block according to whether the corresponding input point coordinates when the output point coordinates are mapped to the input image are located in the same 16×16 square area. In this way, the output points mapped to the input point coordinates in the same 16 rows * 16 columns square area are divided into the same group, and then the input pixel values corresponding to the output points in each group are read in rounds, so that the data blocks returned by the Cache matrix each time constitute a 16 column × 16 row square input image area, and at the same time solve the problem of anisotropy after the output point coordinates are mapped to the input image.
[0080] S205: Perform interpolation processing on the input pixel value based on an interpolation algorithm to obtain an output pixel value.
[0081] In practical applications, interpolation algorithm is a commonly used mathematical tool for estimating unknown values between known data points. It can deduce the functional relationship between data points through the distribution and regularity of known data points, thereby predicting the value of unknown points. In general, different interpolation algorithms require different numbers of known data points for estimating unknown data points. Taking the bilinear interpolation algorithm mentioned in the embodiment of the present application as an example, to calculate the output pixel value corresponding to the output point, it is necessary to filter out up to 4 input pixel values involved in the interpolation, and then interpolate the filtered input pixel values based on the interpolation algorithm to obtain the output pixel value.
[0082] S206: Write the output pixel value to the main memory.
[0083] In practical applications, the write memory in the hardware can write the output pixel values to the storage body (main memory) of the output image. All output pixel values of the image to be output are written into the storage body, indicating that the entire image processing flow is completed.
[0084] In addition, the methods of writing output pixel values are not the same, so the embodiment of the present application can illustrate a possible writing method.
[0085] In one embodiment, writing the output pixel value to main memory comprises:
[0086] Merging the output pixel values corresponding to the output points of the same square block to restore the square output block with the same size as the square block;
[0087] Write the square output block out to main memory.
[0088] In practical applications, continuing with the above example of n=16, and assuming that the square blocks are divided into 4 columns × 4 rows, the output points in the 4 columns × 4 rows square blocks divided by the output image can be grouped in combination with the above Request Block Divide module, and then the data reading required for each group is completed in multiple rounds. After the data reading is completed, the output pixel values corresponding to the output points of the same square block are merged and restored to a square output block of 4 columns × 4 rows, and finally, the square blocks of 4 columns × 4 rows are still passed to the downstream module, that is, the square output block is written out to the main memory through the write memory.
[0089] In addition, since regular inspections are required during the operation of the device, the embodiments of the present application can illustrate a possible regular inspection method.
[0090] In one embodiment, the method further comprises:
[0091] Based on a preset time interval, regularly collect operating status data, and calculate operating performance indicators based on the operating status data;
[0092] Comparing the operating performance index with the preset performance index and obtaining a comparison result; the comparison result includes whether the performance meets the standard or not;
[0093] Image processing is performed according to the comparison result.
[0094] In practical applications, a performance detection module is configured for hardware to detect the real-time operating status of the hardware, and upload it to the software for analysis, and the software issues different processing commands based on different operating states. Specifically, the software first issues preset performance indicators, such as the cache hit rate and the specific preset values corresponding to the cycle pixel (pixel per cycle) mentioned above. The user can set the data acquisition cycle of the performance monitoring module. When the hardware is running, the performance monitoring module collects the real-time operating status data of the hardware according to the preset time interval, and calculates the operating performance indicators (the actual values of the cache hit rate and the cycle pixel) according to the operating status data. The performance monitoring module can compare the operating performance indicators calculated in real time with the preset performance indicators, that is, determine whether the actual value reaches the preset value, and obtain the comparison result. Generally, the situation where the actual value does not reach the preset value is recorded as performance not meeting the standard; the situation where the actual value reaches the preset value is recorded as performance meeting the standard. The comparison result is uploaded to the software, and the software can issue a processing plan based on the comparison result, and it is executed by the hardware.
[0095] In addition, since the image processing methods corresponding to different comparison results are not exactly the same, the embodiment of the present application can illustrate a possible processing method.
[0096] In one embodiment, performing image processing according to the comparison result includes:
[0097] When the comparison result shows that the performance meets the standard, continue to check whether the task corresponding to the current task information is completed;
[0098] If not completed, continue to regularly collect the operating status data based on the preset time interval, calculate the operating performance index, and determine the comparison result;
[0099] If completed, determine whether all slices have been completed;
[0100] If all slices are completed, the feedback image is completed interrupt;
[0101] If all slices have not been completed, a prompt will be given that the task corresponding to the current task information has been completed, and the remaining slice tasks will continue.
[0102] In practical applications, Figure 3 A flowchart of a software and hardware collaborative work provided in an embodiment of the present application, combined with Figure 3 As shown in the figure, the software (white background) is used to analyze and send data, and the hardware (gray background) is used to execute and upload data. Specifically, the software first sends the initial task (current command information) and the corresponding preset performance indicators to the hardware, so that the hardware enters the working state. During the operation of the hardware, the performance monitoring module will regularly sample the operating status data of the hardware and count the performance indicators, calculate the current operating performance indicators of the hardware and compare them with the preset performance indicators. When the comparison result is that the performance meets the standard, continue to check whether the current task is completed. If not, continue to perform performance testing; if completed, continue to determine whether all output slices have been completed. If all output slices have been completed, the hardware will issue a picture completion interrupt, which means that the output of the entire output picture is completed; if not, the software will be notified through other types of interrupts that the current task slice has been completed, and continue to send the remaining slice tasks in the entire output picture.
[0103] In addition, since the image processing methods corresponding to different comparison results are not exactly the same, the embodiment of the present application may illustrate another possible processing method.
[0104] In another embodiment, performing image processing according to the comparison result includes:
[0105] When the comparison result shows that the performance does not meet the standard, a feedback is given that the performance does not meet the standard interruption;
[0106] The acquisition software analyzes the running status data and provides feedback based on the performance non-compliance interrupt; the kill instruction supports the task kill at any time;
[0107] The current task is canceled based on the kill instruction.
[0108] Continue to combine Figure 3 To explain, specifically, when the performance does not meet the standard, the hardware will send a performance failure interrupt to the software. At this time, the software can access the register conversion module through the control bus and confirm the actual status of the hardware. At this time, the software can determine whether to cancel the current task or directly issue a task cancellation command (supporting a forced kill command to kill the task at any time). When the hardware receives the forced kill command, it will enter the task cancellation process.
[0109] As a task cancellation process, it can include:
[0110] S1: The memory stops sending new transmission commands to the AXI bus, and the read and write memory completes the remaining AXI data transmission and response reception;
[0111] S2: The read memory no longer sends data fed back by the main memory to the downstream module, and the write memory does not accept write data sent from the upstream module;
[0112] S3: Reset the data and status registers of all read-only caches in the cache matrix;
[0113] S4: Reset registers and queue contents in other modules;
[0114] S5: Send forced kill completion interrupt.
[0115] In addition, since the adjustment methods when the performance does not meet the requirements are not the same, the embodiment of the present application can illustrate a possible adjustment method.
[0116] In one embodiment, the method further comprises:
[0117] The acquisition software analyzes the operation status data and feeds back a slice size adjustment instruction based on the performance non-compliance interruption;
[0118] The output image is re-sliced based on the slice resizing instructions.
[0119] In actual applications, when the hardware processes the task corresponding to the current task information, the hardware performance does not meet the standard. This application provides a processing method. Specifically, when the software determines that the hardware does not meet the performance standard in processing the current task, the software can analyze the running status data and further slice the output image, and re-send the slice size adjustment instruction and the performance indicators after slicing to the hardware, so that the hardware re-slices the output image and repeats the above image processing process. If the performance is still not up to standard after slicing, the software can further reduce the slice image size or adjust the performance expectations until it meets the standard. It should be noted that the software slices should be sliced from left to right and from top to bottom, and the square style slicing can improve the utilization of data and reduce the impact of anisotropy after the output is mapped to the input coordinates.
[0120] In summary, the present application first obtains task information. The task information includes command information and preset performance indicators. Then, based on the image processing algorithm mapping, the input point coordinates of the input image corresponding to the output point coordinates of the output image are obtained. The image processing algorithm includes an affine algorithm and a projection algorithm. Then, based on the input point coordinates, the input image is cached into a cache matrix composed of n caches. Where n is any value from 4 to 128. Then, the input pixel values corresponding to the input point coordinates are screened. Finally, the input pixel values are interpolated based on the interpolation algorithm to obtain the output pixel values, and the output pixel values are written to the main memory. In this way, the utilization of data is improved through a low-overhead cache matrix, thereby improving the efficiency of image processing.
[0121] Based on the image processing method provided in the above embodiment, the present application also provides an image processing device. The image processing device is described below in conjunction with the embodiments and drawings.
[0122] Figure 4 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application. Figure 4 As shown, the image processing device 400 provided in the embodiment of the present application includes:
[0123] The register conversion module 401 is used to obtain task information; the task information includes command information and performance indicators;
[0124] A mapping module 402, configured to map and obtain input point coordinates of an input image corresponding to output point coordinates of an output image based on an image processing algorithm; the image processing algorithm includes an affine algorithm and a projection algorithm;
[0125] A read memory module 403 is used to cache the input image into a cache matrix consisting of n caches based on the input point coordinates; n is any value from 4 to 128;
[0126] A screening module 404 is used to screen the input pixel values corresponding to the input point coordinates;
[0127] An interpolation processing module 405 is used to perform interpolation processing on the input pixel value based on an interpolation algorithm to obtain an output pixel value;
[0128] The write memory module 406 is used to write the output pixel value to the main memory.
[0129] As an implementation manner, with respect to how to obtain the input point coordinates of the input image, the mapping module 402 is specifically used to:
[0130] Divide the output image into at least one square block;
[0131] Based on an image processing algorithm, the output point coordinates in each of the square blocks are mapped to obtain the input point coordinates of the corresponding input image.
[0132] As an implementation manner, with respect to how to read the input pixel value corresponding to the input point coordinates, the above-mentioned screening module 404 is specifically used to:
[0133] Based on the input point coordinates, grouping the output points in each of the square blocks corresponding to the same n×n segmented input image;
[0134] Based on the mapping relationship between the output point coordinates and the input point coordinates, the input pixel values corresponding to the output points in each group are read respectively.
[0135] As an implementation method, with respect to how to periodically check the hardware operating status, the image processing device 400 further includes a collection module, a comparison module, and a processing submodule;
[0136] A collection module, used to collect operation status data at regular intervals based on a preset time interval, and calculate the operation performance index based on the operation status data;
[0137] A comparison module, used to compare the operating performance index with the preset performance index and obtain a comparison result; the comparison result includes whether the performance meets the standard or not;
[0138] The processing submodule is used to perform image processing according to the comparison result.
[0139] As an implementation manner, regarding how to perform image processing according to the comparison result, the above processing submodule is specifically used for:
[0140] When the comparison result shows that the performance meets the standard, continue to check whether the task corresponding to the current task information is completed;
[0141] If not completed, continue to regularly collect the operating status data based on the preset time interval, calculate the operating performance index, and determine the comparison result;
[0142] If completed, determine whether all slices have been completed;
[0143] If all slices are completed, the feedback image is completed interrupt;
[0144] If all slices have not been completed, a prompt will be given that the task corresponding to the current task information has been completed, and the remaining slice tasks will continue.
[0145] As an implementation manner, regarding how to perform image processing according to the comparison result, the above processing submodule is specifically used for:
[0146] When the comparison result shows that the performance does not meet the standard, a feedback is given that the performance does not meet the standard interruption;
[0147] The acquisition software analyzes the running status data and provides feedback based on the performance non-compliance interrupt; the kill instruction supports the task kill at any time;
[0148] The current task is canceled based on the kill instruction.
[0149] As an implementation manner, in order to deal with the situation where the performance does not meet the standard, the image processing device 400 further includes a slicing module;
[0150] A slicing module, used for obtaining a slice size adjustment instruction for the software to analyze the operation status data and provide feedback based on the performance non-compliance interruption;
[0151] The output image is re-sliced based on the slice resizing instructions.
[0152] As an implementation method, regarding how to write the output pixel value to the main memory, the above-mentioned write memory module 406 is specifically used to
[0153] Merging the output pixel values corresponding to the output points of the same square block to restore the square output block with the same size as the square block;
[0154] Write the square output block out to main memory.
[0155] In summary, the present application first obtains task information. The task information includes command information and preset performance indicators. Then, based on the image processing algorithm mapping, the input point coordinates of the input image corresponding to the output point coordinates of the output image are obtained. The image processing algorithm includes an affine algorithm and a projection algorithm. Then, based on the input point coordinates, the input image is cached into a cache matrix composed of n caches. Where n is any value from 4 to 128. Then, the input pixel values corresponding to the input point coordinates are screened. Finally, the input pixel values are interpolated based on the interpolation algorithm to obtain the output pixel values, and the output pixel values are written to the main memory. In this way, the utilization of data is improved through a low-overhead cache matrix, thereby improving the efficiency of image processing.
[0156] In addition, the present application also provides an image processing device, comprising: a memory for storing a computer program; and a processor for implementing the steps of the above-mentioned image processing method when executing the computer program.
[0157] In addition, the present application also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image processing method described above are implemented.
[0158] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for image processing, characterized in that: The method comprises: Obtaining task information; the task information includes command information and preset performance indicators; Mapping based on an image processing algorithm obtains input point coordinates of the input image corresponding to output point coordinates of the output image; the image processing algorithm includes an affine algorithm and a projection algorithm; Cache the input image into a Cache matrix consisting of n Caches based on the input point coordinates; n is any value from 4 to 128; Filtering the input pixel values corresponding to the input point coordinates; Performing interpolation processing on the input pixel value based on an interpolation algorithm to obtain an output pixel value; Write the output pixel value out to main memory.
2. The method according to claim 1, characterized in that: The mapping based on the image processing algorithm to obtain the input point coordinates of the input image corresponding to the output point coordinates of the output image includes: Divide the output image into at least one square block; Based on an image processing algorithm, the output point coordinates in each of the square blocks are mapped to obtain the input point coordinates of the corresponding input image.
3. The method according to claim 2, characterized in that The screening of the input pixel value corresponding to the input point coordinates includes: Based on the input point coordinates, grouping the output points in each of the square blocks corresponding to the same n×n segmented input image; Based on the mapping relationship between the output point coordinates and the input point coordinates, the input pixel values corresponding to the output points in each group are read respectively.
4. The method according to claim 1, characterized in that: The method further comprises: Based on a preset time interval, regularly collect operating status data, and calculate operating performance indicators based on the operating status data; Comparing the operating performance index with the preset performance index and obtaining a comparison result; the comparison result includes whether the performance meets the standard or not; Image processing is performed according to the comparison result.
5. The method according to claim 4, characterized in that The performing image processing according to the comparison result includes: When the comparison result shows that the performance meets the standard, continue to check whether the task corresponding to the current task information is completed; If not completed, continue to regularly collect the operating status data based on the preset time interval, calculate the operating performance index, and determine the comparison result; If completed, determine whether all slices have been completed; If all slices are completed, the feedback image is completed interrupt; If all slices have not been completed, a prompt will be given that the task corresponding to the current task information has been completed, and the remaining slice tasks will continue.
6. The method according to claim 4, characterized in that The performing image processing according to the comparison result includes: When the comparison result shows that the performance does not meet the standard, a feedback is given that the performance does not meet the standard interruption; The acquisition software analyzes the running status data and provides feedback based on the performance non-compliance interrupt; the kill instruction supports the task kill at any time; The current task is canceled based on the kill instruction.
7. The method according to claim 6, characterized in that The method further comprises: The acquisition software analyzes the operation status data and feeds back a slice size adjustment instruction based on the performance non-compliance interruption; The output image is re-sliced based on the slice resizing instructions.
8. The method according to claim 3, characterized in that Writing the output pixel value to main memory comprises: Merging the output pixel values corresponding to the output points of the same square block to restore the square output block with the same size as the square block; Write the square output block out to main memory.
9. An image processing device, characterized in that: include: Register conversion module, used to obtain task information; The task information includes command information and performance indicators; A mapping module, used for mapping based on an image processing algorithm to obtain input point coordinates of an input image corresponding to output point coordinates of an output image; the image processing algorithm includes an affine algorithm and a projection algorithm; A read memory module, used for caching the input image into a cache matrix consisting of n caches based on the input point coordinates; wherein n is any value from 4 to 128; A screening module, used for screening the input pixel values corresponding to the input point coordinates; An interpolation processing module, used to perform interpolation processing on the input pixel value based on an interpolation algorithm to obtain an output pixel value; A write memory module is used to write the output pixel value to the main memory.
10. An image processing device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the image processing method according to any one of claims 1 to 8 when executing the computer program.