Method and system for obtaining the color of a magic cube by camera recognition

The method of obtaining the color of the Rubik's cube through camera recognition, using image and outline identification algorithm to accurately divide the color representation area, solve the error problems that the programming robots are prone to identify the task, and improve the accuracy and the authority of the system.

CN118968094BActive Publication Date: 2025-01-24GUANGZHOU JOINMAX DIGITAL TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411433352.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-01-24
Estimated Expiration
2044-10-15

AI Technical Summary

Technical Problem

Existing programming robots are susceptible to environmental influences in recognition tasks, resulting in recognition errors, resulting in task failure and user loss of trust, and users may mistakenly think that they are programming errors, wasting time.

Method used

The method of obtaining the color of the Rubik's Cube through camera recognition, including receiving the information waiting to be identified for image pre -processing, use image recognition algorithm and outline identification algorithm to accurately divide the color representation area of ​​the Rubik's cube, extract color feature parameters to determine the color value.

Benefits of technology

It significantly improves the accuracy of Rubik's Cube color recognition, improves the authority of the system, reduces manual intervention, and achieves efficient color recognition and automated processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118968094B_ABST
    Figure CN118968094B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention relates to the field of programming robot technology, and discloses a method for obtaining the color of a Rubik's Cube by using a camera, including: receiving the image information to be recognized obtained by a camera module configured by a user, and performing image preprocessing operations on the image information to be recognized; performing image recognition on the image information to be recognized after the image preprocessing operation according to an image recognition algorithm to determine the Rubik's Cube recognition area in the corresponding image information to be recognized; recognizing the Rubik's Cube recognition area according to a contour recognition algorithm to obtain a color representation area, and the color representation area is the corresponding square area in the nine-square grid of each face of the Rubik's Cube; extracting the color feature parameters in each of the color representation areas obtained to determine the color value corresponding to each color representation area. The solution of the embodiment of the present invention can improve the accuracy of Rubik's Cube color recognition and enhance the authority of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of programming robots, and in particular to a method and system for obtaining the color of a magic cube by camera recognition. Background Art

[0002] For existing programming robots, there will be various tasks assigned to users during the entire programming process. However, in the process of implementing some tasks, due to the influence of the environment, recognition errors may occur, which eventually lead to task failure. This will cause users to feel frustrated and distrustful of system recognition to a certain extent, and thus will have an adverse impact on the promotion of corresponding software products. In addition, the recognition error here will also cause the corresponding user to think that he has made a programming error, thereby wasting more of the user's precious time. Therefore, designing a solution that can improve recognition accuracy has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention

[0003] In view of the above defects, an embodiment of the present invention discloses a method for obtaining the color of a Rubik's Cube by using a camera, which can improve the accuracy of Rubik's Cube color recognition and enhance the authority of system use.

[0004] A first aspect of an embodiment of the present invention discloses a method for obtaining the color of a Rubik's Cube by using a camera, comprising:

[0005] Receiving the image information to be recognized obtained by the camera module configured by the user, and performing image preprocessing operation on the image information to be recognized;

[0006] Performing image recognition on the image information to be recognized after image preprocessing according to an image recognition algorithm to determine a magic cube recognition area in the corresponding image information to be recognized;

[0007] Identify the Rubik's Cube identification area according to the contour recognition algorithm to obtain a color representation area, wherein the color representation area is a corresponding square area in the nine-square grid on each side of the Rubik's Cube;

[0008] The color characteristic parameters in each of the acquired color representation areas are extracted to determine the color value corresponding to each color representation area.

[0009] As an optional implementation manner, in the first aspect of the embodiment of the present invention, before acquiring the corresponding image information to be recognized through the camera module configured by the user, the method further includes:

[0010] Receive the task processing logic configured by the user, and parse the task processing logic to determine the corresponding Rubik's Cube color recognition process;

[0011] The image recognition algorithm includes a convolutional neural network or a threshold recognition algorithm.

[0012] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after performing image recognition on the to-be-recognized screen information that has undergone image preprocessing operation according to the image recognition algorithm to determine the Rubik's Cube recognition area in the corresponding to-be-recognized screen information, the method further includes:

[0013] receiving a first structure kernel element selected by a user, wherein the first structure kernel element defines a domain size and a shape of a first image operation; the first structure kernel element is a square kernel element;

[0014] Align the center point of the first structure core element with the corresponding foreground pixel point in the Rubik's Cube recognition area, and detect the color values ​​of all elements covered by the first structure core element to determine the pixel point values ​​corresponding to the elements that meet the set requirements;

[0015] Performing a value update operation on the corresponding foreground pixel points in the Rubik's Cube recognition area according to the pixel point values ​​corresponding to the elements meeting the set requirements, repeating the above steps until all foreground pixel points in the Rubik's Cube recognition area are processed to obtain the corresponding first color recognition image;

[0016] The step of identifying the magic cube recognition area according to the contour recognition algorithm to obtain the color representation area includes:

