Image processing method and device, computer equipment, storage medium and program product
By using the convolution operation of fixed parameter matrix and pixel matrix in image processing, the problem of long delay time of double cubic interpolated image amplification processing is solved, and efficient image amplification processing is realized, reducing operation delay.
Patent Information
- Application Number
- CN202411998817.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-06-03
AI Technical Summary
When the image is enlarged by double cubic interpolation, the delay time is long, resulting in a surge in computing volume and complex calculation process.
By obtaining the coordinate value of the destination pixel point, determine the coordinate value of the corresponding source pixel point, and divide it into integer and decimal parts. The decimal part is used to query the preset fixed parameter matrix to obtain the corresponding fixed parameter matrix, and the pixel matrix taken out by the integer part in the source image is combined for convolutional operations to obtain the pixel value of the target pixel point.
Change the 8 Bicubic function operations to two addressing operations, which significantly saves the calculation amount, improves the calculation speed, reduces the delay time, and maintains good image processing effects.
Smart Images

Figure CN120088122A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and particularly to an image processing method, apparatus, computer device, storage medium and program product. Background Art
[0002] With the development of technology, high-definition electronic medical endoscopes have become essential medical devices for diagnosing and treating human diseases. In order to observe image details, nearest neighbor interpolation and bilinear interpolation are often used in the image signal processing (ISP) of electronic endoscope images to magnify the images. After the image is magnified, there is a phenomenon that the visual effect at the image details is poor, such as mosaics and blurred edges appearing in the image display.
[0003] Using bicubic interpolation to magnify the image can better preserve the image edges and improve the image display effect, but its calculation process is complex, and implementing it in hardware consumes a large amount of resources and has a long delay time. Summary of the Invention
[0004] In view of this, the present invention provides an image processing method, apparatus, computer device, storage medium and program product to solve the problem of long delay time when using bicubic interpolation to magnify the image.
[0005] In a first aspect, an embodiment of the present invention provides an image processing method, which includes the following steps: obtaining a first coordinate value of a target pixel point; determining a second coordinate value of a source pixel point corresponding to the target pixel point according to the first coordinate value, and dividing the second coordinate value into an integer part and a fractional part; querying in a preset fixed parameter matrix using the fractional part to obtain a fixed parameter matrix corresponding to the fractional part; extracting a pixel matrix corresponding to the target pixel point from the source image using the integer part; performing a convolution operation on the fixed parameter matrix and the pixel matrix to obtain the pixel value of the target pixel point.
[0006] The image processing method provided in this embodiment, by obtaining the first coordinate value of the target pixel point, determining the second coordinate value of the source pixel point corresponding to the target pixel point according to the first coordinate value, and dividing the second coordinate value into an integer part and a fractional part; querying in a preset fixed parameter matrix using the fractional part to obtain a fixed parameter matrix corresponding to the fractional part, extracting a pixel matrix corresponding to the target pixel point from the source image using the integer part, and performing a convolution operation on the fixed parameter matrix and the pixel matrix to obtain the pixel value of the target pixel point. Since the fixed parameter matrix is pre-saved, 8 Bicubic function operations can be changed to two addressing operations, saving a large amount of computation and improving the computation speed to a great extent.
[0007] In an alternative embodiment, determining the second coordinate value of the source pixel corresponding to the target pixel according to the first coordinate value includes: obtaining an image magnification factor; and determining the second coordinate value of the source pixel corresponding to the target pixel according to the first coordinate value and the image magnification factor.
[0008] Thus, the coordinate value of the source pixel corresponding to the target pixel can be accurately determined.
[0009] In an alternative embodiment, before querying the preset fixed parameter matrix using the fractional part to obtain the fixed parameter matrix corresponding to the fractional part, it further includes: dividing the distance between adjacent pixels in the horizontal / vertical direction of the source image into N parts to obtain N - 1 segmentation points; respectively determining the first matrix corresponding to each segmentation point; and respectively inputting each first matrix into a preset function to obtain the fixed parameter matrix.
[0010] Thus, the fixed parameter matrix can be obtained simply and conveniently.
[0011] In an alternative embodiment, querying the preset fixed parameter matrix using the fractional part to obtain the fixed parameter matrix corresponding to the fractional part includes: selecting the segmentation point closest to the fractional part among the N - 1 segmentation points to obtain a reference segmentation point; determining the horizontal distance and vertical distance corresponding to the reference segmentation point; searching for matrix A corresponding to the horizontal distance in the fixed parameter matrix; searching for matrix C corresponding to the vertical distance in the fixed parameter matrix; and obtaining the fixed parameter matrix according to matrix A and matrix C.
[0012] Thus, the fixed parameter matrix can be accurately obtained.
[0013] In an alternative embodiment, obtaining the fixed parameter matrix according to matrix A and matrix C includes: multiplying the transpose matrix of matrix A by matrix C to obtain the fixed parameter matrix.
[0014] Thus, the fixed parameter matrix can be accurately obtained.
[0015] In an alternative embodiment, extracting the pixel matrix corresponding to the target pixel from the source image using the integer part includes: determining the matrix size according to the segmentation points between adjacent pixels in the horizontal / vertical direction of the source image; and extracting the pixel matrix corresponding to the target pixel from the source image according to the matrix size.
[0016] Thus, the convolution operation between the fixed parameter matrix and the pixel matrix can be conveniently and accurately performed.
[0017] In a second aspect, an embodiment of the present invention provides an image processing apparatus, which includes an acquisition module, a source pixel point position determination module, a fixed parameter matrix determination module, a pixel matrix determination module, and a destination pixel point pixel determination module; the acquisition module is configured to acquire a first coordinate value of a destination pixel point; the source pixel point position determination module is configured to determine a second coordinate value of a source pixel point corresponding to the destination pixel point according to the first coordinate value, and divide the second coordinate value into an integer part and a fractional part; the fixed parameter matrix determination module is configured to query in a preset fixed parameter matrix by using the fractional part to obtain a fixed parameter matrix corresponding to the fractional part; the pixel matrix determination module is configured to extract a pixel matrix corresponding to the destination pixel point from the source image by using the integer part; the destination pixel point pixel determination module is configured to perform a convolution operation on the fixed parameter matrix and the pixel matrix to obtain the pixel value of the destination pixel point.
[0018] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to execute the image processing method according to the first aspect or any corresponding implementation manner thereof.
[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions are used to cause a computer to execute the image processing method according to the first aspect or any corresponding implementation manner thereof.
[0020] In a fifth aspect, an embodiment of the present invention further provides a computer program product, which includes computer instructions, and the computer instructions are used to cause a computer to execute the image processing method according to the first aspect or any corresponding implementation manner thereof. Description of the Drawings
[0021] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0022] Figure 1 is a flowchart of an image processing method according to an embodiment of the present invention;
[0023] Figure 2 is a flowchart of another image processing method according to an embodiment of the present invention;
[0024] Figure 3 is a schematic diagram of the combination of bicubic interpolation and nearest neighbor interpolation;
[0025] Figure 4 Schematic diagram of an example of a fixed parameter matrix;
[0026] Figure 5 Flowchart of an example of an image processing method according to an embodiment of the present invention;
[0027] Figure 6 Structural block diagram of an image processing apparatus according to an embodiment of the present invention;
[0028] Figure 7 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed implementation manners
[0029] The method for magnifying an image by bicubic interpolation is as follows: By using the reverse mapping calculation method, the pixel position values of the corresponding source image are calculated according to the pixel position values of the target image (x, y). The (x, y) is split into the integer part coordinates (i, j) and the fractional part coordinates (u, v). The fractional part coordinates (u, v) are converted into matrices [1 + u, u, 1 - u, 2 - u] and [1 + v, v, 1 - v, 2 - v] and input into the Bicubic function s(x) to obtain matrix A [s(1 + u), s(u), s(1 - u), s(2 - u)] and matrix C [s(1 + v), s(v), s(1 - v), s(2 - v)]. Among them,
[0030]
[0031] It can be seen that for each pixel point calculated by bicubic interpolation, the Bicubic function needs to be calculated 8 times, and matrix A and matrix C need to calculate the Bicubic function 4 times respectively. Since the Bicubic function is complex, using bicubic interpolation to magnify an image results in a sharp increase in the amount of computation and a long delay time.
[0032] Based on this, an embodiment of the present invention provides an image processing method. To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0033] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0034] In this embodiment, an image processing method is provided, which can be used in a computer device. Figure 1 It is a flowchart of the image processing method according to an embodiment of the present invention, as Figure 1 shown. The process includes the following steps:
[0035] Step S101: Obtain the first coordinate value of the target pixel point.
[0036] Step S102: Determine the second coordinate value of the source pixel point corresponding to the target pixel point according to the first coordinate value, and divide the second coordinate value into an integer part and a fractional part.
[0037] Step S103: Use the fractional part to query in a preset fixed parameter matrix to obtain the fixed parameter matrix corresponding to the fractional part.
[0038] Specifically, the fixed parameter matrix includes multiple distance values and Bicubic function matrices respectively corresponding to each distance value.
[0039] This is because matrices A and C are the same in form, only with different variable values. Therefore, multiple distance values and Bicubic function matrices respectively corresponding to each distance value, i.e., [s(1 + x), s(x), s(1 - x), s(2 - x)], can be stored in the fixed parameter matrix, and then query according to the fractional part (u, v) in the fixed parameter matrix. In this way, 8 times of Bicubic function operations can be changed to two addressing operations, saving a large amount of computing power and improving the computing speed to a great extent.
[0040] Step S104: Use the integer part to extract the pixel matrix corresponding to the target pixel point from the source image.
[0041] Step S105: Perform a convolution operation on the fixed parameter matrix and the pixel matrix to obtain the pixel value of the target pixel point.
[0042] The image processing of the embodiment of the present invention includes but is not limited to image enlargement, reduction, rotation, translation, etc.
[0043] The image processing method provided in this embodiment determines the second coordinate value of the source pixel corresponding to the target pixel according to the first coordinate value of the target pixel by obtaining the first coordinate value of the target pixel, and divides the second coordinate value into an integer part and a decimal part; queries in a preset fixed parameter matrix using the decimal part to obtain the fixed parameter matrix corresponding to the decimal part, extracts the pixel matrix corresponding to the target pixel from the source image using the integer part, and performs a convolution operation on the fixed parameter matrix and the pixel matrix to obtain the pixel value of the target pixel. Since the fixed parameter matrix is pre-stored, 8 Bicubic function operations can be changed to two addressing operations, saving a large amount of computing power and improving the computing speed to a great extent.
[0044] In this embodiment, an image processing method is provided, which can be used in a computer device. In this embodiment, the image processing method is described by taking image magnification as an example. Figure 2 It is a flowchart of another image processing method according to an embodiment of the present invention. As Figure 2 shown, the process includes the following steps:
[0045] Step S201: Divide the distance between adjacent pixel points in the horizontal and / or vertical directions of the source image into N parts to obtain N - 1 cut points.
[0046] Specifically, the block coefficient N can be adjusted according to the image precision requirements.
[0047] Specifically, as Figure 3 shown, divide the distance between adjacent pixels (i, j) and (i, j + 1) in the horizontal direction of the image into N parts to obtain N - 1 cut points. The distances from the first cut point, the second cut point... the (N - 1)th cut point to the pixel point (i, j) are 1 / N, 2 / N... (N - 1) / N in sequence.
[0048] Also divide the distance between adjacent pixels (i, j) and (i + 1, j) in the vertical direction of the image into N parts to obtain N - 1 cut points. The distances from the first cut point, the second cut point... the (N - 1)th cut point to the pixel point (i, j) are 1 / N, 2 / N... (N - 1) / N in sequence.
[0049] Step S202: Determine the first matrix corresponding to each cut point respectively.
[0050] Specifically, determine the first matrix corresponding to each cut point according to the distance value of each cut point.
[0051] The distance from the first segmentation point to the pixel point (i, j) is 1 / N, and the first matrix corresponding to the first segmentation point is [1 + 1 / N, 1 / N, 1 - 1 / N, 2 - 1 / N]; the distance from the second segmentation point to the pixel point (i, j) is 2 / N, and the first matrix corresponding to the second segmentation point is [1 + 2 / N, 2 / N, 1 - 2 / N, 2 - 2 / N]... The distance from the (N - 1)-th segmentation point to the pixel point (i, j) is (N - 1) / N, and the first matrix corresponding to the (N - 1)-th segmentation point is [1 + (N - 1) / N, (N - 1) / N, 1 - (N - 1) / N, 2 - (N - 1) / N].
[0052] Step S203: Input each first matrix into a preset function respectively to obtain a fixed parameter matrix.
[0053] After completing the horizontal and vertical segmentation, calculate the Bicubic function values corresponding to each segmentation point respectively. Among them, the Bicubic function value corresponding to the first segmentation point is [s(1 + 1 / N), s(1 / N), s(1 - 1 / N), s(2 - 1 / N)]; the Bicubic function value corresponding to the second segmentation point is [s(1 + 2 / N), s(2 / N), s(1 - 2 / N), s(2 - 2 / N)]... The Bicubic function value corresponding to the (N - 1)-th segmentation point is [s(1 + (N - 1) / N), s((N - 1) / N), s(1 - (N - 1) / N), s(2 - (N - 1) / N)].
[0054] That is to say, after completing the horizontal and vertical segmentation, calculate the Bicubic function value [s(1 + k / N), s(k / N), s(1 - k / N), s(2 - k / N)] corresponding to the distance quantity, where k = 1, 2, 3..., N - 1; and store the calculated Bicubic function value into the RAM. It should be noted that since the distance quantities corresponding to the horizontal and vertical directions are the same, only the Bicubic function value needs to be calculated and saved once.
[0055] Specifically, as Figure 4As shown, the fixed parameter matrix includes N - 1 distance values and a Bicubic function matrix corresponding to each distance value respectively. Specifically, the N - 1 distance values include 1 / N, 2 / N, 3 / N..., N - 1 / N. Among them, the Bicubic function matrix corresponding to the first segmentation point is [s(1 + 1 / N), s(1 / N), s(1 - 1 / N), s(2 - 1 / N)]; the Bicubic function matrix corresponding to the second segmentation point is [s(1 + 2 / N), s(2 / N), s(1 - 2 / N), s(2 - 2 / N)]; the Bicubic function matrix corresponding to the m-th segmentation point is [s(1 + m / N), s(m / N), s(1 - m / N), s(2 - m / N)]; the Bicubic function matrix corresponding to the n-th segmentation point is [s(1 + n / N), s(n / N), s(1 - n / N), s(2 - n / N)]; the Bicubic function matrix corresponding to the N - 1-th segmentation point is [s(1 + (N - 1) / N), s((N - 1) / N), s(1 - (N - 1) / N), s(2 - (N - 1) / N)].
[0056] Step S204: Obtain the first coordinate value of the target pixel point.
[0057] Step S205: Determine the second coordinate value of the source pixel point corresponding to the target pixel point according to the first coordinate value, and divide the second coordinate value into an integer part and a fractional part.
[0058] In an alternative embodiment, determining the second coordinate value of the source pixel point corresponding to the target pixel point according to the first coordinate value includes the following steps: obtaining an image magnification factor; determining the second coordinate value of the source pixel point corresponding to the target pixel point according to the first coordinate value and the image magnification factor.
[0059] Step S206: Query in the preset fixed parameter matrix using the fractional part to obtain the fixed parameter matrix corresponding to the fractional part.
[0060] In an alternative embodiment, querying in the preset fixed parameter matrix using the fractional part to obtain the fixed parameter matrix corresponding to the fractional part includes the following steps:
[0061] Step S2061: Select the segmentation point closest to the fractional part among the N - 1 segmentation points to obtain a reference segmentation point.
[0062] Specifically, when the coordinates of the fractional part are (u, v), the square point closest to (u, v) in Figure 3 is (m, n), that is, (m, n) is the reference segmentation point.
[0063] Step S2062: Determine the horizontal distance and vertical distance corresponding to the reference cut point.
[0064] Specifically, the horizontal distance corresponding to the reference cut point (m, n) is m / N, and the vertical distance corresponding to the reference cut point (m, n) is n / N.
[0065] Step S2063: Search for matrix A corresponding to the horizontal distance in the fixed parameter matrix.
[0066] Specifically, as Figure 4 shown, search for matrix A corresponding to m / N in the fixed parameter matrix.
[0067] Step S2064: Search for matrix C corresponding to the vertical distance in the fixed parameter matrix.
[0068] Specifically, as Figure 4 shown, search for matrix C corresponding to n / N in the fixed parameter matrix.
[0069] Step S2065: Obtain the fixed parameter matrix according to matrix A and matrix C.
[0070] Specifically, multiply the transpose matrix of matrix A by matrix C to obtain the fixed parameter matrix.
[0071] That is to say, input (m, n) into the RAM to obtain matrix A and matrix C, and multiply the transpose matrix of matrix A by matrix C to obtain the fixed parameter matrix.
[0072] Step S207: Use the integer part to extract the pixel matrix corresponding to the destination pixel point in the source image.
[0073] In an alternative embodiment, using the integer part to extract the pixel matrix corresponding to the destination pixel point in the source image includes: determining the matrix size according to the cut points between adjacent pixel points in the horizontal / vertical direction of the source image; extracting the pixel matrix corresponding to the destination pixel point in the source image according to the matrix size. For example, when there are N - 1 cut points between adjacent pixel points in the horizontal / vertical direction of the source image, the matrix size is N x N.
[0074] Exemplarily, as Figure 3 shown, there are 3 cut points between (i, j) and (i, j + 1), so it is necessary to extract a 4x4 pixel matrix B centered on (i, j) in the source image
[0075]
[0076] Step S208: Perform a convolution operation on the fixed parameter matrix and the pixel matrix to obtain the pixel value of the destination pixel point.
[0077] Specifically, convolve the pixel matrix B with A T and the C matrix parameters. The convolution result is the pixel value of the newly generated target image.
[0078] It should be noted that in the embodiments of the present invention, the image magnification process is not limited to bicubic interpolation, and interpolation algorithms with better frequency domain response within the allowable range of the convolution kernel size can also be applied.
[0079] The image processing method provided in this embodiment obtains the first coordinate value of the target pixel point, determines the second coordinate value of the source pixel point corresponding to the target pixel point according to the first coordinate value, and divides the second coordinate value into an integer part and a fractional part; queries in the preset fixed parameter matrix using the fractional part to obtain the fixed parameter matrix corresponding to the fractional part, extracts the pixel matrix corresponding to the target pixel point in the source image using the integer part, and performs a convolution operation on the fixed parameter matrix and the pixel matrix to obtain the pixel value of the target pixel point. Since the fixed parameter matrix is pre-stored, 8 Bicubic function operations can be changed to two addressing operations, saving a large amount of computation, improving the computation speed, and having a small delay; at the same time, the image processing effect after magnification is excellent, that is, it ensures a good signal-to-noise ratio and does not lose image edge details; furthermore, the implementation process is a pipelined operation, which is suitable for deployment.
[0080] To illustrate the image processing method of the embodiments of the present invention more clearly, a specific example is given. As Figure 5 shown, the image processing method includes the following steps:
[0081] S1. Determine the number of blocks N between pixels.
[0082] S2. Calculate the Bicubic function to obtain the fixed parameter matrix, and store the fixed parameter matrix in the RAM.
[0083] As Figure 3 shown, the distance between adjacent pixels (i,j) and (i,j + 1) in the horizontal direction of the image can be divided into N parts, and the distance of each part is 1 / N, that is, the distances of the small squares in the figure from the pixel point (i,j) are 1 / N, 2 / N,..., (N - 1) / N in turn. The vertical direction (i,j) and (i + 1,j) of the image are also divided in a similar way. After the horizontal and vertical directions are divided, calculate the Bicubic function values [s(1 + k / N), s(k / N), s(1 - k / N), s(2 - k / N)] corresponding to the distance amounts, where k = 1, 2, 3,..., N - 1, and store the function values in the RAM. Since the distance amounts corresponding to the horizontal and vertical directions are the same, only the function values need to be calculated and stored once.
[0084] Among them, before calculating the Bicubic function to obtain the fixed parameter matrix, it further includes: image edge expansion. Specifically, one row and one column are expanded for the left edge and the upper edge, and two rows and two columns are expanded for the right edge and the lower edge, and adjacent valid pixels are taken for filling.
[0085] S3. Obtain the image magnification factor.
[0086] S4. Determine the second coordinate value of the source pixel corresponding to the target pixel according to the first coordinate value of the target pixel and the image magnification factor.
[0087] S5. Divide the second coordinate value into an integer part and a decimal part, take the nearest (m, n) according to the decimal part, address in the RAM to obtain A T C.
[0088] Specifically, select the segmentation point closest to the decimal part among the N - 1 segmentation points to obtain the reference segmentation point; determine the horizontal distance and the vertical distance corresponding to the reference segmentation point; search for matrix A corresponding to the horizontal distance in the fixed parameter matrix; search for matrix C corresponding to the vertical distance in the fixed parameter matrix; obtain the fixed parameter matrix according to matrix A and matrix C.
[0089] S6. Take out the total 16 matrix pixels of 4x4 of the source image corresponding to (i, j) in the cache, and perform convolution operation with the A T C matrix parameters, and the convolution result is the pixel value of the newly generated target image.
[0090] The image magnification method provided by the embodiments of the present invention is suitable for deployment and implementation on various processors, especially for implementing pipeline operations in FPGA, with low latency and small energy consumption ratio.
[0091] In this embodiment, an image processing device is further provided. This device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated. As used hereinafter, the term "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0092] This embodiment provides an image processing device, as Figure 6 shown, including:
[0093] An acquisition module 601, configured to acquire the first coordinate value of the target pixel;
[0094] A source pixel position determination module 602, configured to determine the second coordinate value of the source pixel corresponding to the target pixel according to the first coordinate value, and divide the second coordinate value into an integer part and a decimal part;
[0095] A fixed parameter matrix determination module 603 is configured to query in a preset fixed parameter matrix using the fractional part to obtain a fixed parameter matrix corresponding to the fractional part;
[0096] A pixel matrix determination module 604 is configured to extract a pixel matrix corresponding to the destination pixel point from the source image using the integer part;
[0097] A destination pixel point pixel determination module 605 is configured to perform a convolution operation on the fixed parameter matrix and the pixel matrix to obtain the pixel value of the destination pixel point.
[0098] In an alternative embodiment, the source pixel point position determination module 602 includes a magnification unit and a splitting unit. The magnification unit is specifically configured to: obtain an image magnification factor; determine a second coordinate value of the source pixel point corresponding to the destination pixel point according to the first coordinate value and the image magnification factor; the splitting unit is specifically configured to: divide the second coordinate value into an integer part and a fractional part.
[0099] In an alternative embodiment, the image processing device further includes a fixed parameter matrix generation module. The fixed parameter matrix generation module is specifically configured to: divide the distance between adjacent pixel points in the horizontal / vertical direction of the source image into N parts to obtain N - 1 cut points; respectively determine a first matrix corresponding to each cut point; respectively input each first matrix into a preset function to obtain a fixed parameter matrix.
[0100] In an alternative embodiment, the fixed parameter matrix determination module 603 includes a reference cut point determination unit, a distance determination unit, a matrix A search unit, a matrix C search unit, and a fixed parameter matrix determination unit. The reference cut point determination unit is configured to: select a cut point closest to the fractional part from the N - 1 cut points to obtain a reference cut point; the distance determination unit is configured to determine a horizontal distance and a vertical distance corresponding to the reference cut point; the matrix A search unit is configured to search for matrix A corresponding to the horizontal distance in the fixed parameter matrix; the matrix C search unit is configured to search for matrix C corresponding to the vertical distance in the fixed parameter matrix; the fixed parameter matrix determination unit is configured to obtain a fixed parameter matrix according to matrix A and matrix C.
[0101] In an alternative embodiment, the fixed parameter matrix determination unit is specifically configured to: multiply the transposed matrix of matrix A by matrix C to obtain a fixed parameter matrix.
[0102] In an alternative embodiment, the pixel matrix determination module 604 is specifically configured to: determine the matrix size according to the cut points between adjacent pixel points in the horizontal / vertical direction of the source image; extract a pixel matrix corresponding to the destination pixel point from the source image according to the matrix size.
[0103] The further function descriptions of the above-mentioned various modules and units are the same as those in the corresponding embodiments above, and will not be repeated here.
[0104] The image processing device in this embodiment is presented in the form of functional units. Here, the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and a memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0105] An embodiment of the present invention further provides a computer device having the above Figure 6 shown image processing device.
[0106] Please refer to Figure 7 , Figure 7 which is a schematic structural diagram of a computer device provided by an optional embodiment of the present invention. As Figure 7 shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including a high-speed interface and a low-speed interface. Each component communicates with each other using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in the memory or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a set of blade servers, or a multi-processor system). Figure 6 In
[0107] Processor 10 can be a central processor, a network processor, or a combination thereof. Among them, processor 10 can further include a hardware chip. The above hardware chip can be an application specific integrated circuit, a programmable logic device, or a combination thereof. The above programmable logic device can be a complex programmable logic device, a field programmable gate array, a general array logic, or any combination thereof.
[0108] Among them, the memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0109] The memory 20 may include a program storage area and a data storage area. The program storage area may store an operating system and application programs required for at least one function. The data storage area may store data created according to the use of the computer device and the like. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some alternative embodiments, the memory 20 may optionally include a memory remotely provided with respect to the processor 10, and these remote memories may be connected to the computer device through a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0110] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk, or a solid-state drive; the memory 20 may further include a combination of the above types of memories.
[0111] The computer device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30, and the output device 40 may be connected through a bus or other means. Figure 7 Taking the connection through a bus as an example. The input device 30 may receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the computer device, such as an image sensor, etc. The output device 40 may be a display device. The above-mentioned display devices include, but are not limited to, a liquid crystal display, a light-emitting diode, a display, and a plasma display. In some alternative embodiments, the display device may be a touch screen.
[0112] The embodiment of the present invention further provides a computer-readable storage medium. The method according to the embodiment of the present invention may be implemented in hardware, firmware, or be implemented as computer code that can be recorded on a storage medium, or be implemented as computer code originally stored in a remote storage medium or a non-transitory machine-readable storage medium and downloaded through a network and to be stored in a local storage medium, so that the method described herein can be stored in such software processed on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium may be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid-state drive, etc.; further, the storage medium may further include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code, and when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiment is implemented.
[0113] A part of the present invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can call or provide the methods and / or technical solutions according to the present invention through the operations of the computer. Those skilled in the art should understand that the forms of existence of computer program instructions in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways for computer program instructions to be executed by a computer include, but are not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible by the computer.
[0114] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. An image processing method, characterized in that: The method comprises: Get the first coordinate value of the destination pixel; Determine a second coordinate value of a source pixel point corresponding to the destination pixel point according to the first coordinate value, and divide the second coordinate value into an integer part and a decimal part; Using the decimal part to search in a preset fixed parameter matrix, obtaining a fixed parameter matrix corresponding to the decimal part; Using the integer part, a pixel matrix corresponding to the destination pixel point is extracted from the source image; The fixed parameter matrix is convolved with the pixel matrix to obtain the pixel value of the target pixel.
2. The image processing method according to claim 1, characterized in that: Determining a second coordinate value of a source pixel point corresponding to the destination pixel point according to the first coordinate value includes: Get the image magnification factor; A second coordinate value of a source pixel point corresponding to the destination pixel point is determined according to the first coordinate value and the image magnification coefficient.
3. The image processing method according to claim 1, characterized in that: Before using the decimal part to search in a preset fixed parameter matrix to obtain a fixed parameter matrix corresponding to the decimal part, the method further includes: Divide the distance between adjacent pixels in the horizontal direction / vertical direction of the source image into N parts to obtain N-1 segmentation points; Determine a first matrix corresponding to each of the segmentation points respectively; Each of the first matrices is input into a preset function to obtain the fixed parameter matrix.
4. The image processing method according to claim 3, characterized in that: The step of using the decimal part to query in a preset fixed parameter matrix to obtain a fixed parameter matrix corresponding to the decimal part includes: Select the split point closest to the decimal part from the N-1 split points to obtain a reference split point; Determine the horizontal distance and the vertical distance corresponding to the reference segmentation point; Searching for a matrix A corresponding to the horizontal distance in the fixed parameter matrix; Searching for a matrix C corresponding to the vertical distance in the fixed parameter matrix; The fixed parameter matrix is obtained according to the matrix A and the matrix C.
5. The image processing method according to claim 4, characterized in that: The obtaining of the fixed parameter matrix according to the matrix A and the matrix C comprises: The fixed parameter matrix is obtained by multiplying the transposed matrix of the matrix A by the matrix C.
6. The image processing method according to claim 3, characterized in that: The step of extracting a pixel matrix corresponding to the destination pixel point from the source image by using the integer part comprises: Determine the size of the matrix according to the dividing points between adjacent pixels in the horizontal direction / vertical direction of the source image; A pixel matrix corresponding to the destination pixel point is taken out from the source image according to the matrix size.
7. An image processing device, characterized in that: The device comprises: An acquisition module, used to acquire a first coordinate value of a target pixel; a source pixel point position determination module, configured to determine a second coordinate value of a source pixel point corresponding to the destination pixel point according to the first coordinate value, and to divide the second coordinate value into an integer part and a decimal part; A fixed parameter matrix determination module, used to use the decimal part to query in a preset fixed parameter matrix to obtain a fixed parameter matrix corresponding to the decimal part; A pixel matrix determination module, used to extract a pixel matrix corresponding to the target pixel point in the source image using the integer part; The target pixel point pixel determination module is used to perform a convolution operation on the fixed parameter matrix and the pixel matrix to obtain the pixel value of the target pixel point.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the image processing method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the image processing method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the image processing method according to any one of claims 1 to 6.