Nothing Special   »   [go: up one dir, main page]

CN111626935B - Pixel map scaling method, game content generation method and device - Google Patents

Pixel map scaling method, game content generation method and device Download PDF

Info

Publication number
CN111626935B
CN111626935B CN202010420062.3A CN202010420062A CN111626935B CN 111626935 B CN111626935 B CN 111626935B CN 202010420062 A CN202010420062 A CN 202010420062A CN 111626935 B CN111626935 B CN 111626935B
Authority
CN
China
Prior art keywords
pixel
color
boundary
map
interpolation operation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010420062.3A
Other languages
Chinese (zh)
Other versions
CN111626935A (en
Inventor
徐舒畅
唐际宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Lexin Shengwen Technology Co ltd
Original Assignee
Chengdu Lexin Shengwen Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Lexin Shengwen Technology Co ltd filed Critical Chengdu Lexin Shengwen Technology Co ltd
Priority to CN202010420062.3A priority Critical patent/CN111626935B/en
Publication of CN111626935A publication Critical patent/CN111626935A/en
Application granted granted Critical
Publication of CN111626935B publication Critical patent/CN111626935B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4007Scaling of whole images or parts thereof, e.g. expanding or contracting based on interpolation, e.g. bilinear interpolation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

The invention provides a pixel map scaling method, a game content generation method and a game content generation device, wherein the scaling method comprises the following steps: traversing the pixel map to obtain a boundary pixel set; screening out an effective boundary set from the boundary pixel set; if the adjacent pixel of the pixel in the pixel map for interpolation operation exists in the effective boundary set, copying the color value of the pixel to an interpolation operation result map; if all the adjacent pixels of the pixels in the pixel map for interpolation operation do not exist in the effective boundary set, performing interpolation operation by using all the adjacent pixels of the pixels, calculating to obtain a color value, and putting the color value into an interpolation operation result map; if the interpolation operation result graph has a new color which is not stored in the pixel graph, searching the color which is closest to the new color in the pixel graph, and combining the new color in the interpolation operation result graph to the closest color; and taking the interpolation operation result graph obtained after all the new colors are combined as a scaling result. Structural and color integrity can be maintained through the scheme.

Description

Pixel map scaling method, game content generation method and device
Technical Field
The invention relates to the technical field of image processing, in particular to a pixel map scaling method, a game content generation method and a game content generation device.
Background
The pixel map is widely used in various programs, and is particularly applied to mobile end games as a material. However, the size requirements for the pixel map are also different in different applications, in particular on different mobile devices. Therefore, scaling operations are often required on the pixel map.
However, in mobile applications, especially in mobile gaming applications, the quality requirements of the pixel map for the user are high. After a pixel image is zoomed by ordinary image zooming processing, for example, Photoshop software is used to zoom the pixel image, the problems of blurred pixel colors in the resultant image and disordered object structures in the image can be caused. And redrawing the pixel map under different resolutions consumes time and labor and has higher cost.
Disclosure of Invention
The invention provides a pixel map scaling method, a game content generation method and a game content generation device, which are used for improving the resolution and color adaptation problems of a pixel map in different applications and ensuring that the pixel map can still keep the integrity of the structure and the color after scaling.
In order to achieve the purpose, the invention is realized by adopting the following scheme:
according to an aspect of the embodiments of the present invention, there is provided a pixel map scaling method, including: acquiring a pixel map, and traversing each pixel of the pixel map to obtain a boundary pixel set; screening out an effective boundary set from the boundary pixel set; if at least one adjacent pixel used for interpolation operation of one pixel in the pixel map exists in the effective boundary set, copying the color value of the pixel in the pixel map to the corresponding position in an interpolation operation result map; if all the adjacent pixels of one pixel in the pixel map for interpolation operation do not exist in the effective boundary set, performing interpolation operation by using all the adjacent pixels of the pixel in the pixel map for interpolation operation, calculating to obtain a color value corresponding to the pixel in the pixel map, and putting the calculated color value into a corresponding position in an interpolation operation result map; if the interpolation operation result graph has a new color which does not exist in the pixel graph, searching the color which is closest to the new color in the pixel graph, and combining the new color in the interpolation operation result graph with the color which is closest to the new color and is found in the pixel graph; and merging all new colors into corresponding colors in the pixel map, and outputting an interpolation operation result map serving as a scaling result of the pixel map.
In some embodiments, traversing each pixel of the pixel map resulting in a set of boundary pixels comprises: and traversing each pixel of the pixel map to obtain pixels with different color values of two adjacent pixels and the color value of the pixels, and using the pixels as boundary pixels to form a boundary pixel set.
In some embodiments, the two adjacent pixels are two pixels adjacent to each other on the left and right.
In some embodiments, screening the set of valid boundaries from the set of boundary pixels comprises: screening out all boundaries consisting of boundary pixels from the boundary pixel set; and if the boundary formed by the boundary pixels in the boundary pixel set is a closed boundary and the length of the closed boundary exceeds a first set length threshold, or the boundary is a non-closed boundary and the length of the non-closed boundary exceeds a second set length threshold, or the color values of all the boundary pixels on the boundary are equal, generating an effective boundary set according to the boundary pixels forming the boundary.
In some embodiments, the step of screening out all boundaries composed of boundary pixels from the boundary pixel set comprises: and screening a group of boundary pixels connected in an eight-way neighborhood from the boundary pixel set to form a boundary.
In some embodiments, if all the neighboring pixels of a pixel in the pixel map used for interpolation do not exist in the effective boundary set, performing interpolation operation by using all the neighboring pixels of the pixel in the pixel map used for interpolation operation, calculating a color value corresponding to the pixel in the pixel map, and placing the calculated color value into a corresponding position in an interpolation operation result map, includes: if the 16 adjacent pixels used for interpolation operation of one pixel in the pixel map do not exist in the effective boundary set, performing cubic convolution interpolation operation by using the 16 adjacent pixels used for interpolation operation of the pixel in the pixel map, calculating to obtain a color value corresponding to the pixel in the pixel map, and putting the calculated color value into a corresponding position in an interpolation operation result map.
In some embodiments, if there is a new color that does not exist in the pixel map in the interpolation operation result map, finding a color in the pixel map that is closest to the new color, and merging the new color in the interpolation operation result map with the color found in the pixel map that is closest to the new color, includes: if the new color which does not exist in the pixel map exists in the interpolation operation result map, converting the new color into an HSV color space to obtain an HSV value of the new color; calculating the Euclidean distance of the HSV of the new color and the HSV of each color in the color list of the pixel map, and taking the color in the color list of the pixel map corresponding to the minimum Euclidean distance as the closest color of the new color; and replacing the color value of the new color in the interpolation operation result graph with the color value of the nearest color of the new color so as to merge the new color into the nearest color.
According to another aspect of an embodiment of the present invention, there is provided a game content generation method including: scaling the pixel map using the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method according to any of the above embodiments when executing the program.
According to another aspect of embodiments of the present invention, there is provided a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method of any of the above embodiments.
According to the pixel map scaling method, the game content generation method, the electronic device and the computer-readable storage medium, when the pixel map is scaled, the object structure confusion and the color blurring in the result map after interpolation operation can be prevented, and in addition, the re-drawing is not needed, and the cost is not increased. Therefore, the method can improve the resolution and color adaptation problems of the pixel map in different applications, and simultaneously ensure that the zoomed pixel map can still keep the integrity of the structure and the color.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
FIG. 1 is a flowchart illustrating a pixel map scaling method according to an embodiment of the invention;
FIG. 2 is a flowchart illustrating a pixel map scaling method according to an embodiment of the invention;
FIG. 3 is a schematic diagram of a boundary pixel in an embodiment of the invention;
FIG. 4 is a diagram illustrating an eight-connected neighborhood in accordance with an embodiment of the present invention;
FIG. 5 is a flow chart illustrating a method for merging colors in a pixel result graph according to an embodiment of the present invention;
FIG. 6 is an example of a pixel map used in an embodiment of the present invention;
FIG. 7 is a graph of the result of the pixel map shown in FIG. 6 enlarged using Photoshop software;
FIG. 8 is a diagram showing the result of enlarging the pixel map shown in FIG. 6 by using the pixel map scaling method according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
In order to solve or improve the problems of fuzzy pixel colors and disordered object structures in a result image after the pixel image is zoomed and avoid cost rise caused by drawing the pixel image under different resolutions, the invention provides a pixel image zooming method to generate the same series of pixel images suitable for mobile equipment with different resolutions together, ensure the quality to meet the requirements of users and solve the problem of recycling the pixel images in mobile application.
Fig. 1 is a flowchart illustrating a pixel map scaling method according to an embodiment of the invention. As shown in fig. 1, the pixel map scaling method of the embodiments may include the following steps S110 to S160.
Specific embodiments of steps S110 to S160 will be described in detail below.
Step S110: and acquiring a pixel map, and traversing each pixel of the pixel map to obtain a boundary pixel set.
In step S110, the pixel map is composed of pixels. Each pixel in the pixel map may be traversed row by row and it may be determined whether each pixel belongs to a boundary pixel, such that all boundary pixels in the pixel map may be found, which constitute a set of boundary pixels. The boundaries, which are made up of boundary pixels, can reflect the structure of objects in the pixel map.
A boundary pixel can be defined as a pixel that can be considered as a boundary pixel if the pixel and two pixels adjacent to the pixel have the same color value (pixel value).
In this case, for example, in step S110, the step of traversing each pixel of the pixel map to obtain a boundary pixel set may specifically include the steps of: and S111, traversing each pixel of the pixel map to obtain pixels with different color values of two adjacent pixels and the color values of the two adjacent pixels, and using the pixels as boundary pixels to form a boundary pixel set.
Wherein, one color value is different from another color value, which may mean that the interpolation of the two color values is within a certain interpolation range.
More specifically, a boundary pixel may be defined as a pixel that can be considered as a boundary pixel if the color value (pixel value) of the pixel and the color values (pixel values) of two pixels adjacent to the left and right are both different. In this case, in step S111, the two adjacent pixels may be two pixels adjacent to each other in the left-right direction. Specifically, for a pixel in the pixel map, if the color value (pixel value) of the pixel is different from the color value (pixel value) of the pixel adjacent to the left of the pixel, and the color value (pixel value) of the pixel is different from the color value (pixel value) of the pixel adjacent to the right of the pixel, the pixel is considered as a boundary pixel in the pixel map. In other embodiments, the two adjacent pixels may be two pixels adjacent to each other up and down.
Step S120: and screening out an effective boundary set from the boundary pixel set.
In step S120, the boundary pixels in the boundary pixel set may be divided into one or more groups according to pixel connectivity, each group of boundary pixels may form a boundary, and a boundary that is more reflective of an object structure in the pixel map among the boundaries may be regarded as an effective boundary. The effective boundary may be represented by the screened boundary pixels, so screening the effective boundary from the boundary pixel set may refer to screening the boundary pixels of the effective boundary from the boundary pixel set.
The valid boundaries, such as target contours, important segmentation lines, etc., can be selected by setting certain criteria for different types of boundaries (e.g., closed boundaries, non-closed boundaries). The set criteria may be one or more. For example, a length of a closed boundary or a non-closed boundary reaching a certain threshold may be considered a valid boundary. For example, if the colors of the pixels on the boundary are equal, the boundary may be an important contour, a dividing line, or the like, and such a boundary may be regarded as an effective boundary.
In this case, the step S120 of screening out the effective boundary set from the boundary pixel set may specifically include the steps of: s121, screening out all boundaries formed by boundary pixels from the boundary pixel set; and S122, if the boundary formed by the boundary pixels in the boundary pixel set is a closed boundary and the length of the closed boundary exceeds a first set length threshold, or the boundary is a non-closed boundary and the length of the non-closed boundary exceeds a second set length threshold, or the color values of all the boundary pixels on the boundary are equal, generating an effective boundary set according to the boundary pixels forming the boundary.
In step S121, the boundary may be formed by filtering connected boundary elements from the boundary pixel set, so as to obtain one or more boundaries. In step S122, if there are adjacent boundary pixels on both sides of all the boundary pixels in the boundary, the boundary may be considered as a closed boundary. In step S123, if at least two boundary pixels exist in the boundary, and only one side of the at least two boundary pixels has an adjacent boundary pixel, the boundary may be considered as a non-closed boundary, and the pixel may be a pixel at both ends. The length of the boundary can be determined according to the number of pixels on the line of the boundary, and the first set length threshold and the second set length threshold can also be represented by the set number of pixels, and the two may have different values or the same value, and the specific situation can be determined according to the situation of object structure, resolution and the like in the pixel map.
This step S121, namely, screening out all boundaries composed of boundary pixels from the boundary pixel set, may more specifically include the steps of: s1211, screening a group of boundary pixels connected in the eight-pass neighborhood from the boundary pixel set to form a boundary.
Wherein, for a pixel, the octant neighborhood can refer to the eight pixel regions adjacent to the element left, right, up, down, left up, right up, left down, right down. In step S1211, specifically, a boundary pixel may be taken out from the boundary pixel set, then the boundary pixel existing in the eight-way neighborhood of the boundary pixel and existing in the boundary pixel set is found, then the boundary pixel existing in the eight-way neighborhood of each boundary pixel in the eight-way neighborhood of the boundary pixel and existing in the boundary pixel set may be continuously found, and the search for the connected boundary pixels is continuously sequentially extended until there is no new boundary pixel in the eight-way neighborhood of the found boundary pixel, so as to obtain a boundary.
Step S130: and if at least one adjacent pixel used for interpolation operation of one pixel in the pixel map exists in the effective boundary set, copying the color value of the pixel in the pixel map to the corresponding position in an interpolation operation result map.
Step S140: if all the adjacent pixels of one pixel in the pixel map for interpolation operation do not exist in the effective boundary set, performing interpolation operation by using all the adjacent pixels of the pixel in the pixel map for interpolation operation, calculating to obtain a color value corresponding to the pixel in the pixel map, and putting the calculated color value into a corresponding position in an interpolation operation result map.
The pixel map may be scaled by interpolating pixels (e.g., nearest neighbor interpolation, bilinear interpolation, cubic convolution, etc.). In the prior art, interpolation is performed on each pixel in the pixels to obtain a result graph. In the embodiment of the invention, interpolation operation is selectively carried out on the pixels in the pixel image. When preparing to perform interpolation operation on one pixel in the pixel map, it is necessary to find the adjacent pixels of the pixel, that is, the adjacent pixels used for the interpolation operation, and then perform the interpolation operation by using the adjacent pixels. For example, in the case of performing interpolation operation by using the cubic convolution method, 16 pixels adjacent to the pixel can be found to form a matrix B, and then the interpolation operation can be performed by respectively left-multiplying and right-multiplying the matrix B, i.e., A1B a2, by the matrix A1 and the matrix a2 (the matrices A1 and a2 can be calculated by a kernel function in the cubic convolution operation, the matrix B can be 4 × 4, the matrix A1 is 1 × 4, and the matrix a2 is 4 × 1).
When preparing to perform interpolation operation on one pixel in the pixel map, if it is checked that a pixel in the adjacent pixels (adjacent pixels used for interpolation operation) of the pixel is a boundary pixel in the effective boundary set, that is, a boundary pixel on the effective boundary, the step S130 is performed to directly copy the color value of the boundary pixel to the result map corresponding to the interpolation operation, and if it is checked that all pixels in the adjacent pixels of the pixel are not boundary pixels in the effective boundary set, the step S140 is performed to perform interpolation operation on the pixel to obtain a new color value, and place the new color value in the result map corresponding to the interpolation operation. In this way, important boundary pixels can be retained in the zoomed result image, so that the structure of an object in the pixel image can be well ensured.
In specific implementation, in order to obtain a better interpolation effect, a cubic convolution method can be adopted for interpolation operation. In this case, the step S140, more specifically, may include the steps of: and S141, if the 16 adjacent pixels used for interpolation operation of one pixel in the pixel map do not exist in the effective boundary set, performing cubic convolution interpolation operation by using the 16 adjacent pixels used for interpolation operation of the pixel in the pixel map, calculating to obtain a color value corresponding to the pixel in the pixel map, and putting the calculated color value into a corresponding position in an interpolation operation result map. Wherein, the 16 adjacent pixels used for interpolation operation can be determined according to the positions of the adjacent pixels in the existing cubic convolution method.
Step S150: if the interpolation operation result graph has a new color which does not exist in the pixel graph, searching the color which is closest to the new color in the pixel graph, and combining the new color in the interpolation operation result graph with the color which is closest to the new color and is found in the pixel graph.
Each pixel in the pixel map is operated in the above steps S130 and S140, so that each pixel in the pixel map has a corresponding color value to be put into the result map, thereby obtaining a preliminary result map (interpolation operation result map).
The colors of the pixels in the original pixel map can be arranged into a color list, and color values can be recorded. The values of some pixels in the interpolation result map are interpolated, and some new colors may be generated by interpolation. Therefore, each pixel in the result graph can be traversed to see whether the color of the pixel exists in the color list, if not, the color of the pixel is a new color, and the color closest to the color can be found from the color list to replace the new color at the pixel.
In specific implementation, the closest color can be found by calculating the euclidean distance. For example, in the step S150, if there is a new color that does not exist in the pixel map in the interpolation operation result map, the color closest to the new color in the pixel map is searched, and the new color in the interpolation operation result map is merged to the color closest to the new color found in the pixel map, which may specifically include the steps of: s151, if the interpolation operation result graph has a new color which does not exist in the pixel graph, converting the new color into an HSV color space to obtain an HSV value of the new color; s152, calculating the Euclidean distance between the new color HSV and the HSV of each color in the color list of the pixel map, and taking the color in the color list of the pixel map corresponding to the minimum Euclidean distance as the closest color of the new color; s153, replacing the color value of the new color in the interpolation operation result graph with the color value of the closest color of the new color, so as to merge the new color into the closest color.
Among them, the HSV color space includes Hue, Saturation, and transparency (Hue, Saturation, Value, HSV) parameters. The hue, saturation, and transparency (HSV value) can be calculated from the new color information to convert to an HSV color space. Similarly, the value of HSV for each color in the color list of the pixel map may be calculated. Therefore, the Euclidean distance between the HSV of the new color and the HSV of each color in the color list is calculated to judge that the color in the color list is closest to the new color, and the color value of the found closest color can be used for replacing the value of the calculated new color, so that the new color is merged to the color closest to the new color. Therefore, the problem of color blurring after the original pixel image is zoomed can be avoided through color combination.
Step S160: and merging all new colors into corresponding colors in the pixel map, and outputting an interpolation operation result map serving as a scaling result of the pixel map.
Repeating the above step S150 can find out all new colors in the interpolation operation result map, and combine all new colors to the corresponding closest color (in the pixel map), so as to obtain the interpolation operation result map after color combination, that is, all new colors in the interpolation operation result map have been combined to the corresponding color in the pixel map, where there is no new color. The interpolation operation result map after color combination can be used as the scaling result of the pixel map.
According to the pixel map scaling method provided by the embodiment of the invention, the boundary pixel set is found from the pixel map, and the effective boundary set is found, so that the boundary reflecting the object structure in the pixel map can be found. Then, by reserving color values related to the effective boundary during interpolation operation and performing interpolation operation on pixels not related to the effective boundary, the effective boundary in the pixel map can be reserved well, so that the structure of an object in the pixel map can be kept well, and the structure confusion of the object in a result map after interpolation operation can be prevented. By carrying out interpolation operation and combining the new color appearing in the result graph after the effective boundary is reserved to the nearest color, the color of the result graph after the interpolation operation can be prevented from being fuzzy. Therefore, the method of the embodiment of the invention can generate the same series of pixel maps which can be suitable for mobile equipment with different resolutions, ensures the quality to meet the requirements of users, solves the problem of recycling of the pixel maps in mobile application, and does not need to redraw images, thereby not increasing the cost.
Based on the same inventive concept as the above embodiments, the present invention also provides a game content generating method, including: the pixel map is scaled using the pixel map scaling method described in any of the above embodiments. In the game content generation process, scaling of the pixel map may be involved, thereby generating images of different sizes. Of course, the game content generation may also include other related steps, which may depend on the requirements of the specific game content.
An embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the pixel map scaling method according to any of the above embodiments or the game content generation method according to any of the above embodiments when executing the program.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the pixel map scaling method according to any of the above embodiments or the steps of the game content generation method according to any of the above embodiments.
In order that those skilled in the art will better understand the present invention, embodiments of the present invention will be described below with reference to specific examples.
In one embodiment, as shown in FIG. 2, a scaling method for a pixel map may include steps 201 to 206, which are specifically described as follows:
step 201: the edge detection is performed on the input pixel map M.
As shown in FIG. 3, if the color values of the current pixel P, its left and right neighboring pixels (P-1) and (P +1) are different from the P color value, the P pixel is defined as a boundary pixel. Each element of the input pixel map M is traversed to find the set of boundary pixels E.
Step 202: a valid boundary is selected from the set of boundary pixels E.
The selection criteria for the active boundary may include: 1) the boundary is closed and the length exceeds a threshold T1; 2) non-closed boundaries, but length exceeds a threshold T2; 3) all pixels on the border are equal in color. The boundary pixels meeting the above condition may be the contour of the object in general, or important parting lines. In particular, in confirming whether the boundary is closed, if a certain pixel is located within the eight-connected neighborhood of the current pixel P, as shown in fig. 4, two pixels can be considered to be connected.
Preserving the above boundary pixels helps to ensure the structural integrity of the resulting graph when scaling the pixel graph.
Step 203: an active boundary set E is selected from the set of boundary pixels E, per step 202.
Step 204: the input pixel image M is interpolated by a cubic convolution method (Bicubic Interpolation), and a result map M is generated. For each pixel P in the resulting graph, the cubic convolution method can be viewed as a series of matrix multiplications. In this embodiment, the cubic convolution operation may be performed through three matrices A1BA2The multiplication is completed. Let the current pixel in the input pixel map M be P, then M (P) ═ a1B(P)A2Where M (P) represents a calculated pixel value corresponding to the pixel P, and b (P) represents a matrix formed by pixels adjacent to the pixel P. Wherein the B matrix corresponds to 16 neighboring pixels, A, of the current pixel P1And A2Can be obtained by a kernel function K () calculation in a cubic convolution operation. The matrix sizes are respectively: a. the1Is 1X 4, B is 4X 4, A2Is 4 × 1. Illustratively, the kernel function K () may be represented as:
Figure BDA0002496606400000091
when interpolating each pixel P of the result map by cubic convolution, it is checked whether 16 adjacent pixels in the B matrix exist in the effective boundary E set. If so, the boundary pixel values (color values) are directly copied to the result graph. Otherwise, performing interpolation operation by adopting a cubic convolution method, and calculating the current pixel value. Thus, step 204 can be finally expressed as:
Figure BDA0002496606400000101
step 205: and carrying out color combination on the pixels in the result graph M.
Due to the interpolation, some new color values may be introduced into the resulting map M. Assuming that the color list in the input map M is T, any new color C that is not in T and appears in the result map M may be merged, as shown in fig. 5, the merging process may include the following steps:
1) the new color C is converted into HSV color space for representation.
2) And calculating the color C' closest to the new color C in the color list T according to the Euclidean distance of the HSV.
3) The assignment C ═ C 'is made to merge the new color to its closest color C'.
Step 206: and obtaining a final result graph M as a scaling result of the original pixel graph.
Fig. 6 is an example of a pixel map used in an embodiment of the present invention, and as shown in fig. 6, the object in the pixel map is a remote controller for game. Fig. 7 is a result diagram obtained by amplifying the pixel map shown in fig. 6 by using Photoshop software, fig. 8 is a result diagram obtained by amplifying the pixel map shown in fig. 6 by using the pixel map scaling method according to an embodiment of the present invention, and comparing fig. 7 with fig. 8 with fig. 6, it can be seen that the remote control image in the pixel map amplified by using Photoshop software has the problems of structural disorder and color blur, while the remote control image in the pixel map amplified by using the method according to the embodiment of the present invention better retains the structure of the object in the pixel map, and the problem of color blur is also improved.
The embodiment provides a scaling method for a pixel map, which is a pixel map scaling method based on boundary and color preservation, and can solve the problems of resolution and color adaptation of the pixel map in different applications, and simultaneously ensure that the pixel map can still keep the integrity of structure and color after scaling.
In summary, the pixel map scaling method, the game content generation method, the electronic device and the computer-readable storage medium according to the embodiments of the present invention can prevent the confusion of the object structure and the color blur in the result map after the interpolation operation when scaling the pixel map, and do not need to redraw, which does not increase the cost.
In the description herein, reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," "an example," "a particular example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. The sequence of steps involved in the various embodiments is provided to schematically illustrate the practice of the invention, and the sequence of steps is not limited and can be suitably adjusted as desired.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A pixel map scaling method, comprising:
acquiring a pixel map, and traversing each pixel of the pixel map to obtain a boundary pixel set;
screening out an effective boundary set from the boundary pixel set;
if at least one adjacent pixel used for interpolation operation of one pixel in the pixel map exists in the effective boundary set, copying the color value of the pixel in the pixel map to the corresponding position in an interpolation operation result map; if all the adjacent pixels of one pixel in the pixel map for interpolation operation do not exist in the effective boundary set, performing interpolation operation by using all the adjacent pixels of the pixel in the pixel map for interpolation operation, calculating to obtain a color value corresponding to the pixel in the pixel map, and putting the calculated color value into a corresponding position in an interpolation operation result map;
if the interpolation operation result graph has a new color which does not exist in the pixel graph, searching the color which is closest to the new color in the pixel graph, and combining the new color in the interpolation operation result graph with the color which is closest to the new color and is found in the pixel graph;
and merging all new colors into corresponding colors in the pixel map, and outputting an interpolation operation result map serving as a scaling result of the pixel map.
2. The pixel map scaling method of claim 1, wherein traversing each pixel of the pixel map resulting in a set of boundary pixels comprises:
and traversing each pixel of the pixel map to obtain pixels with different color values of two adjacent pixels and the color value of the pixels, and using the pixels as boundary pixels to form a boundary pixel set.
3. The pixel map scaling method of claim 2, wherein the two adjacent pixels are left and right adjacent pixels.
4. The pixel map scaling method of claim 1, wherein screening the set of active boundaries from the set of boundary pixels comprises:
screening out all boundaries consisting of boundary pixels from the boundary pixel set;
and if the boundary formed by the boundary pixels in the boundary pixel set is a closed boundary and the length of the closed boundary exceeds a first set length threshold, or the boundary is a non-closed boundary and the length of the non-closed boundary exceeds a second set length threshold, or the color values of all the boundary pixels on the boundary are equal, generating an effective boundary set according to the boundary pixels forming the boundary.
5. The pixel map scaling method of claim 4, wherein screening all boundaries comprised of boundary pixels from the set of boundary pixels comprises:
and screening a group of boundary pixels connected in an eight-way neighborhood from the boundary pixel set to form a boundary.
6. The pixel map scaling method according to claim 1, wherein if all the neighboring pixels for interpolation operation of a pixel in the pixel map do not exist in the effective boundary set, performing interpolation operation by using all the neighboring pixels for interpolation operation of the pixel in the pixel map, calculating a color value corresponding to the pixel in the pixel map, and placing the calculated color value in a corresponding position in an interpolation operation result map, includes:
if the 16 adjacent pixels used for interpolation operation of one pixel in the pixel map do not exist in the effective boundary set, performing cubic convolution interpolation operation by using the 16 adjacent pixels used for interpolation operation of the pixel in the pixel map, calculating to obtain a color value corresponding to the pixel in the pixel map, and putting the calculated color value into a corresponding position in an interpolation operation result map.
7. The pixel map scaling method according to claim 1, wherein if there is a new color not stored in the pixel map in the interpolation operation result map, finding a color in the pixel map that is closest to the new color, and merging the new color in the interpolation operation result map with the color found in the pixel map that is closest to the new color, comprises:
if the new color which does not exist in the pixel map exists in the interpolation operation result map, converting the new color into an HSV color space to obtain an HSV value of the new color;
calculating the Euclidean distance of the HSV of the new color and the HSV of each color in the color list of the pixel map, and taking the color in the color list of the pixel map corresponding to the minimum Euclidean distance as the closest color of the new color;
and replacing the color value of the new color in the interpolation operation result graph with the color value of the nearest color of the new color, so as to merge the new color into the nearest color.
8. A game content generation method, comprising: scaling the pixel map using the method of any of claims 1 to 7.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 8 are implemented when the processor executes the program.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 8.
CN202010420062.3A 2020-05-18 2020-05-18 Pixel map scaling method, game content generation method and device Active CN111626935B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010420062.3A CN111626935B (en) 2020-05-18 2020-05-18 Pixel map scaling method, game content generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010420062.3A CN111626935B (en) 2020-05-18 2020-05-18 Pixel map scaling method, game content generation method and device