[0017] Each square area in the first color recognition image is recognized according to a contour recognition algorithm to obtain a color representation area.

[0018] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after performing image recognition on the to-be-recognized screen information that has undergone image preprocessing operation according to the image recognition algorithm to determine the Rubik's Cube recognition area in the corresponding to-be-recognized screen information, the method further includes:

[0019] receiving a second structure kernel element selected by a user, wherein the second structure kernel element defines a size and a shape of a domain of a second image operation; the second structure kernel element is a square kernel element;

[0020] Align the center point of the second structure core element with the corresponding foreground pixel point in the Rubik's Cube recognition area, and detect the color values ​​of all elements covered by the structure core element to determine the pixel point values ​​corresponding to the elements that meet the set requirements;

[0021] Performing a value update operation on the corresponding foreground pixel points in the Rubik's Cube recognition area according to the pixel point values ​​corresponding to the elements meeting the set requirements, repeating the above steps until all foreground pixel points in the Rubik's Cube recognition area are processed to obtain the corresponding second color recognition image;

[0022] The step of identifying the magic cube recognition area according to the contour recognition algorithm to obtain the color representation area includes:

[0023] Each square area in the second color recognition image is recognized according to a contour recognition algorithm to obtain a color representation area.

[0024] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after receiving the to-be-recognized picture information acquired based on the camera module configured by the user, the method further includes:

[0025] Obtain the number of online users currently programmed, and match the number of online users with a set personnel number-compression parameter mapping table to determine the current image compression parameter;

[0026] Performing image compression processing on the corresponding picture information to be identified according to the current image compression parameter to obtain compressed image information;

[0027] The image information to be identified is subjected to image preprocessing operations, including:

[0028] An image preprocessing operation is performed on the compressed image information.

[0029] As an optional implementation manner, in the first aspect of the embodiment of the present invention, before obtaining the number of online users of the current programming user, the method further includes:

[0030] Receiving programming competition information, and parsing the programming competition information to determine the estimated number of participants in each time period and the image quality requirements of the corresponding competition;

[0031] The obtaining the number of online users of the current programming user, and matching the number of online users with a set personnel number-compression parameter mapping table to determine the current image compression parameter, includes:

[0032] Obtain the number of online users of the current programming in the corresponding period, and update the total number of users in the corresponding period according to the number of online users of the current programming and the estimated number of players in the corresponding period;

[0033] According to the total number of users in the corresponding time period, the current image compression parameters are matched with the set number of users-compression parameter mapping table to determine the current image compression parameters, wherein the current image compression parameters include image compression rate and image quality, and the image compression rate and image quality correspond to each other;

[0034] If the image quality is not lower than the image quality requirement of the corresponding game, the image compression rate associated with the image quality is determined as the final image compression rate; if the image quality is lower than the image quality requirement of the corresponding game, the image compression rate associated with the image quality requirement is determined as the final image compression rate.

[0035] As an optional implementation, in the first aspect of the embodiment of the present invention, a shading structure is built around the camera module, and the shading structure is built by building blocks; the camera module is configured to turn off the automatic white balance function and reduce the picture brightness;

[0036] The extracting the acquired color characteristic parameters in each of the color representation areas to determine the color value corresponding to each of the color representation areas includes:

[0037] Convert the extracted color representation area into color feature parameters;

[0038] Calculate the average color value of each color representation area, and use the average color value as the color feature data of the corresponding color representation area;

[0039] The color distance formula is used to calculate the similarity between the color feature data in the color representation area and the predefined color, and the predefined color with the highest similarity is selected as the recognition result.

[0040] A second aspect of an embodiment of the present invention discloses a system for obtaining the color of a Rubik's Cube by using a camera, comprising:

[0041] Acquisition module: used to receive the image information to be recognized obtained by the camera module configured by the user, and perform image preprocessing operation on the image information to be recognized;

[0042] Image recognition module: used for performing image recognition on the to-be-recognized picture information after image preprocessing operation according to an image recognition algorithm to determine the magic cube recognition area in the corresponding to-be-recognized picture information;

[0043] Region recognition module: used to recognize the Rubik's Cube recognition region according to the contour recognition algorithm to obtain a color representation region, wherein the color representation region is a corresponding square region in the nine-square grid on each side of the Rubik's Cube;

[0044] Color extraction module: used for extracting the color characteristic parameters in each of the acquired color representation areas to determine the color value corresponding to each color representation area.

[0045] A third aspect of an embodiment of the present invention discloses an electronic device, comprising: a memory storing executable program code; a processor coupled to the memory; the processor calls the executable program code stored in the memory to execute the method for obtaining the color of a Rubik's Cube by using a camera disclosed in the first aspect of the embodiment of the present invention.

[0046] A fourth aspect of an embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the method for obtaining the color of a Rubik's Cube by using a camera disclosed in the first aspect of an embodiment of the present invention.

