Dithering-based down-sampling method and storage medium

The problem of texture detail loss in image downsampling is solved by using a dithering downsampling method. By randomly selecting sampling points with dithering offset and combining it with fixed-point interpolation, image detail preservation and computational complexity are achieved.

CN120835124BActive Publication Date: 2025-12-05XINRUIHUA MICROELECTRONICS (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511325512.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-17
Publication Date
2025-12-05
Estimated Expiration
2045-09-17

AI Technical Summary

Technical Problem

Existing image downsampling methods result in the loss of texture details, and traditional interpolation algorithms suffer from jagged edges and blurring.

Method used

A dithering-based downsampling method is adopted, which randomly selects sampling points in the image by dithering downsampling offset. The pixel values ​​of the downsampling points are calculated by combining dithering and fixed-point interpolation, which preserves image details and reduces computational complexity.

Benefits of technology

It effectively preserves image details, reduces the loss of image pixel information, and has low computational complexity, making it easy to implement in hardware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120835124B_ABST
    Figure CN120835124B_ABST
Patent Text Reader

Abstract

The application discloses a dithering-based downsampling method and a storage medium, and relates to the technical field of image data processing; the method comprises the following steps: S1, obtaining the downsampling step length of two directions of a to-be-downsampled image; S2, obtaining a dithering downsampling direction from the two directions, obtaining a dithering downsampling offset sequence, and obtaining a dithering downsampling offset from the sequence as an initial dithering downsampling offset; S3, obtaining the downsampling point of each to-be-downsampled processing unit in the to-be-downsampled image of a current frame based on the dithering downsampling offset, taking the pixel value of the downsampling point as a pixel value after downsampling, and obtaining a target image of the current frame after downsampling; obtaining a next dithering downsampling offset, and obtaining a target image of a next frame based on the new dithering downsampling offset. Through dithering downsampling, the loss of image pixel information is reduced, and more image details are effectively retained; the method has the advantages of low calculation complexity and easy hardware implementation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image data processing technology, and in particular to a dither-based downsampling method and storage medium. Background Technology

[0002] With the rapid development of display technology, the screen resolutions of terminal devices are becoming increasingly diverse, ranging from HD and FHD to 4K and even 8K, and the resolutions of image sources also vary greatly. Therefore, image downsampling, as a fundamental operation that converts high-resolution images into low-resolution images, directly affects the final display effect on the screen due to its quality.

[0003] Currently, most mainstream image downsampling methods are based on interpolation algorithms, such as nearest neighbor interpolation, bilinear interpolation, and bicubic interpolation. Essentially, these methods output the final pixel value by calculating a weighted average of one or more source pixels surrounding the target pixel on a fixed sampling grid.

[0004] However, these traditional fixed-point downsampling methods suffer from problems such as jagged edges, image blurring, and loss of detail. While nearest-neighbor interpolation is computationally inexpensive, it uses only the grayscale value of the pixel closest to the sample point, resulting in noticeable mosaic and jagged edges. Bilinear and bicubic isointerpolation algorithms, as low-pass filters, sacrifice edge sharpness and rich texture details by weighted averaging of surrounding pixel regions during computation.

[0005] Therefore, the loss of texture details caused by downsampling has become a technical problem that urgently needs to be solved. Summary of the Invention

[0006] This invention provides a dithering-based downsampling method and storage medium to solve the technical problem of texture detail loss caused by downsampling.

[0007] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0008] A dither-based downsampling method includes the following steps:

[0009] Step S1: Obtain the downsampling step size in the first and second directions of the image to be downsampled;

[0010] Step S2: Obtain the jitter downsampling direction from the first direction and the second direction, obtain the jitter downsampling offset sequence, and obtain a jitter downsampling offset from the jitter downsampling offset sequence as the initial jitter downsampling offset;

[0011] Step S3: Obtain the downsampling points of each downsampling processing unit in the image to be downsampled in the current frame based on the dithering downsampling offset. The pixel values ​​of the downsampled points are used as the downsampled pixel values ​​to obtain the target image of the current frame after downsampling; the next jitter downsampling offset is obtained as the new jitter downsampling offset, and the target image of the next frame is obtained based on the new jitter downsampling offset.

[0012] A further technical solution is that, in step S1, the downsampling step size 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.

[0013] A further technical solution is that, in step S1, the resolution of the image to be downsampled is obtained. and the resolution of the downsampled target image Using the resolution of the first direction of the image to be downsampled Divide by the resolution of the target image in the first direction Obtain the downsampling step size in the first direction Using the resolution of the second direction of the image to be downsampled Divide by the resolution of the target image in the second direction Obtain the downsampling step size in the second direction The first direction is horizontal, and the second direction is vertical.

[0014] A further technical solution is as follows: In step S2, the number of candidate points is obtained by rounding down the downsampling step size in the jitter downsampling direction. Based on the number of candidate points, a jitter downsampling offset sequence {0,1,2,..., is obtained. -1}, each data point in the jitter downsampling offset sequence is a jitter downsampling offset. .

[0015] A further technical solution is that, in step S2, a pseudo-random number generator is used to obtain the jitter downsampling offset and it follows a uniform distribution to form a jitter downsampling offset sequence.

[0016] A further technical solution is as follows: In step S2, the jitter downsampling offset sequence is a jitter downsampling offset circular queue. A position is randomly selected as the head of the queue based on the jitter downsampling offset circular queue, and the jitter downsampling offset of the image to be downsampled in the first frame for downsampling processing is read and obtained.

[0017] A further technical solution is as follows: In step S3, if there is a non-jitter downsampling direction, a fixed-point downsampling method is used for downsampling in the non-jitter downsampling direction; the fixed-point downsampling method is nearest neighbor interpolation, linear interpolation, or cubic interpolation.

