Image processing method and device
An image processing and processing algorithm technology, which is applied in the field of image processing to achieve the effect of improving processing efficiency
Pending Publication Date: 2019-10-29
BEIJING HUAJIE IMI TECH CO LTD
5 Cites 0 Cited by
AI-Extracted Technical Summary
Problems solved by technology
[0003] For example, the ever-emerging image processing technology and the application requirements based on image processing technology make the amount of image data processed by the processor more and more large, and the application based on image processing technology requires higher and higher processin...
Method used
102: the first image is moved from the second storage space to the reserved space of the first storage space, to process the first image by means of the first storage space, wherein the storage speed of the second storage space is lower tha...
Abstract
The invention provides an image processing method and device. The method comprises the following steps of determining a first image to be moved to a reserved space of a first storage space at presentin images to be processed, moving the first image from the second storage space to a reserved space of the first storage space, processing the first image based on a preset image processing algorithm,obtaining a second image corresponding to the first image, moving the second image from the reserved space of the first storage space to the reserved space of the second storage space; wherein the storage speed of the second storage space is smaller than that of the first storage space, but the capacity of the second storage space is larger than that of the first storage space. Therefore, the first image of the to-be-processed image is temporarily stored in the first storage space, and the second image is moved to the second storage space after the second image corresponding to the first image is obtained, so that the first storage space and the second storage space can be used for assisting the processor at the same time, and the processing efficiency of the processor is improved.
Application Domain
Image memory managementProcessor architectures/configuration
Technology Topic
Image basedImaging processing +1
Image
Examples
- Experimental program(1)
Example Embodiment
[0042] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
[0043] see figure 1 , which shows an image processing method provided by an embodiment of the present invention, which can simultaneously utilize the first storage space and the second storage space to assist the processor to improve the processing efficiency of the processor, wherein figure 1 The image processing method shown may include the following steps:
[0044]101: Determine the first image to be moved to the reserved space of the first storage space among the images to be processed. In this embodiment, the data volume of the first image to be moved depends on the reserved space of the first storage space, and further needs to be combined with the current preset image processing algorithm for the first image, so that the first The sum of the data volume of the image, the intermediate data generated during the processing based on the preset image processing algorithm, and the result data obtained by the preset image processing algorithm cannot exceed the reserved space of the first storage space, where the preset image processing algorithm obtains The resulting data is the second image corresponding to the first image described below. A corresponding feasible way of determining the first image includes the following process:
[0045] According to the reserved space of the first storage space, the amount of intermediate data and result data generated by the preset image processing algorithm, determine the amount of image data that can be processed by the first storage space; based on the images that can be processed by the first storage space The amount of data is to divide the image to be processed into sub-blocks to obtain each image sub-block included in the image to be processed. The data amount of each image sub-block is less than or equal to the image data amount; the first image is composed of at least one image sub-block, and the first The data amount of the image is less than or equal to the image data amount.
[0046] The intermediate data generated during the processing of the preset image processing algorithm refers to the intermediate results (not necessary) that may be generated during the processing of the image to be processed by the preset image processing algorithm. Although it is only used temporarily, it will also occupy a certain amount of time. Storage space, the specific amount of data is determined by the preset image processing algorithm; the result data generated by the preset image processing algorithm processing process is the second image, which is in one-to-one correspondence with the first image to be moved, and will eventually be moved to In the reserved space of the second storage space, the second images corresponding to other first images together constitute the result image of the image to be processed.
[0047] For example, if the preset image processing algorithm can enlarge the image to be processed, the data volume of the image to be processed will increase after being processed by the preset image processing algorithm; If the amount is reduced, the reserved space can not only store the first image to be moved, but also store the intermediate data generated during the processing of the preset image processing algorithm, and should also be able to store the image obtained after processing the preset image processing algorithm. The resulting data (i.e. the second image). The preset image processing algorithm may depend on actual application requirements, which is not limited in this embodiment.
[0048] After obtaining the amount of image data that can be processed by the first storage space, the image data amount can be used as the data amount of the image sub-block in the image to be processed, and the image to be processed is divided into sub-blocks, or a value smaller than the image data amount can be selected as The data volume of image sub-blocks in the image to be processed, and the image to be processed is divided into sub-blocks.
[0049] That is to say, the method of dividing the image to be processed into sub-blocks in this embodiment can be: based on the amount of image data that can be processed by the first storage space and the data amount of the image to be processed, the number of image sub-blocks of the image to be processed is determined, and based on the amount of image data to be processed The number of image sub-blocks is divided into rows and columns of the image to be processed to obtain each image sub-block included in the image to be processed.
[0050] For example, based on the amount of image data that can be processed by the first storage space, the data amount of the image sub-block in the image to be processed is determined, assuming that the data amount of the image sub-block is m, and the data amount of the image to be processed is M, then the number of image blocks (represents rounding up), and based on this, determine the division method of the image sub-block, and then determine the number of rows and columns of the image sub-block.
[0051] One point that needs to be explained here is: when dividing based on the data amount m of the image sub-block, there may be an uneven distribution of the image to be processed. For example, the image sub-block at the edge position of the image to be processed is smaller than the maximum data amount m. This is because: assuming that the number of rows of the image to be processed is R, the number of columns is C, and the data volume of the image sub-block is r for the number of rows of the image sub-block of m, and the number of columns is c, then N=(C/c) *(R/r), and the values of C/c and R/r are not integers, which means that the image sub-block at the edge position is smaller than the data amount m, and then the number of image blocks needs to be obtained by rounding up, and further The number N of image blocks may also be corrected in combination with the number of image sub-blocks at edge positions.
[0052] In addition, after the image to be processed is divided based on the amount of data m, the image sub-block is quantized into the number of rows and columns of the image sub-block, as the number of rows above is r, the number of columns is c, and the data amount of the image sub-block m=r*c*per The number of pixel bytes. In this embodiment, the data volume of the image sub-block can also be corrected to re-divide the image to be processed. The process can include: obtaining the row number r and the column number c corresponding to the image sub-block, based on the characteristics of the processor and Preset the image processing algorithm, adjust the number of rows r and the number of columns c of the image sub-block, so that the data volume of the image sub-block meets the requirements of the processor characteristics and the data volume of the preset image processing algorithm, such as dividing the image sub-block The number of rows is adjusted to r', the number of columns is adjusted to c', and the data volume m of the image sub-block is adjusted to m'=r'*c'*bytes per pixel. After the data amount of the image sub-block is adjusted, the image to be processed may be re-divided into sub-blocks based on the adjusted data amount of the image sub-block, so as to obtain each image sub-block again.
[0053] 102: Move the first image from the second storage space to the reserved space of the first storage space, so as to process the first image with the help of the first storage space, wherein the storage speed of the second storage space is lower than that of the first storage space storage speed, but the capacity of the second storage space is greater than that of the first storage space, so that the processing efficiency of the first image can be accelerated.
[0054] In this embodiment, the process of moving the first image includes: obtaining the storage address of the first image in the second storage space and the storage address in the reserved space of the first storage space, based on the storage address of the first image in the second storage space The storage address and the storage address in the reserved space of the first storage space move the first image, so based on the storage address of the first image in the second storage space, the correlation of the first image in the second storage space can be obtained data, and store the related data of the first image based on the storage address of the reserved space of the first storage space.
[0055] Since the related data of the first image needs to be moved, the source address of the related data of the first image in the second storage space needs to be continuously updated during the moving process to obtain corresponding data. In this embodiment, the first image can be moved by means of DMA (Direct Memory Access, direct memory access) technology, and when moving by means of DMA technology, it is also necessary to obtain the height of the image sub-block, the width of the image sub-block ( The height and width depend on the number of rows and columns of the image sub-block), the width step of the image to be processed in the first storage space and the width step of the image to be processed in the second storage space, and the width step refers to the The length of the storage space occupied by one line of image data is a length value greater than or equal to the image width, and the image to be processed is moved by combining these parameters with DMA technology.
[0056] 103: Based on a preset image processing algorithm, process the first image to obtain a second image corresponding to the first image. For example, the preset image processing algorithm is an algorithm to change the size of the image to be processed, such as enlarging the image to be processed or reducing the size of the image to be processed to the target size. One way is to use bilinear interpolation algorithm to achieve scale transformation. For the first The size of the first image stored in the reserved space of the storage space is converted to obtain the second image corresponding to the first image, and at the same time, the content in the first image will not be modified to retain the first image. This embodiment does not elaborate.
[0057] 104: Move the second image from the reserved space of the first storage space to the reserved space of the second storage space.
[0058] It can be understood that: the reserved space of the second storage space is a storage area for storing the result data of the first image processed based on the preset image processing algorithm, that is, the storage area for storing the second image, which is obtained from the first storage For the process of moving the reserved space of the space to the reserved space of the second storage space, please refer to the relevant description in the above step 102, so that after the first image is moved from the second storage space to the first storage space, it undergoes preset image processing, Move the second image corresponding to the first image from the first storage space to the second storage space, the process is as follows figure 2 shown.
[0059] In this embodiment, the reserved space of the first storage space, the reserved space of the second storage space, the amount of image data to be processed, and the preset image processing algorithm determine the number of transfers. A space is regarded as moving in, and moving from the first storage space to the second storage space is regarded as moving out. Specifically, there are four situations as follows:
[0060] One case: move in once, move out once; if the capacity of the reserved space of the first storage space meets the storage requirements of the data volume of the image to be processed, the intermediate data and the result data generated during the processing of the preset image processing algorithm (As the capacity of the reserved space of the first storage space is greater than the data volume of the image to be processed, the sum of the data volume of the intermediate data and the result data generated by the preset image processing algorithm processing process), the image to be processed will be directly As the first image, it only needs to be moved once, and after being processed by the preset image processing algorithm, it only needs to be moved once.
[0061] Another situation: moving in once and moving out multiple times; if the capacity of the reserved space of the first storage space is obviously larger than the data volume of the image to be processed, but the capacity of the reserved space of the first storage space cannot meet the preset image processing The storage requirements of the intermediate data and result data generated by the image processing process of the algorithm to be processed (such as the capacity of the reserved space of the first storage space is less than the data volume of both the intermediate data and the result data generated by the preset image processing algorithm processing process sum), then the image to be processed is directly used as the first image, and only needs to be moved once, and then the sub-blocks are divided in the first storage space, and each image sub-block is processed through the preset image processing algorithm, and each obtained A second image moves it to the second storage space.
[0062] Another situation: move in multiple times, move out multiple times; this is the most common situation, for the capacity of the reserved space of the first storage space is smaller than the data volume of the image to be processed, and the reserved space of the first storage space The capacity of the preset image processing algorithm cannot meet the storage requirements of the intermediate data and result data generated by the image processing process to be processed. At this time, the image to be processed needs to be divided into sub-blocks, and different first images are moved to the first storage space each time. , each image sub-block in the first image is processed through the preset image processing algorithm, and every time a second image is obtained, it is moved to the second storage space
[0063] Another situation: move in multiple times and move out at one time; the purpose is that the capacity of the reserved space of the first storage space is less than the amount of data of the image to be processed and the intermediate data generated by the preset image processing algorithm processing process Storage requirements (for example, the capacity of the reserved space of the first storage space is less than the sum of the data volume of the image to be processed and the intermediate data generated by the preset image processing algorithm), but obviously greater than the data volume of the result data, then The image to be processed is divided into different first images and moved to the first storage space several times, and after obtaining the second images corresponding to all the first images, all the second images are moved to the second storage space.
[0064] It can be known from the above technical solution that among the images to be processed, the first image to be moved to the reserved space of the first storage space is determined, and the first image is moved from the second storage space to the reserved space of the first storage space, based on the reserved It is assumed that the image processing algorithm processes the first image to obtain the second image corresponding to the first image, and moves the second image from the reserved space of the first storage space to the reserved space of the second storage space, wherein the second storage The storage speed of the space is lower than that of the first storage space, but the capacity of the second storage space is greater than that of the first storage space, so the first image of the image to be processed is temporarily stored in the first storage space, and obtained After the second image corresponding to the first image is moved to the second storage space, the first storage space and the second storage space can be used to assist the processor at the same time, especially the first storage space is assisted by the second storage space Storing data enables the first storage space to use more resources for the processor, thereby improving the processing efficiency of the processor.
[0065]For the aforementioned method embodiments, for the sake of simple description, they are expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, Certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0066] Corresponding to the above method embodiment, the embodiment of the present invention also provides an image processing device, the structure of which is as follows image 3 As shown, it may include: a determining unit 10 , a moving unit 20 and a processing unit 30 .
[0067] The determining unit 10 is configured to determine the first image to be moved to the reserved space of the first storage space among the images to be processed. In this embodiment, the data volume of the first image to be moved depends on the reserved space of the first storage space, and further needs to be combined with the current preset image processing algorithm for the first image, so that the first The sum of the data volume of the image, the intermediate data generated during the processing based on the preset image processing algorithm, and the result data obtained by the preset image processing algorithm cannot exceed the reserved space of the first storage space, where the preset image processing algorithm obtains The resulting data is the second image corresponding to the first image described below. A possible way for the corresponding determining unit 10 to determine the first image includes the following process:
[0068] According to the reserved space of the first storage space, the amount of intermediate data and result data generated by the preset image processing algorithm, determine the amount of image data that can be processed by the first storage space; based on the images that can be processed by the first storage space The amount of data is to divide the image to be processed into sub-blocks to obtain each image sub-block included in the image to be processed. The data amount of each image sub-block is less than or equal to the image data amount; the first image is composed of at least one image sub-block, and the first The data volume of the image is less than or equal to the data volume of the image, wherein one way for the determination unit 10 to divide the sub-blocks is: to determine the image of the image to be processed based on the data volume of the image data that can be processed by the first storage space and the data volume of the image to be processed The number of blocks is based on the number of image blocks of the image to be processed, and the image to be processed is divided into rows and columns to obtain each image sub-block included in the image to be processed. For specific explanations, please refer to the method embodiment, which will not be described in this embodiment.
[0069] The moving unit 20 is used to move the first image from the second storage space to the reserved space of the first storage space, so as to process the first image by means of the first storage space, and the storage speed of the second storage space is lower than that of the first storage space. The storage speed of the storage space, but the capacity of the second storage space is greater than the capacity of the first storage space.
[0070] In this embodiment, the process of moving the first image includes: obtaining the storage address of the first image in the second storage space and the storage address in the reserved space of the first storage space, based on the storage address of the first image in the second storage space The storage address and the storage address in the reserved space of the first storage space move the first image, so based on the storage address of the first image in the second storage space, the correlation of the first image in the second storage space can be obtained data, and store the related data of the first image based on the storage address of the reserved space of the first storage space.
[0071] Since the related data of the first image needs to be moved, the source address of the related data of the first image in the second storage space needs to be continuously updated during the moving process to obtain corresponding data. In this embodiment, the first image can be moved by means of DMA technology, and when moving by means of DMA technology, it is also necessary to obtain the height of the image sub-block, the width of the image sub-block (height and width are viewed as rows of the image sub-block number and number of columns), the width step of the image to be processed in the first storage space and the width step of the image to be processed in the second storage space, the width step refers to the storage space occupied by one line of image data in the image Length is a length value greater than or equal to the width of the image, and the image to be processed is moved through these parameters combined with DMA technology.
[0072] The processing unit 30 is configured to process the first image based on a preset image processing algorithm to obtain a second image corresponding to the first image. For example, the preset image processing algorithm is an algorithm to change the size of the image to be processed, such as enlarging the image to be processed or reducing the size of the image to be processed to the target size. One way is to use bilinear interpolation algorithm to achieve scale transformation. For the first The size of the first image stored in the reserved space of the storage space is converted to obtain the second image corresponding to the first image, and at the same time, the content in the first image will not be modified to retain the first image. This embodiment does not elaborate.
[0073] The moving unit 20 is further configured to move the second image from the reserved space of the first storage space to the reserved space of the second storage space. It can be understood that: the reserved space of the second storage space is a storage area for storing the result data of the first image processed based on the preset image processing algorithm, that is, the storage area for storing the second image, which is obtained from the first storage The process of moving the reserved space of the space to the reserved space of the second storage space is similar to the process of moving the first image from the reserved space of the second storage space to the reserved space of the first storage space. To illustrate, after the first image is moved from the second storage space to the first storage space, the preset image processing is performed, and the second image corresponding to the first image is then moved from the first storage space to the second storage space.
[0074] In this embodiment, the reserved space of the first storage space, the reserved space of the second storage space, the amount of image data to be processed, and the preset image processing algorithm determine the number of transfers. A space is regarded as moving in, and moving from the first storage space to the second storage space is regarded as moving out. Specifically, there are four situations as follows:
[0075] One situation: move in once, move out once; another situation: move in once, move out many times; another situation: move in many times, move out many times; another situation: move in many times, move out once For the description of these four situations, please refer to the method embodiment, which will not be described in this embodiment.
[0076] It can be known from the above technical solution that among the images to be processed, the first image to be moved to the reserved space of the first storage space is determined, and the first image is moved from the second storage space to the reserved space of the first storage space, based on the reserved It is assumed that the image processing algorithm processes the first image to obtain the second image corresponding to the first image, and moves the second image from the reserved space of the first storage space to the reserved space of the second storage space, wherein the second storage The storage speed of the space is lower than that of the first storage space, but the capacity of the second storage space is greater than that of the first storage space, thus temporarily storing the first image of the image to be processed in the first storage space, and obtaining the second After the second image corresponding to an image, the second image is moved to the second storage space, so that the first storage space and the second storage space can be used to assist the processor at the same time, especially through the second storage space to assist the first storage space to store data, so that the first storage space can use more resources for the processor and improve the processing efficiency of the processor. And when the first image is processed based on the preset image processing algorithm, the remaining first image to be processed or the obtained second image can be moved, so that the image moving operation is performed while the first image is being processed, so as to Time multiplexing is realized by optimizing the image processing flow, so that the processing efficiency of the processor can be improved.
[0077] In addition, after the image to be processed is divided based on the amount of data m, the image sub-block is quantized into the number of rows and columns of the image sub-block, as the number of rows above is r, the number of columns is c, and the data amount of the image sub-block m=r*c*per The number of pixel bytes, the image processing device provided in this embodiment can also correct the data volume of the image sub-block to re-divide the image to be processed, the structure of the corresponding image processing device is as follows Figure 4 shown in image 3 Basically, an adjustment unit 40 may also be included.
[0078] The adjustment unit 40 is used to obtain the number of rows and the number of columns corresponding to the image sub-block, and adjust the number of rows and the number of columns corresponding to the image sub-block based on the characteristics of the processor and the preset image processing algorithm; based on the adjusted image sub-block Adjust the data volume of the image sub-blocks corresponding to the number of rows and columns, and re-divide the image to be processed into sub-blocks based on the adjusted data volume of the image sub-blocks to obtain each image sub-block again. For details, please refer to Relevant descriptions in the method embodiments will not be described in this embodiment.
[0079] In addition, the embodiment of the present invention also provides a terminal, and the terminal includes:
[0080] first storage space;
[0081] The second storage space, the storage speed of the second storage space is lower than the storage speed of the first storage space, but the capacity of the second storage space is greater than the capacity of the first storage space;
[0082] The processor is configured to determine the first image to be moved to the reserved space of the first storage space among the images to be processed, and move the first image from the second storage space to the reserved space of the first storage space, based on a preset The image processing algorithm processes the first image to obtain a second image corresponding to the first image, and moves the second image from the reserved space of the first storage space to the reserved space of the second storage space.
[0083] For the execution process of the processor, reference may be made to the foregoing method embodiments, which will not be elaborated in this embodiment.
[0084] An embodiment of the present invention also provides a storage medium, in which computer program codes are stored, and when the computer program codes are run by a processor, the above image processing method is implemented.
[0085] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. For the same and similar parts in each embodiment, refer to each other, that is, Can. As for the device-type embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for related parts, please refer to part of the description of the method embodiments.
[0086] Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
[0087] The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily 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 invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0088] The above is only a preferred embodiment of the present invention, and it should be pointed out that for those of ordinary skill in the art, some improvements and modifications can be made without departing from the principle of the present invention. It should be regarded as the protection scope of the present invention.
PUM


Description & Claims & Application Information
We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
Similar technology patents
Neural network-based grinding machining working condition detection method
Owner:NANJING UNIV +1
Shaft gear composite processing machine tool
Owner:CHONGQING MACHINE TOOL GROUP
Device and method for magnetically grinding inner surfaces of large-diameter long and straight pipes
Owner:UNIV OF SCI & TECH LIAONING
Method for preparing high strength and ductility magnesium-rare earth alloy through selective laser melting additive manufacturing technology
Owner:SHANGHAI JIAO TONG UNIV
Method and device for converting video image format
Owner:IDEAPOOL CULTURE & TECH CO LTD
Classification and recommendation of technical efficacy words
- Improve processing efficiency
Method for automatically acquiring new words from Chinese webpages
Owner:TSINGHUA UNIV
Full-automatic cloth paving and cutting integrated machine
Owner:CHONGQING UNIV OF TECH
Method for Managing Local IP Access Connection
Owner:ZTE CORP
Method and device for processing concurrent data and electronic accounting system
Owner:ADVANCED NEW TECH CO LTD
Ferritic steel barrel butt-junction circular-seam hot-wire TIG multi-layer multipath welding method
Owner:HARBIN JIANCHENG GRP