[0047] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0048] The method for obtaining the color of the Rubik's Cube by using a camera in the embodiment of the present invention can significantly improve the image quality through image preprocessing operations, providing a clearer and more accurate image basis for subsequent color recognition. At the same time, the image recognition algorithm and the contour recognition algorithm are used to accurately divide the color representation area of ​​each face of the Rubik's Cube, ensuring the accuracy of color recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 It is a flowchart of a method for obtaining the color of a Rubik's Cube by using a camera according to an embodiment of the present invention;

[0051] Figure 2 is a schematic diagram of a process for performing a first image processing disclosed in an embodiment of the present invention;

[0052] Figure 3 is a schematic diagram of the compression matching process disclosed in an embodiment of the present invention;

[0053] Figure 4 is a schematic diagram of a process of compression quality matching disclosed in an embodiment of the present invention;

[0054] Figure 5 It is a structural diagram of a system for obtaining the color of a Rubik's Cube by using a camera, provided in an embodiment of the present invention;

[0055] Figure 6 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] It should be noted that the terms "first", "second", "third", "fourth", etc. in the specification and claims of the present invention are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having" in the embodiments of the present invention and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0058] For existing programming robots, there will be various tasks assigned to users to implement during the entire programming implementation process. However, in the implementation process of some tasks, due to the influence of the environment, recognition errors occur, which eventually lead to task failure. This will cause users to feel frustrated and distrustful of system recognition to a certain extent, and thus will have an adverse impact on the promotion of corresponding software products. And the recognition error here will also cause an impact that makes the corresponding user think that he has programmed incorrectly, thereby wasting more of the user's precious time. Based on this, the embodiment of the present invention discloses a method, system, electronic device and storage medium for obtaining the color of the Rubik's Cube by camera recognition. Through image preprocessing operations, it can significantly improve the image quality and provide a clearer and more accurate image basis for subsequent color recognition. At the same time, the image recognition algorithm and the contour recognition algorithm are used to accurately divide the color representation area of ​​each face of the Rubik's Cube to ensure the accuracy of color recognition.

[0059] Embodiment 1

[0060] See also Figure 1 , Figure 1It is a flow chart of the method for obtaining the color of the Rubik's Cube by camera recognition disclosed in the embodiment of the present invention. Among them, the execution subject of the method described in the embodiment of the present invention is an execution subject composed of software and / or hardware, and the execution subject can receive relevant information by wired or / and wireless means, and can send certain instructions. Of course, it can also have certain processing functions and storage functions. The execution subject can control multiple devices, such as a remote physical server or cloud server and related software, or it can be a local host or server and related software that performs related operations on a device placed somewhere. In some scenarios, multiple storage devices can also be controlled, and the storage devices can be placed in the same place or different places as the devices. For example Figure 1 As shown, the method for obtaining the color of the Rubik's Cube based on camera recognition includes the following steps:

[0061] S101: receiving image information to be recognized obtained by a camera module configured by a user, and performing image preprocessing operations on the image information to be recognized;

[0062] S102: performing image recognition on the image information to be recognized that has undergone image preprocessing according to an image recognition algorithm to determine a Rubik's Cube recognition area in the corresponding image information to be recognized;

[0063] S103: Identify the Rubik's Cube identification area according to a contour recognition algorithm to obtain a color representation area, where the color representation area is a corresponding square area in the nine-square grid on each side of the Rubik's Cube;

[0064] S104: extracting the acquired color characteristic parameters in each of the color representation areas to determine the color value corresponding to each of the color representation areas.

[0065] This method automatically captures the Rubik's Cube image through a camera, and uses image processing and recognition algorithms to quickly locate the position of the Rubik's Cube in the picture and the colors of its faces, greatly improving the automation and efficiency of color recognition and reducing the need for human intervention.

[0066] Image preprocessing operations (such as denoising, contrast enhancement, etc.) can significantly improve image quality, providing a clearer and more accurate image basis for subsequent color recognition. At the same time, the image recognition algorithm and contour recognition algorithm are used to accurately divide the color representation area of ​​each face of the Rubik's Cube, ensuring the accuracy of color recognition. Since the entire recognition process including image capture, preprocessing, recognition and color extraction are completed automatically, high real-time performance can be achieved. This is especially important for application scenarios that require fast response (such as automatic timing and scoring systems in Rubik's Cube competitions).

[0067] The method is based on an algorithm, so its application scope and performance can be easily expanded by optimizing the algorithm or adding new functions. For example, the algorithm can be further developed to identify the specific rotation state or solution state of the Rubik's Cube.

[0068] More preferably, before acquiring the corresponding image information to be recognized through the camera module configured by the user, the method further includes:

[0069] Receive the task processing logic configured by the user, and parse the task processing logic to determine the corresponding Rubik's Cube color recognition process;