Publications (2)

Publication Number Publication Date
CN111626935A CN111626935A (en) 2020-09-04
CN111626935B true CN111626935B (en) 2021-01-15

Family

ID=72260617

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010420062.3A Active CN111626935B (en) 2020-05-18 2020-05-18 Pixel map scaling method, game content generation method and device

Country Status (1)

Country Link
CN (1) CN111626935B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101677106A (en) * 2008-09-17 2010-03-24 三星电子株式会社 Pixel cell, image sensor including a pixel cell, system having the same, and method of forming a pixel cell
CN101950242A (en) * 2010-09-19 2011-01-19 电子科技大学 Multiple viewpoint scene imaging scaling display control method
CN102105903A (en) * 2008-08-02 2011-06-22 万特里克斯公司 Method and system for predictive scaling of colour mapped images
CN104299185A (en) * 2014-09-26 2015-01-21 京东方科技集团股份有限公司 Image magnification method, image magnification device and display device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR950011530B1 (en) * 1992-09-25 1995-10-05 삼성전자주식회사 Digital zooming system
US5838840A (en) * 1996-08-29 1998-11-17 Bst/Pro Mark Inspection device using a field mode video camera with interpolation to replace missing pixels
CN100373912C (en) * 2006-07-10 2008-03-05 宁波大学 Quick double linear interpolating method in image amplification process
CN100596173C (en) * 2008-06-11 2010-03-24 四川虹微技术有限公司 Image zooming method and apparatus
JP2012080369A (en) * 2010-10-01 2012-04-19 Sony Corp Image processing apparatus and image processing method
JP5699633B2 (en) * 2011-01-28 2015-04-15 株式会社リコー Image processing apparatus, pixel interpolation method, and program
CN107330860A (en) * 2017-07-03 2017-11-07 山东财经大学 A kind of rational interpolation Zoom method based on CT image borders
CN110430403B (en) * 2019-07-25 2021-11-02 上海晰图信息科技有限公司 Image processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102105903A (en) * 2008-08-02 2011-06-22 万特里克斯公司 Method and system for predictive scaling of colour mapped images
CN101677106A (en) * 2008-09-17 2010-03-24 三星电子株式会社 Pixel cell, image sensor including a pixel cell, system having the same, and method of forming a pixel cell
CN101950242A (en) * 2010-09-19 2011-01-19 电子科技大学 Multiple viewpoint scene imaging scaling display control method
CN104299185A (en) * 2014-09-26 2015-01-21 京东方科技集团股份有限公司 Image magnification method, image magnification device and display device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王强."有理插值样条方法及其在数字图像处理中的应用研究".《中国博士学位论文全文数据库(电子期刊) 信息科技辑》.2007, *