[0018] A further technical solution is that, 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 step S3 specifically includes the following steps:

[0020] Step S31: Obtain the downsampling base point in the first direction of the image to be downsampled. downsampling base point in the second direction To obtain the initial base point of the current target image;

[0021] Step S32: Obtain the sampling point in the first direction ;

[0022] Step S33: Obtain sampling points in the second direction ;

[0023] Step S34: Based on the sampling points in the first direction sampling points in the second direction Obtain the downsampling point of the current downsampling processing unit. ;

[0024] Step S35: The pixel value of the current pixel in the current target image is the downsampling point of the current downsampling processing unit. Pixel values;

[0025] Step S36: Let = The next pixel of the current target image is taken as the current target pixel, and step S32 is executed until all downsampling processing units in the horizontal direction of the current downsampling processing unit have been processed; let =0, The first column of the next row of pixels in the current target image is taken as the current pixel. Step S32 is executed until all downsampling processing units in the current downsampled image are processed and the downsampled current target image is obtained. The jitter downsampling offset of the downsampled image to be processed in the next frame is read and the next frame downsampled image is processed. Step S31 is executed to process the next frame downsampled image until all downsampled images are processed.

[0026] A further technical solution is as follows: In step S2, at least one direction is the jitter downsampling direction; when the first direction is the jitter downsampling direction, a first jitter downsampling offset sequence is obtained, and a first jitter downsampling offset amount is obtained. In step S32, the downsampling base point is based on the first direction. and the first jitter downsampling offset Obtain sampling points in the first direction Sampling points in the first direction The value is Sampling points in the first direction For jitter sampling points;

[0027] In step S2, when the second direction is the jitter downsampling direction, a second jitter downsampling offset sequence is obtained, and a second jitter downsampling offset is obtained. In step S33, the downsampling base point is based on the second direction. Second jitter downsampling offset Obtain sampling points in the second direction sampling points in the second direction The value is sampling points in the second direction These are the sampling points for jitter.

[0028] A further technical solution is as follows: In step S2, when the first direction is a non-jitter downsampling direction, in step S32, the downsampling base point is based on the first direction. The sampling points in the first direction are obtained using the fixed-point downsampling method. Sampling points in the first direction These are non-jitter sampling points;

[0029] In step S2, when the second direction is a non-jitter downsampling direction, in step S33, the downsampling base point is based on the second direction. The sampling points in the second direction are obtained using the fixed-point downsampling method. sampling points in the second direction These are non-jitter sampling points.

[0030] A further technical solution is as follows: In step S1, when the downsampling step size is a decimal, in step S35, the downsampling point... If it is a virtual pixel, then it is based on the downsampling point. The downsampling results are obtained using nearest neighbor interpolation, linear interpolation, or cubic interpolation and used as the downsampling points for the current downsampling processing unit. The pixel value.

[0031] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described jitter-based downsampling method.

[0032] The beneficial effects of adopting the above technical solution are as follows:

[0033] A dithering-based downsampling method includes the following steps: Step S1: Obtain the downsampling step size in a first direction and a second direction of the image to be downsampled; Step S2: Obtain the dithering downsampling direction from the first direction and the second direction, and obtain the dithering downsampling offset sequence. Step S3: Obtain a jitter downsampling offset from the jitter downsampling offset sequence as the initial jitter downsampling offset; Step S3: Obtain the downsampling point of each downsampling processing unit in the downsampling image of the current frame based on the jitter downsampling offset. Downsampling points The pixel values ​​are used as the downsampled pixel values ​​to obtain the target image of the current frame after downsampling; the next jitter downsampling offset is obtained as the new jitter downsampling offset, and the target image of the next frame is obtained based on the new jitter downsampling offset. Through jitter downsampling and other methods, it reduces the loss of image pixel information and effectively preserves more image details; at the same time, it has the advantages of low computational complexity and ease of hardware implementation. Attached Figure Description

[0034] Figure 1 This is a flowchart of Example 1;

[0035] Figure 2 This is the first state diagram of the jitter downsampling offset circular queue in Example 1;

[0036] Figure 3 This is the state diagram of the circular queue of jitter downsampling offset between two adjacent frames;

[0037] Figure 4 It is a state evolution diagram of the same processing unit with horizontal dithering downsampling for eight consecutive frames;

[0038] Figure 5 This is a state diagram of the horizontal jitter downsampling points in Example 1;

[0039] Figure 6 This is a state diagram of the downsampling points in Example 1;

[0040] Figure 7a This is a state diagram of the downsampling point of the target image in the k-th frame at the same output pixel in Example 1;

[0041] Figure 7b This is a state diagram of the downsampling point of the target image in the (k+1)th frame at the same output pixel in Example 1;

[0042] Figure 7c This is a state diagram of the downsampling point of the target image in the (k+2)th frame at the same output pixel in Example 1;

[0043] Figure 7d This is a state diagram of the downsampling point of the target image in the (k+3)th frame at the same output pixel in Example 1;

[0044] Figure 7e This is a state diagram of the downsampling point of the target image in the (k+4)th frame at the same output pixel in Example 1;

[0045] Figure 7f This is a state diagram of the downsampling point of the target image in Example 1 at the (k+5)th frame of the same output pixel;

[0046] Figure 7g This is a state diagram of the downsampling point of the target image in the (k+6)th frame at the same output pixel in Example 1;

[0047] Figure 7h This is a state diagram of the downsampling point of the target image in the (k+7)th frame at the same output pixel in Example 1;

[0048] Figure 8 It is a state diagram of the same processing unit for eight consecutive frames of vertical dithering downsampling.

[0049] Figure 9 It is a state diagram of the vertical jitter downsampling points;

[0050] Figure 10 This is a state diagram of the downsampling points in Example 2;

[0051] Figure 11a This is a state diagram of the downsampling point of the target image in the k-th frame at the same output pixel in Example 2;