[0070] By receiving the task processing logic configured by the user and parsing it to determine the Rubik's Cube color recognition process, the system can perform highly customized operations based on the specific needs of the user. This flexibility enables the system to adapt to more diverse application scenarios and user needs, and enrich the overall recognition task settings. And when performing specific implementations, you only need to pay attention to the task processing logic configured by the user. You can analyze the above task processing logic to determine whether the user can complete the corresponding task logic configuration, and combine it with the final recognition result for scoring.

[0071] The image recognition algorithm includes a convolutional neural network or a threshold recognition algorithm. Clarifying that the image recognition algorithm is a convolutional neural network or a threshold recognition algorithm provides a more specific implementation path for the system. Convolutional neural networks have significant advantages in processing complex images and recognizing high-precision colors due to their powerful feature extraction and classification capabilities; while threshold recognition algorithms are more applicable in scenarios with high real-time requirements due to their simple calculations and high efficiency. Selecting the appropriate algorithm according to the specific application scenario can further improve the performance and accuracy of the system.

[0072] More preferably, Figure 2 As shown, after performing image recognition on the to-be-recognized picture information that has undergone image preprocessing operation according to the image recognition algorithm to determine the magic cube recognition area in the corresponding to-be-recognized picture information, it also includes:

[0073] S1021: receiving a first structure kernel element selected by a user, where the first structure kernel element defines a domain size and shape of a first image operation; the first structure kernel element is a square kernel element;

[0074] S1022: aligning the center point of the first structure core element with the corresponding foreground pixel point in the Rubik's Cube recognition area, and detecting the color values ​​of all elements covered by the first structure core element to determine the pixel point values ​​corresponding to the elements that meet the set requirements;

[0075] S1023: performing a value update operation on the corresponding foreground pixel points in the Rubik's Cube recognition area according to the pixel point values ​​corresponding to the elements meeting the set requirements, and repeating the above steps until all foreground pixel points in the Rubik's Cube recognition area are processed to obtain the corresponding first color recognition image;

[0076] The step of identifying the magic cube recognition area according to the contour recognition algorithm to obtain the color representation area includes:

[0077] Each square area in the first color recognition image is recognized according to a contour recognition algorithm to obtain a color representation area.

[0078] The present invention selects a square kernel element as the first structural kernel element and detects and processes the color value within the defined area, which can effectively enhance the image details in the magic cube recognition area and suppress unnecessary noise. This processing method helps to improve the accuracy and reliability of subsequent color recognition.

[0079] The application of square kernel elements helps to better preserve and highlight the shape and boundary information in the Rubik's Cube recognition area. In the process of color recognition, clear shapes and boundaries are crucial for accurately identifying the color and position of each face of the Rubik's Cube.

[0080] By detecting the color values ​​of all elements covered by the first structural core element and updating the values ​​of only the elements that meet the set requirements, the colors in the cube recognition area can be made more consistent and uniform. This is very helpful for improving the accuracy of color recognition and subsequent color classification and matching.

[0081] Although this step adds an extra processing flow, the complexity and time cost of global calculation can be reduced to a certain extent by using the structural kernel elements for local processing. In addition, since the structural kernel elements are pre-defined, they can be quickly and efficiently applied to the Rubik's Cube recognition area in practical applications.

[0082] Allowing users to select the first structural core element not only increases the flexibility of the system, but also improves user participation and satisfaction. Users can adjust the size and shape of the structural core element according to their needs and preferences to obtain the best recognition effect.

[0083] More preferably, after performing image recognition on the to-be-recognized picture information that has undergone image preprocessing operation according to the image recognition algorithm to determine the magic cube recognition area in the corresponding to-be-recognized picture information, the method further includes:

[0084] receiving a second structure kernel element selected by a user, wherein the second structure kernel element defines a size and a shape of a domain of a second image operation; the second structure kernel element is a square kernel element;

[0085] Align the center point of the second structure core element with the corresponding foreground pixel point in the Rubik's Cube recognition area, and detect the color values ​​of all elements covered by the structure core element to determine the pixel point values ​​corresponding to the elements that meet the set requirements;

[0086] Performing a value update operation on the corresponding foreground pixel points in the Rubik's Cube recognition area according to the pixel point values ​​corresponding to the elements meeting the set requirements, repeating the above steps until all foreground pixel points in the Rubik's Cube recognition area are processed to obtain the corresponding second color recognition image;

[0087] The step of identifying the magic cube recognition area according to the contour recognition algorithm to obtain the color representation area includes:

[0088] Each square area in the second color recognition image is recognized according to a contour recognition algorithm to obtain a color representation area.

[0089] The solution of the embodiment of the present invention can further enhance the quality of the image by applying the second structural kernel element to perform secondary processing on the magic cube recognition area. The selection of the square kernel element helps to make more detailed adjustments and optimizations to the color values ​​while maintaining the integrity of the image structure, thereby improving the accuracy of color recognition.

[0090] After the first image recognition determines the Rubik's Cube recognition area, the second structural kernel element is used to re-detect and process the color values ​​in the area, which can more accurately identify the colors of each face of the Rubik's Cube. This dual processing mechanism helps reduce errors and uncertainties in color recognition and improves the overall recognition accuracy.

[0091] Allowing users to select the size and shape of the second structural core element increases the flexibility and customizability of the system. Users can adjust the structural core elements according to specific recognition needs and Rubik's Cube features to achieve the best recognition results. This user-involved design concept helps improve user experience and satisfaction. Although additional processing steps are added, the entire color recognition process can be optimized by using structural core elements for local processing. The locality of structural core elements makes calculations more efficient while reducing the complexity and time cost of global processing. By generating a second color recognition image, a verification stage is actually added to the color recognition process. This helps to further verify and confirm the accuracy of color recognition in subsequent processing, improving the reliability and stability of the entire system.

[0092] That is, during the specific implementation, the first color recognition image, the second color recognition image and the image corresponding to the Rubik's Cube recognition area can all be subjected to subsequent color processing, and then mutually verified based on the final recognition. If the three recognition colors are consistent, the corresponding result is directly output; if all three are inconsistent, the user is reminded that there is a possibility of recognition error, thereby avoiding the user wasting too much time on finding programming reasons due to system reasons.

[0093] More preferably, Figure 3 As shown, after receiving the image information to be recognized obtained by the camera module configured by the user, it also includes:

[0094] S1011: Acquire the number of online users currently programming, and match the number of online users with a set personnel number-compression parameter mapping table to determine the current image compression parameter;

[0095] S1012: performing image compression processing on the corresponding picture information to be identified according to the current image compression parameter to obtain compressed image information;

[0096] The image information to be identified is subjected to image preprocessing operations, including:

[0097] An image preprocessing operation is performed on the compressed image information.

[0098] The scheme of the embodiment of the present invention obtains the number of online users of the current programming and adjusts the image compression parameters accordingly, so that the system can dynamically optimize resource utilization according to actual usage. When the number of users is small, a lower compression ratio can be used to maintain a high image quality; when the number of users is large, the compression ratio is automatically increased to reduce the network transmission bandwidth and storage space occupied. This adaptive adjustment mechanism helps to improve the overall performance and efficiency of the system.

[0099] The embodiment of the present invention dynamically adjusts the image compression parameters to ensure that users can obtain relatively stable image recognition speed and quality under different user loads. It avoids transmission delays or reduced recognition quality caused by insufficient image compression under high load conditions, thereby improving user experience. Through reasonable image compression, the consumption of network bandwidth and storage space can be reduced, thereby reducing the operating cost of the system. This cost-saving effect is particularly obvious when there are a large number of users.

[0100] The scheme of the embodiment of the present invention introduces a mapping table of the number of online users and image compression parameters, so that the system can easily cope with the growth of the number of users in the future. By adjusting the parameters in the mapping table, the system can automatically adapt to user groups of different sizes without making large-scale changes to the hardware or software. Allowing system administrators to adjust the number of personnel-compression parameter mapping table according to actual needs increases the flexibility and customizability of the system. This design concept enables the system to adapt to different application scenarios and user needs, and improves the applicability and competitiveness of the system.

[0101] More preferably, before obtaining the number of online users of the current programming user, the method further includes:

[0102] Receiving programming competition information, and parsing the programming competition information to determine the estimated number of participants in each time period and the image quality requirements of the corresponding competition;

[0103] like Figure 4 As shown, the method of obtaining the number of online users of the current programming user and matching the number of online users with a set personnel number-compression parameter mapping table to determine the current image compression parameter includes:

[0104] S1012a: Obtain the number of online users of the current programming in the corresponding time period, and update the total number of users in the corresponding time period according to the number of online users of the current programming and the estimated number of players in the corresponding time period;

[0105] S1012b: determining a current image compression parameter by matching the total number of users in the corresponding time period with a set number of users-compression parameter mapping table, wherein the current image compression parameter includes an image compression rate and an image quality, and the image compression rate and the image quality correspond to each other;

[0106] S1012c: If the image quality is not lower than the image quality requirement of the corresponding game, the image compression rate associated with the image quality is determined as the final image compression rate; if the image quality is lower than the image quality requirement of the corresponding game, the image compression rate associated with the image quality requirement is determined as the final image compression rate.

[0107] By receiving and parsing the programmed competition information, the system can obtain the estimated number of players in each time period and the image quality requirements of the corresponding competition. This enables the system to more accurately match the competition requirements and provide appropriate image compression parameters for different competition periods and scenes, thereby ensuring that the image quality meets the competition requirements without excessively occupying resources.

[0108] The system not only determines the image compression parameters based on the number of online users currently programmed, but also updates the total number of users based on the estimated number of players in the corresponding period. This dynamic adjustment mechanism enables the system to respond more flexibly to changes in the number of users, ensuring stable image transmission and processing performance even during peak competition periods.

[0109] When determining image compression parameters, the system takes into account both image compression rate and image quality, and ensures the correspondence between them. This means that the system can maximize the compression rate while ensuring image quality, thereby reducing network bandwidth and storage space usage. At the same time, when the image quality cannot meet the requirements of the competition, the system will prioritize image quality and improve image clarity by reducing the compression rate.

[0110] By accurately matching competition requirements and dynamically adjusting image compression parameters, the system can ensure that users can obtain high-quality image recognition experience in different competition periods and scenarios. This helps to improve user satisfaction and participation, and further promote the development of programming competitions. The introduction of the processing of programming competition information and the dynamic adjustment mechanism of image compression parameters enables the system to better adapt to programming competitions of different sizes and types. Whether it is a small internal competition or a large international competition, the system can be flexibly configured and optimized according to actual needs to ensure the smooth progress of the competition.

[0111] More preferably, a shading structure is built around the camera module, and the shading structure is built with building blocks; the camera module is configured to turn off the automatic white balance function and reduce the picture brightness;

[0112] During the specific implementation, the camera hardware settings were adjusted: the automatic white balance function was turned off, and the screen brightness was appropriately reduced. These adjustments can reduce the impact of ambient light changes on color recognition and improve the consistency and accuracy of color recognition. Light uniformity control: By building a building block ceiling around the camera, the length, width and height of the ceiling are 20 cm, 15 cm and 3 cm respectively, and the camera is placed in the center of the ceiling so that it can capture images from a uniform light source. This effectively reduces the interference of complex light and ensures the uniformity of light, thereby greatly improving the consistency and stability of image acquisition and the accuracy of color recognition.

[0113] The extracting the acquired color characteristic parameters in each of the color representation areas to determine the color value corresponding to each of the color representation areas includes:

[0114] Convert the extracted color representation area into color feature parameters;

[0115] Calculate the average color value of each color representation area, and use the average color value as the color feature data of the corresponding color representation area;

[0116] The color distance formula is used to calculate the similarity between the color feature data in the color representation area and the predefined color, and the predefined color with the highest similarity is selected as the recognition result.

[0117] By converting color representation areas into color feature parameters, the system can represent the color characteristics of these areas in a standardized and quantifiable manner. This precise quantification method helps reduce errors caused by the subjectivity and ambiguity of color description and improves the accuracy of color recognition. Calculating the average color value of each color representation area as color feature data can smooth out color fluctuations and noise in the area, making the color feature more stable and reliable. This stability helps to improve the robustness of the color recognition system under different lighting conditions, shooting angles and device performance.

[0118] Using the color distance formula to calculate the similarity between the color representation area and the predefined color is a scientific and effective color matching method. By comparing the distance of color feature data in the color space, the system can accurately find the predefined color closest to the color representation area, thereby improving the accuracy and efficiency of color recognition. The entire color recognition process is automated and intelligent, and all steps from color representation area extraction to color value determination can be completed without human intervention. This automated and intelligent feature not only improves the speed and efficiency of color recognition, but also reduces the errors and uncertainties caused by human factors.

[0119] By calculating and comparing the color distance, the color of each small square can be accurately identified and distinguished. This method can effectively distinguish different colors, and even achieve high recognition accuracy between similar colors, thereby obtaining the color configuration of each face of the Rubik's Cube.

[0120] During the specific implementation, each small square in the Rubik's Cube can be further divided into a preset number of small square areas; then, the colors can be further distinguished according to the accuracy of the small square number recognition, and even the color changes of each small square can be identified, and the final color value can be further determined based on the color changes.

[0121] The method for obtaining the color of the Rubik's Cube by using a camera in the embodiment of the present invention can significantly improve the image quality through image preprocessing operations, providing a clearer and more accurate image basis for subsequent color recognition. At the same time, the image recognition algorithm and the contour recognition algorithm are used to accurately divide the color representation area of ​​each face of the Rubik's Cube, ensuring the accuracy of color recognition.

[0122] Embodiment 2

[0123] See also Figure 5 , Figure 5Schematic diagram of the structure of the system for obtaining the color of the Rubik's Cube by using a camera according to an embodiment of the present invention. Figure 5 As shown, the system for obtaining the color of the Rubik's Cube by camera recognition may include:

[0124] The acquisition module 21 is used to receive the image information to be recognized obtained by the camera module configured by the user, and perform image preprocessing operations on the image information to be recognized;

[0125] Image recognition module 22: used for performing image recognition on the to-be-recognized picture information after image preprocessing operation according to an image recognition algorithm to determine the magic cube recognition area in the corresponding to-be-recognized picture information;

[0126] The region recognition module 23 is used to recognize the Rubik's Cube recognition region according to the contour recognition algorithm to obtain a color representation region, wherein the color representation region is a corresponding square region in the nine-square grid on each side of the Rubik's Cube;

[0127] The color extraction module 24 is used to extract the color characteristic parameters in each of the acquired color representation areas to determine the color value corresponding to each color representation area.

[0128] The method for obtaining the color of the Rubik's Cube by using a camera in the embodiment of the present invention can significantly improve the image quality through image preprocessing operations, providing a clearer and more accurate image basis for subsequent color recognition. At the same time, the image recognition algorithm and the contour recognition algorithm are used to accurately divide the color representation area of ​​each face of the Rubik's Cube, ensuring the accuracy of color recognition.

[0129] Embodiment 3

[0130] See also Figure 6 , Figure 6 Schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. The electronic device may be a computer, a server, etc. Of course, in certain circumstances, it may also be a smart device such as a mobile phone, a tablet computer, a monitoring terminal, and an image acquisition device with processing functions. Figure 6 As shown, the electronic device may include:

[0131] A memory 510 storing executable program codes;

[0132] a processor 520 coupled to the memory 510;

[0133] The processor 520 calls the executable program code stored in the memory 510 to execute part or all of the steps in the method for obtaining the color of the magic cube by camera recognition in the first embodiment.

[0134] The embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute part or all of the steps in the method for obtaining the color of a magic cube by using a camera to identify the color of the magic cube in the first embodiment.

[0135] The embodiment of the present invention further discloses a computer program product, wherein when the computer program product is run on a computer, the computer executes part or all of the steps in the method for obtaining the color of a magic cube by camera recognition in the first embodiment.

[0136] An embodiment of the present invention further discloses an application publishing platform, wherein the application publishing platform is used to publish a computer program product, wherein when the computer program product runs on a computer, the computer executes part or all of the steps in the method of obtaining the color of a Rubik's Cube by camera recognition in Embodiment 1.

[0137] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0138] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0139] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0140] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a memory and includes several requests to enable a computer device (which can be a personal computer, server or network device, etc., specifically a processor in a computer device) to perform some or all steps of the method described in each embodiment of the present invention.

[0141] In the embodiments provided by the present invention, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.

[0142] A person of ordinary skill in the art may understand that part or all of the steps in the various methods of the embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, the storage medium including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically-erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0143] The above is a detailed introduction to the method, system, electronic device and storage medium for obtaining the color of a Rubik's Cube by using a camera to recognize the color of the Rubik's Cube disclosed in the embodiments of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for obtaining the color of a Rubik's Cube by using a camera, characterized in that: include: Receiving the image information to be recognized obtained by the camera module configured by the user, and performing image preprocessing operation on the image information to be recognized; Performing image recognition on the image information to be recognized after image preprocessing according to an image recognition algorithm to determine a magic cube recognition area in the corresponding image information to be recognized; After performing image recognition on the to-be-recognized picture information that has undergone image preprocessing operation according to the image recognition algorithm to determine the magic cube recognition area in the corresponding to-be-recognized picture information, the method further includes: receiving a first structure kernel element selected by a user, wherein the first structure kernel element defines a domain size and a shape of a first image operation; the first structure kernel element is a square kernel element; Align the center point of the first structure core element with the corresponding foreground pixel point in the Rubik's Cube recognition area, and detect the color values ​​of all elements covered by the first structure core element to determine the pixel point values ​​corresponding to the elements that meet the set requirements; Performing a value update operation on the corresponding foreground pixel points in the Rubik's Cube recognition area according to the pixel point values ​​corresponding to the elements meeting the set requirements, repeating the above steps until all foreground pixel points in the Rubik's Cube recognition area are processed to obtain the corresponding first color recognition image; The Rubik's Cube recognition area is identified according to a contour recognition algorithm to obtain a color representation area, and the color representation area is a corresponding square area in the nine-square grid on each side of the Rubik's Cube; the identifying the Rubik's Cube recognition area according to the contour recognition algorithm to obtain the color representation area includes: Identify each square area in the first color recognition image according to a contour recognition algorithm to obtain a color representation area; The color characteristic parameters in each of the acquired color representation areas are extracted to determine the color value corresponding to each color representation area.

2. The method for obtaining the color of a magic cube by camera recognition as claimed in claim 1, characterized in that: Before the receiving of the corresponding image information to be recognized based on the camera module configured by the user, the method further includes: Receive the task processing logic configured by the user, and parse the task processing logic to determine the corresponding Rubik's Cube color recognition process; The image recognition algorithm includes a convolutional neural network or a threshold recognition algorithm.

3. The method for obtaining the color of a magic cube by camera recognition as claimed in claim 1, characterized in that: After performing image recognition on the to-be-recognized picture information that has undergone image preprocessing operation according to the image recognition algorithm to determine the magic cube recognition area in the corresponding to-be-recognized picture information, the method further includes: receiving a second structure kernel element selected by a user, wherein the second structure kernel element defines a size and a shape of a domain of a second image operation; the second structure kernel element is a square kernel element; Align the center point of the second structure core element with the corresponding foreground pixel point in the Rubik's Cube recognition area, and detect the color values ​​of all elements covered by the second structure core element to determine the pixel point values ​​corresponding to the elements that meet the set requirements; Performing a value update operation on the corresponding foreground pixel points in the Rubik's Cube recognition area according to the pixel point values ​​corresponding to the elements meeting the set requirements, repeating the above steps until all foreground pixel points in the Rubik's Cube recognition area are processed to obtain the corresponding second color recognition image; The step of identifying the magic cube recognition area according to the contour recognition algorithm to obtain the color representation area includes: Each square area in the second color recognition image is recognized according to a contour recognition algorithm to obtain a color representation area.