Also Published As

Publication number Publication date
CN111626935A (en) 2020-09-04

Similar Documents

Publication Publication Date Title
US7149355B2 (en) Image processing apparatus, image processing method, image processing program, and computer-readable record medium storing image processing program
EP0650287B1 (en) Image processing method and apparatus
US9076234B2 (en) Super-resolution method and apparatus for video image
WO2018082185A1 (en) Image processing method and device
US8363985B2 (en) Image generation method and apparatus, program therefor, and storage medium which stores the program
US20070206025A1 (en) Image Processor and Method, Computer Program, and Recording Medium
JP2007527567A (en) Image sharpening with region edge sharpness correction
US11854157B2 (en) Edge-aware upscaling for improved screen content quality
CN115546027B (en) Image suture line determination method, device and storage medium
CN113506305B (en) Image enhancement method, semantic segmentation method and device for three-dimensional point cloud data
EP2966613A1 (en) Method and apparatus for generating a super-resolved image from an input image
Lukin et al. High-quality algorithm for Bayer pattern interpolation
JP4126541B2 (en) Image processing apparatus, image processing method, image processing program, and storage medium
CN112017113B (en) Image processing method and device, model training method and device, equipment and medium
CN111626935B (en) Pixel map scaling method, game content generation method and device
US8538163B2 (en) Method and system for detecting edges within an image
JP4756436B2 (en) Pattern recognition apparatus, pattern recognition method, and pattern recognition program
JP4857975B2 (en) Image processing system and image processing program
JPH07334648A (en) Method and device for processing image
KR20070119482A (en) Image resampling method
JP4265362B2 (en) Image processing device
JP3462957B2 (en) Image processing method
JP2006050481A (en) Image processing apparatus, image processing method and program thereof
JP3972625B2 (en) Image processing apparatus and image processing method
JP2001086368A (en) Image processor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant