METHOD FOR CONVERTING A DIGITAL IMAGE
Patent Information
- Application Number
- DE602021036483
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-06-30
- Filing Date
- 2021-06-16
- Publication Date
- 2025-08-20
- Estimated Expiration
- 2041-06-16
AI Technical Summary
Existing methods for converting digital images between devices with different formats require excessive memory usage due to inefficient resizing and pixel format modification processes.
A method that involves resizing the initial digital image before modifying the pixel format, using techniques like decimation and low-pass filtering, to reduce the number of pixels and increase the bit representation of colors, thereby optimizing memory usage.
This approach significantly reduces the required memory area needed for the conversion process, minimizing storage requirements while maintaining image quality for neural network compatibility.
Description
DOMAINE DE L'INVENTION
[0001] The present invention relates, in general, to methods for converting digital images, in particular for adapting the format of a digital image exchanged between two devices not using the same digital image format. In a preferred application of the invention, one of the devices is an image acquisition device and the other device is a neural network. ETAT DE LA TECHNIQUE
[0002] A digital image is an image stored in binary form. It consists of a set of pixels or points. The pixels are organized into rows and columns. Each pixel is associated with a color.
[0003] The digital image is represented as a matrix of values. Each value is associated with a pixel and represents the pixel's color. The matrix has as many rows as the image has rows. The matrix has as many columns as the image has columns.
[0004] The color of a pixel is generally broken down into three primary components. These three primary components are used to find the color of a pixel using additive synthesis. These three primary components are: a red component, a green component, and a blue component. The value associated with each pixel is then composed of three values that correspond respectively to the intensity of each primary component. The intensity of each primary component is represented by a specific number of bits. The coded expression can also be used instead of the represented expression.
[0005] For example, in the RGB565 format the red component is represented by 5 bits, the green component by 6 bits and the blue component by 5 bits. Each color is thus represented by 16 bits or 2 bytes.
[0006] In the RGB888 format, the red component is represented by 8 bits, the green component by 8 bits, and the blue component by 8 bits. Each color is thus represented by 24 bits or 3 bytes.
[0007] A two-dimensional digital image has a width and a height. The format of the digital image is defined by various parameters, including: the number of pixels across the digital image, the number of pixels up the digital image, and the number of bits used to represent the color value of each pixel.
[0008] The pair (number of pixels in width of the digital image; number of pixels in height of the digital image) is generally called the definition of the digital image. The definition is noted X*Y where X represents the number of pixels in width of the digital image and Y the number of pixels in height of the digital image.
[0009] When an image acquisition device and an image-using device do not operate with the same digital image format, the two devices cannot work together. A digital image conversion is then performed.
[0010] There figure 1 represents a known method of converting a digital image. This conversion method comprises a step of modifying MODIF a pixel format of an initial digital image, in order to obtain an intermediate digital image. This method comprises a step of resizing REDI the intermediate digital image, in order to obtain a converted digital image.
[0011] In this conversion process, the MODIF modification step is performed prior to the REDI resizing step.
[0012] This conversion process therefore makes it possible to supply a third-party device with a digital image acquired by the acquisition device, in the event that the image acquisition device and the third-party device do not operate with the same digital image format.
[0013] The MODIF modification step of a pixel format of the initial digital image allows you to modify the number of bits used to represent the colors of the pixels. If the color of a pixel is broken down into three primary components (red, green and blue), the MODIF modification step of a pixel format of the initial digital image allows you to modify independently for each primary component the number of bits used to represent the primary component.
[0014] The REDI resizing step of the intermediate digital image is performed by changing the number of pixels in the intermediate digital image. This REDI resizing step can be performed by decreasing the number of pixels in width of the intermediate digital image and / or decreasing the number of pixels in height of the intermediate digital image.
[0015] There figure 2 illustrates an example of use of the method known from the figure 1 .
[0016] In this use, the modification MODIF of the pixel format of the initial digital image is carried out from an RGB565 format to an RGB888 format. Thus, the number of bits used to represent the colors is increased. If the size of the initial digital image is L kilobytes (kB), then the size of the intermediate digital image is L*1.5 kilobytes.
[0017] In the example of using the figure 2 , the REDI resizing step allows, from an intermediate digital image having a resolution of 320*240 (resolution of digital images generally acquired by an ACQUI acquisition device of the camera type) to obtain a converted digital image having a resolution of 224*224 (resolution of digital images generally used by a neural network).
[0018] During the MODIF modification and REDI resizing steps, the same area of a MEM memory is used to store the initial digital image, the intermediate digital image and the converted digital image.
[0019] To minimize the size of the MEM memory area, the pixel values of the intermediate digital image are written instead of the pixel values of the initial digital image. To minimize the size of the MEM memory area, the pixel values of the converted digital image are written instead of the pixel values of the initial digital image or instead of the pixel values of the intermediate digital image.
[0020] In the example of using the figure 2 , the MEM memory area has a size greater than the size of the initial digital image and the size of the converted digital image. Indeed, the initial digital image has a resolution of 320*240 and the color of each pixel is represented by 2 bytes. The initial digital image therefore has a size of 153.6 kilobytes. The intermediate digital image has a resolution of 320*240 and the color of each pixel is represented by 3 bytes. The intermediate digital image therefore has a size of 230.4 kilobytes. The converted digital image has a resolution of 224*224 and the color of each pixel is represented by 3 bytes. The converted digital image therefore has a size of 150.6 kilobytes. So in this case the size of the MEM memory area must be 230.4 kilobytes, in order to be able to store the intermediate digital image.
[0021] Accordingly, to perform the conversion between an initial digital image of size 153.6 kilobytes and a converted digital image of size 150.6 kilobytes, the known conversion method requires, in the example of using the figure 2 , that the MEM memory area is 230.4 kilobytes.
[0022] The computer program ARM-Software, the source code of which is available on GitHub.com at https: / / github.com / ARM-software / ML-examples and referred to in the publication "Image recognition on Arm Cortex-M with CMSIS-NN", by Arm Limited, discloses a method for converting an image format from RGB565 to RGB888 in which the image is resized and then converted.
[0023] There is therefore a need for a method of converting a digital image requiring a smaller amount of memory. EXPOSE DE L'INVENTION
[0024] The invention makes it possible to overcome the aforementioned drawbacks by proposing a method for converting an initial digital image into a converted digital image, the initial digital image consisting of a set of pixels, the pixels being associated respectively with colors, the initial digital image being acquired by an acquisition device, the converted digital image being usable by a neural network, the method comprising the following steps, resizing the initial digital image to obtain an intermediate digital image, the resizing being carried out by reducing a number of pixels of the initial image, modifying a format of one of the pixels of the intermediate digital image to obtain the converted digital image, the modification being carried out by increasing a number of bits used to represent the color of the pixel. The resizing is carried out prior to the modification.
[0025] This process offers the advantage of being able to limit the amount of memory required for its implementation.
[0026] In one embodiment the initial digital image is stored at the beginning of an area of a memory, the resizing is performed by scanning the area of the memory and incrementing addresses of the area of the memory. The modification is performed by scanning the area of the memory and decrementing addresses of the area of the memory.
[0027] In one embodiment the initial digital image is stored at the end of an area of a memory, the resizing is performed by traversing the area of the memory and decrementing addresses of the area of the memory. The modification is performed by traversing the area of the memory and incrementing the addresses of the area of the memory.
[0028] In one embodiment, the resizing of the initial digital image is performed by decimating the pixels of the initial digital image.
[0029] In one embodiment, the resizing of the image of the initial digital image is carried out by low-pass filtering of the initial digital image and then by decimating the pixels of the initial digital image.
[0030] Another aspect of the invention is an electronic chip configured to implement the conversion method presented above.
[0031] In one embodiment, the electronic chip comprises a processing unit and a memory. The processing unit is configured to implement the conversion method presented above.
[0032] Another aspect of the invention is a system comprising a device for acquiring an initial digital image, a neural network using a converted digital image, and an electronic chip capable of converting the initial digital image into the converted digital image.
[0033] Another aspect of the invention is a computer program product comprising program code instructions which when executed by an electronic chip enable the implementation of the conversion method presented above. DESCRIPTION DES FIGURES
[0034] Other characteristics, aims and advantages of the invention will emerge from the following description, which is purely illustrative and non-limiting, and which must be read in conjunction with the appended drawings in which: [ Fig. 1 ] There figure 1 represents a known conversion process. [ Fig. 2 ] There figure 2 represents a use of the known conversion process. [ Fig. 3 ] There figure 3 represents a device according to one aspect of the invention. Fig. 4 ] There figure 4 alternatively represents the device according to one aspect of the invention. Fig. 5 ] There figure 5 represents a conversion method according to one aspect of the invention. [ Fig. 6 ] There figure 6 represents a use of a first embodiment of the conversion method of the invention. Fig. 7 ] There figure 7 represents a use of a second embodiment of the conversion method of the invention. Fig. 8 ] There figure 8 represents in another way the conversion process of the invention. DESCRIPTION DETAILLEE DE L'INVENTION
[0035] There figure 3 represents a device DISP comprising a device ACQUI for acquiring a digital image and an electronic chip PUCE. The electronic chip PUCE comprises a processing unit UNIT and a memory MEM. The memory MEM makes it possible to store values in locations associated respectively with addresses.
[0036] The DISP device can be a user device, for example a smartphone, a tablet computer, a computer.
[0037] The processing unit UNIT is configured to implement a method of converting an initial digital image into a converted digital image.
[0038] The initial digital image is obtained from the ACQUI acquisition device.
[0039] The converted digital image is used by a neural network RN (not shown in the figure 3 ).
[0040] Digital images (original and converted) are represented as matrices of values. Each value is associated with a pixel and represents the pixel's color. The matrix for each image has as many rows as the image has rows. The matrix has as many columns as the image has columns.
[0041] The digital image is stored in an area of the MEM memory. This storage is achieved by concatenating the elements of the digital image matrix by rows or columns and then storing these elements in the area of the MEM memory.
[0042] The MEM memory area includes a lower bound associated with an address called the lower address. The MEM memory area includes an upper bound associated with an address called the upper address.
[0043] There figure 4 represents in another way the DISP device. The MEM memory of the PUCE chip is also used to store the RN neural network using the converted digital image that was acquired by the acquisition device ACQUI and then converted. This RN neural network can be stored in the area of the MEM memory used for the conversion of the initial digital image.
[0044] There figure 5 represents a conversion method of the invention. The conversion method of the invention is implemented for example by the processing unit UNIT. The conversion method of the invention comprises a step of resizing REDI the initial digital image, in order to obtain an intermediate digital image. The conversion method of the invention comprises a step of modifying MODIF a format of the pixels of the intermediate digital image, in order to obtain a converted digital image.
[0045] In the conversion method of the invention, the REDI resizing step is carried out prior to the MODIF modification step.
[0046] The REDI resizing step of the initial digital image is performed by changing the number of pixels in the initial digital image. This REDI resizing step can be performed by decreasing the number of pixels in width of the initial digital image and / or decreasing the number of pixels in height of the initial digital image.
[0047] This reduction can be achieved by decimating the pixels of the initial digital image. Decimation is also known as subsampling. Sampling a physical image involves taking values representing the color of pixels in the physical image. This sampling is done with a defined interval between pixels. Sampling the physical image produces a digital image. Decimating a digital image involves reducing the number of values taken. During decimation, only a certain number of pixels from the initial digital image are kept in the intermediate digital image. For example, only one pixel is kept every M pixels, where M is called the decimation factor.
[0048] Prior to decimation, the REDI resizing step may include low-pass filtering of the initial digital image.
[0049] The MODIF modification step of a pixel format of the intermediate digital image allows the number of bits used to represent the colors respectively associated with the pixels to be modified. If the color of the pixel is decomposed into three primary components (red, green and blue), the MODIF modification step of a pixel format of the initial digital image allows the number of bits used to represent this primary component to be modified independently for each primary component.
[0050] In a first embodiment of the conversion method of the invention, the resizing step REDI is performed by traversing the area of the memory MEM in a first direction and the modification step MODIF is performed by traversing the area of the memory MEM in a second direction. The first direction is identical to the second direction.
[0051] There figure 6 illustrates an example of use of the first embodiment of the conversion method of the invention represented figure 5 .
[0052] In the example of using the figure 6 , the REDI resizing step allows, from an initial digital image having a resolution of 320*240 (resolution of digital images generally acquired by an ACQUI acquisition device of the camera type), to obtain an intermediate digital image having a resolution of 224*224 (resolution of digital images generally used by the RN neural network).
[0053] In the example of using the figure 6 , the step of modifying the pixel format of the intermediate digital image is carried out from an RGB565 format to an RGB888 format. The color value of each pixel is then represented and stored in the memory area MEM by 3 bytes after the modification of the format, and no longer by 2 bytes as before the modification of the format. Therefore, the step of modifying the format is carried out by increasing the number of bits used to represent the colors of the pixels. In this example of use, if the size of the intermediate digital image is L kilobytes then the size of the converted digital image is L*1.5 kilobytes, due to the modification of the pixel format.
[0054] In the example of using the figure 6 , the initial digital image is stored in the MEM memory area in such a way that the values of the initial digital image are stored continuously up to the higher address. Thus the initial digital image is stored at the end of the MEM memory area.
[0055] In the example of using the figure 6 The REDI resizing step is performed first. The intermediate digital image obtained after resizing is stored in the MEM memory area so that the start address of the intermediate digital image is close to or identical to the start address of the initial digital image.
[0056] In the example of using the figure 6 The REDI resizing step is performed starting from the lower address and incrementing addresses up to the higher address.
[0057] In the example of using the figure 6 The MODIF modification step of the intermediate digital image is performed second. This conversion is performed starting from the lower address and incrementing the addresses. The pixel values of the converted digital image are stored continuously starting from the lower address. Thus the converted digital image is stored at the beginning of the MEM memory area.
[0058] Performing the REDI resizing step before the MODIF modification step makes it possible to limit the size of the MEM memory area required to store the different images.
[0059] Indeed, the initial digital image has a resolution of 320*240 and the color of each pixel is represented by 2 bytes. The initial digital image has a size of 153.6 kilobytes. The intermediate digital image has a resolution of 224*224 and the color of each pixel is represented by 2 bytes. The intermediate digital image has a size of 100.4 kilobytes. The final digital image has a resolution of 224*224 and the color of each pixel is represented by 3 bytes. The converted digital image has a size of 150.6 kilobytes. However, in order to carry out the MODIF modification step, it is necessary to reserve a space in the MEM memory area free of value in the area located between the lower address and the beginning of the intermediate digital image. This free area must be configured so that the converted digital image can end up at the same level as the intermediate digital image.This free area should be 50 kilobytes in the example of using the . figure 6 .
[0060] Accordingly, to carry out the conversion between an initial digital image of size 153.6 kilobytes and a converted digital image of size 150.6 kilobytes, the first embodiment of the conversion method of the invention illustrated in figure 5 requires a MEM memory area of size 203.776 kilobytes.
[0061] The conversion method of the invention makes it possible to limit the size of the MEM memory area required compared to the known conversion method.
[0062] In a second embodiment of the conversion method of the invention, the resizing step REDI is performed by browsing the memory in a first direction and the modification step MODIF is performed by browsing the memory in a second direction. The first direction is opposite to the second direction.
[0063] This second embodiment of the conversion method of the invention offers the advantage of limiting the size of the memory area MEM necessary for the conversion of the initial digital image, compared to the first embodiment of the conversion method of the invention.
[0064] The first direction is the traversal of the addresses, by incrementing these addresses and the second direction is the traversal of the addresses, by decrementing these addresses. In this case, the initial digital image is continuously stored in the MEM memory area in such a way that the beginning of the initial image is stored at the lower address. The initial digital image is therefore stored at the beginning of the MEM memory area.
[0065] The first direction can correspond to the traversal of the addresses, by decrementing these addresses and the second direction can correspond to the traversal of the addresses, by incrementing these addresses. In this case, the initial digital image is stored continuously in the MEM memory area in such a way that the end of the initial image is stored at the higher address. The initial digital image is therefore stored at the end of the MEM memory area.
[0066] There figure 7 illustrates a use of the second embodiment of the conversion method of the invention. In this use, the initial digital image is stored at the beginning of the memory area. The REDI resizing step is carried out starting from the upper addresses and decrementing the addresses. The end address of the intermediate digital image is identical to the end address of the initial digital image.
[0067] Thus the starting address of the intermediate digital image is greater than the lower address and therefore the area of the MEM memory located between the starting address of the intermediate digital image and the lower address will be free of value.
[0068] In the example of using the figure 7 , the modification step MODIF is performed by starting with the lower addresses and incrementing the addresses. The address of the start of the converted digital image is advantageously equal to the lower address.
[0069] The second embodiment of the conversion method does not require the reservation of a specific space in the area of the MEM memory free of value in the area located between the lower address and the start of the intermediate digital image. Indeed, this area between the lower address and the start of the intermediate digital image is by construction free of value.
[0070] Thus, to carry out the conversion between an initial digital image of size 153.6 kilobytes and a final digital image of size 150.528 kilobytes, the second embodiment of the conversion method of the figure 5 requires a MEM memory area of size 153.6 kilobytes.
[0071] The second embodiment of the conversion method of the invention makes it possible to limit the size of the MEM memory area required compared to the first embodiment of the conversion method of the invention.
[0072] There figure 8 illustrates the second conversion method in the case where it also includes a data adaptation step ADAPT in order to adapt the converted digital image to a data format expected by the input of the neural network RN.
[0073] This ADAPT data adaptation step includes two sub-steps: a first conversion sub-step allowing to pass from a representation of the color of a pixel on 8 bits with values between 0 and 255 to another representation on 8 bits with values limited by the training of the neural network (for example between 0 and 1, between -1 and 1, or another interval). a second sub-step of representation of the values of the colors of the pixels in a format compatible with the neural network (for example a fixed point type representation, or an integer representation (scale * (q - zp)), or other).
Claims
1. A method for converting an initial digital image into a converted digital image, the initial digital image consisting of a set of pixels, the pixels being associated respectively with colours, the initial digital image being acquired by an acquisition device (ACQUI), the initial digital image being stored in an area of a memory (MEM), the converted digital image being usable by a neural network (RN), the method comprising the following steps: - resizing (REDI) the initial digital image to obtain an intermediate digital image, the resizing (REDI) being carried out by reducing a number of pixels of the initial image, the values of the pixels of the intermediate digital image being written in place of the values of the pixels of the initial digital image; - modifying (MODIF) a format of the pixels of the intermediate digital image to obtain the converted digital image, the modification (MODIF) being carried out by increasing a number of bits used to represent the colour of the pixel, the values of the pixels of the converted digital image being written in place of values of the pixels of the initial digital image or in place of values of the pixels of the intermediate digital image; the resizing (REDI) being carried out prior to the modification (MODIF), the resizing step (REDI) being carried out by travelling the memory area in a first direction, the modification step (MODIF) being carried out by travelling the memory area in a second direction, the first direction being opposite to the second direction.
2. The conversion method according to claim 1, wherein: - the initial digital image is stored at the beginning of the memory area (MEM); - the resizing (REDI) is carried out by travelling the memory area (MEM) and incrementing addresses of the memory area (MEM); - the modification (MODIF) is carried out by travelling the memory area (MEM) and decrementing the addresses of the memory area (MEM).
3. The conversion method according to claim 1, wherein: - the initial digital image is stored at the end of the memory area (MEM); - the resizing (REDI) is carried out by travelling the memory area (MEM) and decrementing addresses of the memory area (MEM); - the modification (MODIF) is carried out by travelling the memory area (MEM) and incrementing the addresses of the memory area (MEM).
4. The conversion method according to any one of claims 1 to 3, wherein: - the resizing (REDI) of the initial digital image is carried out by decimating the pixels of the initial digital image.
5. The conversion method according to any one of claims 1 to 3, wherein: - the resizing (REDI) of the initial digital image is carried out by low-pass filtering of the initial digital image then by decimating the pixels of the initial digital image.
6. An electronic chip (PUCE) configured to implement the conversion method according to any one of claims 1 to 5.
7. The electronic chip (PUCE) according to claim 6 comprising a processing UNIT (UNIT) and a memory (MEM), the processing UNIT (UNIT) being configured to implement the conversion method according to any one of claims 1 to 5.
8. A system (SYST) comprising: - a device (ACQUI) for acquiring an initial digital image, - a neural network (RN) using a converted digital image, - an electronic chip (PUCE) according to claim 6 or 7 capable of converting the initial digital image into the converted digital image.
9. A computer program product comprising program code instructions which, when executed by an electronic chip (PUCE), enable the implementation of the conversion method according to any one of claims 1 to 5.