4. The method for obtaining the color of a magic cube by camera recognition as claimed in claim 1, characterized in that: After receiving the image information to be recognized obtained by the camera module configured by the user, the method further includes: Obtain the number of online users currently programmed, and match the number of online users with a set personnel number-compression parameter mapping table to determine the current image compression parameter; Performing image compression processing on the corresponding picture information to be identified according to the current image compression parameter to obtain compressed image information; The image information to be identified is subjected to image preprocessing operations, including: An image preprocessing operation is performed on the compressed image information.

5. The method for obtaining the color of a magic cube by camera recognition as claimed in claim 4, characterized in that: Before obtaining the number of online users of the current programming user, the method further includes: Receiving programming competition information, and parsing the programming competition information to determine the estimated number of participants in each time period and the image quality requirements of the corresponding competition; The obtaining the number of online users of the current programming user, and matching the number of online users with a set personnel number-compression parameter mapping table to determine the current image compression parameter, includes: Obtain the number of online users of the current programming in the corresponding period, and update the total number of users in the corresponding period according to the number of online users of the current programming and the estimated number of players in the corresponding period; According to the total number of users in the corresponding time period, the current image compression parameters are matched with the set number of users-compression parameter mapping table to determine the current image compression parameters, wherein the current image compression parameters include image compression rate and image quality, and the image compression rate and image quality correspond to each other; If the image quality is not lower than the image quality requirement of the corresponding game, the image compression rate associated with the image quality is determined as the final image compression rate; if the image quality is lower than the image quality requirement of the corresponding game, the image compression rate associated with the image quality requirement is determined as the final image compression rate.

6. The method for obtaining the color of a magic cube by camera recognition as claimed in claim 1, characterized in that: A shading structure is built around the camera module, and the shading structure is built with building blocks; the camera module is configured to turn off the automatic white balance function and reduce the picture brightness; The extracting the acquired color characteristic parameters in each of the color representation areas to determine the color value corresponding to each of the color representation areas includes: Convert the extracted color representation area into color feature parameters; Calculate the average color value of each color representation area, and use the average color value as the color feature data of the corresponding color representation area; The color distance formula is used to calculate the similarity between the color feature data in the color representation area and the predefined color, and the predefined color with the highest similarity is selected as the recognition result.

7. A system for obtaining the color of a Rubik's Cube by using a camera, characterized in that: include: Acquisition module: used to receive the image information to be recognized obtained by the camera module configured by the user, and perform image preprocessing operation on the image information to be recognized; Image recognition module: used for performing image recognition on the to-be-recognized picture information after image preprocessing operation according to an image recognition algorithm to determine the magic cube recognition area in the corresponding to-be-recognized picture information; After performing image recognition on the to-be-recognized picture information that has undergone image preprocessing operation according to the image recognition algorithm to determine the magic cube recognition area in the corresponding to-be-recognized picture information, the method further includes: receiving a first structure kernel element selected by a user, wherein the first structure kernel element defines a domain size and a shape of a first image operation; the first structure kernel element is a square kernel element; Align the center point of the first structure core element with the corresponding foreground pixel point in the Rubik's Cube recognition area, and detect the color values ​​of all elements covered by the first structure core element to determine the pixel point values ​​corresponding to the elements that meet the set requirements; Performing a value update operation on the corresponding foreground pixel points in the Rubik's Cube recognition area according to the pixel point values ​​corresponding to the elements meeting the set requirements, repeating the above steps until all foreground pixel points in the Rubik's Cube recognition area are processed to obtain the corresponding first color recognition image; A region recognition module is used to recognize the Rubik's Cube recognition region according to a contour recognition algorithm to obtain a color representation region, wherein the color representation region is a corresponding square region in the nine-square grid on each side of the Rubik's Cube; the recognition of the Rubik's Cube recognition region according to the contour recognition algorithm to obtain a color representation region includes: Identify each square area in the first color recognition image according to a contour recognition algorithm to obtain a color representation area; Color extraction module: used for extracting the color characteristic parameters in each of the acquired color representation areas to determine the color value corresponding to each color representation area.

8. An electronic device, characterized in that: include: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the method for obtaining the color of a magic cube by using a camera to recognize the color of the magic cube as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program enables a computer to execute the method for obtaining the color of a magic cube by using a camera to recognize the color of the magic cube as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method of guiding users to restore Rubik's cube

    CN107154058A