[0052] Figure 11b This is a state diagram of the downsampling point of the target image in the (k+1)th frame at the same output pixel in Example 2;

[0053] Figure 11c This is a state diagram of the downsampling point of the target image in the (k+2)th frame at the same output pixel in Example 2;

[0054] Figure 11d This is a state diagram of the downsampling point of the target image in the (k+3)th frame at the same output pixel in Example 2;

[0055] Figure 11e This is a state diagram of the downsampling point of the target image in the (k+4)th frame at the same output pixel in Example 2;

[0056] Figure 11fThis is a state diagram of the downsampling point of the target image in the (k+5)th frame at the same output pixel in Example 2;

[0057] Figure 11g This is a state diagram of the downsampling point of the target image in the (k+6)th frame at the same output pixel in Example 2;

[0058] Figure 11h This is a state diagram of the downsampling point of the target image in the (k+7)th frame at the same output pixel in Example 2;

[0059] Figure 12 This is a state diagram of the downsampling points in Example 4;

[0060] Figure 13a This is a state diagram of the downsampling point of the target image in the k-th frame at the same output pixel in Example 4;

[0061] Figure 13b This is a state diagram of the downsampling point of the target image in the (k+1)th frame at the same output pixel in Example 4;

[0062] Figure 13c This is a state diagram of the downsampling point of the target image at the same output pixel in the (k+2)th frame in Example 4;

[0063] Figure 13d This is a state diagram of the downsampling point of the target image in the (k+3)th frame at the same output pixel in Example 4;

[0064] Figure 14 This is a state diagram of the horizontal jitter downsampling points in Example 5;

[0065] Figure 15a This is a state diagram of the downsampling points of the current downsampling processing unit in Example 5;

[0066] Figure 15b This is the state diagram of non-jitter downsampling direction linear interpolation in Example 5. Detailed Implementation

[0067] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this application or its application or use. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0068] Many specific details are set forth in the following description in order to provide a full understanding of this application. However, this application may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the spirit of this application. Therefore, this application is not limited to the specific embodiments disclosed below.

[0069] Example 1:

[0070] like Figure 1 As shown in Figure 7, this invention discloses a dither-based downsampling method for a resolution of 3840. The input image of 2560 is downsampled to obtain a final resolution of 480. 320 output image.

[0071] like Figure 1 As shown, the specific steps include the following:

[0072] Step S1: Obtain the image to be downsampled and the downsampling step size in both the horizontal and vertical directions.

[0073] Obtain the resolution of the image to be downsampled. and the resolution of the downsampled target image Using the resolution of the first direction of the image to be downsampled Divide by the resolution of the target image in the first direction Obtain the downsampling step size in the first direction Using the resolution of the second direction of the image to be downsampled Divide by the resolution of the target image in the second direction Obtain the downsampling step size in the second direction .

[0074] The details are as follows.

[0075] Obtaining the image to be downsampled involves acquiring the current frame image and using it as the preset input image. The downsampled target image is the output target image, with the first direction being the horizontal direction and the second direction being the vertical direction. Based on the preset resolution parameters of the input image and the output target image, the downsampling step size in the horizontal and vertical directions is calculated.

[0076] The downsampling step size is calculated as follows: Let the preset resolution parameter of the input image be... The preset resolution of the output target image is .

[0077] According to the following formula:

[0078] ,

[0079]

[0080] The horizontal downsampling step size can be obtained as follows: The downsampling step size in the vertical direction is .

[0081] Alternatively, the following formula can be used for calculation:

[0082] ,

[0083]

[0084] In this embodiment, the preset resolution parameter of the input image is: The preset resolution of the output target image is According to formulas (1) and (2), the downsampling step size in the horizontal direction is: The downsampling step size in the vertical sampling direction is .

[0085] 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.

[0086] Step S2: Obtain the jitter downsampling direction and jitter downsampling offset.

[0087] Step S2 is the core step of this application.

[0088] Obtain the jitter downsampling direction, which can be either the first or second direction. Round down the downsampling step size of the jitter downsampling direction to obtain the number of candidate points. Based on the number of candidate points, a jitter downsampling offset sequence {0,1,2,..., is obtained. -1}, each data point in the jitter downsampling offset sequence is a jitter downsampling offset. .

[0089] In this embodiment, the first direction is the jitter downsampling direction, and jitter downsampling is used; the second direction is the non-jitter downsampling direction, and the nearest neighbor interpolation method is used for downsampling.

[0090] The jitter downsampling offset sequence is a jitter downsampling offset circular queue. A position is randomly selected as the head of the queue, and the jitter downsampling offset of the first frame of the image to be downsampled is read to obtain the offset. .

[0091] The details are as follows.

[0092] The horizontal direction is selected as the jitter downsampling direction only, and the horizontal jitter downsampling offset is determined by a preset jitter circular queue. That is, the data in the jitter downsampling offset sequence is randomly sorted and formed into a queue. The data in the queue is read once for each frame of image. That is, a fixed jitter downsampling offset is used to downsample one frame of image, and the data in the queue is read in a circular manner. This jitter downsampling offset sequence is the jitter downsampling offset circular queue.

[0093] Read the first element of the preset jitter circular queue, which has the same number of candidate points as the current frame, and use it as the jitter downsampling offset for the current frame. When reading the jitter downsampling offset from the jitter circular queue for the first time, an address can be randomly selected from several candidate addresses in the jitter circular queue to read the stored data as the current jitter downsampling offset.

[0094] Assume a pre-defined jittery circular queue, as follows.

[0095] like Figure 2 As shown, a pointer `head` is set in this queue to identify the head of the queue. The sampling offset of the current frame is obtained by reading the first element of the current circular queue. Assuming the data in the memory unit pointed to by the frame pointer is 6, the jitter offset of the current frame image can be obtained as follows: .

