Caching graphics overlay to be applied to image
By dividing the graphics overlay into line segments and using run-length encoding, the problem of graphics overlays occupying a large amount of cache memory space is solved, and storage space and bandwidth are optimized.
Patent Information
- Application Number
- CN202410420349.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-04-18
- Filing Date
- 2024-04-09
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-04-09
AI Technical Summary
In the prior art, graphics overlays occupy a large amount of cache memory space in video applications, especially since transparent pixels also occupy storage space, resulting in an increase in cache memory size.
Divide the graphics overlay into multiple sequential line segments, and cache partial information of the graphics element or run-length encoding of the same pixel in the cache memory depending on whether it overlaps with the graphics element to reduce storage space requirements.
This effectively reduces the storage space required for caching graphics overlays, reduces the bandwidth for reading data from cache memory, and improves storage efficiency.
Smart Images

Figure CN118828007A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to graphic overlays to be applied to images, and in particular, to caching graphic overlays to be applied to images. Background Art
[0002] In video applications such as videos from surveillance cameras or monitoring cameras, graphic overlays are sometimes added to image frames of the video before encoding. Such overlays can include elements in the form of text, numbers and symbols, for example. Elements can be, for example, static labels (e.g., indications of what the camera is showing, such as entrances, building X, etc.), timestamps, information text, company names and / or logos. When an overlay is to be added to an image frame of a video, the overlay is typically stored in a cache memory, for example, as a bitmap. Then, the data describing the overlay is read out from the cache memory and combined with the data related to the image frame to which the overlay should be added. This will require a considerable cache memory. For example, if the overlay is stored as a bitmap and should be able to include elements in all image frames, the cache memory will have to be large enough to store a bitmap of a size corresponding to the size of the image. In order to reduce the size of the cache memory for caching overlays, the possibility of including overlays can be limited to a certain part or parts of the image frame. Summary of the invention
[0003] In order to overcome or at least alleviate the above-mentioned deficiencies in the prior art, the present disclosure provides an improved method for caching a graphic overlay to be applied to an image, a corresponding apparatus and a non-transitory computer-readable storage medium as defined in the accompanying independent claims.
[0004] The present invention exploits the recognition that since graphics overlays in most cases are intended to add information without obscuring large portions of an image frame, graphics overlays typically include a large portion of transparent pixels. However, even transparent pixels take up space in a cache memory in which the graphics overlay is stored before being added to an image. It is therefore desirable to provide a method for caching graphics overlays that reduces the size of the cache memory required in which the overlay is cached.
[0005] According to a first aspect, a method for caching a graphics overlay to be applied to an image is provided. A graphics overlay description is obtained that specifies the content, size, and position in the image of a graphics element of the graphics overlay, and the graphics overlay is divided into a plurality of sequential line segments. For each line segment, the graphics overlay description is used to determine whether the line segment overlaps with a portion of the graphics element. In the event that the line segment overlaps with a portion of the graphics element, information representing the portion of the graphics element is cached in a cache memory for the line segment. In the event that the line segment does not overlap with a portion of the graphics element, a run-length encoding representing the same pixel is cached in a cache memory for the line segment.
[0006] By dividing the graphics overlay into a plurality of sequential line segments and caching the run-length encoding for the line segments that do not overlap a portion of the graphics element, the cache space required to cache the pixels is reduced, and thus the size of the buffer used to cache the graphics overlay can be reduced compared to if information about each individual pixel (e.g., a bitmap representation) is cached, the complete overlay also including the portion that does not overlap a portion of the graphics element. In addition, the run-length encoding representing the same pixel of the line segments that do not overlap a portion of the graphics element can be efficiently read out from the cache memory. For example, the run-length encoding of the line segments that do not overlap a portion of the graphics element will require a lower bandwidth to be read out from the cache memory compared to reading out the pixel data of each pixel of such a line segment.
[0007] The same pixels means, for example, that the pixels all have the same color and transparency, or that the pixels are all completely transparent pixels.
[0008] The information representing the portion of the graphic element may be pixel data representing the portion of the graphic element. The pixel data representing the portion of the graphic element may be obtained from a memory storing pixel data representing the graphic element. Then, the method may further include: in the case where the line segment overlaps with a portion of the graphic element, caching corresponding run-length codes representing the same pixels in the line segment before and after the portion of the graphic element in the cache memory for the line segment. By caching the run-length codes of the pixels in the line segment before and after the portion of the graphic element, the cache space required for caching the pixels is reduced, and thus the size of the buffer for caching the graphic overlay layer can be reduced compared to if the pixel data for each individual pixel in the pixels in the line segment before and after the portion of the graphic element is cached. In addition, the run-length codes representing the same pixels in the line segment before and after the portion of the graphic element can be efficiently read out from the cache memory. For example, if the amount of time taken to run-length encode the pixels in the row fragment that precede and follow the portion of a graphics element from cache memory is the same as the amount of time taken to read the pixel data for each of the pixels before and after the portion of the graphics element, the run-length encoding of the pixels in the row fragment that precede and follow the portion of the graphics element will require a lower bandwidth.
[0009] Alternatively, the information representing the portion of the graphic element may be a run-length encoding of the same pixel representing the portion of the graphic element. By caching the run-length encoding of the same pixel representing the portion of the graphic element, the cache space required to cache the pixel is reduced, and thus the size of the buffer for caching the graphic overlay can be reduced compared to if the pixel data for each individual pixel of the portion of the graphic element is cached. In addition, the run-length encoding of the same pixel in the pixels before and after the portion of the graphic element can be efficiently read out from the cache memory. For example, if the run-length encoding of the pixels before and after the portion of the graphic element is read out in the same amount of time as the pixel data for each pixel in the pixels before and after the portion of the graphic element, the run-length encoding of the pixels before and after the portion of the graphic element will require a lower bandwidth to be read out from the cache memory. Then, the method may further include: in the case where the line segment overlaps with a portion of the graphic element, caching the run-length encoding of the same pixel in front of and after the portion of the graphic element in the cache memory for the line segment.
[0010] In the act of obtaining a graphic overlay description, the obtained graphic overlay description may further specify the content, size, and position in the image of the additional graphic element of the graphic overlay. Then, the method further includes: if the line fragment overlaps with a portion of the additional graphic element, caching information representing the portion of the additional graphic element in a cache memory for the line fragment; and if the line fragment overlaps with both a portion of the graphic element and a portion of the additional graphic element, caching information representing both the portion of the graphic element and the portion of the additional graphic element in a cache memory for the line fragment.
[0011] The information representing both the portion of the graphic element and the portion of the additional graphic element may be pixel data representing a combination of the portion of the graphic element and the portion of the additional graphic element.
[0012] According to a second aspect, there is provided a non-transitory computer readable storage medium having stored thereon instructions for implementing the method according to the first aspect when executed in a camera having at least a processor and a cache memory.
[0013] According to a third aspect, an apparatus for caching a graphics overlay to be applied to an image is provided. The apparatus includes a cache memory and a circuit configured to perform an obtaining function, a dividing function, a determining function, and a caching function. The obtaining function is configured to obtain a graphics overlay description indicating the content, size, and position in the image of a graphic element of the graphics overlay. The dividing function is configured to divide the graphics overlay into a plurality of sequential line segments. The determining function is configured to, for each line segment, use the graphics overlay description to determine whether the line segment overlaps with a portion of the graphic element. The caching function is configured to, for each line segment, cache information representing the portion of the graphic element in the cache memory for the line segment if the line segment overlaps with a portion of the graphic element, and cache run-length encoding representing the same pixel in the cache memory for the line segment if the line segment does not overlap with a portion of the graphic element.
[0014] Where applicable, the above optional additional features of the method according to the first aspect also apply to the apparatus according to the third aspect. To avoid unnecessary repetitions, reference is made to the above.
[0015] According to the detailed description given below, the further applicable scope of the present invention will become apparent. However, it should be understood that, although the preferred embodiments of the present invention are described, since various changes and modifications within the scope of the present invention will become apparent to those skilled in the art according to the detailed description, the detailed description and specific examples are given only by way of illustration.
[0016] Therefore, it should be understood that, because the described device or the described method can be changed, the present invention is not limited to the specific components of such a device and the action of such a method. It should also be understood that the terms used in this article are only used for the purpose of describing a specific embodiment and are not intended to be restrictive. It must be noted that, as used in the specification and the appended claims, the articles "one" and "the (said)" are intended to represent one or more of the elements present, unless the context clearly indicates otherwise. Therefore, for example, a reference to a "unit" or "the (said) unit" can include several devices, etc. In addition, the words "comprise", "include", "contain" and similar expressions do not exclude other elements or steps. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The above and other aspects of the present invention will now be described in more detail with reference to the accompanying drawings, which should not be considered limiting but instead are for explanation and understanding.
[0018] Figure 1 A flow chart relating to an embodiment of a method for caching a graphics overlay to be applied to an image is shown.
[0019] Figure 2 A simplified illustration of a graphics overlay including a graphical element divided into row segments is shown.
[0020] Figure 3 Shown with Figure 2 An illustration of the cache associated with the row fragments of the graphics overlay shown in .
[0021] Figure 4 A diagram relating to caching of line fragments of a graphics overlay layer comprising two graphics elements divided into line fragments is shown.
[0022] Figure 5 A schematic diagram is shown relating to an embodiment of an apparatus for caching a graphics overlay to be applied to an image. DETAILED DESCRIPTION
[0023] The invention will now be described hereinafter with reference to the accompanying drawings in which currently preferred embodiments of the invention are shown. However, the invention may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein.
[0024] In the following, reference will be made to Figures 1 to 4 An embodiment of a method 100 for caching a graphics overlay to be applied to an image is described.
[0025] Figure 1A flowchart related to an embodiment of a method 100 for caching a graphic overlay to be applied to an image is shown. The method 100 comprises: obtaining S110 a graphic overlay description that specifies the content, size, and position in the image of a graphic element of the graphic overlay. The graphic overlay description may be of any type that specifies the content, size, and position in the image of the graphic element. For example, the graphic overlay description may include a bitmap representation of the graphic element and the position of the graphic element in the image. Alternatively, the graphic overlay description may include a vectorized representation of the graphic element and the size and position in the image of the graphic element. For example, if the graphic element is a character of a specific font and size that should be located at a specific position in the image, this is provided in the graphic overlay description. Then, the bitmap representation of the character of the specific font and size can be generated by rasterizing from the vectorized representation of the character. Then, the bitmap representation can be stored in a font set, which is a single bitmap texture containing all characters of the font and size that have been rasterized from their respective vectorized representations so far. Once characters of a font and size are stored in the font set, the bitmap representation of the characters of that font and size in the font set can be copied ("bit-blocked") from the font set when an overlay to be applied to an image at a location in the image that includes characters of that font and size given by the graphical overlay description is cached. A graphical element may, for example, include one or more glyphs or characters (e.g., letters, numbers, etc.), graphical objects or designs, or a combination thereof. In general, a graphical element may be intended to convey information to a viewer. Typically, a graphical element will constitute only a limited portion of an image that should be overlaid and should cover as small a portion of the image as possible while still conveying relevant information to a viewer, for example.
[0026] The method 100 further comprises: dividing the graphic overlay into S120 a plurality of sequential row segments. Preferably, all the row segments have the same size. Each row segment corresponds to a segment of a row of pixels in the image, so that the row segment describes the portion of the overlay that should be applied to the segment of the row of pixels in the image. All the row segments together will correspond to the entire image or one or more selected regions of the image, so that each row segment of the graphic overlay corresponds to a segment of a row of pixels in the image. Therefore, the method 100 can be used for a graphic overlay covering all or only a portion of the image. Preferably, since the method 100 will eventually use run-length encoding representing the same pixel for the row segments that do not overlap with a portion of the graphic element, and the longer such a row segment is, the more such run-length encoding will compress data, each row segment should not be too short. On the other hand, if the row segment is too long, the probability that the row segment will overlap with a portion of the graphic element will increase, and in such a case, the run-length encoding representing the same pixel cannot be used for the entire row segment. Preferably, the total width (W) of the overlay divided by the length (F) of the row segment should be higher than a threshold value (e.g., greater than 64). In some cases, the length of a line segment (F) is chosen to be 128 pixels. However, this can be adjusted up or down by an order of magnitude or two. The size of a line segment can be set to be optimal for a particular scene, or can be set to be suitable for a range of different scenes.
[0027] Now turn to Figure 2 , Figure 2A simplified illustration of a graphic overlay 200 including a graphic element 201 in the form of a capital letter "T" that should be applied to an image is divided into row segments so that each row segment of the graphic overlay 200 is applied to a corresponding segment of a row in the image. If the graphic overlay 200 should be applied to a portion of an image, this description may also apply with appropriate modifications. Each row segment is shown as a solid box including ten pixels, and the divisions between pixels are shown with dashed lines. It should be noted that the size and number of pixels have been rewritten for ease of illustration. In actual implementations, the number of pixels in a row segment can be much larger (e.g., 64, 128, or 256). Similarly, the pixels can be much smaller relative to the size of the graphic element 201. There are three row segments in each row, and there are twelve rows in total. The first row segment 211 is a row segment of the first row 241 from the top of the graphic overlay 200 that should be applied to the first segment from the left of the first row of pixels from the top of the image. The subsequent second row segment 212 is a row segment of the first row 241 of the second left segment of the first row of pixels from the top of the image, which should be applied starting from the pixel to the right of the last pixel of the first left segment of the first row of pixels from the top of the image. The first row 241 further includes a subsequent third row segment 213. The first row segment 211, the second row segment 212, and the third row segment 213 should be applied together to all pixels of the first row of pixels from the top of the image. After the third row segment, the subsequent fourth row segment 214 is a row segment in the second row 242 of the graphic overlay 200 that should be applied to the first left segment of the second row of pixels from the top of the image. The second row 242 further includes a fifth row segment 215 and a sixth row segment 216, so that the fourth row segment 214, the fifth row segment 215, and the sixth row segment 216 should be applied together to all pixels of the second row of pixels from the top of the image. This process is then repeated for each successive row from the third row 243 to the last row 252 from the top of the graphics overlay 200. Specifically, the 34th row segment 234, the 35th row segment 235, and the 36th row segment 236 of the last row 252 should be applied together to all pixels of the last row of pixels from the top of the image. Figure 2 With the depicted description of row segments of graphics overlay 200 , it is apparent how a graphics overlay of any size may be divided into row segments of any size.
[0028] like Figure 1As shown in , a set of actions B130 are then performed for each line segment. First, a determination is made S132 using the graphics overlay description whether the line segment overlaps a portion of a graphics element. In the graphics overlay description, the content, size, and position of the graphics element in the image are specified. Thus, it can be determined for each line segment whether the line segment overlaps a portion of the graphics element. As shown in Figure 2 As can be seen in FIG. 1 , the second leftmost row fragment in each of the second row 242 to the ninth row 249 from the top of the graphics overlay 200 overlaps a portion of the graphics element 201. Next, caching S136, S138 is performed. What is cached for the row fragment depends on the result from the determination S132. In the case C134 where the row fragment overlaps a portion of the graphics element, information representing the portion of the graphics element is cached S136 for the row fragment in the cache memory. In the case C134 where the row fragment does not overlap a portion of the graphics element, the run-length encoding representing the same pixel is cached S138 in the cache memory for the row fragment.
[0029] For a row segment that overlaps a portion of a graphic element, the information representing the portion of the graphic element in the cache memory that is cached S136 may be, for example, pixel data of the portion of the graphic element. In some embodiments, the pixel data of each of the pixels of the row segment is cached S136. In an alternative embodiment, only the pixel data of each of the pixels that overlap the portion of the graphic element is stored. For the pixels in the row segment before and after the portion of the graphic element (i.e., the pixels before and after the portion of the row segment that overlaps the portion of the graphic element), the corresponding run-length encoding representing the same pixel may be cached S137. For example, the same pixel may be a transparent pixel, so that after applying a graphic overlay, these pixels of the overlay will not be visible in the image, i.e., the original pixels of the image to which the transparent pixels are applied will not be affected by the application of the overlay.
[0030] For a row segment that does not overlap any part of a graphic element, the run-length encoding representing the same pixel cached in the cache memory S138 for the row segment can be based on any type of run-length encoding. Run-length encoding means lossless encoding, and means that for multiple instances in a sequence with the same value, instead of providing the same value for each of the instances, the data is compressed by simply identifying the value and the number of instances in the sequence to which it is applied. For example, the run-length encoding of the input data "aaaabbbcc" can be "a4b3c2". In this case, it is related to a sequence of the same pixels. Instead of providing pixel data for each pixel. The pixel data and an indication of the number of pixels in the sequence with these pixel data are identified. Run-length encoding can be performed so that if two consecutive pixels have the same fully transparent indication (α value = 0), the two consecutive pixels will be encoded as two identical pixels, and if the two consecutive pixels have an indication less than fully transparent (α value> 0), the two consecutive pixels must have the same value for each color channel and have the same transparent indication (α value) to be encoded as two identical pixels. Thus, if the current pixel has the same color value as the color value of the previously encoded pixel for all color channels, or if both the previously encoded pixel and the current pixel are transparent, the current pixel will not be encoded as a new entry. Here, the same pixel can mean that the pixels have the same color and transparency (alpha value), for example, all are red and all are 50% transparent (alpha value is 0.5), or the pixels in the same channel are all completely transparent (alpha=0). In the latter case, since completely transparent pixels are the same regardless of their color, the colors can be different. Typically, the same pixel indicates that the pixel should have the same effect when the overlay is applied to the image. Thus, for example, a run-length encoding indicating multiple transparent pixels of an overlay when applied to an image can be included as transparent pixels with different colors (e.g., a red transparent pixel and some green transparent pixels). Therefore, even if the run-length encoding indicates the same pixels, this does not require that they all have the same pixel data when applied to the image, as long as they provide the same (identical) effect in the image, for example, even if their pixel data indicates different colors, they are all transparent. In addition, rather than simply using run-length encoding to indicate that all pixels are fully transparent, an alternative scheme is included where run-length encoding indicates that some of the pixels are fully transparent (having a first color) and the rest of the pixels are fully transparent (having a second color). However, this will reduce the amount of compression achieved by run-length encoding.
[0031] Now turn to Figure 3 , Figure 3 Shown with Figure 2. As an example, the cache associated with the first row fragment of the sixth row 246 of the graphic overlay 200 will be described. As can be seen, the first row fragment from the left and the third row fragment of the sixth row 246 of the graphic overlay 200 do not overlap with any portion of the graphic element 201. Therefore, run-length encoding representing ten identical pixels is cached in the storage buffer for the first row fragment from the left and the third row fragment of the sixth row 246 of the graphic overlay 200 (which is indicated by these row fragments marked by diagonal stripes). The second row fragment from the left of the sixth row 246 of the graphic overlay 200 overlaps with a portion of the graphic element 201, which is indicated by the overlay marked by vertical stripes. Specifically, the third pixel to the ninth pixel of the second row fragment from the left of the sixth row 246 of the graphic overlay 200 overlaps with a portion of the graphic element 201. As can be noted, the overlay covers the pixels of the graphic element 201 in the form of an uppercase "T" that are part of the uppercase "T" (i.e., the third to fifth pixels and the seventh to ninth pixels). This definition of the overlay is due to the fact that the graphic element 201 is described or described in the graphic overlay description as a bitmap, or the bitmap has been derived from the graphic overlay description, and the bitmap is a rectangle of 7 pixels wide and 8 pixels high.
[0032] In one embodiment, pixel data for each pixel of a row fragment that overlaps a portion of a graphics element is cached. With respect to the second row fragment from the left of sixth row 246 of graphics overlay 200, this would mean that first pixel data for two fully transparent pixels (hereinafter, transparent pixels), followed by pixel data for each of the seven pixels of that portion of the graphics element, and finally pixel data for the last transparent pixel would be cached.
[0033] In another embodiment, pixel data for each of the pixels is cached only for the portion that overlaps with the portion of the graphic element 201. The first pixel, the second pixel, and the tenth pixel of the second-from-left row segment of the sixth row 246 of the graphic overlay 200 do not overlap with any portion of the graphic element 201. Therefore, corresponding run-length encodings representing the same pixel can be cached for the first pixel and the second pixel of the second-from-left row segment of the sixth row 246 and the tenth pixel of the second-from-left row segment of the sixth row 246. Therefore, with respect to the second-from-left row segment of the sixth row 246 of the graphic overlay 200, this would mean that the run-length encoding representing two identical transparent pixels, followed by the pixel data for each of the seven pixels of that portion of the graphic element, and finally the run-length encoding representing one transparent pixel would be cached. It should be noted that for this particular case, caching the run-length encodings of these pixels would not cause any compression compared to storing the pixel data for each of the pixels. However, if the row segment is much longer, the number of pixels before and after the overlay would be much larger, and compression would result from the run-length encoding of the transparent pixels before and after the overlay, respectively.
[0034] In an additional embodiment, the run-length encoding is also cached for the same pixels in the sequence of portions that overlap the portion of the graphics element 201. Thus, with respect to the second row of fragments from the left of the sixth row 246 of the graphics overlay 200, this would mean that the run-length encoding representing five identical transparent pixels, followed by the pixel data for one pixel of the portion of the graphics element, and finally the run-length encoding representing four transparent pixels would be cached.
[0035] In an additional embodiment, run-length encoding can be used to cache all pixels of the overlay. In this case, run-length encoding can also be used to describe the graphic element in the graphic overlay description. For example, with respect to the second row fragment from the left of the second row 242 of the graphic overlay 200, this will mean that the run-length encoding representing two identical transparent pixels, followed by the run-length encoding of seven identical pixels representing this part of the graphic element and finally the run-length encoding representing one transparent pixel will be cached. It should be noted that for this particular case, the run-length encoding of the cached transparent pixels will not cause any compression compared to the pixel data of each in the storage pixel. However, if the row fragment is much longer, the number of pixels before and after the overlay will be much larger, and compression will be generated by the run-length encoding of the transparent pixels before and after the overlay, respectively.
[0036] Obtaining the graphics overlay description of S110 may further specify the content, size, and position in the image of the additional graphics element of the graphics overlay. Unless the line fragment overlaps both the graphics element and the additional graphics element, caching associated with the line fragment may be performed in association with the additional graphics element as described above with respect to the graphics element.
[0037] In case a line fragment overlaps both a portion of the graphics element and a portion of the additional graphics element, information representing both the portion of the graphics element and the portion of the additional graphics element may be cached in a cache memory for the line fragment.
[0038] In some cases, the information representing both the portion of the graphical element and the portion of the additional graphical element may be pixel data representing a combination of the portion of the graphical element and the portion of the additional graphical element. For example, in the case where a line fragment overlaps a portion of the graphical element and a portion of the additional graphical element, and the portion of the graphical element and the portion of the additional graphical element also overlap each other, preferably pixel data representing a combination of the portion of the graphical element and the portion of the additional graphical element is cached. The combination may be based on alpha blending, for example.
[0039] Now turn to Figure 4 , Figure 4 Shows that and Figure 2 The size of the graphic overlay 200 is the same as that of Figure 2 The cache-related illustration of the row fragments of graphics overlay 400 is divided into row fragments in the same manner as in graphics overlay 200 . Figure 4 The graphic overlay 400 in Figure 2 The difference between the graphic overlay 200 in FIG. 1 and FIG. 2 is that, in addition to the graphic element 201 in the form of a capital letter “T”, Figure 4The graphic overlay 400 in FIG. 4 includes an additional graphic element 202 in the form of a capital letter "E". As an example, a cache associated with the first row fragment of the sixth row 446 of the graphic overlay 400 will be described. As can be seen, the first row fragment from the left and the third row fragment of the sixth row 446 of the graphic overlay 400 do not overlap with any portion of the graphic element 201 or any portion of the additional graphic element 202. Therefore, run-length encoding representing ten identical pixels is cached in the storage buffer for the first row fragment from the left and the third row fragment of the sixth row 446 of the graphic overlay 400 (which is indicated by these row fragments marked by diagonal stripes). The second row fragment from the left of the sixth row 446 of the graphic overlay 400 overlaps with a portion of the graphic element 201 and a portion of the graphic element 202, which is indicated by the overlay marked by horizontal stripes. Specifically, the second pixel to the ninth pixel of the second row fragment from the left of the sixth row 446 of the graphic overlay 400 overlaps with a portion of the graphic element 201 or a portion of the additional graphic element 202. The second pixel overlaps only a portion of the additional graphic element 202, and therefore, for this pixel, the pixel data of the corresponding pixel of the portion of the additional graphic element 202 will be cached. The third pixel to the sixth pixel overlap a portion of the additional graphic element 202 and a portion of the graphic element 201, and therefore, for each of these pixels, a combination of the pixel data of each of the corresponding pixels of the portion of the additional graphic element 202 and each of the corresponding pixels of the portion of the graphic element 201 will be cached. For example, the combination can be achieved by alpha blending. The seventh pixel to the ninth pixel overlap only a portion of the graphic element 201, and therefore, for each of these pixels, the pixel data of each of the corresponding pixels of the portion of the graphic element 201 will be cached. For pixels that do not overlap any portion of the graphic element 201 or any portion of the additional graphic element 202, the pixel data associated with each pixel or the run-length encoding representing the number of the same pixels can be cached.
[0040] Figure 5 A schematic block diagram of an embodiment of an apparatus 500 for caching a graphic overlay to be applied to an image is shown. The apparatus 500 may be any type of apparatus such as a monitoring camera, a security camera or a surveillance camera.
[0041] The device 500 comprises a buffer memory 510 and a circuit 530. The device 500 may be a camera, and will then typically also comprise an encoder (not shown), an image sensor (not shown) and an image processor (not shown).
[0042] The circuit 530 is configured to perform the functions of the apparatus 500. The circuit 530 may include a processor 532 such as a central processing unit (CPU), a microcontroller or a microprocessor. The processor 532 is configured to execute program code. The program code may, for example, be configured to perform the functions of the apparatus 500.
[0043] The device 500 may further include a memory 540. The memory 540 may be one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory, a random access memory (RAM), and other suitable devices. In a typical arrangement, the memory 540 may include a non-volatile memory for long-term data storage and a volatile memory used as a system memory for the circuit 530. The memory 540 may exchange data with the circuit 530 via a data bus. There may also be accompanying control lines and an address bus between the memory 540 and the circuit 530.
[0044] The functions of the device 500 may be implemented in the form of executable logic routines (e.g., lines of code, software programs, etc.) stored on a non-transitory computer-readable medium (e.g., memory 540) of the device 500 and may be performed by the circuit 530 (e.g., using the processor 532). In addition, the functions of the device 500 may be stand-alone software applications or may form part of a software application that performs additional tasks associated with the device 500. The functions described may be considered as methods that the processing unit (e.g., the processor 530 of the circuit 532) is configured to perform. In addition, although the functions described may be implemented in software, such functions may also be performed via dedicated hardware or firmware or some combination of hardware, firmware and / or software.
[0045] The circuit 530 of the apparatus 500 is configured to perform an obtaining function 541 , a dividing function 542 , a determining function 543 , and a caching function 544 .
[0046] Obtain function 541 is configured to obtain a graphics overlay description that specifies the content, size and position in the image of the graphical elements of the graphics overlay.
[0047] The partitioning function 542 is configured to partition the graphics overlay into a plurality of sequential row segments.
[0048] The determination function 543 is configured to determine, for each line segment, using the graphics overlay description, whether the line segment overlaps a portion of the graphical element.
[0049] The caching functionality 544 is configured to cache information representing a portion of a graphics element in a cache memory for each line fragment determined to overlap with the portion of the graphics element, and is configured to cache a run-length encoding representing the same pixel in a cache memory for each line fragment determined not to overlap with any portion of the graphics element.
[0050] About the above Figures 1 to 4 The corresponding actions of the described method 100 for caching a graphics overlay to be applied to an image provide further details regarding the functions that the circuit 510 is configured to perform.
[0051] Those skilled in the art will appreciate that the present invention is not limited to the above-described embodiments. On the contrary, many modifications and variations may be made within the scope of the appended claims. By studying the drawings, the disclosure, and the appended claims, those skilled in the art may understand and implement these modifications and variations when practicing the claimed invention.
Claims
1. A method for caching a graphics overlay to be applied to an image, the method comprising: obtaining a graphics overlay description specifying content, size, and location within the image of a graphical element of the graphics overlay; dividing the graphics overlay into a plurality of sequential row segments; as well as For each line fragment, using the graphics overlay description, determine whether the line fragment overlaps a portion of the graphics element, if the line fragment overlaps a portion of the graphics element, cache information representing the portion of the graphics element for the line fragment in a cache memory, and if the line fragment does not overlap any portion of the graphics element, cache a run-length encoding representing the same pixel in the cache memory for the line fragment.
2. The method according to claim 1, wherein: The information representing the portion of the graphic element is pixel data representing the portion of the graphic element.
3. The method according to claim 2, wherein: The pixel data representing the portion of the graphic element is obtained from a memory storing pixel data representing the graphic element.
4. The method according to claim 2, further comprising: In case the line fragment overlaps a portion of the graphics element, corresponding run-length encodings representing the same pixels in the line fragment before and after the portion of the graphics element are cached in the cache memory for the line fragment.
5. The method according to claim 1, wherein: The information representing the portion of the graphic element is a run-length encoding of identical pixels representing the portion of the graphic element.
6. The method according to claim 1, wherein: In the act of obtaining the graphics overlay description, the obtained graphics overlay description further specifies the content, size, and position in the image of additional graphical elements of the graphics overlay, the method further comprising: in case the line fragment overlaps with a portion of the additional graphics element, caching information representing the portion of the additional graphics element for the line fragment in the cache memory, and In case the line fragment overlaps both a portion of the graphics element and a portion of the additional graphics element, information representing both the portion of the graphics element and the portion of the additional graphics element is cached in the cache memory for the line fragment.
7. The method according to claim 6, wherein: The information representing both the portion of the graphic element and the portion of the additional graphic element is pixel data representing a combination of the portion of the graphic element and the portion of the additional graphic element.
8. A non-transitory computer-readable storage medium having stored thereon instructions for implementing the method according to claim 1 when executed in a device having a processor and a cache memory.
9. An apparatus for caching a graphics overlay to be applied to an image, the apparatus comprising: Cache memory; as well as The circuit is configured to perform: an obtaining function configured to obtain a graphics overlay description specifying content, size and location in the image of a graphical element of the graphics overlay; a partitioning function configured to partition the graphics overlay into a plurality of sequential row segments; a determination function configured to determine, for each line segment, using the graphics overlay description, whether the line segment overlaps a portion of the graphics element; as well as A caching function is configured to, for each line fragment, cache information representing the portion of the graphics element in the cache memory for the line fragment if the line fragment overlaps the portion of the graphics element, and cache a run-length encoding representing the same pixel in the cache memory for the line fragment if the line fragment does not overlap any portion of the graphics element.
10. The device according to claim 9, wherein: The information representing the portion of the graphic element is pixel data representing the portion of the graphic element.
11. The device according to claim 10, wherein: The pixel data representing the portion of the graphic element is obtained from a memory storing pixel data representing the graphic element.
12. The device according to claim 10, wherein: The cache function is further configured to, for each row fragment: In case the line fragment overlaps a portion of the graphics element, corresponding run-length encodings representing the same pixels in the line fragment before and after the portion of the graphics element are cached in the cache memory for the line fragment.
13. The device according to claim 9, wherein: The information representing the portion of the graphic element is a run-length encoding of identical pixels representing the portion of the graphic element.
14. The device according to claim 9, wherein: In the obtaining function, the obtained graphics overlay description further specifies the content, size and position in the image of additional graphics elements of the graphics overlay, and wherein the caching function is further configured to, for each line fragment: In case the line fragment overlaps with a portion of the additional graphic element, caching information representing the portion of the additional graphic element for the line fragment in a cache memory, and In case the line fragment overlaps both a portion of the graphics element and a portion of the additional graphics element, information representing both the portion of the graphics element and the portion of the additional graphics element is cached in a cache memory for the line fragment.
15. The device according to claim 14, wherein: The information representing both the portion of the graphic element and the portion of the additional graphic element is pixel data representing a combination of the portion of the graphic element and the portion of the additional graphic element.
Citation Information
Patent Citations
Blending multiple display layers
CN101460992A
Screen superposition display system and method and picture compression method
CN112165588A
Image composition device, image forming apparatus and computer readable medium storing program
US20100225971A1
