CN113362400A - User interface color matching detection method, device, equipment and storage medium - Google Patents

User interface color matching detection method, device, equipment and storage medium Download PDF

Info

Publication number
CN113362400A
CN113362400A CN202110738028.5A CN202110738028A CN113362400A CN 113362400 A CN113362400 A CN 113362400A CN 202110738028 A CN202110738028 A CN 202110738028A CN 113362400 A CN113362400 A CN 113362400A
Authority
CN
China
Prior art keywords
color
main
user interface
picture
detected
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.)
Pending
Application number
CN202110738028.5A
Other languages
Chinese (zh)
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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202110738028.5A priority Critical patent/CN113362400A/en
Publication of CN113362400A publication Critical patent/CN113362400A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Quality & Reliability (AREA)
  • Geometry (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to an artificial intelligence technology, and discloses a user interface color matching detection method, which comprises the following steps: carrying out color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph; carrying out three-primary-color conversion processing on the primary color of the primary graph to obtain three-primary-color values of the primary graph; calculating a color difference value between the three primary color values of the main picture and the pre-acquired three primary color values of the background picture of the user interface to be detected to obtain a picture difference percentage; and comparing the picture difference percentage with a preset picture difference percentage threshold, and if the picture difference percentage is smaller than the preset picture difference percentage threshold, generating a detection result that the user interface to be detected is qualified. The invention also relates to a blockchain technology, wherein the preset picture difference percentage threshold value is stored in the blockchain. The invention can solve the problems of high manpower cost for auditing, negligence in manual auditing, low efficiency, poor failure, operation cost improvement and the like in the prior art.

Description

User interface color matching detection method, device, equipment and storage medium
Technical Field
The invention relates to the field of artificial intelligence, in particular to a user interface color matching detection method and device, electronic equipment and a computer readable storage medium.
Background
In an application program (APP) test, a user interface of an application program is often required to be updated, the updating frequency is high, and the user interface test is required to be performed every time the user interface is updated.
Taking the application program of the input method as an example, each time a new type of skin is pushed out, it is necessary to check whether the picture of each key of the keyboard is correct, the difference between the picture of the key and the background color cannot be too large, and the like. The current common detection mode is manual inspection; however, hundreds of skin types may be submitted every day, if each skin type needs to be manually checked, the labor cost for checking is very high, and due to manual checking, negligence caused by checking fatigue may exist, and the checking timeliness is poor due to low efficiency of manual checking.
A large amount of testing personnel needs to be put into simple, repeated and low-value labor, so that the working efficiency of the test is greatly reduced, the working enthusiasm is reduced, and the operation cost is increased.
Disclosure of Invention
The invention provides a user interface color matching detection method, a user interface color matching detection device, electronic equipment and a computer readable storage medium, and mainly aims to solve the problems that in the prior art, the user interface of a newly developed application program passes through manual auditing, the manpower cost for auditing is high, the manual auditing is neglected, the efficiency is low, the failure is poor, the operation cost is increased and the like.
In a first aspect, to achieve the above object, the present invention provides a method for detecting color matching of a user interface, where the method includes:
carrying out color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph; the user interface to be detected comprises a main graph and a background graph;
carrying out three-primary-color conversion processing on the primary color of the primary graph to obtain three-primary-color values of the primary graph;
calculating a color difference value between the three primary color values of the main picture and the pre-acquired three primary color values of the background picture of the user interface to be detected to obtain a picture difference percentage;
and comparing the picture difference percentage with a preset picture difference percentage threshold, and if the picture difference percentage is smaller than the preset picture difference percentage threshold, generating a detection result that the user interface to be detected is qualified.
In a second aspect, in order to solve the above problem, the present invention further provides a user interface color matching detection apparatus, including:
the color analysis module is used for carrying out color analysis on a main graph of the user interface to be detected to obtain a main color of the main graph; the user interface to be detected comprises a main graph and a background graph;
the three-primary color conversion module is used for carrying out three-primary color conversion processing on the primary color of the primary graph to obtain a three-primary color value of the primary graph;
the picture difference percentage calculation module is used for calculating a color difference value between the three primary color values of the main graph and the pre-acquired three primary color values of the background graph of the user interface to be detected to obtain a picture difference percentage;
and the detection result generation module is used for comparing the picture difference percentage with a preset picture difference percentage threshold value, and if the picture difference percentage is smaller than the preset picture difference percentage threshold value, generating a detection result that the user interface to be detected is qualified.
In a third aspect, to solve the above problem, the present invention further provides an electronic apparatus, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the steps of the user interface color match detection method as described above.
In a fourth aspect, to solve the above problem, the present invention further provides a computer-readable storage medium storing a computer program, which when executed by a processor implements the user interface color matching detection method as described above.
According to the user interface color matching detection method, the user interface color matching detection device, the electronic equipment and the storage medium, the main colors in the main graph and the background graph of the user interface to be detected are converted into three primary color values, and then the color difference values of the main graph and the background graph are calculated, so that the picture difference percentage is obtained; and finally, generating a detection result of the user interface to be detected based on the comparison result of the picture difference percentage and a preset picture difference percentage threshold value. Whether color matching among all picture elements in the design of the user interface to be detected is coordinated or not can be automatically identified, mixing of abnormal pictures can be rapidly and accurately identified, coordination of the user interface is guaranteed, testing manpower can be greatly liberated, accuracy and verification timeliness of verification work of the user interface pictures are improved, and accordingly enthusiasm of creators and use experience of users are improved.
Drawings
FIG. 1 is a flowchart illustrating a method for detecting color matching of a user interface according to an embodiment of the present invention;
FIG. 2 is a block diagram of a user interface color matching detection apparatus according to an embodiment of the present invention;
fig. 3 is a schematic internal structural diagram of an electronic device implementing a method for detecting color matching of a user interface according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a user interface color matching detection method. Referring to fig. 1, a flowchart of a method for detecting color matching of a user interface according to an embodiment of the present invention is shown. The method may be performed by an apparatus, which may be implemented by software and/or hardware.
In this embodiment, the method for detecting color matching of a user interface includes:
and S110, performing color analysis on the main graph of the user interface to be detected to obtain the main color of the main graph. The user interface to be detected comprises a main graph and a background graph.
Specifically, in the application program (APP) testing process, the user interface needs to be tested at the same time, when the user terminal is not installed, the main graph and the background graph of the user interface in the installation package need to be subjected to color matching detection, wherein the user interface to be detected can be APP theme skin, theme skin of a mobile phone system and the like. Taking an input method skin as an example, each time a new skin is introduced, it is required to check whether the picture of each key of the keyboard is correct or not, the difference between the key picture and the ground color cannot be too large, and the two colors cannot be completely the same, wherein the key picture is the main picture referred in the embodiment of the present invention, and the ground color is the background picture referred in the embodiment of the present invention.
As an optional embodiment of the present invention, before performing color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph, the method further includes:
generating a user interface color matching detection instruction according to an interface compression packet corresponding to the user interface to be detected;
according to the user interface color matching detection instruction, decompressing an interface compression packet corresponding to the user interface to be detected to obtain a picture storage file of the user interface to be detected; the picture storage file of the user interface to be detected comprises a main picture and a background picture of the user interface to be detected.
Specifically, when the user interface color matching detection platform receives an interface compression packet corresponding to the user interface to be detected uploaded by an author, the information of the received interface compression packet is sent to the processor, and the processor generates a user interface color matching detection instruction according to the information that the obtained interface compression packet is successfully uploaded. And according to the user interface color matching detection instruction, decompressing the interface compression packet corresponding to the user interface to be detected through a decompression tool to obtain the picture storage file of the user interface to be detected. The decompression tool can select a corresponding decompression tool according to a file form of a compressed packet, for example, a skin packet is used for decompressing skin. In order to facilitate uploading of design and storage of a main graph and a background graph of a user interface, the user interface designed by a designer is generally stored in a compression package in a main graph and background graph mode, the compression package needs to be decompressed after the user interface color matching detection platform is uploaded, and pictures in a file are processed after the decompression.
As an optional embodiment of the present invention, before performing color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph, the method further includes:
extracting the main picture of the user interface to be detected from a picture storage file of the user interface to be detected according to the picture name of the main picture of the user interface to be detected; wherein,
the main picture is named with the picture name of the main picture in advance; the background picture is named with the picture name of the background picture in advance.
Specifically, in order to distinguish the main graph and the background graph of the user interface to be detected, a designer names the main graph and the background graph in advance, for example, the picture name of the background graph is background, and the picture name of the main graph is master; and distinguishing the main graph and the background graph in the picture storage file obtained after the interface compression packet is decompressed according to the picture names of the main graph, and extracting the main graph from the picture storage file according to the name of the main graph for processing.
As an optional embodiment of the present invention, performing color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph includes:
performing HSV color conversion processing on the color of the main graph to obtain an HSV color model of the main graph; the HSV color model comprises chroma, saturation and brightness;
carrying out impurity color filtering treatment on the HSV color model of the main map to obtain a main map color;
carrying out binarization processing on the main image color to obtain a black-and-white image of the main image; wherein, the white area in the black-and-white picture is the area where the main picture color in the main picture is located, and the black area in the black-and-white picture is the non-color area of the main picture with impurity color removed by filtering;
carrying out morphological corrosion expansion processing on the black-and-white image of the main image to eliminate noise in the black-and-white image and obtain a noise-free black-and-white image;
and counting the area of the white area in the black-and-white image without the noise point, and taking the main color corresponding to the white area with the largest area in the black-and-white image without the noise point as the main color of the main image.
Specifically, parameters of the HSV (Hue, Saturation, Value) color model include: hue (H), saturation (S) and lightness (V), and converting the color of the main graph into an HSV color model by performing HSV color conversion treatment on the color of the main graph, so that the impurity color doped in the main graph is conveniently filtered and removed, and the determination of the main color of the main graph is prevented from being influenced by the impurity color; impurity color filtering processing can be carried out on the HSV color model of the main graph through a cv2.inRange () function (existing function) to obtain a main graph color; the method comprises the steps that impurity color filtering processing is carried out on an HSV color model of a main graph to obtain a main graph color actually, namely, the color of a pixel point in the HSV color model of the main graph is compared with the color in a color dictionary of a preset main graph color, the same color is reserved, different colors are removed, and therefore pixels of the color left after the impurity color of the main graph is removed are obtained, and the main graph color is obtained; however, the main image color may include multiple colors, and at this time, in order to facilitate color difference calculation with the background image, only the main image color with the largest occupied area needs to be selected, that is, the main color in the main image is selected; carrying out binarization processing on the main image color to obtain a black-and-white image of the main image; the white area in the black-and-white image is the area where the main color in the main image is located, the black area in the black-and-white image is the non-color area where the impurity color in the main image is filtered, the main color corresponding to the white area with the largest area is selected as the main color of the main image, and in order to reduce the influence of noise and facilitate the statistics of the area of the white area, morphological corrosion expansion processing needs to be carried out on the black-and-white image of the main image.
And step S120, performing three-primary-color conversion processing on the primary color of the main picture to obtain three-primary-color values of the main picture.
Specifically, in order to obtain the color difference between the main pattern and the background pattern, it is necessary to perform numerical processing on the main color of the main pattern and the main color of the background pattern. Among them, the three primary colors (RGB) refer to three basic colors that cannot be decomposed any more among colors. Taking black and white as an example, after converting black into three primary colors, the obtained black three primary color values are (256, 256, 256); after converting the white color into three primary colors, the three primary color values of the obtained white color are (0, 0, 0).
Step S130, calculating a color difference value between the three primary color values of the main picture and the pre-acquired three primary color values of the background picture of the user interface to be detected to obtain the picture difference percentage.
Specifically, the three primary color values of the main graph and the three primary color values of the background graph are numerical values, a difference value between the two three primary color values can be obtained through calculation, and whether the user interface to be detected is qualified or not is judged through the difference value.
As an optional embodiment of the present invention, an obtaining method for detecting three primary color values of a background image of a user interface picture includes:
performing HSV color conversion treatment on the color of the background image to obtain an HSV color model of the background image; the HSV color model comprises chroma, saturation and brightness;
carrying out impurity color filtering treatment on the HSV color model of the background image to obtain the color of the background image;
carrying out binarization processing on the background image color to obtain a black and white image of the background image; wherein, the white area in the black-and-white image is the area where the background image color in the background image is located, and the black area in the black-and-white image is the non-color area where the impurity color in the background image is filtered;
carrying out morphological corrosion expansion treatment on the black-and-white image of the background image to eliminate noise in the black-and-white image to obtain a noise-free black-and-white image;
counting the area of a white area in the black-and-white image without the noise point, and taking the background image color corresponding to the white area with the largest area in the black-and-white image without the noise point as the main color of the background image;
and carrying out three-primary color conversion processing on the main color of the background image to obtain three-primary color values of the main color of the background image.
Specifically, the method for acquiring the three-primary-color values of the background image of the user interface to be detected is similar to the method for acquiring the three-primary-color values of the main image, and the colors of the background image are converted into HSV color models, so that the impurity colors in the background image can be conveniently filtered and removed, and the determination of the main color of the background image is prevented from being influenced by the impurity colors; similarly, impurity color filtering processing can be carried out on the HSV color model of the background image through a cv2.inRange () function (existing function) to obtain the color of the background image; the impurity color filtering processing is carried out on the HSV color model of the background image, and the actual background image color is obtained by comparing the colors of the pixel points in the HSV color model of the background image with the colors in a color dictionary of the preset background image color, reserving the same color and removing different colors, so that the pixels of the color left after the impurity color is removed on the background image are obtained, and the background image color is obtained; however, the background image color may include multiple colors, and at this time, in order to facilitate color difference calculation with the main image, only the background image color with the largest occupied area needs to be selected, that is, the main color in the background image is selected; carrying out binarization processing on the background image color to obtain a black and white image of the background image; the white area in the black-and-white image is the area where the background image color in the main image is located, the black area in the black-and-white image is the non-color area where the impurity color in the background image is filtered, the background image color corresponding to the white area with the largest area is selected as the main color of the background image, and in order to reduce the influence of noise and facilitate the statistics of the area of the white area, morphological corrosion expansion processing needs to be performed on the black-and-white image of the main image. And after the primary color of the background image is obtained, carrying out three-primary color conversion treatment on the primary color of the background image to obtain three-primary color values of the primary color of the background image.
As an optional embodiment of the present invention, the calculating a color difference value between the three primary color values of the main map and the pre-obtained three primary color values of the background map of the user interface to be detected to obtain the picture difference percentage includes:
and performing sum of variances processing on three color components of the three primary color values of the main image and three color components of the three primary color values of the background image to obtain the difference percentage of the image.
Specifically, if the main color of the main map is black and the main color of the background map is white, the three primary color values of black are (256, 256, 256), and the three primary color values of white are (0, 0, 0); then the picture difference percentage is 196608 and the data represents the color difference value.
Step S140, comparing the picture difference percentage with a preset picture difference percentage threshold, and if the picture difference percentage is smaller than the preset picture difference percentage threshold, generating a detection result that the user interface to be detected is qualified.
Specifically, a preset picture difference percentage threshold is set according to actual scene needs, the picture difference percentage is compared with the preset picture difference percentage threshold, and a detection result of the user interface to be detected is obtained according to a result obtained through comparison. And if the picture difference percentage is smaller than a preset picture difference percentage threshold value, generating a detection result that the user interface to be detected is qualified.
As an optional embodiment of the present invention, the storing a preset picture difference percentage threshold in the block chain, comparing the picture difference percentage with the preset picture difference percentage threshold, and if the picture difference percentage is smaller than the preset picture difference percentage threshold, after generating a detection result that the user interface to be detected is qualified, further includes:
and if the picture difference percentage is larger than or equal to a preset picture difference percentage threshold value, generating a detection result that the user interface to be detected is unqualified, and generating a voice prompt that the detection is unqualified according to the detection result that the detection is unqualified.
Specifically, when the picture difference percentage is larger, the difference between the two pictures is larger, and the error is larger, so that when the picture difference percentage is larger than or equal to a preset picture difference percentage threshold, a detection result that the user interface to be detected is unqualified is generated; and when the picture difference percentage is smaller than a preset picture difference percentage threshold value, generating a detection result that the interface picture to be detected is qualified. And after the final detection result is obtained, the processor feeds back the detection result to the detector in a way of prompting voice or prompting characters. Preferably, the voice prompt with unqualified detection is generated according to the detection result with unqualified detection, so that a detector can notice the unqualified detection result, and further processing such as modification is performed.
Fig. 2 is a functional block diagram of a user interface color matching detection apparatus according to an embodiment of the present invention.
The user interface color matching detection apparatus 200 according to the present invention may be installed in an electronic device. According to the implemented functions, the user interface color matching detection device may include a color analysis module 210, a three primary colors conversion module 220, a picture difference percentage calculation module 230, and a detection result generation module 240. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
and the color analysis module 210 is configured to perform color analysis on the main graph of the user interface to be detected to obtain a main color of the main graph. The user interface to be detected comprises a main graph and a background graph.
Specifically, in the application program (APP) testing process, the user interface needs to be tested at the same time, when the user terminal is not installed, the main graph and the background graph of the user interface in the installation package need to be subjected to color matching detection, wherein the user interface to be detected can be APP theme skin, theme skin of a mobile phone system and the like. Taking an input method skin as an example, each time a new skin is introduced, it is required to check whether the picture of each key of the keyboard is correct or not, the difference between the key picture and the ground color cannot be too large, and the two colors cannot be completely the same, wherein the key picture is the main picture referred in the embodiment of the present invention, and the ground color is the background picture referred in the embodiment of the present invention.
As an optional embodiment of the present invention, before performing color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph, the method further includes:
generating a user interface color matching detection instruction according to an interface compression packet corresponding to the user interface to be detected;
according to the user interface color matching detection instruction, decompressing an interface compression packet corresponding to the user interface to be detected to obtain a picture storage file of the user interface to be detected; the picture storage file of the user interface to be detected comprises a main picture and a background picture of the user interface to be detected.
Specifically, when the user interface color matching detection platform receives an interface compression packet corresponding to the user interface to be detected uploaded by an author, the information of the received interface compression packet is sent to the processor, and the processor generates a user interface color matching detection instruction according to the information that the obtained interface compression packet is successfully uploaded. And according to the user interface color matching detection instruction, decompressing the interface compression packet corresponding to the user interface to be detected through a decompression tool to obtain the picture storage file of the user interface to be detected. The decompression tool can select a corresponding decompression tool according to a file form of a compressed packet, for example, a skin packet is used for decompressing skin. In order to facilitate uploading of design and storage of a main graph and a background graph of a user interface, the user interface designed by a designer is generally stored in a compression package in a main graph and background graph mode, the compression package needs to be decompressed after the user interface color matching detection platform is uploaded, and pictures in a file are processed after the decompression.
As an optional embodiment of the present invention, before performing color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph, the method further includes:
extracting the main picture of the user interface to be detected from a picture storage file of the user interface to be detected according to the picture name of the main picture of the user interface to be detected; wherein,
the main picture is named with the picture name of the main picture in advance; the background picture is named with the picture name of the background picture in advance.
Specifically, in order to distinguish the main graph and the background graph of the user interface to be detected, a designer names the main graph and the background graph in advance, for example, the picture name of the background graph is background, and the picture name of the main graph is master; and distinguishing the main graph and the background graph in the picture storage file obtained after the interface compression packet is decompressed according to the picture names of the main graph, and extracting the main graph from the picture storage file according to the name of the main graph for processing.
As an optional embodiment of the present invention, performing color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph includes:
performing HSV color conversion processing on the color of the main graph to obtain an HSV color model of the main graph; the HSV color model comprises chroma, saturation and brightness;
carrying out impurity color filtering treatment on the HSV color model of the main map to obtain a main map color;
carrying out binarization processing on the main image color to obtain a black-and-white image of the main image; wherein, the white area in the black-and-white picture is the area where the main picture color in the main picture is located, and the black area in the black-and-white picture is the non-color area of the main picture with impurity color removed by filtering;
carrying out morphological corrosion expansion processing on the black-and-white image of the main image to eliminate noise in the black-and-white image and obtain a noise-free black-and-white image;
and counting the area of the white area in the black-and-white image without the noise point, and taking the main color corresponding to the white area with the largest area in the black-and-white image without the noise point as the main color of the main image.
Specifically, parameters of the HSV (Hue, Saturation, Value) color model include: hue (H), saturation (S) and lightness (V), and converting the color of the main graph into an HSV color model by performing HSV color conversion treatment on the color of the main graph, so that the impurity color doped in the main graph is conveniently filtered and removed, and the determination of the main color of the main graph is prevented from being influenced by the impurity color; impurity color filtering processing can be carried out on the HSV color model of the main graph through a cv2.inRange () function (existing function) to obtain a main graph color; the method comprises the steps that impurity color filtering processing is carried out on an HSV color model of a main graph to obtain a main graph color actually, namely, the color of a pixel point in the HSV color model of the main graph is compared with the color in a color dictionary of a preset main graph color, the same color is reserved, different colors are removed, and therefore pixels of the color left after the impurity color of the main graph is removed are obtained, and the main graph color is obtained; however, the main image color may include multiple colors, and at this time, in order to facilitate color difference calculation with the background image, only the main image color with the largest occupied area needs to be selected, that is, the main color in the main image is selected; carrying out binarization processing on the main image color to obtain a black-and-white image of the main image; the white area in the black-and-white image is the area where the main color in the main image is located, the black area in the black-and-white image is the non-color area where the impurity color in the main image is filtered, the main color corresponding to the white area with the largest area is selected as the main color of the main image, and in order to reduce the influence of noise and facilitate the statistics of the area of the white area, morphological corrosion expansion processing needs to be carried out on the black-and-white image of the main image.
And the three-primary color conversion module 220 is configured to perform three-primary color conversion processing on the primary color of the primary map to obtain a three-primary color value of the primary map.
Specifically, in order to obtain the color difference between the main pattern and the background pattern, it is necessary to perform numerical processing on the main color of the main pattern and the main color of the background pattern. Among them, the three primary colors (RGB) refer to three basic colors that cannot be decomposed any more among colors. Taking black and white as an example, after converting black into three primary colors, the obtained black three primary color values are (256, 256, 256); after converting the white color into three primary colors, the three primary color values of the obtained white color are (0, 0, 0).
The picture difference percentage calculating module 230 is configured to calculate a color difference value between the three primary color values of the main image and the pre-obtained three primary color values of the background image of the user interface to be detected, so as to obtain a picture difference percentage.
Specifically, the three primary color values of the main graph and the three primary color values of the background graph are numerical values, a difference value between the two three primary color values can be obtained through calculation, and whether the user interface to be detected is qualified or not is judged through the difference value.
As an optional embodiment of the present invention, an obtaining method for detecting three primary color values of a background image of a user interface picture includes:
performing HSV color conversion treatment on the color of the background image to obtain an HSV color model of the background image; the HSV color model comprises chroma, saturation and brightness;
carrying out impurity color filtering treatment on the HSV color model of the background image to obtain the color of the background image;
carrying out binarization processing on the background image color to obtain a black and white image of the background image; wherein, the white area in the black-and-white image is the area where the background image color in the background image is located, and the black area in the black-and-white image is the non-color area where the impurity color in the background image is filtered;
carrying out morphological corrosion expansion treatment on the black-and-white image of the background image to eliminate noise in the black-and-white image to obtain a noise-free black-and-white image;
counting the area of a white area in the black-and-white image without the noise point, and taking the background image color corresponding to the white area with the largest area in the black-and-white image without the noise point as the main color of the background image;
and carrying out three-primary color conversion processing on the main color of the background image to obtain three-primary color values of the main color of the background image.
Specifically, the method for acquiring the three-primary-color values of the background image of the user interface to be detected is similar to the method for acquiring the three-primary-color values of the main image, and the colors of the background image are converted into HSV color models, so that the impurity colors in the background image can be conveniently filtered and removed, and the determination of the main color of the background image is prevented from being influenced by the impurity colors; similarly, impurity color filtering processing can be carried out on the HSV color model of the background image through a cv2.inRange () function (existing function) to obtain the color of the background image; the impurity color filtering processing is carried out on the HSV color model of the background image, and the actual background image color is obtained by comparing the colors of the pixel points in the HSV color model of the background image with the colors in a color dictionary of the preset background image color, reserving the same color and removing different colors, so that the pixels of the color left after the impurity color is removed on the background image are obtained, and the background image color is obtained; however, the background image color may include multiple colors, and at this time, in order to facilitate color difference calculation with the main image, only the background image color with the largest occupied area needs to be selected, that is, the main color in the background image is selected; carrying out binarization processing on the background image color to obtain a black and white image of the background image; the white area in the black-and-white image is the area where the background image color in the main image is located, the black area in the black-and-white image is the non-color area where the impurity color in the background image is filtered, the background image color corresponding to the white area with the largest area is selected as the main color of the background image, and in order to reduce the influence of noise and facilitate the statistics of the area of the white area, morphological corrosion expansion processing needs to be performed on the black-and-white image of the main image. And after the primary color of the background image is obtained, carrying out three-primary color conversion treatment on the primary color of the background image to obtain three-primary color values of the primary color of the background image.
As an optional embodiment of the present invention, the calculating a color difference value between the three primary color values of the main map and the pre-obtained three primary color values of the background map of the user interface to be detected to obtain the picture difference percentage includes:
and performing sum of variances processing on three color components of the three primary color values of the main image and three color components of the three primary color values of the background image to obtain the difference percentage of the image.
Specifically, if the main color of the main map is black and the main color of the background map is white, the three primary color values of black are (256, 256, 256), and the three primary color values of white are (0, 0, 0); then the picture difference percentage is 196608 and the data represents the color difference value.
The detection result generating module 240 is configured to compare the picture difference percentage with a preset picture difference percentage threshold, and if the picture difference percentage is smaller than the preset picture difference percentage threshold, generate a detection result that the user interface to be detected is qualified.
Specifically, a preset picture difference percentage threshold is set according to actual scene needs, the picture difference percentage is compared with the preset picture difference percentage threshold, and a detection result of the user interface to be detected is obtained according to a result obtained through comparison. And if the picture difference percentage is smaller than a preset picture difference percentage threshold value, generating a detection result that the user interface to be detected is qualified.
As an optional embodiment of the present invention, the storing a preset picture difference percentage threshold in the block chain, comparing the picture difference percentage with the preset picture difference percentage threshold, and if the picture difference percentage is smaller than the preset picture difference percentage threshold, after generating a detection result that the user interface to be detected is qualified, further includes:
and if the picture difference percentage is larger than or equal to a preset picture difference percentage threshold value, generating a detection result that the user interface to be detected is unqualified, and generating a voice prompt that the detection is unqualified according to the detection result that the detection is unqualified.
Specifically, when the picture difference percentage is larger, the difference between the two pictures is larger, and the error is larger, so that when the picture difference percentage is larger than or equal to a preset picture difference percentage threshold, a detection result that the user interface to be detected is unqualified is generated; and when the picture difference percentage is smaller than a preset picture difference percentage threshold value, generating a detection result that the interface picture to be detected is qualified. And after the final detection result is obtained, the processor feeds back the detection result to the detector in a way of prompting voice or prompting characters. Preferably, the voice prompt with unqualified detection is generated according to the detection result with unqualified detection, so that a detector can notice the unqualified detection result, and further processing such as modification is performed.
Fig. 3 is a schematic structural diagram of an electronic device implementing a method for detecting color matching of a user interface according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a user interface match color detection program 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes of a user interface color matching detection program, but also to temporarily store data that has been output or is to be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the whole electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (e.g., user interface color matching detection programs, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 3 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The user interface match color detection program 12 stored in the memory 11 of the electronic device 1 is a combination of instructions that, when executed in the processor 10, may implement:
carrying out color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph; the user interface to be detected comprises a main graph and a background graph;
carrying out three-primary-color conversion processing on the primary color of the primary graph to obtain three-primary-color values of the primary graph;
calculating a color difference value between the three primary color values of the main picture and the pre-acquired three primary color values of the background picture of the user interface to be detected to obtain a picture difference percentage;
and comparing the picture difference percentage with a preset picture difference percentage threshold value by the user interface to be detected, and if the picture difference percentage is smaller than the preset picture difference percentage threshold value, generating a detection result that the user interface to be detected is qualified.
Specifically, the specific implementation method of the processor 10 for the instruction may refer to the description of the relevant steps in the embodiment corresponding to fig. 1, which is not described herein again. It should be emphasized that, in order to further ensure the privacy and security of the preset picture difference percentage threshold, the preset picture difference percentage threshold may also be stored in a node of a block chain.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method for detecting color matching of a user interface, which is applied to an electronic device, is characterized by comprising the following steps:
carrying out color analysis on a main graph of a user interface to be detected to obtain a main color of the main graph; the user interface to be detected comprises a main graph and a background graph;
carrying out three-primary-color conversion processing on the primary color of the primary graph to obtain three-primary-color values of the primary graph;
calculating a color difference value between the three primary color values of the main picture and the pre-acquired three primary color values of the background picture of the user interface to be detected to obtain a picture difference percentage;
and comparing the picture difference percentage with a preset picture difference percentage threshold, and if the picture difference percentage is smaller than the preset picture difference percentage threshold, generating a detection result that the user interface to be detected is qualified.
2. The method for detecting color matching of a user interface of claim 1, wherein before the color of the main graph of the user interface to be detected is analyzed to obtain the main color of the main graph, the method further comprises:
generating a user interface color matching detection instruction according to an interface compression packet corresponding to the user interface to be detected;
according to the user interface color matching detection instruction, decompressing an interface compression packet corresponding to the user interface to be detected to obtain a picture storage file of the user interface to be detected; the picture storage file of the user interface to be detected comprises a main picture and a background picture of the user interface to be detected.
3. The method for detecting color matching of a user interface of claim 2, wherein before the color of the main image of the user interface to be detected is analyzed to obtain the main color of the main image, the method further comprises:
extracting the main picture of the user interface to be detected from the picture storage file of the user interface to be detected according to the picture name of the main picture of the user interface to be detected; wherein,
the main picture is named with the picture name of the main picture in advance; the background picture is named with the picture name of the background picture in advance.
4. The method for detecting color matching of a user interface of claim 1, wherein the color analysis of the main graph of the user interface to be detected to obtain the main color of the main graph comprises:
performing HSV color conversion processing on the color of the main graph to obtain an HSV color model of the main graph; wherein the HSV color model comprises hue, saturation, and brightness;
carrying out impurity color filtering treatment on the HSV color model of the main map to obtain a main map color;
carrying out binarization processing on the main image color to obtain a black-and-white image of the main image; wherein, the white area in the black-and-white picture is the area where the main picture color in the main picture is located, and the black area in the black-and-white picture is the non-color area of the main picture from which the impurity color is filtered;
carrying out morphological corrosion expansion processing on the black-white image of the main image to eliminate noise in the black-white image so as to obtain a noise-free black-white image;
and counting the area of the white area in the black-and-white image without the noise point, and taking the main color corresponding to the white area with the largest area in the black-and-white image without the noise point as the main color of the main image.
5. The method for detecting color matching of a user interface according to claim 1, wherein the method for obtaining the three primary color values of the background image of the user interface to be detected comprises:
performing HSV color conversion treatment on the color of the background image to obtain an HSV color model of the background image; wherein the HSV color model comprises hue, saturation, and brightness;
carrying out impurity color filtering treatment on the HSV color model of the background image to obtain the color of the background image;
carrying out binarization processing on the background image color to obtain a black and white image of the background image; the white area in the black-and-white image is the area where the background image color in the background image is located, and the black area in the black-and-white image is the non-color area where the impurity color in the background image is filtered;
carrying out morphological corrosion expansion treatment on the black and white image of the background image to eliminate noise in the black and white image to obtain a noise-free black and white image;
counting the area of a white area in the noise-free black-and-white image, and taking the background image color corresponding to the white area with the largest area in the noise-free black-and-white image as the main color of the background image;
and carrying out three-primary color conversion processing on the main color of the background image to obtain three-primary color values of the main color of the background image.
6. The method for detecting color matching of a user interface according to claim 1, wherein the calculating a color difference value between the three primary color values of the main image and the pre-obtained three primary color values of the background image of the user interface to be detected to obtain a picture difference percentage comprises:
and carrying out sum of variance processing on three color components of the three primary color values of the main image and three color components of the three primary color values of the background image to obtain the difference percentage of the image.
7. The method for detecting color matching of a user interface according to claim 1, wherein the preset picture difference percentage threshold is stored in a block chain, the comparing the picture difference percentage with the preset picture difference percentage threshold, and if the picture difference percentage is smaller than the preset picture difference percentage threshold, after generating a detection result that the user interface to be detected is qualified, further comprising:
and if the picture difference percentage is larger than or equal to the preset picture difference percentage threshold value, generating a detection result that the user interface to be detected is unqualified, and generating a voice prompt that the detection is unqualified according to the detection result that the detection is unqualified.
8. A user interface color matching detection apparatus, the apparatus comprising:
the color analysis module is used for carrying out color analysis on a main graph of the user interface to be detected to obtain a main color of the main graph; the user interface to be detected comprises a main graph and a background graph;
the three-primary color conversion module is used for carrying out three-primary color conversion processing on the primary color of the primary graph to obtain a three-primary color value of the primary graph;
the picture difference percentage calculation module is used for calculating a color difference value between the three primary color values of the main graph and the pre-acquired three primary color values of the background graph of the user interface to be detected to obtain a picture difference percentage;
and the detection result generation module is used for comparing the picture difference percentage with a preset picture difference percentage threshold value, and if the picture difference percentage is smaller than the preset picture difference percentage threshold value, generating a detection result that the user interface to be detected is qualified.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the steps of the user interface color match detection method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, implements the user interface color matching detection method of any of claims 1 to 7.
CN202110738028.5A 2021-06-30 2021-06-30 User interface color matching detection method, device, equipment and storage medium Pending CN113362400A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110738028.5A CN113362400A (en) 2021-06-30 2021-06-30 User interface color matching detection method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110738028.5A CN113362400A (en) 2021-06-30 2021-06-30 User interface color matching detection method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113362400A true CN113362400A (en) 2021-09-07

Family

ID=77537397

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110738028.5A Pending CN113362400A (en) 2021-06-30 2021-06-30 User interface color matching detection method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113362400A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115357166A (en) * 2022-08-26 2022-11-18 重庆尚优科技有限公司 Intelligent management system for smart city map color matching

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201535A (en) * 2016-07-14 2016-12-07 广州神马移动信息科技有限公司 The method and apparatus that toolbar background color converts along with the domain color of picture
CN108108299A (en) * 2017-11-29 2018-06-01 厦门集微科技有限公司 A kind of ui testing method and device
CN110347524A (en) * 2019-05-28 2019-10-18 平安普惠企业管理有限公司 A kind of feedback method and device, storage medium, electronic equipment of exception information
CN111399965A (en) * 2020-04-16 2020-07-10 Oppo广东移动通信有限公司 User interface compatible display method and device, equipment and storage medium
CN112114929A (en) * 2020-09-29 2020-12-22 青岛海信移动通信技术股份有限公司 Display apparatus and image display method thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201535A (en) * 2016-07-14 2016-12-07 广州神马移动信息科技有限公司 The method and apparatus that toolbar background color converts along with the domain color of picture
CN108108299A (en) * 2017-11-29 2018-06-01 厦门集微科技有限公司 A kind of ui testing method and device
CN110347524A (en) * 2019-05-28 2019-10-18 平安普惠企业管理有限公司 A kind of feedback method and device, storage medium, electronic equipment of exception information
CN111399965A (en) * 2020-04-16 2020-07-10 Oppo广东移动通信有限公司 User interface compatible display method and device, equipment and storage medium
CN112114929A (en) * 2020-09-29 2020-12-22 青岛海信移动通信技术股份有限公司 Display apparatus and image display method thereof

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115357166A (en) * 2022-08-26 2022-11-18 重庆尚优科技有限公司 Intelligent management system for smart city map color matching

Similar Documents

Publication Publication Date Title
CN112446839B (en) Image enhancement method, image enhancement device, electronic equipment and computer readable storage medium
CN111652279B (en) Behavior evaluation method and device based on time sequence data and readable storage medium
CN111694844B (en) Enterprise operation data analysis method and device based on configuration algorithm and electronic equipment
CN115311167B (en) Color gamut control method, device and equipment based on multicolor light and storage medium
CN112508145A (en) Electronic seal generation and verification method and device, electronic equipment and storage medium
CN112579621A (en) Data display method and device, electronic equipment and computer storage medium
CN115860023A (en) Cigarette equipment management method and device based on two-dimensional code, electronic equipment and medium
CN113362400A (en) User interface color matching detection method, device, equipment and storage medium
CN114782405A (en) Bridge crack detection method and device based on image recognition and machine vision
CN115278186B (en) Controllable uniform projection method, device, equipment and medium based on Internet of things
CN114913518B (en) License plate recognition method, device, equipment and medium based on image processing
CN111277724A (en) Detection method and device for abnormal operation application, electronic equipment and storage medium
CN113822379B (en) Process process anomaly analysis method and device, electronic equipment and storage medium
CN113128440A (en) Target object identification method, device, equipment and storage medium based on edge equipment
CN113095284A (en) Face selection method, device, equipment and computer readable storage medium
CN112183520A (en) Intelligent data information processing method and device, electronic equipment and storage medium
CN112541899A (en) Incomplete certificate detection method and device, electronic equipment and computer storage medium
CN116109213B (en) Project security inspection method and system applied to construction scene and electronic equipment
JP2016224481A (en) Display screen test system
CN115100081B (en) LCD display screen gray scale image enhancement method, device, equipment and storage medium
CN113222873B (en) Image data enhancement method and device based on two-dimensional Gaussian distribution and storage medium
CN118172313A (en) Cervical digital slice image quality monitoring method and system
CN115205596A (en) Image classification method, device, equipment and storage medium
CN114723400B (en) Service authorization management method, device, equipment and storage medium
CN112101279B (en) Target object abnormality detection method, target object abnormality detection device, electronic equipment and storage medium

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
AD01 Patent right deemed abandoned

Effective date of abandoning: 20241008