[0096] The characteristic of a jittery circular queue is that: the jittery circular queue should be predefined to be related to the set {0,1,2,..., The given set of all permutations of {-1} corresponds to one of them. In other words, the above jittery circular queue is only one of the permutations of {-1}. One of the permutations, the rest All 1 permutations can be used to generate the corresponding jittery circular queue.

[0097] Only after a frame of image processing is completed will the pointer of the jitter circular queue move forward by one element, thereby achieving the purpose of generating a new horizontal jitter offset in the next frame.

[0098] like Figure 3 As shown, specifically, taking the jitter circular queue mentioned above as an example, the jitter offset of the k-th frame image at the top of the figure is... Due to the introduction of a jitter circular queue, the jitter offset of the (k+1)th frame in the lower part of the image within the current window is: 7.

[0099] like Figure 4 As shown in the figure, from top to bottom, similarly, the jitter offsets of the (k+2), (k+3), (k+4), (k+5), (k+6), and (k+7)th frames can be obtained. The numbers are 5, 3, 1, 0, 2, and 4 respectively.

[0100] Step S3: Obtain downsampling points to obtain the target image.

[0101] like Figure 5 As shown, horizontally from left to right, 0-7 represent the x-coordinate of the pixel, and vertically from top to bottom, 0-7 represent the y-coordinate of the pixel. (0,0) represents the pixel in the first row and first column, (7,7) represents the pixel in the eighth row and eighth column, and 8... An array of 8 pixels forms a downsampling processing unit. Each downsampling step involves determining an x-coordinate and a y-coordinate from this downsampling processing unit to form a downsampling point. Then downsample.

[0102] The calculation steps are as follows.

[0103] Step S31: Obtain the downsampling base point in the first direction of the image to be downsampled. downsampling base point in the second direction , =0, =0, the initial base point of the current target image is (0,0).

[0104] Step S32: Downsampling base point based on the first direction and jitter downsampling offset Obtain sampling points in the first direction Sampling points in the first direction The value is Sampling points in the first direction These are the sampling points for jitter.

[0105] Step S33: Downsampling base point based on the second direction The sampling points in the second direction are obtained using the nearest neighbor interpolation method. sampling points in the second direction These are non-jitter sampling points.

[0106] Step S34: Based on the sampling points in the first direction sampling points in the second direction Obtain the downsampling point of the current downsampling processing unit. .

[0107] Step S35: The pixel value of the current pixel in the current target image is the downsampling point of the current downsampling processing unit. The pixel value.

[0108] Step S36: Let = The next pixel of the current target image is taken as the current pixel, 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 so on, until all downsampling processing units in the horizontal direction of the current downsampling processing unit are processed; let =0, And accordingly, the pointer of the current pixel in the current target image is moved to the first column of the next row, that is, the downsampling point of the current downsampling processing unit is prepared. Move to the first downsampling processing unit in the next row. The current pixel of the current target image is ready to receive the downsampling data of the next row. Execute step S32 until all downsampling processing units in the current downsampling image have been processed, obtain the downsampled current target image and display it; increment the read pointer of the jitter downsampling offset circular queue, and read the jitter downsampling offset of the downsampling image to be used for downsampling processing of the next frame. Then, proceed to step S31, which is to prepare to process the next frame of the downsampled image, until all downsampled images have been processed.

[0109] The details are as follows.

[0110] In this embodiment, only the horizontal direction is selected as the dithering downsampling direction. For ease of description, the detailed process of dithering downsampling is given by taking the calculation process of the pixel at position (0,0) of the output target image as an example, which specifically includes the following sub-steps.

[0111] Step 1: Obtain the set of candidate sampling points in the first direction.

[0112] Downsampling step size based on the first direction Obtain the first sampling window The first direction is the jitter downsampling direction, and the first sampling window is the jitter sampling window, as detailed below.

[0113] First, the downsampling base point in the initial jitter downsampling direction can be determined. =0, and the downsampling step size in the first downsampling direction obtained in step S1 is The interval that is left-closed and right-open can be determined as the jitter sampling window. Furthermore, a set of jitter sampling candidate points, consisting of integer points within the jitter sampling window, is obtained. Within the current jitter sampling window .

[0114] Step 2: Obtain the jitter downsampling points in the first direction.

[0115] like Figure 5 As shown, the horizontal jitter offset of the current frame is... Determine the jitter downsampling point in the first downsampling direction. For example, currently... We can determine that the jitter downsampling point in the current first downsampling direction is the 6th candidate point in the jitter downsampling candidate point set, because the counting starts from 0, that is... .

[0116] Furthermore, since this embodiment selects the horizontal direction as the first downsampling direction, the downsampling base point of the first downsampling direction needs to be updated after each downsampling.

[0117]

[0118] According to the above formula It can be updated. .

[0119] Step 3: Determine the fixed sampling points in the non-jitter downsampling direction and calculate the downsampled output pixel values.

[0120] In this embodiment, only the horizontal direction is selected as the jitter downsampling direction; therefore, the non-jitter downsampling direction is the vertical direction. Nearest neighbor interpolation is used for downsampling in the non-jitter downsampling direction.

[0121] First, we can determine the initial downsampling base point in the non-jitter downsampling direction. =0, because the nearest neighbor interpolation method, a fixed-point downsampling method, is used. and It is closer to position 0, therefore it is determined. Combined with step S3, the obtained The downsampling point can be finally determined as .

[0122] like Figure 6 As shown, the final output is the target image. exist Pixel values:

[0123]

[0124] in, Indicates that the input frame image A is in The pixel value at that location.

[0125] Finally, since this embodiment selects the horizontal direction as the jitter downsampling direction, and the non-jitter downsampling direction is the vertical direction, the downsampling base point of the non-jitter downsampling direction is updated:

[0126]

[0127] According to formula (6), since =8.0, therefore Remain unchanged, that is .

[0128] Step 4: Output the downsampled target images sequentially.

[0129] Repeat steps one, two, and three to perform downsampling from left to right, line by line, to obtain the downsampled output frame image. Repeat the above operation for each received frame and display the output frame image in real time on the display device.

[0130] like Figure 7a , Figure 7b , Figure 7c , Figure 7d , Figure 7e , Figure 7f , Figure 7g and Figure 7h The diagram illustrates the downsampling of the target image at the same output pixel point for eight consecutive frames. In this embodiment, due to the jitter downsampling introduced in the horizontal direction, the sampling position of each frame is offset horizontally according to the jitter offset of the current frame. On the one hand, it performs dithering; on the other hand, based on the continuity between image frames, it retains more effective information of the image and reduces the loss of image pixel information.

[0131] Furthermore, by employing a jitter downsampling method in the horizontal direction and introducing a jitter offset, the weighted summation calculation process required in the calculation process, as with other fixed-sampling-point methods such as linear interpolation and cubic interpolation, is avoided. This also eliminates the need for multipliers in the hardware implementation, thereby reducing hardware overhead.

[0132] Example 2:

[0133] Example 2 differs from Example 1 in that the first direction is a non-jitter downsampling direction, and the nearest neighbor interpolation method is used for downsampling; the second direction is a jitter downsampling direction, and jitter downsampling is used.

[0134] This invention discloses a dither-based downsampling method for a resolution of 3840. The input image of 2560 is downsampled to obtain a final resolution of 480. The output image at 320p includes the following steps:

[0135] Step S1: Same as in Example 1, and will not be repeated.

[0136] Step S2: Obtain the jitter downsampling direction and jitter downsampling offset.

[0137] In this embodiment, only the vertical direction is selected as the jitter downsampling direction, and the jitter downsampling offset of the jitter downsampling direction is determined by a preset jitter circular queue.

[0138] like Figure 2 As shown, the first element of a preset jitter circular queue, which has the same number of current candidate points, is read as the jitter downsampling offset for the current frame. Assume a pre-defined jittery circular queue.

[0139] A pointer `head` is set in this queue to identify the head of the queue. The sampling offset of the current frame is obtained by reading the first element of the current circular queue. For example, if the frame pointer points to 6, the jitter offset of the current frame image can be obtained as follows: .

[0140] The characteristics of a jittery circular queue are as follows:

[0141] The preset jittery circular queue should be consistent with the set {0,1,2,..., The given set of all permutations of {-1} corresponds to one of them. In other words, the above jittery circular queue is only one of the permutations of {-1}. One of the permutations, the rest All 1 permutations can be used to generate the corresponding jittery circular queue.

[0142] The pointer of the jitter circular queue moves forward by one element only after a frame of image processing is completed.

[0143] Taking the jitter circular queue mentioned above as an example, the jitter offset of the k-th frame image is: Due to the introduction of a jitter circular queue, the jitter offset of the (k+1)th frame within the current window is: 7.

[0144] 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)th frames can be obtained. The corresponding numbers are 5, 3, 1, 0, 2, and 4.

[0145] Step S3: Obtain downsampling points to obtain the target image.

[0146] The calculation steps are as follows.

[0147] Step S31: Obtain the downsampling base point in the first direction of the image to be downsampled. downsampling base point in the second direction , =0, =0, the initial base point of the current target image is (0,0).

[0148] Step S32: Downsampling base point based on the first direction The sampling points in the first direction are obtained using the nearest neighbor interpolation method. Sampling points in the first direction These are non-jitter sampling points.

[0149] Step S33: Downsampling base point based on the second direction and jitter downsampling offset Obtain sampling points in the second direction sampling points in the second direction The value is sampling points in the second direction These are the sampling points for jitter.

[0150] Step S34: Based on the sampling points in the first direction sampling points in the second direction Obtain the downsampling point of the current downsampling processing unit. .

[0151] Step S35: The pixel value of the current pixel in the current target image is the downsampling point of the current downsampling processing unit. The pixel value.

[0152] Step S36: Let = Execute step S32 until all downsampling processing units in the horizontal direction of the current downsampling processing unit have been processed, then... =0, And accordingly, the pointer of the current pixel in the current target image is moved to the first column of the next row, that is, the downsampling point of the current downsampling processing unit is prepared. Move to the first downsampling processing unit in the next row. The current pixel of the current target image is ready to receive the downsampling data of the next row. This process continues until all downsampling processing units in the current downsampling image have been processed, resulting in the downsampled current target image, which is then displayed. The read pointer of the jitter downsampling offset circular queue is incremented, and the jitter downsampling offset for downsampling the next frame of the image is read. Then, proceed to step S31, which is to prepare to process the next frame of the downsampled image, until all downsampled images have been processed.

[0153] The details are as follows.

[0154] In this embodiment, only the vertical direction is selected as the jitter downsampling direction. For ease of description, the detailed process of jitter downsampling is given by taking the calculation process of the jitter sampling point at position (0,0) of the output target image as an example, which specifically includes the following sub-steps.

[0155] Step 1: Determine the set of candidate points for jitter sampling.

[0156] First, the downsampling base point in the initial jitter downsampling direction can be determined. =0, and the downsampling step size in the first downsampling direction obtained in step S1 is The interval that is closed on the left and open on the right can be determined as the vertical jitter sampling window. This further yields the current jitter sampling candidate point set, consisting of integer points within the jitter sampling window. .

[0157] Step 2: Determine the jitter downsampling point.

[0158] Based on the jitter offset in the jitter downsampling direction of the current frame and jitter sampling candidate point set This allows us to determine the jitter downsampling point in the jitter downsampling direction.

[0159] 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 6th candidate point in the jitter downsampling candidate point set, that is... .

[0160] Furthermore, since this embodiment selects the vertical direction as the jitter downsampling direction, it is necessary to update the downsampling base point of the jitter downsampling direction:

[0161]

[0162] According to the above formula It can be determined that it can be updated at present. .

[0163] Step 3: Determine the fixed sampling points in the non-jitter downsampling direction and calculate the downsampled output pixel values.

[0164] In this embodiment, only the vertical direction is selected as the jitter downsampling direction; therefore, the non-jitter downsampling direction is the horizontal direction. Downsampling in the non-jitter downsampling direction is performed using the nearest neighbor interpolation method.

[0165] First, we can determine the initial downsampling base point in the non-jitter downsampling direction. =0, because the nearest neighbor interpolation method, a fixed-point downsampling method, is used. and It is closer to position 0, therefore it is determined. Combined with step S3, the obtained The downsampling point can be finally determined as .

[0166] like Figure 10 As shown, the final output is the target image. exist Pixel values:

[0167]

[0168] in, Indicates that the input frame image A is in The pixel value at that location.

[0169] Finally, since this embodiment selects the vertical direction as the jitter downsampling direction, and the non-jitter downsampling direction is the horizontal direction, the downsampling base point of the non-jitter downsampling direction is updated as follows:

[0170]

[0171] According to formula (8), since Therefore, update .

[0172] Step 4: Same as Example 1, and will not be repeated.

[0173] like Figure 11a , Figure 11b , Figure 11c , Figure 11d , Figure 11e , Figure 11f , Figure 11g and Figure 11h As shown, this is a schematic diagram of downsampling points of the target image at the same output pixel for eight consecutive frames. In this embodiment, due to the dithering downsampling introduced in the vertical direction, the sampling position of each frame is offset vertically according to the dithering amount of the current frame. On the one hand, it performs dithering; on the other hand, based on the continuity between image frames, it retains more effective information of the image and reduces the loss of image pixel information.

[0174] Example 3:

[0175] The difference between Example 3 and Examples 1 and 2 is that, in step S2, a pseudo-random number generator is used to determine the jitter downsampling offset in the jitter downsampling direction.

[0176] This invention discloses a jitter-based downsampling method, which includes the following steps, and the similarities with Embodiments 1 and 2 will not be repeated here.

[0177] In step S2, a pseudo-random number generator is used to determine the jitter downsampling offset in the jitter downsampling direction.

[0178] A random jitter offset is generated by a random number generator based on the number of elements in the jitter sampling candidate point set. The key feature is that, for the horizontal and / or downsampling step size step, the random number generator generates a pseudo-random number R, and the random number is required to... Furthermore, the random number sequence follows a uniform distribution, ensuring that candidate points in the jitter sampling are selected with equal probability. This also guarantees that more pixel information is displayed on the screen, thereby reducing image data loss.

[0179] Example 4:

[0180] Example 4 differs from Examples 1, 2 and 3 in that it uses a jitter downsampling method in both the horizontal and vertical directions.

[0181] This invention discloses a dither-based downsampling method, comprising the following steps:

[0182] You can select to use dithering downsampling in both the horizontal and vertical directions. For example: for a resolution of 3840... The input image of 2560 is downsampled to obtain a final resolution of 480. The specific steps for producing a 320 output image are as follows.

[0183] Step S1: Same as in Example 1, and will not be repeated.

[0184] Step S2: Obtain the jitter downsampling direction and jitter downsampling offset.

[0185] In this embodiment, both the horizontal and vertical directions are selected as jitter downsampling directions. For ease of description, the horizontal jitter downsampling direction and the vertical jitter downsampling direction are used for distinction. The jitter offset is determined in the horizontal direction using the method of Embodiment 1, and the jitter offset is determined in the vertical direction using the method of Embodiment 2.

[0186] When using dithering downsampling in both the horizontal and vertical directions, it should be noted that: the dithering cyclic sequences in both directions can share the same dithering sequence and / or pseudo-random number generator, or they can be set separately to obtain... and .

[0187] Alternatively, a two-dimensional jitter offset can be generated using a two-dimensional jittered cyclic sequence or a two-dimensional pseudo-random number generator, thereby achieving simultaneous acquisition. and .

[0188] Based on a randomly selected position in the first jitter downsampling offset circular queue as the queue head, the first jitter downsampling offset of the image to be downsampled in the first frame, used for downsampling processing, is read and obtained. Based on the second jitter downsampling offset circular queue, a position is randomly selected as the head of the queue, and the second jitter downsampling offset of the first frame of the image to be downsampled is read and obtained. .

[0189] Step S3: Obtain downsampling points to obtain the target image.

[0190] The calculation steps are as follows.

[0191] Step S31: Obtain the downsampling base point in the first direction of the image to be downsampled. downsampling base point in the second direction , =0, =0, the initial base point of the current target image is (0,0).

[0192] Step S32: Downsampling base point based on the first direction and the first jitter downsampling offset Obtain sampling points in the first direction Sampling points in the first direction The value is Sampling points in the first direction These are the sampling points for jitter.

[0193] Step S33: Downsampling base point based on the second direction Second jitter downsampling offset Obtain sampling points in the second direction sampling points in the second direction The value is sampling points in the second direction These are the sampling points for jitter.

[0194] Step S34: Sampling points based on the first direction sampling points in the second direction Obtain the downsampling point of the current downsampling processing unit. .

[0195] Step S35: The pixel value of the current pixel in the current target image is the downsampling point of the current downsampling processing unit. The pixel value.

[0196] Step S36: Let = Execute step S32 until all downsampling processing units in the horizontal direction of the current downsampling processing unit have been processed, then... =0, And accordingly, the pointer of the current pixel in the current target image is moved to the first column of the next row, that is, the downsampling point of the current downsampling processing unit is prepared. Move to the first downsampling processing unit in the next row. The current pixel of the current target image is ready to receive the downsampling data of the next row. This process continues until all downsampling processing units in the current downsampling image have finished processing, obtaining the downsampled current target image and displaying it. Increment the pointer of the first jitter downsampling offset circular queue by one, and read the first jitter downsampling offset of the downsampling image to be used for downsampling processing the next frame. The pointer to the second jitter downsampling offset circular queue is incremented by one, and the jitter downsampling offset of the second image to be downsampled in the next frame is obtained for downsampling processing. Then, proceed to step S31, which is to prepare to process the next frame of the downsampled image, until all downsampled images have been processed.

[0197] The details are as follows.

[0198] For ease of description, the detailed process of jitter downsampling is given by taking the calculation process of the jitter downsampling point at position (0,0) of the output target image as an example. The specific process includes the following sub-steps.

[0199] Step 1: Determine the set of candidate points for jitter sampling.

[0200] First, it can be known that the initial downsampling base points for the horizontal and vertical dithering downsampling directions are respectively... =0 and =0, based on the downsampling step sizes obtained in step S1 in the horizontal and vertical directions respectively and The interval that is left-closed and right-open can be determined as the horizontal and vertical jitter sampling windows, respectively. and Furthermore, the current horizontal and vertical jitter sampling candidate point sets, composed of integer points within the jitter sampling window, are obtained as follows: and .

[0201] Step 2: Determine the jitter downsampling point.

[0202] Based on the horizontal and vertical jitter offset of the current frame and Determine the jitter downsampling point in the jitter downsampling direction.

[0203] For example, the horizontal and vertical jitter offsets of the current frame are determined in step S2. and .

[0204] The current horizontal jitter downsampling point can be determined as the fourth candidate point in the set of horizontal jitter downsampling candidate points; similarly, the current vertical jitter downsampling point can be determined as the seventh candidate point in the set of vertical jitter downsampling candidate points. This is based on the jitter downsampling candidate point set described in the first step. and This allows us to obtain the current two-dimensional jitter sampling point. .

[0205] Step 3: Directly output the downsampled pixel value based on the jitter downsampling point.

[0206] like Figure 12 As shown, since both the horizontal and vertical directions are selected as the dithering downsampling directions, there are no non-dithering downsampling directions, and the target image is directly output. exist Pixel values:

[0207]

[0208] in, Indicates that the input frame image A is in The pixel value at that location.

[0209] Step 4: Same as Example 1, and will not be repeated.

[0210] Assume that the two-dimensional jitter offset of the current output image position (0,0) for four consecutive frames can be obtained, see Table 1.

[0211] Table 1: Two-dimensional jitter offset table for four consecutive frames

[0212]

[0213] like Figure 13a , Figure 13b , Figure 13c and Figure 13d As shown in the sampling state diagram of four consecutive frames at output image position (0,0), it can be observed that the sampling points at output image position (0,0) are different for the four consecutive frames. Specifically, at frame k... ; and in the (k+1)th frame ; at frame k+2 ; at frame k+3 .

[0214] In this embodiment, due to the jitter downsampling introduced in both the horizontal and vertical directions, the sampling position of each frame is adjusted in both the horizontal and vertical directions according to the horizontal and vertical jitter offset of the current frame. , On the one hand, it performs dithering; on the other hand, based on the continuity between image frames, it retains more effective information of the image and reduces the loss of image pixel information.

[0215] Example 5:

[0216] Example 5 differs from Example 1 in that the downsampling step size is a decimal. In step S35, when the downsampling point... When it is a virtual pixel, based on downsampling points The downsampling result is obtained using linear interpolation and used as the downsampling point for the current downsampling processing unit. The pixel value.

[0217] This invention discloses a dither-based downsampling method, comprising the following steps:

[0218] In this embodiment, the input image with a resolution of 3840*2560 is downsampled to obtain an output image with a resolution of 512*342. Dithering downsampling is performed in the horizontal direction, and linear interpolation is used for downsampling in the vertical direction.

[0219] Step S1: Downsampling step size in the first direction downsampling step size in the first direction ;

[0220] Step S2: Select the first direction as the jitter downsampling direction, and assume that the jitter downsampling offset of the current frame's jitter downsampling direction has been obtained. .

[0221] Step S3: To better understand this embodiment, assume that we have already processed a certain processing unit in the middle of the image.

[0222] Step S31: The same as in Example 1 will not be repeated here.

[0223] Step S32:

[0224] Current first direction downsampling base point Second direction downsampling base point .

[0225] like Figure 14 As shown, since the first direction is the jitter downsampling direction, the downsampling base point is based on the first direction. Rounding down and jitter downsampling offset The sampling points in the first direction are obtained by addition. Sampling points in the first direction These are the sampling points for jitter.

[0226] Step S33: Since the second direction is a non-jitter downsampling direction, the sampling points in the second downsampling direction are obtained. sampling points in the second direction These are non-jitter sampling points.

[0227] Step S34: Based on the sampling points in the first direction sampling points in the second direction Obtain the downsampling point of the current downsampling processing unit. .

[0228] like Figure 15a As shown, the sampling points in the first direction Sampling points in the second downsampling direction Downsampling points .

[0229] Step S35: Note that it is possible Since it is a decimal, the current downsampling point In reality, this does not exist for sampling points that are not integers. These are called virtual pixels, so a linear interpolation method is needed to obtain the final downsampled output.

[0230] The general steps of linear interpolation are given below, as explained below.

[0231] like Figure 15b As shown, the coordinates of pixel B in the current output image are... interpolation point The value is between m and m+1, at the sampling point where the first downsampling direction has been determined. According to the following linear interpolation formula:

[0232]

[0233] in, .

[0234] You can obtain downsampled output values.

[0235] In this embodiment, Thus, the coefficients in the interpolation formula can be obtained. Combined with interpolation endpoints and This will give you the final output pixel values.

[0236] Step S36: Same as in Example 1, and will not be repeated.

[0237] Example 6:

[0238] This invention discloses a jitter-based downsampling device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. The memory and the processor form an electronic terminal. When the processor executes the computer program, it implements the corresponding steps in Embodiment 1, Embodiment 2, Embodiment 3, Embodiment 4, or Embodiment 5.

[0239] Example 7:

[0240] The present invention discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the corresponding steps in Embodiment 1, Embodiment 2, Embodiment 3, Embodiment 4, or Embodiment 5.

[0241] Compared to the above embodiment, in step S31, the initial downsampling base point in the first direction of the image to be downsampled is obtained. downsampling base point in the second direction Under normal circumstances =0, =0, but can also be non-zero, for example: =1, =0, or =0, =1 can still achieve the same effect as jitter downsampling technology.

[0242] Compared to the above embodiment, in step S1, the downsampling step size of the first and second directions of the image to be downsampled can also be set in advance according to actual needs.

[0243] The technical concept is summarized and explained as follows.

[0244] The technical solution of this application is a dither-based image downsampling method, including the following steps:

[0245] Step S1: Obtain the current frame image. Obtain the current frame image and calculate the downsampling step size in the horizontal and vertical directions based on the preset resolution parameters of the input image and the output target image.

[0246] Step S2: Select at least one direction as the jitter downsampling direction, and obtain the jitter offset of the jitter downsampling direction by means of a preset jitter circular queue or a pseudo-random number generator;

[0247] Step S3: For the jitter downsampling direction, determine the jitter downsampling point by combining the downsampling base point and the jitter offset, and update the downsampling base point for the jitter downsampling direction. If there is a non-jitter downsampling direction, use the traditional fixed sampling point downsampling method to downsample and output downsampled pixel values ​​in the direction not selected as jitter downsampling, and update the downsampling base point for the non-jitter downsampling direction. Otherwise, directly output downsampled pixel values ​​based on the jitter downsampling point. The traditional fixed sampling point downsampling method includes, but is not limited to, nearest neighbor interpolation, linear interpolation, and cubic interpolation. Downsampling is performed row by row from left to right to obtain the downsampled output frame image. The above operation is repeated for each received frame, and the output frame image is displayed in real time on the display device.

[0248] This application effectively preserves more image details by introducing random jitter in at least one sampling direction; and compared with traditional downsampling methods, it has advantages such as low computational complexity and ease of hardware implementation, and can be widely used in various display devices such as VR and AR.

Claims

1. A dither-based down-sampling method, characterized by: comprising the steps of: Step S1 : obtaining a downsampling step size in a first direction of the image to be downsampled and a downsampling step size in a second direction ; obtaining a dithered down-sampling direction from the first direction and the second direction, obtaining a dithered down-sampling offset sequence, and obtaining a dithered down-sampling offset from the dithered down-sampling offset sequence as an initial dithered down-sampling offset; The number of candidate points is obtained by rounding down the downsampling step size in the jitter downsampling direction. Based on the number of candidate points, a jitter downsampling offset sequence {0,1,2,..., is obtained. -1}, each data point in the jitter downsampling offset sequence is a jitter downsampling offset. ; Step S3: obtaining the downsampling point of each to-be-downsampled processing unit in the to-be-downsampled image of the current frame based on the jitter downsampling offset obtaining the target image of the current frame after downsampling by taking the pixel value of the downsampling point as the pixel value after downsampling; obtaining the next jitter downsampling offset as a new jitter downsampling offset, and obtaining the target image of the next frame based on the new jitter downsampling offset; the step S3 specifically comprises 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 ;​​ 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; 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. reading the dithered down-sampling offset for down-sampling processing of the next frame of the to-be-down-sampled image, performing step S31, and processing the next frame of the to-be-down-sampled image until all to-be-down-sampled images are processed. 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 down-sampling base point of the first direction is obtained based on the first direction and the fixed point down-sampling method , the sampling point of the first direction is a non-shake sampling point; 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.

2. The dither-based down-sampling method of claim 1, wherein: In the step S1, the down-sampling step lengths of the first direction and the second direction are obtained based on the resolution of the to-be-down-sampled image and the resolution of the target image after down-sampling.

3. The dither-based down-sampling method of claim 1, wherein: In the step S2, the dithered down-sampling offset is obtained by using a pseudo-random number generator and is subject to a uniform distribution, and a dithered down-sampling offset sequence is formed.

4. The dither-based down-sampling method of claim 1, wherein: In the step S2, the dithered down-sampling offset sequence is a dithered down-sampling offset circular queue, a position is randomly selected as the head of the queue based on the dithered down-sampling offset circular queue, and the dithered down-sampling offset for down-sampling processing of the first frame of the to-be-down-sampled image is read and obtained.

5. The dither-based down-sampling method of claim 1, wherein: In the step S3, if there is a non-dithered down-sampling direction, fixed-point down-sampling is performed in the non-dithered down-sampling direction; the fixed-point down-sampling method is a nearest neighbor interpolation method, a linear interpolation method, or a cubic interpolation method.

6. The dither-based downsample method of claim 1, wherein: In the step S3, after the target image of the current frame after down-sampling is obtained, the target image of the current frame is displayed.

7. The dither-based downsample method of claim 1, wherein: 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.

8. A computer-readable storage medium, the computer-readable storage medium storing a computer program, characterized in that: The computer program is executed by the processor to implement the dithered down-sampling method in any one of claims 1-7.

Citation Information

Patent Citations

  • Sampling jitter acquisition method

    CN103368873A

  • Image downsampling method and image processing device

    CN119135862A