Methods and systems for converting digital images to digital images
Patent Information
- Application Number
- TW113139385
- Authority / Receiving Office
- TW · TW
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2026-08-11
- Estimated Expiration
- 2044-10-15
AI Technical Summary
Traditional image processing techniques face high complexity, excessive storage size, poor transmission performance, and insufficient color consistency and detail preservation, especially in high-precision image conversion and reconstruction.
The method involves color grouping and block numbering, using RGBHS and LabHS color spaces to reduce data, simplify processing, and improve storage and transmission efficiency, while ensuring color accuracy and detail integrity through cluster analysis and contour extraction.
This approach reduces data volume, simplifies processing complexity, enhances storage efficiency, and improves transmission performance, ensuring accurate color and detail preservation in digital images.
Smart Images

Figure TWG2TB001905442_001 
Figure TWG2TB001905442_002 
Figure TWG2TB001905442_003
Abstract
Description
Technical Field
[0001] This invention relates to image processing technology, and in particular to a method and system for converting digital images into digital images. Prior Technology
[0002] Traditional technologies have the following main problems in digital image processing:
[0003] 1. High complexity in image processing:
[0004] In traditional image processing techniques, each pixel in an image usually needs to be processed independently, which makes the processing complex and computationally intensive. Especially when high-precision image conversion or reconstruction is required, the processing time is long and the resource consumption is high.
[0005] 2. Excessive storage size and poor transmission performance:
[0006] For high-resolution images, in addition to occupying a lot of storage space, the large file size increases transmission time and latency, especially in scenarios with limited network bandwidth or high data transmission requirements, resulting in slow image transmission speed.
[0007] 3. Insufficient color consistency and detail:
[0008] Traditional methods are prone to color blurring or mixing in color processing, especially when adjacent areas have similar colors, resulting in insufficient segmentation. Furthermore, they struggle to preserve detailed information in complex images, easily leading to information loss or detail distortion during reconstruction. Summary of the Invention
[0009] The main objective of this invention is to provide a method and system for converting digital images into digital images. By using color grouping and block numbering, the amount of data can be effectively reduced, the complexity of image processing can be simplified, and the storage efficiency and transmission performance of traditional images can be improved. It is particularly suitable for applications that require simplified processing and rapid reproduction.
[0010] Another objective of this invention is to provide a method and system for converting digital images into digital images, which can ensure the integrity of image details and the accuracy of color while processing image information, thereby improving the shortcomings of traditional image processing methods in terms of detail loss and color blurring.
[0011] Therefore, in order to achieve the above objectives, the method for converting a digital image to a digital image provided by the present invention involves acquiring a digital image, performing a color classification and grouping procedure on the colors of the digital image, obtaining the outline of the digital image, and classifying the colors of the digital image into color blocks of different colors; using the outline of the digital image as a range, assigning numbers to the corresponding positions of these color blocks, and assigning the same number to color blocks of the same color, thereby obtaining a digital image; wherein, the number is a number, a letter, or any combination thereof.
[0012] In one embodiment, the method for converting a digital image to a digital image further includes a data acquisition and conversion procedure, which includes:
[0013] An RGB color space is extracted from different coordinates (x, y) in the digital image. Each RGB color space includes a red channel (R), a green channel (G), and a blue channel (B).
[0014] Each RGB color space data is converted into an HSV color space data, and a chroma channel (H) and a saturation channel (S) are extracted from each HSV color space data. These are then combined with the red channel (R), green channel (G), and blue channel (B) to form a five-dimensional RGBHS color space.
[0015] Next, the data of each channel in the five-dimensional color space of RGBHS is reduced to one-dimensional array data.
[0016] In one embodiment, the color classification and grouping procedure is based on a preset number of colors (K) and uses a cluster classification method to divide the colors into K color groups.
[0017] In one embodiment, the color classification and grouping procedure further includes:
[0018] Each of the one-dimensional array data is converted into a LabHS color space data, each LabHS color space data including a luminance (L), a green-red component (a), a blue-yellow component (b), a chroma channel (H), and a saturation channel (S);
[0019] Based on the LabHS color space data, the color representative value (C) for each coordinate (x, y) is calculated using the following formula: C = L* + a* + b* + H + S; where L*, a*, and b* are the values of the luminance (L), the green-red component (a), and the blue-yellow component (b) after being shifted and positively valued, respectively.
[0020] Calculate and sort the representative values of these colors (C);
[0021] K coordinates (x, y) with higher statistical values of the color representative value (C) are selected, and the Lab values of these coordinates (x, y) are used as cluster centers; the Lab values include the brightness (L), the green-red component (a), and the blue-yellow component (b);
[0022] Cluster analysis is performed on the Lab values of all coordinates (x, y) with the cluster centers. After iterative convergence, the L'a'b' values of a convergent cluster center are obtained.
[0023] Replace the Lab values in the same color group with the L'a'b' values of the convergent cluster center;
[0024] Then convert the L'a'b' value into an R'G'B' value and send it back.
[0025] In one embodiment, the iterative convergence operation is as follows: Step A: Calculate the distance from the Lab value of each coordinate (x,y) to different cluster centers, and assign the Lab value of each coordinate (x,y) to the cluster center corresponding to the nearest cluster center; Step B: Calculate the average distance between the Lab values of the coordinates (x,y) contained in the cluster, and update the cluster center with the average value; Step C: Repeat steps A and B until the cluster center no longer changes, thereby obtaining the converged cluster center.
[0026] In one embodiment, the method for converting a digital image to a digital image further includes a fill-in-the-original-color-points procedure, in which each of the R'G'B' values replaces an initial color value (R,G,B) at each coordinate position (x,y) to obtain an image image having K colors.
[0027] In one embodiment, the method for converting a digital image to a digital image further includes a grayscale processing procedure to convert the image into grayscale and obtain K grayscale layers according to the color groups.
[0028] In one embodiment, the method for converting a digital image to a digital image further includes a contour extraction procedure, which extracts contours from each grayscale layer, labels the extracted contours from the same grayscale layer with corresponding numbers, and obtains a contour image for each.
[0029] In one embodiment, the method for converting a digital image into a digital image further includes a layer integration process that integrates the grayscale layers to obtain a digital image containing the outlines and the numbers.
[0030] Furthermore, the present invention also provides a system for performing the aforementioned method, which is capable of coloring the digital image based on each of the numbers. Simple Explanation of the Diagram
[0031] Figure 1 is a flowchart of the program operation of the present invention. Figure 2 is a flowchart of the contour extraction process of the present invention. Figure 3 is a flowchart illustrating the usage of the present invention. Implementation
[0032] This invention discloses a method and system for converting digital images into digital images. It can effectively reduce the amount of data and simplify the complexity of image processing by using color grouping and block numbering. It also improves the storage efficiency and transmission performance of traditional images. It is particularly suitable for applications that require simplified processing and rapid reproduction. The details are described below.
[0033] The term "k-means" can be broken down into five main steps: 1. Determine the value of k. 2. Randomly assign K centroids. 3. Calculate the distance between each sample and each centroid, and assign the sample to the nearest centroid. 4. Create a new centroid by averaging all samples assigned to each previous centroid. 5. Repeat steps 3 and 4 above until the centroids no longer change significantly.
[0034] The main difference between the term "k-means++" and k-means is that the first centroid is randomly selected, and then the remaining centroids are determined based on the probability of the data distribution.
[0035] The method disclosed in this invention differs from k-means and k-means++ in that the determination of the center points is not random. Simply put, this invention, for digital images, calculates the color representative value (C) for each coordinate (x, y) based on color space data. Then, these color representative values (C) are statistically analyzed and sorted, and the K color representative values (C) with the highest statistical values are selected to obtain K cluster centers.
[0036] Please refer to Figure 1. The method for converting a digital image into a digital image according to the present invention involves acquiring a digital image, performing a color classification and grouping procedure P2 on the colors of the digital image, obtaining the outline of the digital image, and classifying the colors of the digital image into color blocks of different colors; using the outline of the digital image as a range, assigning numbers to the corresponding positions of these color blocks, and assigning the same number to color blocks of the same color, thereby obtaining a digital image; wherein, the number is a number, a letter, or any combination thereof.
[0037] Specifically, the method for converting a digital image to a digital image further includes a data acquisition and conversion program P1, a program to fill in the original color points P3, a grayscale processing program P4, a contour extraction program P5, and a layer integration program P6.
[0038] The data extraction and conversion program P1 includes:
[0039] Step 101: Extract an RGB color space from different coordinates (x, y) in the digital image. Each RGB color space includes a red channel (R), a green channel (G), and a blue channel (B).
[0040] Step 102: Convert each RGB color space data into an HSV color space data, and extract a chroma channel (H) and a saturation channel (S) from each HSV color space data. Then combine them with the red channel (R), green channel (G), and blue channel (B) to form a five-dimensional color space of RGBHS.
[0041] Step 103: Next, reduce the dimensionality of each channel data in the five-dimensional color space of RGBHS to one-dimensional array data.
[0042] For example, according to steps 101 to 103 above, if a 5x5 color image is to be converted into a one-dimensional data structure, the step-by-step conversion method is as follows:
[0043] First, take a 5x5 RGB image, i.e., image[R][G][B]. Then calculate H and S to make it image[R][G][B][H][S], where:
[0044] R,G,B = Red, Green, Blue (Red channel, Green channel, Blue channel)
[0045] H,S = Hue, Saturation (chroma channel, saturation channel)
[0046] Next, each channel is flattened out, and then these channels are combined in sequence to form a continuous one-dimensional array of data.
[0047] In other words, for a 5x5 RGBHS image, the flattening process is as follows:
[0048] 1. Red Channel (R): Flatten the 5x5 array of the red channel.
[0049] 2. Green Channel (G): Flatten the 5x5 array of green channels.
[0050] 3. Blue Channel (B): Flatten the 5x5 array of the blue channel.
[0051] 4. Chroma Channel (H): A 5x5 array of flattened chroma channels.
[0052] 5. Saturation Channel (S): A 5x5 array of flattened saturation channels.
[0053] Each channel contains 5×5=25 elements. Since there are 5 channels, the total size of the flattened one-dimensional array will be 25×5=125 elements.
[0054] Examples of flattened surfaces are shown in the table below: Original 5x5 image One-dimensional array after flattening R = [ [R11, R12, R13, R14, R15] , [R21, R22, R23, R24, R25] , [R31, R32, R33, R34, R35] , [R41, R42, R43, R44, R45] , [R51, R52, R53, R54, R55] ] G = [ [G11, G12, G13, G14, G15] , [G21, G22, G23, G24, G25] , [G31, G32, G33, G34, G35] , [G41, G42, G43, G44, G45] , [G51, G52, G53, G54, G55] ] B = [ [B11, B12, B13, B14, B15] , [B21, B22, B23, B24, B25] , [B31, B32, B33, B34, B35] , [B41, B42, B43, B44, B45] , [B51, B52, B53, B54, B55] ] H = [ [H11, H12, H13, H14, H15] , [H21, H22, H23, H24, H25] , [H31, H32, H33, H34, H35] , [H41, H42, H43, H44, H45] , [H51, H52, H53, H54, H55] ] S = [ [S11, S12, S13, S14, S15] , [S21, S22, S23, S24, S25] , [S31, S32, S33, S34, S35] , [S41, S42, S43, S44, S45] , [S51, S52, S53, S54, S55] Flattened = [R11, G11, B11, H11, S11 ..., S15, R21, G21, B21, H21, S21, ..., S45, R51, G51, B51, H51, S51, ..., S55]
[0055] The color classification and grouping program P2 is based on a preset number of colors (K) and uses a cluster classification method to divide the colors into K color groups.
[0056] Furthermore, the color classification and grouping program P2 also includes:
[0057] Step 201: Convert each of the one-dimensional array data into a LabHS color space data, each LabHS color space data including a luminance (L), a green-red component (a), a blue-yellow component (b), a chroma channel (H), and a saturation channel (S);
[0058] Step 202: Calculate the color representative value (C) for each coordinate (x, y) based on the LabHS color space data. The calculation formula is: C = L* + a* + b* + H + S; where L*, a*, and b* are the positive-shifted values of the luminance (L), the green-red component (a), and the blue-yellow component (b), respectively.
[0059] Step 203: Count and sort the representative values of these colors (C);
[0060] Step 204: Select the K coordinates (x, y) with the highest statistical values of the color representative value (C), and use the Lab values of these coordinates (x, y) as the cluster centers; the Lab values include the brightness (L), the green-red component (a), and the blue-yellow component (b);
[0061] Step 205: Perform cluster analysis on the Lab values of all coordinates (x, y) with the cluster centers. After iterative convergence, obtain the L'a'b' value of a convergent cluster center.
[0062] Step 206: Replace the Lab values in the same color group with the L'a'b' values of the convergent cluster center;
[0063] Step 207: Then convert the L'a'b' value into an R'G'B' value and send it back.
[0064] In step 205, steps A to C follow the iterative convergence process:
[0065] Step A: Assign data points to the nearest cluster center. Specifically, for each data point, calculate its distance to all cluster centers (usually using Euclidean distance), and then assign the data point to the cluster corresponding to the nearest cluster center. Here, a data point refers to the Lab value of all coordinates (x, y) from step 201.
[0066] Step B: Update the cluster center. Specifically, for each cluster, calculate the average distance (centroid) of all data points in that cluster, and update the cluster center to this average.
[0067] Step C: Repeat steps A and B. In detail, continuously repeat steps A and B until the cluster center no longer changes (i.e., convergence is achieved) or the preset number of iterations is reached, thereby obtaining the converged cluster center.
[0068] The original color point filling procedure P3 replaces the initial color value (R,G,B) at each coordinate position (x,y) with each of the R'G'B' values to obtain an image map, which has K colors.
[0069] The grayscale processing program P4 converts the image into grayscale and obtains K grayscale layers according to the color groups.
[0070] The contour extraction program P5 extracts contours from each grayscale layer separately, and labels the extracted contours from the same grayscale layer with corresponding numbers, thus obtaining a contour image for each.
[0071] In other words, as shown in Figure 2, a further example implementation is provided, where K is 8, representing 8 colors, and the following steps are performed:
[0072] Step 301 (marked as S301 in Figure 2): Extract the image of the same color individually, convert it to grayscale, and obtain K grayscale layers respectively.
[0073] Step 302 (marked as S302 in Figure 2): Magnify each grayscale layer by 20 times to facilitate boundary comparison. Continue to compare the boundaries to obtain the coordinate set of the boundary contour.
[0074] Step 303 (marked as S303 in Figure 2): Draw the coordinate set into an image and mark the area with color numbers to obtain a contour map with the same color number.
[0075] Step 304 (marked as S304 in Figure 2): Repeat steps 301 to 303 above until all colors have been completed, and you will get the outline of all colors.
[0076] The P6 layer blending program combines these grayscale layers to obtain a digital image containing the outlines and numbers. In other words, after obtaining the outline of each color number, each layer is sequentially blended (Image Composition or Multilayer Composition), like two slides superimposed. Normally, each layer will not overlap the outline area of the others, so the final blending will form a single outline of all color numbers. For example, the steps are as follows:
[0077] Step 401: Obtain the coordinates and numbers of all contours within the second contour drawing.
[0078] Step 402: Fill all the coordinate grayscale values into the first contour map to form a contour fusion map.
[0079] Step 403: Repeat steps 401 and 402 for the remaining layers to obtain a contour map where all layers are merged.
[0080] Step 404: Finally, adjust this outline to the resolution of any desired print size. For example, for an A4 image, 297mm in length (approximately 11.6 inches), if printed at 600dpi, the required length is 600 x 11.6 = 6960 pixels; the width follows the same principle, resulting in a high-resolution outline.
[0081] Furthermore, as shown in Figure 1, the method for converting a digital image to a digital image further includes a CMYK coloring program P7, which follows the color classification and grouping program P2, converting each color group into a CMYK color space. Each CMYK color space includes a cyan channel (C), a magenta channel (M), a yellow channel (Y), and a black channel (K). Moreover, the colors in this CMYK color space are used as the basis for color matching, serving as the foundation for the painter's coloring pigments.
[0082] In summary, the specific usage process of this invention provides a system for performing a method of converting a digital image into a digital image. As shown in Figure 3, the system allows the user to input the digital image and select the preset number of colors (K). After processing, the user can color the digital image based on each of the preset numbers, and finally adjust the size of the output image to obtain the final image.
[0083] In simple terms, the system includes at least a computing module and a database. The computing module can be, but is not limited to, a Central Processing Unit (CPU), or other programmable general-purpose or special-purpose microprocessors, digital signal processors (DSPs), programmable controllers, application-specific integrated circuits (ASICs), or other similar components or combinations thereof. The database can be stored on a specific medium such as phase-change memory (PRAM), static random-access memory (SRAM), dynamic random-access memory (DRAM), flash memory disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, to store the aforementioned data or the computation results of the computing module. Other detailed features of the system are prior art and will not be described further.
[0084] In summary, although the present invention has been disclosed above with reference to embodiments, it is not intended to limit the invention. Those skilled in the art can make various modifications and refinements without departing from the spirit and scope of the invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
[0085] P1: Data Acquisition and Conversion Program P2: Color Classification and Grouping Program P3: Fill in the original color point procedure P4: Grayscale processing procedure P5: Contour Extraction Procedure P6: Layer Integration Program P7: CMYK Coloring Procedure 301 S301: Procedure 302 S302: Procedure 304 S303: Procedure 304 S304: Steps
Claims
1. A method for converting a digital image into a digital image, comprising: A digital image is acquired, and an RGB color space is extracted from different coordinates (x, y) of the digital image. Each RGB color space includes a red channel (R), a green channel (G), and a blue channel (B). Each RGB color space data is then converted into an HSV color space data, and a chroma channel (H) and a saturation channel (S) are extracted from each HSV color space data. These are then combined with the red channel (R), green channel (G), and blue channel (B) to form a five-dimensional RGBHS color space. Next, the channel data in this five-dimensional RGBHS color space is reduced to a one-dimensional array data. Based on this, a color classification and grouping procedure is performed on the colors of the digital image, and the outline of the digital image is obtained, thereby distinguishing the colors of the digital image into different color blocks. Using the outline of the digital image as a range, numbers are assigned to the corresponding positions of the color blocks, and color blocks of the same color are assigned the same number, thereby obtaining a digital image; wherein the number is a number, a letter, or any combination thereof.
2. The method for converting a digital image to a digital image as described in claim 1, wherein, This color classification and grouping program is based on a preset number of colors (K) and uses a clustering method to divide the colors into K color groups.
3. The method for converting a digital image to a digital image as described in claim 2, wherein, The color classification and grouping procedure further includes: converting each one-dimensional array data into LabHS color space data, each LabHS color space data including a luminance (L), a green-red component (a), a blue-yellow component (b), a chroma channel (H), and a saturation channel (S); calculating the color representative value (C) of each coordinate (x, y) based on each LabHS color space data, the calculation formula is: C = L* + a* + b* + H + S; where L*, a*, and b* are the positive-shifted values of the luminance (L), the green-red component (a), and the blue-yellow component (b), respectively; statistically analyzing and sorting these color representative values (C); selecting the K coordinates (x, y) with the highest statistical values of the color representative values (C), and using the Lab values of these coordinates (x, y) as a cluster center; the Lab value includes the luminance (L), the green-red component (a), and the blue-yellow component (b); and calculating the Lab values of all coordinates (x, y). Cluster analysis is performed on the values and cluster centers. After iterative convergence, a convergent cluster center L'a'b' value is obtained. The Lab values in the same color group are replaced with the convergent cluster center L'a'b' value. Then, the L'a'b' value is converted into an R'G'B' value and sent back.
4. The method for converting a digital image to a digital image as described in claim 3, wherein, The iterative convergence process is as follows: Step A: Calculate the distance from the Lab value of each coordinate (x,y) to different cluster centers, and assign the Lab value of each coordinate (x,y) to the cluster center corresponding to the nearest cluster center; Step B: Calculate the average distance between the Lab values of the coordinates (x,y) contained in the cluster, and update the cluster center with the average value; Step C: Repeat steps A and B until the cluster center no longer changes, thus obtaining the converged cluster center.
5. The method for converting a digital image to a digital image as described in claim 3, further comprising a fill-in original color point procedure, replacing an initial color value (R,G,B) at each coordinate position (x,y) with each of the R'G'B' values respectively, to obtain an image image having K colors.
6. The method for converting a digital image to a digital image as described in claim 5, further comprising a grayscale processing procedure for converting the image to grayscale and obtaining K grayscale layers according to the color groups.
7. The method for converting a digital image to a digital image as described in claim 6, further comprising a contour extraction procedure, performing contour extraction on each of the grayscale layers, labeling the extracted contours on the same grayscale layer with corresponding numbers, and obtaining a contour image for each.
8. The method for converting a digital image to a digital image as described in claim 7, comprising a layer integration procedure that integrates the grayscale layers to obtain a digital image containing the outlines and the numbers.
9. A system for performing the method of any one of claims 1 to 8, including coloring the digital image based on each of the numbers.
Citation Information
Patent Citations
Image compression method and device based on combination of user interaction and semantic segmentation technology
CN111953989A
Image compression coding method, device and electronic equipment
CN113747167A
Image compression method and device, and moving image encoding method
TW200810565A
Systems and methods for encoding an image
US20240259585A1