De-sampling method based on jitter and storage medium
By introducing a jittered downsampling offset and a jittered downsampling offset sequence in the image downsampling process, the problem of texture detail loss in traditional methods is solved, and better image detail preservation and computational efficiency are achieved.
Patent Information
- Application Number
- CN202511325512.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-17
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2045-09-17
AI Technical Summary
Existing image downsampling methods lead to loss of texture details, especially traditional interpolation algorithms lose edge sharpness and texture details during the downsampling process.
A dither-based downsampling method is adopted. By introducing dither downsampling offsets in the horizontal and vertical directions, combining the dither downsampling offset sequence and the pseudo-random number generator, the dithered or non-dithered downsampling direction is selected, and downsampling is performed using the nearest neighbor interpolation method, the linear interpolation method, or the cubic interpolation method.
It effectively preserves image details, reduces image pixel information loss, has low computational complexity, and is easy to implement in hardware.
Smart Images

Figure CN120835124A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image data processing, and in particular to a dithering-based downsampling method and a storage medium. BACKGROUND
[0002] With the rapid development of display technology, the screen resolution of terminal devices presents a diversification trend, ranging from high definition HD, full high definition FHD to 4K or even 8K, and the resolutions of image sources also vary greatly. Therefore, as a basic operation of converting a high-resolution image into a low-resolution image, the method of image downsampling directly affects the display effect of the final screen.
[0003] At present, mainstream image downsampling methods are mostly based on interpolation algorithms, such as nearest neighbor interpolation, bilinear interpolation and bicubic interpolation. The essence of these methods is to output the final pixel value by calculating the weighted average value of one or more source pixels around the target pixel point on a fixed sampling grid.
[0004] However, these traditional fixed-point downsampling methods have problems such as jaggies, image blurring and loss of details. Although the nearest neighbor interpolation method has the characteristic of small amount of calculation, it uses only the gray value of the nearest pixel to the measured sampling point as the gray value of the sampling point, which will produce obvious mosaic and jaggies. As a low-pass filter, bilinear and bicubic interpolation algorithms lose the sharpness of the edges and rich texture details in the calculation process by performing weighted averaging on the surrounding pixel region.
[0005] Therefore, the loss of texture details caused by downsampling is a technical problem to be solved. SUMMARY
[0006] The present application provides a dithering-based downsampling method and a storage medium, which solves the technical problem of loss of texture details caused by downsampling.
[0007] To solve the above technical problems, the technical solution adopted by the present application is as follows:
[0008] A dithering-based downsampling method, comprising the following steps:
[0009] Step S1: obtaining the downsampling step length in the first direction and the second direction of the image to be downsampled;
[0010] Step S2: obtaining a dithering downsampling direction from the first direction and the second direction, obtaining a dithering downsampling offset sequence, and obtaining a dithering downsampling offset from the dithering downsampling offset sequence as an initial dithering downsampling offset;
[0011] Step S3: obtaining a down-sampling point of each to-be-down-sampled processing unit in the to-be-down-sampled image of the current frame based on the jitter down-sampling offset , obtaining the pixel value of the down-sampling point as a down-sampled pixel value, obtaining a target image of the down-sampled current frame, obtaining a next jitter down-sampling offset as a new jitter down-sampling offset, and obtaining a target image of a next frame based on the new jitter down-sampling offset.
[0012] A further technical solution is that in the step S1, a first direction and a second direction down-sampling step length are obtained based on a resolution of the to-be-down-sampled image and a resolution of the down-sampled target image.
[0013] A further technical solution is that in the step S1, a resolution of the to-be-down-sampled image and a resolution of the down-sampled target image are obtained. A first direction down-sampling step length is obtained by dividing a first direction resolution of the to-be-down-sampled image by a first direction resolution of the target image. A second direction down-sampling step length is obtained by dividing a second direction resolution of the to-be-down-sampled image by a second direction resolution of the target image. The first direction is a horizontal direction, and the second direction is a vertical direction.
[0014] A further technical solution is that in the step S2, a candidate point number is obtained by rounding down a down-sampling step length of a jitter down-sampling direction. A jitter down-sampling offset sequence {0, 1, 2,..., -1} is obtained based on the candidate point number, and each data in the jitter down-sampling offset sequence is a jitter down-sampling offset.
[0015] A further technical solution is that in the step S2, a pseudo-random number generator is used to obtain a jitter down-sampling offset and to conform to a uniform distribution, thereby forming a jitter down-sampling offset sequence.
[0016] A further technical solution is that in the step S2, the jitter down-sampling offset sequence is a jitter down-sampling offset circular queue, a position is randomly selected as a head of the queue based on the jitter down-sampling offset circular queue, and a jitter down-sampling offset used for down-sampling processing of the to-be-down-sampled image of the first frame is read and obtained.
[0017] A further technical solution is: in step S3, if there is a non-jitter downsampling direction, downsampling is performed in the non-jitter downsampling direction using a fixed-point downsampling method; the fixed-point downsampling method is a nearest neighbor interpolation method, a linear interpolation method, or a cubic interpolation method.
[0018] A further technical solution is: in step S3, after obtaining the downsampled target image of the current frame, the target image of the current frame is displayed.
[0019] A further technical solution is that the step S3 is specifically divided into the following steps:
[0020] Step S31: Obtain the downsampling base point in the first direction of the image to be downsampled and the downsampling base point in the second direction , obtain the initial base point of the current target image;
[0021] Step S32: Obtain sampling points in the first direction ;
[0022] Step S33: Obtain sampling points in the second direction ;
[0023] Step S34: Sampling points based on the first direction and the sampling points in the second direction , get the downsampling point of the current downsampling processing unit ;
[0024] Step S35: The pixel value of the current pixel point of the current target image is the downsampling point of the current downsampling processing unit. Pixel value of
[0025] Step S36: Set = , the next pixel point of the current target image is used as the current target pixel point, and step S32 is executed until all the downsampling processing units in the horizontal direction of the current downsampling processing unit are processed; let =0, , the first column of the next row of pixels of the current target image is used as the current pixel, and step S32 is executed until all the downsampling processing units in the current downsampled image are processed, thereby obtaining the downsampled current target image; the jitter downsampling offset of the downsampled image of the next frame used for downsampling processing is read, and step S31 is executed to process the next frame of the downsampled image until all the downsampled images are processed.
[0026] Further technical solutions are as follows: in the step S2, at least one direction is a dithering decimation direction, when the first direction is the dithering decimation direction, a first dithering decimation offset sequence is obtained, and a first dithering decimation offset is obtained ; in the step S32, a sampling point of the first direction is obtained based on a decimation base point of the first direction and the first dithering decimation offset , the value of the sampling point of the first direction is , and the sampling point of the first direction is a dithering sampling point .
[0027] In the step S2, when the second direction is the dithering decimation direction, a second dithering decimation offset sequence is obtained, and a second dithering decimation offset is obtained ; in the step S33, a sampling point of the second direction is obtained based on a decimation base point of the second direction and the second dithering decimation offset , the value of the sampling point of the second direction is , and the sampling point of the second direction is a dithering sampling point .
[0028] Further technical solutions are as follows: in the step S2, when the first direction is a non-dithering decimation direction, in the step S32, a sampling point of the first direction is obtained based on a decimation base point of the first direction and a fixed-point decimation method , and the sampling point of the first direction is a non-dithering sampling point .
[0029] In the step S2, when the second direction is the non-dithering decimation direction, in the step S33, a sampling point of the second direction is obtained based on a decimation base point of the second direction and the fixed-point decimation method , and the sampling point of the second direction is a non-dithering sampling point .
[0030] Further technical solutions are as follows: in the step S1, when the decimation step is a decimal number, in the step S35, the decimation point is a virtual pixel point, then a decimation result is obtained based on the decimation point and by using a nearest-neighbor interpolation method, a linear interpolation method or a cubic interpolation method, and the pixel value of the decimation point of the current decimation processing unit is taken as a pixel value of the decimation point .
[0031] A computer readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned jitter-based downsampling method.
[0032] The technical scheme has the beneficial effects that:
[0033] A jitter-based downsampling method includes the following steps: step S1: obtaining a first direction and a second direction of a downsampling step of a to-be-downsampled image; step S2: obtaining a jittered downsampling direction from the first direction and the second direction, obtaining a jittered downsampling offset sequence, obtaining a jittered downsampling offset in the jittered downsampling offset sequence as an initial jittered downsampling offset; step S3: obtaining a downsampling point of each to-be-downsampled processing unit in a current frame of the to-be-downsampled image based on the jittered downsampling offset , taking a pixel value of the downsampling point as a pixel value after downsampling, obtaining a target image after downsampling of the current frame, obtaining a next jittered downsampling offset as a new jittered downsampling offset, and obtaining a target image of a next frame based on the new jittered downsampling offset. The method reduces loss of image pixel information and effectively retains more image details through jittered downsampling. Meanwhile, the method has the advantages of low computational complexity and easy hardware implementation. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1 is a flowchart of embodiment 1;
[0035] Figure 2 is a first state diagram of a jittered downsampling offset circular queue of embodiment 1;
[0036] Figure 3 is a state diagram of jittered downsampling offset circular queues of two adjacent frames;
[0037] Figure 4 is a state evolution diagram of the same processing unit of horizontal jittered downsampling of eight consecutive frames;
[0038] Figure 5 is a state diagram of jittered downsampling points in the horizontal direction of embodiment 1;
[0039] Figure 6 is a state diagram of downsampling points of embodiment 1;
[0040] Figure 7a is a state diagram of downsampling points of the target image in the kth frame of the same output pixel point of embodiment 1;
[0041] Figure 7b is a state diagram of downsampling points of the target image in the k+1th frame of the same output pixel point of embodiment 1;
[0042] Figure 7c is a state diagram of the down-sampled points of the target image of Example 1 at the same output pixel point at the k+2 frame;
[0043] Figure 7d is a state diagram of the down-sampled points of the target image of Example 1 at the same output pixel point at the k+3 frame;
[0044] Figure 7e is a state diagram of the down-sampled points of the target image of Example 1 at the same output pixel point at the k+4 frame;
[0045] Figure 7f is a state diagram of the down-sampled points of the target image of Example 1 at the same output pixel point at the k+5 frame;
[0046] Figure 7g is a state diagram of the down-sampled points of the target image of Example 1 at the same output pixel point at the k+6 frame;
[0047] Figure 7h is a state diagram of the down-sampled points of the target image of Example 1 at the same output pixel point at the k+7 frame;
[0048] Figure 8 is a state diagram of the down-sampled points of the same processing unit for eight consecutive frames of vertical dithering;
[0049] Figure 9 is a state diagram of the down-sampled points of the vertical dithering;
[0050] Figure 10 is a state diagram of the down-sampled points of Example 2;
[0051] Figure 11a is a state diagram of the down-sampled points of the target image of Example 2 at the same output pixel point at the k frame;
[0052] Figure 11b is a state diagram of the down-sampled points of the target image of Example 2 at the same output pixel point at the k+1 frame;
[0053] Figure 11c is a state diagram of the down-sampled points of the target image of Example 2 at the same output pixel point at the k+2 frame;
[0054] Figure 11d is a state diagram of the down-sampled points of the target image of Example 2 at the same output pixel point at the k+3 frame;
[0055] Figure 11e is a state diagram of the down-sampled points of the target image of Example 2 at the same output pixel point at the k+4 frame;
[0056] Figure 11fis a state diagram of the down-sampling point of the target image of example 2 at the k+5th frame of the same output pixel point;
[0057] Figure 11g is a state diagram of the down-sampling point of the target image of example 2 at the k+6th frame of the same output pixel point;
[0058] Figure 11h is a state diagram of the down-sampling point of the target image of example 2 at the k+7th frame of the same output pixel point;
[0059] Figure 12 is a state diagram of the down-sampling point of example 4;
[0060] Figure 13a is a state diagram of the down-sampling point of the target image of example 4 at the kth frame of the same output pixel point;
[0061] Figure 13b is a state diagram of the down-sampling point of the target image of example 4 at the k+1th frame of the same output pixel point;
[0062] Figure 13c is a state diagram of the down-sampling point of the target image of example 4 at the k+2th frame of the same output pixel point;
[0063] Figure 13d is a state diagram of the down-sampling point of the target image of example 4 at the k+3th frame of the same output pixel point;
[0064] Figure 14 is a state diagram of the down-sampling point of example 5 in the horizontal direction;
[0065] Figure 15a is a state diagram of the down-sampling point of the current down-sampling processing unit of example 5;
[0066] Figure 15b is a state diagram of the non-shaking down-sampling direction linear interpolation of example 5. DETAILED DESCRIPTION
[0067] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. The following description of at least one exemplary embodiment is actually only illustrative, but not as any limitation on the present application and its application or use. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making any creative effort fall within the scope of protection of the present application.
[0068] Many specific details are set forth in the following description in order to provide a thorough understanding of the present application. However, the present application can be practiced according to other embodiments that can not be described in detail herein, and the present application is not limited to the embodiments described herein. Rather, the present application is limited only by the claims.
[0069] Embodiment 1
[0070] As shown in Fig. 7, the present application discloses a jitter-based downsampling method, which downsamples an input image with a resolution of 3840 Figure 1 x 2160 to obtain an output image with a resolution of 480 x 270.
[0071] As shown in Fig. 7, the present application discloses a jitter-based downsampling method, which downsamples an input image with a resolution of 3840 Figure 1 x 2160 to obtain an output image with a resolution of 480 x 270.
[0072] Step S1: obtaining an image to be downsampled and the downsampling step length in horizontal and vertical directions.
[0073] obtaining the resolution of the image to be downsampled and the resolution of the target image after downsampling. dividing the resolution of the first direction of the image to be downsampled by the resolution of the first direction of the target image to obtain the downsampling step length in the first direction. dividing the resolution of the second direction of the image to be downsampled by the resolution of the second direction of the target image to obtain the downsampling step length in the second direction. . .
[0074] The details are as follows.
[0075] The image to be downsampled is obtained, i.e., the current frame image is obtained and used as a preset input image, and the target image after downsampling is the output target image. The first direction is the horizontal direction, and the second direction is the vertical direction. According to the resolution parameters of the preset input image and the output target image, the downsampling step lengths in the horizontal and vertical directions are calculated.
[0076] The downsampling step length calculation method is as follows: let the preset resolution parameter of the input image be , and the preset resolution of the output target image be .
[0077] According to the following formula: ,
[0078] the downsampling step length in the horizontal direction is , the downsampling step size in the vertical direction is .
[0079] Alternatively, you can use the following calculation formula: ,
[0080] In this embodiment, the preset resolution parameter of the input image is , the preset resolution of the output target image is According to formula (1) and formula (2), we can get: the horizontal downsampling step size is , the downsampling step size in the vertical sampling direction is .
[0081] Any downsampling step size calculated based on the resolution of the image to be downsampled and the target image after downsampling may be a decimal.
[0082] Step S2: Obtain the dither downsampling direction and the dither downsampling offset.
[0083] Step S2 is the core step of this application.
[0084] Get the jitter downsampling direction, which is the first direction or the second direction, and round down the downsampling step size in the jitter downsampling direction to get the candidate points. , based on the number of candidate points, obtain the jitter downsampling offset sequence {0,1,2,..., -1}, each data in the jitter downsampling offset sequence is a jitter downsampling offset .
[0085] In this embodiment, the first direction is a dithered downsampling direction, and dithered downsampling is adopted; the second direction is a non-dithered downsampling direction, and the nearest neighbor interpolation method is adopted for downsampling.
[0086] The dithered downsampling offset sequence is a dithered downsampling offset circular queue. A position is randomly selected as the head of the queue based on the dithered downsampling offset circular queue to obtain the dithered downsampling offset of the downsampled image to be used for downsampling processing of the first frame. .
[0087] Details are as follows.
[0088] Only the horizontal direction is selected as the dither downsampling direction, and the dither downsampling offset in the horizontal direction is determined by using a preset dither circular queue. That is, the data in the dither downsampling offset sequence is randomly sorted and formed into a queue. The data in the queue is read once when processing one frame of image. That is, a fixed dither downsampling offset is used to downsample one frame of image, and the data in the queue is read in a circular manner in sequence. The dither downsampling offset sequence is called the dither downsampling offset circular queue.
[0089] Read the first element of the preset jitter circular queue with the same number of candidate points as the jitter downsampling offset of the current frame When the jitter downsampling offset is read from the jitter circular queue for the first time, an address may be randomly selected from the candidate point addresses of the jitter circular queue to read the stored data as the current jitter downsampling offset.
[0090] Assume that a jitter circular queue is preset as follows.
[0091] like Figure 2 As shown, the pointer head is set in the queue to identify the queue head, and the sampling offset of the current frame is obtained by reading the head element of the current circular queue. Assuming that the data in the storage unit pointed to by the frame pointer is 6, the jitter offset of the current frame image can be obtained as .
[0092] The characteristic of the jitter circular queue is that the preset jitter circular queue should be consistent with the set {0,1,2,..., -1} corresponds to one of the full permutation sets. In other words, the jitter circular queue is only !One of the arrangements, the rest !-1 kinds of arrangements can be used to generate corresponding jitter circular queues.
[0093] Only when the processing of a frame of image is completed, the pointer of the dithering circular queue is moved forward by one element, thereby achieving the purpose of generating a new horizontal dithering offset in the next frame.
[0094] like Figure 3 As shown, specifically: taking the above jitter cycle queue as an example, the jitter offset of the k-th frame image in the upper part of the figure is , due to the introduction of the jitter cycle queue, the jitter offset of the current frame of the k+1th frame image in the lower part of the figure under the current window is 7.
[0095] like Figure 4 As shown in the figure, from top to bottom, similarly, the corresponding jitter offsets of the k+2, k+3, k+4, k+5, k+6, and k+7 frames can be obtained. They are 5, 3, 1, 0, 2, and 4 respectively.
[0096] Step S3: obtaining the down-sampling point, obtaining the target image.
[0097] As shown in the figure, 0-7 from left to right in horizontal direction represent the horizontal coordinates of the pixel points, 0-7 from top to bottom in vertical direction represent the vertical coordinates of the pixel points, (0, 0) represents the pixel point in the first row and the first column, (7, 7) represents the pixel point in the eighth row and the eighth column, and 8 Figure 5 pixel points form a down-sampling processing unit, and each time of down-sampling is to determine a horizontal coordinate and a vertical coordinate of a pixel point to be down-sampled from the down-sampling processing unit to form a down-sampling point , and then down-sampling.
[0098] The calculation steps are as follows.
[0099] Step S31: obtaining the down-sampling base point in the first direction and the down-sampling base point in the second direction of the image to be down-sampled. =0, =0, the initial base point (0, 0) of the current target image.
[0100] Step S32: obtaining the sampling point in the first direction based on the down-sampling base point in the first direction and the jitter down-sampling offset , the value of the sampling point in the first direction is , and the sampling point in the first direction is a jitter sampling point.
[0101] Step S33: obtaining the sampling point in the second direction based on the down-sampling base point in the second direction and the nearest neighbor interpolation method, the sampling point in the second direction is a non-jitter sampling point.
[0102] Step S34: obtaining the down-sampling point of the current down-sampling processing unit based on the sampling point in the first direction and the sampling point in the second direction .
[0103] Step S35: the pixel value of the current pixel point of the current target image is the pixel value of the down-sampling point of the current down-sampling processing unit.
[0104] Step S36: let = , the next pixel point of the current target image is taken as the current pixel point, and step S32 is executed, that is, after the current downsampling processing unit is processed, the next downsampling processing unit to the right of the current downsampling processing unit is processed, and the process is repeated in sequence until all the downsampling processing units to be downsampled in the horizontal direction of the current downsampling processing unit are processed; let =0, , and accordingly move the pointer of the current pixel point of the current target image to the first column of the next row, that is, prepare to move the downsampling point of the current downsampling processing unit to the first column of the next row. Move to the first downsampled processing unit in the next row of downsampled processing units, and the current pixel of the current target image is ready to receive the downsampled data of the next row. Execute step S32 until all downsampled processing units in the current downsampled image have been processed, and obtain the downsampled current target image and display it; increase the read pointer of the dithered downsampling offset circular queue by one, and read the dithered downsampling offset for downsampling the next frame of the downsampled image. , executing step S31, that is, preparing to process the next frame of the image to be downsampled, until all the images to be downsampled are processed.
[0105] Details are as follows.
[0106] In this embodiment, only the horizontal direction is selected as the dither downsampling direction. For the sake of convenience, the detailed process of dither downsampling is described by taking the calculation process of the pixel point at the (0,0) position of the output target image as an example, which specifically includes the following sub-steps.
[0107] Step 1: Obtain a set of candidate sampling points in the first direction.
[0108] Downsampling step size based on the first direction Get the first sampling window , the first direction is the jitter downsampling direction, and the first sampling window is the jitter sampling window, as follows.
[0109] First, we can know the downsampling base point of the initialized jitter downsampling direction =0, the downsampling step length of the first downsampling direction obtained in step S1 is The left closed and right open interval can be determined as the jitter sampling window ; Further, obtain the jitter sampling candidate point set composed of integer points in the jitter sampling window , within the current jitter sampling window .
[0110] Step 2: Obtain the jitter downsampling points in the first direction.
[0111] like Figure 5 As shown, the horizontal jitter offset of the current frame is determine the jittered down-sampling point in the first down-sampling direction. For example, the current jittered down-sampling point in the first down-sampling direction is the 6th candidate point in the set of jittered down-sampling candidate points, because the counting starts from 0, that is, .
[0112] Further, since the horizontal direction is selected as the first down-sampling direction in the embodiment, the down-sampling base point in the first down-sampling direction needs to be updated after each down-sampling.
[0113]
[0114] According to the above formula , the down-sampling base point in the first down-sampling direction can be updated as .
[0115] Step 3: Determine the fixed sampling point in the non-jittered down-sampling direction and calculate the down-sampled pixel value.
[0116] In the embodiment, only the horizontal direction is selected as the jittered down-sampling direction, and thus the non-jittered down-sampling direction is the vertical direction. The non-jittered down-sampling direction is down-sampled by using the nearest neighbor interpolation method.
[0117] Firstly, it is known that the down-sampling base point in the non-jittered down-sampling direction is initialized as = 0. Since the nearest neighbor interpolation method is used as the fixed point down-sampling method, it is known that , and is closer to the position 0, and thus it is determined that . In combination with the determined in step S3, it is finally determined that the down-sampling point is .
[0118] As shown in FIG. 6, the output target image Figure 6 is directly outputted. The pixel value at in the output target image is:
[0119] wherein represents the pixel value of the input frame image A at .
[0120] Finally, since the horizontal direction is selected as the jittered down-sampling direction in the embodiment, the non-jittered down-sampling direction is the vertical direction, and thus the down-sampling base point in the non-jittered down-sampling direction is updated as
[0121] According to formula (6), since = 8.0, it is known that Remain unchanged, that is .
[0122] Fourth step: output the target image after down-sampling in sequence.
[0123] Repeat the first step, the second step and the third step, and down-sample from left to right and line by line to obtain the output frame image after down-sampling, and repeat the above operation for each received frame, and display the output frame image in real time on the display device.
[0124] As shown in Figure 7a , Figure 7b , Figure 7c , Figure 7d , Figure 7e , Figure 7f , Figure 7g and Figure 7h , the target image is shown in the down-sampling point demonstration diagram of the same output pixel point for eight consecutive frames. In this embodiment, due to the introduction of the dithering down-sampling in the horizontal direction, the sampling position of each frame is dithered in the horizontal direction according to the dithering offset of the current frame On the other hand, based on the continuity between image frames, the effectiveness of the image information is retained more, and the loss of image pixel point information is reduced.
[0125] In addition, due to the use of the dithering down-sampling method in the horizontal direction, by introducing the dithering offset, the weighted summation calculation process in the calculation process of other fixed sampling point sampling methods such as linear interpolation method and cubic interpolation method is avoided, and the use of the multiplier is avoided in the hardware implementation process, thereby reducing the hardware overhead.
[0126] Embodiment 2
[0127] Embodiment 2 is different from embodiment 1 in that the first direction is a non-dithering down-sampling direction, and the nearest neighbor interpolation method is used for down-sampling; the second direction is a dithering down-sampling direction, and the dithering down-sampling is used.
[0128] The application discloses a dithering-based down-sampling method. The input image with a resolution of 3840 320 output image with a resolution of 480
[0129] Step S1: same as embodiment 1, which will not be repeated.
[0130] Step S2: obtain the dithering down-sampling direction and the dithering down-sampling offset.
[0131] In this embodiment, only the vertical direction is selected as the dithering down-sampling direction, and the dithering down-sampling offset of the dithering down-sampling direction is determined in the form of a preset dithering cycle queue.
[0132] like Figure 2 As shown, the first element of the preset jitter circular queue with the same number as the current candidate points is read as the jitter downsampling offset of the current frame . Assume that a jitter circular queue is preset.
[0133] The pointer head is set in the queue to identify the queue head, and the sampling offset of the current frame is obtained by reading the head element of the current circular queue. Assuming that when the frame pointer points to 6, the jitter offset of the current frame image can be obtained as .
[0134] Among them, the characteristics of the jitter circular queue are:
[0135] The preset jitter circular queue for should be consistent with the set {0,1,2,..., -1} corresponds to one of the full permutation sets. In other words, the jitter circular queue is only !One of the arrangements, the rest !-1 kinds of arrangements can be used to generate corresponding jitter circular queues.
[0136] Only when a frame of image processing is completed, the pointer of the jitter loop queue moves forward one element.
[0137] Taking the above jitter cycle queue as an example, the jitter offset of the k-th frame image is , due to the introduction of the jitter cycle queue, the jitter offset of the current frame of the k+1 frame image in the current window is 7.
[0138] like Figure 8 As shown in the figure, from left to right, similarly, the jitter window offsets of the k+2, k+3, k+4, k+5, k+6, and k+7 frames can be obtained. The corresponding numbers are 5, 3, 1, 0, 2, and 4 respectively.
[0139] Step S3: Obtain downsampling points to obtain the target image.
[0140] The calculation steps are as follows.
[0141] Step S31: Obtain the downsampling base point in the first direction of the image to be downsampled and the downsampling base point in the second direction , =0, =0, the initial base point of the current target image is (0,0).
[0142] Step S32: Downsampling base point based on the first direction And the nearest neighbor interpolation method is used to obtain the sampling points in the first direction , sampling points in the first direction is the non-jitter sampling point.
[0143] Step S33: Downsampling base point based on the second direction and jitter downsampling offset Get the sampling points in the second direction , sampling points in the second direction The value of , sampling points in the second direction is the jitter sampling point.
[0144] Step S34: Sampling points based on the first direction and the sampling points in the second direction , get the downsampling point of the current downsampling processing unit .
[0145] Step S35: The pixel value of the current pixel point of the current target image is the downsampling point of the current downsampling processing unit. The pixel value of .
[0146] Step S36: Set = , execute step S32 until all downsampling processing units in the horizontal direction of the current downsampling processing unit are processed, and then =0, , and accordingly move the pointer of the current pixel point of the current target image to the first column of the next row, that is, prepare to move the downsampling point of the current downsampling processing unit to the first column of the next row. Move to the first downsampling processing unit in the next row of downsampling processing units, and the current pixel of the current target image is ready to receive the downsampling data of the next row until all downsampling processing units in the current downsampling image have completed processing, and the downsampled current target image is obtained and displayed; the read pointer of the dithered downsampling offset circular queue is increased by one, and the dithered downsampling offset of the downsampling image to be used for downsampling processing of the next frame is read. , executing step S31, that is, preparing to process the next frame of the image to be downsampled, until all the images to be downsampled are processed.
[0147] Details are as follows.
[0148] In this embodiment, only the vertical direction is selected as the dither downsampling direction. For ease of description, the detailed process of dither downsampling is described by taking the calculation process of the dither sampling point at the (0,0) position of the output target image as an example, which specifically includes the following sub-steps.
[0149] Step 1: Determine the set of candidate jitter sampling points.
[0150] First, we can know the downsampling base point of the initialized jitter downsampling direction =0, the downsampling step length of the first downsampling direction obtained in step S1 is The left closed and right open interval can be determined as the vertical jitter sampling window , and further obtain the current jitter sampling candidate point set composed of integer points in the jitter sampling window .
[0151] Step 2: Determine the jitter downsampling point.
[0152] The jitter offset in the downsampling direction according to the jitter of the current frame and jitter sampling candidate point set , the jitter downsampling point in the jitter downsampling direction can be determined.
[0153] like Figure 9 As shown, for example, according to the current and , it can be determined that the jitter downsampling point in the current jitter sampling direction is the sixth candidate point in the jitter downsampling candidate point set, that is, .
[0154] Furthermore, since the vertical direction is selected as the dither downsampling direction in this embodiment, the downsampling base point in the dither downsampling direction needs to be updated:
[0155] According to the above formula , you can confirm that you can update .
[0156] Step 3: Determine the fixed sampling points in the non-dithered downsampling direction and calculate the downsampled output pixel values.
[0157] In this embodiment, only the vertical direction is selected as the dithered downsampling direction, so the non-dithered downsampling direction is the horizontal direction. The non-dithered downsampling direction is down-sampled using the nearest neighbor interpolation method.
[0158] First, we can know the initial downsampling base point of the non-jitter downsampling direction =0, due to the use of the nearest neighbor interpolation method, a fixed point downsampling method, and The distance to position 0 is closer, so it is determined Combined with step S3 to determine the obtained , the downsampling point can be finally determined as .
[0159] like Figure 10As shown, the final output target image is directly outputted In the pixel value of the input frame image A at .
[0160]
[0161] wherein, represents the pixel value of the input frame image A at .
[0162] Finally, since the vertical direction is selected as the dithering down-sampling direction in the present embodiment, the non-dithering down-sampling direction is the horizontal direction, then the down-sampling base point in the non-dithering down-sampling direction is updated as:
[0163] According to formula (8), since , the is updated.
[0164] Step 4: Same as embodiment 1, not repeated here.
[0165] As shown in Figure 11a , Figure 11b , Figure 11c , Figure 11d , Figure 11e , Figure 11f , Figure 11g and Figure 11h , the down-sampling point diagram of the target image in the same output pixel point for eight consecutive frames, in the present embodiment, since the dithering down-sampling is introduced in the vertical direction, the sampling position of each frame is dithered in the vertical direction according to the dithering offset of the current frame ; on the other hand, based on the continuity between image frames and frames, more effective information of the image is retained, and the loss of image pixel point information is reduced.
[0166] Embodiment 3
[0167] Embodiment 3 is different from embodiment 1 and embodiment 2 in that, in step S2, the dithering down-sampling offset of the dithering down-sampling direction is determined by using a pseudo-random number generator.
[0168] The present application discloses a kind of dithering-based down-sampling method, comprising the following steps, same with embodiment 1 and embodiment 2, not repeated here.
[0169] In step S2, the dithering down-sampling offset of the dithering down-sampling direction is determined by using a pseudo-random number generator.
[0170] According to the number of elements in the jitter sampling candidate point set, a random jitter offset is generated by a random number generator. It is characterized in that for horizontal and / or down-sampling step length step, the random number generator generates a pseudo-random number R, and requires the random number , and the random number sequence is uniformly distributed, so as to ensure that the jitter sampling candidate point is selected with equal probability. And it can ensure that more pixel information is displayed by the display screen, thereby reducing the loss of image data.
[0171] Embodiment 4:
[0172] Embodiment 4 is different from Embodiment 1, Embodiment 2 and Embodiment 3 in that the jitter down-sampling method is used in both horizontal and vertical directions.
[0173] The application discloses a jitter-based down-sampling method, comprising the following steps:
[0174] The jitter down-sampling method can be selected in both horizontal and vertical directions. For example, an input image with a resolution of 3840 * 2560 is down-sampled to obtain an output image with a resolution of 480 * 320, and the specific steps are as follows.
[0175] Step S1: same as Embodiment 1, which will not be repeated here.
[0176] Step S2: obtain the jitter down-sampling direction and the jitter down-sampling offset.
[0177] In this embodiment, both the horizontal direction and the vertical direction are selected as the jitter down-sampling direction. For convenience of description, the horizontal jitter down-sampling direction and the vertical jitter down-sampling direction are distinguished. The jitter offset is determined in the horizontal direction by the method of Embodiment 1, and the jitter offset is determined in the vertical direction by the method of Embodiment 2.
[0178] When the jitter down-sampling is used in both horizontal and vertical directions, it should be noted that the jitter cycle sequences in the two directions can share the same jitter sequence or / and pseudo-random number generator, or the jitter cycle sequences or / and pseudo-random number generator can be set respectively, so as to obtain and .
[0179] In addition, a two-dimensional jitter cycle sequence or a two-dimensional pseudo-random number generator can also be used to generate a two-dimensional jitter offset, so as to realize the simultaneous acquisition of and .
[0180] A position is randomly selected as the head of the first jitter down-sampling offset cycle queue based on the first jitter down-sampling offset cycle queue, and the first jitter down-sampling offset for down-sampling processing of the first frame of the to-be-down-sampled image is read . A position is randomly selected as the head of the queue based on the second jitter down-sampling offset cyclic queue, and the second jitter down-sampling offset for down-sampling processing of the first frame of the to-be-down-sampled image is read .
[0181] Step S3: Obtain the down-sampling point, and obtain the target image.
[0182] The calculation step is as follows.
[0183] Step S31: Obtain the down-sampling base point in the first direction and the down-sampling base point in the second direction , =0, =0, the initial base point (0, 0) of the current target image.
[0184] Step S32: Obtain the sampling point in the first direction based on the down-sampling base point in the first direction and the first jitter down-sampling offset , the value of the sampling point in the first direction is , and the sampling point in the first direction is a jitter sampling point.
[0185] Step S33: Obtain the sampling point in the second direction based on the down-sampling base point in the second direction and the second jitter down-sampling offset , the value of the sampling point in the second direction is , and the sampling point in the second direction is a jitter sampling point.
[0186] Step S34: Obtain the down-sampling point of the current down-sampling processing unit based on the sampling point in the first direction and the sampling point in the second direction .
[0187] Step S35: The pixel value of the current pixel point of the current target image is the pixel value of the down-sampling point of the current down-sampling processing unit.
[0188] Step S36: Let = , and execute step S32 until all to-be-down-sampled processing units in the horizontal direction of the current down-sampling processing unit are processed, and let =0, and the pointer of the current pixel point of the current target image is moved to the first column of the next row, i.e. the down-sampling point of the current down-sampling processing unit is prepared to be down-sampled to the first down-sampling processing unit of the next row, the current pixel point of the current target image is ready to receive the down-sampling data of the next row, until all the down-sampling processing units in the current down-sampling image are processed, the down-sampled current target image is obtained and displayed; the pointer of the first jitter down-sampling offset circular queue is added by one, and the first jitter down-sampling offset for down-sampling processing of the next frame of the down-sampling image is obtained , the pointer of the second jitter down-sampling offset circular queue is added by one, and the jitter down-sampling offset for down-sampling processing of the second down-sampling image of the next frame is obtained , step S31 is executed, i.e. the next frame of the down-sampling image is prepared to be processed, until all the down-sampling images are processed.
[0189] The details are as follows.
[0190] For the convenience of description, the detailed process of jitter down-sampling is given by taking the calculation process of the jitter down-sampling point at the (0, 0) position of the output target image as an example, which specifically includes the following sub-steps.
[0191] First step: determining the jitter down-sampling candidate point set.
[0192] Firstly, it is known that the down-sampling base points of the initialized horizontal and vertical jitter down-sampling directions are =0 and =0, according to step S1, the down-sampling step lengths of the horizontal and vertical directions are and , the left-closed right-open interval can be determined as the horizontal and vertical jitter sampling windows and , and further the current horizontal and vertical jitter sampling candidate point sets composed of the integer points in the jitter sampling window are and .
[0193] Second step: determining the jitter down-sampling point.
[0194] The jitter down-sampling point of the jitter down-sampling direction is determined according to the horizontal and vertical jitter offsets and of the current frame.
[0195] For example, the horizontal and vertical jitter offsets of the current frame are determined to be and by step S2.
[0196] The current horizontal dithering down-sampling point can be determined as the fourth candidate point in the horizontal dithering down-sampling candidate point set; similarly, the current vertical dithering down-sampling point can be determined as the seventh candidate point in the vertical dithering down-sampling candidate point set. According to the dithering down-sampling candidate point set in the first step and , the current two-dimensional dithering sampling point .
[0197] Step 3: directly output the down-sampling pixel value according to the dithering down-sampling point.
[0198] As shown in Figure 12 , since the horizontal direction and the vertical direction are both selected as the dithering down-sampling direction, there is no non-dithering down-sampling direction, and the output target image is directly outputted. The pixel value of the output target image at the position (0, 0) is:
[0199] wherein, A(x, y) represents the pixel value of the input frame image A at the position (x, y).
[0200] Step 4: same as example 1, which will not be repeated here.
[0201] Suppose the two-dimensional dithering offset of the current output image position (0, 0) in the continuous four frames, see Table 1.
[0202] Table 1: two-dimensional dithering offset table of the continuous four frames
[0203] As shown in Figure 13a , Figure 13b , Figure 13c and Figure 13d , the sampling state diagram of the continuous four frames of the output image position (0, 0) can be found: the sampling points of the continuous four frames at the output image position (0, 0) are different. Specifically, the sampling point at the kth frame is ; the sampling point at the k+1th frame is ; the sampling point at the k+2th frame is ; and the sampling point at the k+3th frame is .
[0204] In this embodiment, since the dithering down-sampling is introduced in the horizontal and vertical directions, the sampling position of each frame is dithered in the horizontal and vertical directions according to the horizontal and vertical dithering offset of the current frame , On the other hand, based on the continuity between image frames and frames, the effectiveness of the image information is more retained, and the loss of image pixel point information is reduced.
[0205] Embodiment 5:
[0206] Embodiment 5 is different from Embodiment 1 in that the down-sampling step is a decimal number, and in step S35, when the down-sampling point is a virtual pixel point, the down-sampling result is obtained based on the down-sampling point and a linear interpolation method and taken as the pixel value of the down-sampling point of the current down-sampling processing unit.
[0207] A down-sampling method based on dithering is disclosed, comprising the following steps:
[0208] In this embodiment, an input image with a resolution of 3840*2560 is down-sampled to obtain an output image with a resolution of 512*342, and dithering down-sampling is performed in the horizontal direction, and linear interpolation is used for down-sampling in the vertical direction.
[0209] Step S1: the down-sampling step in the first direction is obtained.
[0210] Step S2: the first direction is selected as the dithering down-sampling direction, and it is assumed that the dithering down-sampling offset of the dithering down-sampling direction of the current frame has been obtained.
[0211] Step S3: in order to better understand this embodiment, it is assumed that the current processing unit is in the middle of the image.
[0212] Step S31: the same as Embodiment 1.
[0213] Step S32:
[0214] The down-sampling base point in the current first direction and the down-sampling base point in the second direction are obtained.
[0215] As shown in FIG. 3, since the first direction is the dithering down-sampling direction, the down-sampling point Figure 14 in the first direction is obtained by rounding up the down-sampling base point in the first direction and adding the dithering down-sampling offset , and the down-sampling point in the first direction is a dithering sampling point.
[0216] Step S33: since the second direction is the non-dithering down-sampling direction, the down-sampling point in the second direction is obtained, and the down-sampling point in the second direction is a non-dithering sampling point.
[0217] Step S34: obtaining the sampling point in the first direction based on the sampling point and the sampling point in the second direction , and obtaining the down-sampling point of the current down-sampling processing unit .
[0218] As shown in Figure 15a , the sampling point in the first direction , the sampling point in the second down-sampling direction , and the down-sampling point .
[0219] Step S35: it is noted that the current down-sampling point may be a fraction, thus the current down-sampling point actually does not exist, and for such a down-sampling point with a non-integer, it is called a virtual pixel point, thus it is necessary to obtain the final down-sampling output result by a linear interpolation method.
[0220] The general steps of linear interpolation are given below, and the description is as follows.
[0221] As shown in Figure 15b , the pixel point coordinate of the current output image B is , and the to-be-interpolated point is between m and m+1, the sampling point in the first down-sampling direction has been determined , and the down-sampling output value can be obtained according to the following linear interpolation formula:
[0222] wherein, .
[0223] The down-sampling output value can be obtained.
[0224] In the embodiment, the coefficient in the interpolation formula can be obtained, and the final output pixel value can be obtained in combination with the interpolation end points and .
[0225] Step S36: same as in Embodiment 1, and will not be described herein again.
[0226] Embodiment 6:
[0227] The application discloses a down-sampling device based on dithering, which comprises a memory, a processor, and a computer program stored in the memory and capable of running on the processor, the memory and the processor form an electronic terminal, and the processor implements the corresponding steps in Embodiments 1, 2, 3, 4, or 5 when the computer program is executed.
[0228] Embodiment 7:
[0229] The application discloses a computer readable storage medium, which stores a computer program, and the computer program realizes corresponding steps in embodiment 1, embodiment 2, embodiment 3, embodiment 4 or embodiment 5 when executed by a processor.
[0230] In step S31, the initial down-sampling base points in the first direction and the second direction in the to-be-down-sampled image are obtained and In general cases, =0, =0, or =1, =0, or =0, =1, and the same technical effect of dithering down-sampling can be achieved.
[0231] In step S1, the down-sampling step lengths in the first direction and the second direction of the to-be-down-sampled image can also be set in advance according to actual needs.
[0232] The technical concept is summarized as follows.
[0233] The technical solution of the application is a dithering-based image down-sampling method, which comprises the following steps:
[0234] Step S1: obtaining a current frame image, and calculating the down-sampling step lengths in the horizontal direction and the vertical direction according to preset resolution parameters of an input image and an output target image;
[0235] Step S2: selecting at least one direction as a dithering down-sampling direction, and obtaining a dithering offset of the dithering down-sampling direction by means of a preset dithering circular queue or a pseudo-random number generator;
[0236] Step S3: determining a dithering down-sampling point in the dithering down-sampling direction by combining the down-sampling base point and the dithering offset, updating the down-sampling base point in the dithering down-sampling direction, using a traditional fixed sampling point down-sampling method to down-sample and output a down-sampled pixel value in an unselected direction which is not the dithering down-sampling direction, updating the down-sampling base point in the unselected direction, or directly outputting a down-sampled pixel value according to the dithering down-sampling point. The traditional fixed sampling point down-sampling method includes, but is not limited to, a nearest neighbor interpolation method, a linear interpolation method and a cubic interpolation method. The down-sampling processing is performed from left to right and row by row to obtain a down-sampled output frame image, the above operation is repeated for each received frame, and the output frame image is displayed in real time on a display device.
[0237] The application effectively retains more image details by introducing random dithering in at least one sampling direction, and has the advantages of low computational complexity and easy hardware implementation compared with traditional downsampling methods, and can be widely applied to various display devices such as VR and AR.
Claims
1. A dither-based down-sampling method, characterized by: The method comprises the following steps: Step S1: obtaining the downsampling step length in the first direction and the second direction of the image to be downsampled; Step S2: obtaining the jittered downsampling direction from the first direction and the second direction, obtaining a jittered downsampling offset sequence, and obtaining a jittered downsampling offset from the jittered downsampling offset sequence as an initial jittered downsampling offset; Step S3: obtaining a down-sampling point of each to-be-down-sampling processing unit in the to-be-down-sampled image of the current frame based on the jitter down-sampling offset obtaining a target image of the current frame after down-sampling by taking the pixel value of the down-sampling point as a pixel value after down-sampling; obtaining a next jitter down-sampling offset as a new jitter down-sampling offset, and obtaining a target image of a next frame based on the new jitter down-sampling offset.
2. The dither-based down-sampling method of claim 1, wherein: In the step S1, the downsampling step length in the first direction and the second direction is obtained based on the resolution of the image to be downsampled and the resolution of the target image after downsampling.
3. The dither-based down-sampling method of claim 1, wherein: In the step S2, the candidate point number is obtained by rounding down the down-sampling step length of the jitter down-sampling direction , and a jitter down-sampling offset sequence {0, 1, 2,... -1} is obtained based on the candidate point number, each data in the jitter down-sampling offset sequence being a jitter down-sampling offset .
4. The dither-based down-sampling method of claim 1, wherein: In the step S2, the jittered downsampling offset is obtained by using a pseudo-random number generator and is subject to uniform distribution, thereby forming the jittered downsampling offset sequence.
5. The dither-based down-sampling method of claim 1, wherein: In the step S2, the jittered downsampling offset sequence is a jittered downsampling offset circular queue, a position is randomly selected as the head of the queue based on the jittered downsampling offset circular queue, and the jittered downsampling offset for downsample processing of the first frame of the image to be downsampled is read and obtained.
6. The dither-based down-sampling method of claim 1, wherein: In the step S3, if there is a non-jittered downsampling direction, fixed-point downsampling is performed in the non-jittered downsampling direction; the fixed-point downsampling method is the nearest neighbor interpolation method, the linear interpolation method or the cubic interpolation method.
7. The dither-based down-sampling method of claim 1, wherein: In the step S3, after the target image of the current frame after downsampling is obtained, the target image of the current frame is displayed.
8. The dither-based downsample method of claim 1, wherein: In the step S1, the down-sampling step size in the first direction , the down-sampling step size in the second direction , the step S3 specifically includes the following steps, Step S31: obtaining a down-sampling base point in a first direction of the image to be down-sampled and a down-sampling base point in a second direction , obtaining an initial base point of the current target image; Step S32: Obtain the sampling points in the first direction ; Step S33: Obtain sampling points in the second direction ; Step S34: obtaining a down-sampling point of the current down-sampling processing unit based on the sampling point of the first direction and the sampling point of the second direction . ; Step S35: the pixel value of the current pixel point of the current target image is the pixel value of the downsampling point of the current downsampling processing unit; Step S36: let = , the next pixel point of the current target image as the current pixel point, and execute step S32 until all the to-be-down-sampling processing units in the horizontal direction of the current down-sampling processing unit are processed. Let = 0, , the first column of the next row of pixels of the current target image as the current pixel point, step S32 is executed until all the to-be-down-sampled processing units in the current to-be-down-sampled image are processed, and the down-sampled current target image is obtained. The jittered downsampling offset for downsample processing of the next frame of the image to be downsampled is read and obtained, the step S31 is executed, and the next frame of the image to be downsampled is processed until all the images to be downsampled are processed.
9. The dither-based down-sampling method of claim 8, wherein: In the step S2, at least one direction is the dithering down-sampling direction, when the first direction is the dithering down-sampling direction, a first dithering down-sampling offset sequence is obtained, and a first dithering down-sampling offset is obtained ; in the step S32, based on the down-sampling base point of the first direction and the first dithering down-sampling offset , a sampling point of the first direction is obtained , the value of the sampling point of the first direction is , and the sampling point of the first direction is a dithering sampling point; In the step S2, when the second direction is the dithering down-sampling direction, a second dithering down-sampling offset sequence is obtained, and a second dithering down-sampling offset is obtained ; in the step S33, based on the down-sampling base point of the second direction and the second dithering down-sampling offset , a sampling point of the second direction is obtained , the value of the sampling point of the second direction is , and the sampling point of the second direction is a dithering sampling point; In the step S2, when the first direction is a non-shake down-sampling direction, in the step S32, the sampling points of the first direction are obtained based on the down-sampling base points of the first direction and the fixed-point down-sampling method , the sampling points of the first direction are non-shake sampling points; In the step S2, when the second direction is a non-shifting downsampling direction, in step S33, the sampling points of the second direction are obtained based on the downsampling base points of the second direction and the fixed-point downsampling method , the sampling points of the second direction are non-shifting sampling points; In the step S1, when the down-sampling step is a decimal number, in the step S35, the down-sampling point is a virtual pixel point, then the down-sampling result is obtained based on the down-sampling point and the pixel value of the down-sampling point of the current down-sampling processing unit by using the nearest neighbor interpolation method, the linear interpolation method or the cubic interpolation method.
10. A computer-readable storage medium storing a computer program, wherein: The computer program is executed by the processor to implement the jitter-based downsampling method in any one of claims 1-9.
Citation Information
Patent Citations
Sampling jitter acquisition method
CN103368873A
Image downsampling method and image processing device
CN119135862A
Nerve supersampling method and apparatus
CN119484931A
Neural upsampling and denoising rendered images
US20250139740A1