WO2024041443A9 - 显示界面的测试方法及装置、存储介质、电子设备 - Google Patents

显示界面的测试方法及装置、存储介质、电子设备 Download PDF

Info

Publication number
WO2024041443A9
WO2024041443A9 PCT/CN2023/113522 CN2023113522W WO2024041443A9 WO 2024041443 A9 WO2024041443 A9 WO 2024041443A9 CN 2023113522 W CN2023113522 W CN 2023113522W WO 2024041443 A9 WO2024041443 A9 WO 2024041443A9
Authority
WO
WIPO (PCT)
Prior art keywords
image
display interface
matching relationship
screen image
original
Prior art date
Application number
PCT/CN2023/113522
Other languages
English (en)
French (fr)
Other versions
WO2024041443A1 (zh
Inventor
王镜茹
Original Assignee
京东方科技集团股份有限公司
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 京东方科技集团股份有限公司 filed Critical 京东方科技集团股份有限公司
Publication of WO2024041443A1 publication Critical patent/WO2024041443A1/zh
Publication of WO2024041443A9 publication Critical patent/WO2024041443A9/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/001Industrial image inspection using an image reference approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • 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

Definitions

  • the embodiments of the present disclosure relate to the field of automated testing technology, and in particular, to a display interface testing method, a display interface testing device, a computer-readable storage medium, and an electronic device.
  • the display interface of the display terminal needs to be tested manually.
  • manual testing will result in low testing efficiency and low accuracy of the test results.
  • a method for testing a display interface comprising:
  • the display interface of the display terminal is tested according to the first image matching relationship and the second image matching relationship.
  • calculating a first mean square error between the current screen image and the expected screen image, and determining a first image matching relationship between the current screen image and the expected screen image according to the first mean square error includes:
  • a first difference relationship between the first mean square error and a first preset threshold is calculated, and a first image matching relationship between the current screen image and the expected screen image is obtained according to the first difference relationship.
  • calculating a first difference map between the current screen image and the expected screen image, and determining a second image matching relationship between the current screen image and the expected screen image according to the first difference map includes:
  • Segmenting the first difference image based on a preset image segmentation algorithm to obtain a foreground image and a background image included in the first difference image, and calculating the number of non-zero pixels included in the foreground image;
  • a second image matching relationship between the current screen image and the expected screen image is obtained according to the number of non-zero pixels.
  • testing the display interface of the display terminal according to the first image matching relationship and the second image matching relationship includes:
  • the method for testing the display interface further includes:
  • an erasing function in the display interface of the display terminal is tested.
  • the method for testing the display interface further includes:
  • the first control matching relationship and the second control matching relationship between the touch area and the control screenshot are determined according to the third mean square error and the third difference map, and the touch function of the interactive control in the display interface of the display terminal is tested according to the first control matching relationship and the second control matching relationship.
  • the method for testing the display interface further includes:
  • the input function and/or machine learning function of the display interface of the display terminal is tested according to the content matching relationship.
  • calculating the sub-content image of each sub-content included in the standard content according to the fourth difference map includes:
  • the original content includes original graphics and/or original characters
  • the primitive shape includes any one or more of a rectangle, an ellipse, a triangle, a regular polygon and an irregular polygon.
  • the display interface testing method when the original graphic is a rectangle, after calculating the sub-content image of each sub-content included in the standard content according to the fourth difference map, the display interface testing method further includes:
  • the original graphic is determined to be a square.
  • the display interface testing method when the original graphic is an ellipse, after calculating the sub-content image of each sub-content included in the standard content according to the fourth difference map, the display interface testing method further includes:
  • the method for testing the display interface further includes:
  • the second original connected area is filtered to obtain a second target connected area, and the line input function of the display interface of the display terminal is tested based on the second target connected area.
  • the line input function includes at least one of a line color input function, a line smoothness input function, and a line width input function.
  • testing the line input function of the display interface of the display terminal based on the second target connected area includes:
  • the line color input function of the display interface of the display terminal is tested according to the color matching relationship.
  • testing the line input function of the display interface of the display terminal based on the second target connected area includes:
  • a line width matching relationship of the original line shape is calculated according to the second average value and the target line width of the original line shape, and a line width input function of the display interface of the display terminal is tested according to the line width matching relationship.
  • testing the line input function of the display interface of the display terminal based on the second target connected area includes:
  • the line smoothness matching relationship of the original line shape is calculated, and the line smoothness input function of the display interface of the display terminal is tested according to the line smoothness matching relationship.
  • the preset event input object includes a robotic arm.
  • a testing device for a display interface comprising:
  • a first image acquisition module used to acquire a current screen image of the display terminal and an expected screen image corresponding to the current screen image
  • a first calculation module configured to calculate a first mean square error between the current screen image and the expected screen image, and determine a first image matching relationship between the current screen image and the expected screen image according to the first mean square error
  • a second calculation module configured to calculate a first difference map between the current screen image and the expected screen image, and determine a second image matching relationship between the current screen image and the expected screen image according to the first difference map;
  • the display interface testing module is used to test the display interface of the display terminal according to the first image matching relationship and the second image matching relationship.
  • a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, the method for testing a display interface described in any one of the above is implemented.
  • an electronic device including:
  • a memory configured to store executable instructions of the processor
  • the processor is configured to execute any one of the above-mentioned display interface testing methods by executing the executable instructions.
  • FIG. 1 schematically shows a flow chart of a method for testing a display interface according to an exemplary embodiment of the present disclosure.
  • FIG. 2 schematically shows an example diagram of a display terminal according to an example embodiment of the present disclosure.
  • FIG. 3 schematically shows an example scene diagram of a non-dot grid writing background according to an example embodiment of the present disclosure.
  • FIG. 4 schematically shows an example scene diagram of a dot-grid writing background according to an example embodiment of the present disclosure.
  • FIG. 5 schematically shows a flow chart of a method for testing an erase function included in a display interface of a display terminal according to an exemplary embodiment of the present disclosure.
  • FIG. 6 schematically shows an example diagram of a scene of a target screen image including an erase area according to an example embodiment of the present disclosure.
  • FIG. 7 schematically shows a flow chart of a method for testing a touch function of an interactive control included in a display interface of a display terminal according to an exemplary embodiment of the present disclosure.
  • FIG8 schematically shows an example scene diagram of an interactive control in two different states according to an example embodiment of the present disclosure.
  • FIG9 schematically shows a flow chart of a method for testing an input function and/or a machine learning function of a display interface of a display terminal according to an exemplary embodiment of the present disclosure.
  • FIG. 10 schematically shows an example diagram of an original character and a standardized character according to an exemplary embodiment of the present disclosure.
  • FIG. 11 schematically shows an example scene diagram of a first initial cropping result according to an example embodiment of the present disclosure.
  • FIG. 12 schematically shows an example scene diagram of a first target cropping result according to an example embodiment of the present disclosure.
  • FIG. 13 schematically shows a flow chart of a method for testing a line input function of a display interface of a display terminal according to an exemplary embodiment of the present disclosure.
  • FIG. 14 schematically shows an example scene diagram of a specific shape of an original line according to an example embodiment of the present disclosure.
  • FIG. 15 schematically shows an example diagram of a square included in an original line according to an example embodiment of the present disclosure.
  • FIG. 16 schematically shows an example diagram of a scene of geodesic distance according to an example embodiment of the present disclosure.
  • FIG. 17 schematically shows a block diagram of a testing device for a display interface according to an example embodiment of the present disclosure.
  • FIG. 18 schematically shows an electronic device for implementing the above-mentioned display interface testing method according to an exemplary embodiment of the present disclosure.
  • this example implementation first provides a method for testing a display interface, which can be run on a display terminal, which can be used in various scenarios such as conferences, teaching, and business, and the smart interactive tablet has interactive functions such as touch, a large size (for example, generally larger than 50 inches), and is installed with software such as handwriting, wireless screen projection, and remote video conferencing; of course, those skilled in the art can also run the method disclosed in this disclosure on other platforms (for example, servers, server clusters, or cloud servers, etc.) as needed, and this exemplary embodiment does not specifically limit this.
  • the method for testing the display interface may include the following steps:
  • Step S110 Acquire a current screen image of the display terminal and an expected screen image corresponding to the current screen image
  • Step S120 Calculate a first mean square error between the current screen image and the expected screen image, and determine a first image matching relationship between the current screen image and the expected screen image according to the first mean square error;
  • Step S130 Calculate a first difference map between the current screen image and the expected screen image, and determine a second image matching relationship between the current screen image and the expected screen image according to the first difference map;
  • Step S140 Testing the display interface of the display terminal according to the first image matching relationship and the second image matching relationship.
  • the display function of the display interface of the display terminal can be tested according to the first image matching relationship and the second image matching relationship between the current screen image and the expected screen image, automatic testing of the display interface of the display terminal is realized, and the problem of low testing efficiency caused by manual testing in the prior art is solved; on the other hand, by calculating the first mean square error between the current screen image and the expected screen image, and determining the first image matching relationship between the current screen image and the expected screen image according to the first mean square error; then calculating the first difference map between the current screen image and the expected screen image, and determining the second image matching relationship between the current screen image and the expected screen image according to the first difference map; finally, according to the first image matching relationship and the second image matching relationship, the display interface of the display terminal is tested. Since the first image matching relationship and the second image matching relationship are considered at the same time in the process of testing the display interface, the problem of low accuracy of the test result caused by considering only one image matching relationship can be avoided,
  • the display terminal 200 may include a display (front end) 210, a processor (back end, which is provided with a corresponding algorithm, and therefore may also be referred to as the bottom layer of the algorithm) 220, and an input component, which may include a touch component;
  • the processor may include a processor provided on a cloud server, or may include a local processor provided on a smart interactive tablet, and this example does not impose any special restrictions on this.
  • the display interface testing method recorded in the example embodiment of the present disclosure can test the display function of the display interface of the display terminal.
  • it can also test the erasing function of the display interface, the touch function of the interactive controls included in the display interface, the graphic beautification function of the display interface of the display terminal (that is, the AI algorithm recognition function) and the line input function of the display interface of the display terminal; of course, in actual application, other functions of the display interface of the display terminal can also be tested, and this example does not impose any special restrictions on this.
  • step S110 a current screen image of the display terminal and an expected screen image corresponding to the current screen image are acquired.
  • the front end can pass the expected content image (the expected screen image corresponding to the current screen image) and the current screen of the all-in-one machine (the current screen image) to the algorithm bottom layer; that is, the algorithm bottom layer (processor) can obtain the current screen image of the display terminal and the expected screen image corresponding to the current screen image from the front end.
  • the current screen image may include those shown in Figures 3 and 4.
  • the current screen image shown in FIG3 it is a non-dot grid writing background, that is, a normal writing background board; in the current screen image shown in FIG4 , it is a dot grid writing background; at the same time, in the current screen images shown in FIG3 and FIG4 , the corresponding interactive control area 301 and the interactive control area 401 are displayed below the current screen image, and the interactive controls displayed in the interactive control area may include but are not limited to: color interactive controls, erase interactive controls, delete interactive controls, withdraw interactive controls, line interactive controls, handwriting interactive controls, etc. In the specific application process, the corresponding interactive controls can be selected according to actual needs, and this example does not impose any special restrictions on this.
  • step S120 a first mean square error between the current screen image and the expected screen image is calculated, and a first image matching relationship between the current screen image and the expected screen image is determined according to the first mean square error.
  • calculating a first mean square error between the current screen image and the expected screen image, and determining a first image matching relationship between the current screen image and the expected screen image based on the first mean square error can be achieved in the following manner: first, obtaining a first pixel value of a first pixel point included in the current screen image, and a second pixel value of a second pixel point of the expected screen image; secondly, calculating a pixel difference between the first pixel value and a second pixel value of a second pixel point corresponding to the first pixel point, and calculating the first mean square error based on the pixel difference; then, calculating a first difference relationship between the first mean square error and a first preset threshold, and obtaining a first image matching relationship between the current screen image and the expected screen image based on the first difference relationship.
  • the mean square error can be represented by MSE.
  • the mean square error can be used to characterize the average sum of the squares of the distances of each data from the true value, that is, the average sum of the squares of the errors.
  • the specific calculation formula of the first mean square error can be shown in the following formula (1):
  • n is the number of pixels included in the current screen image and/or the expected screen image
  • X csi,i is the first pixel value of the i-th first pixel in the current screen image (Current Screen Image)
  • X dsi,i is the second pixel value of the i-th second pixel in the desired screen image (Desired Screen Image).
  • the first image matching relationship can be determined according to the first mean square error; wherein, in a specific application process, when the first mean square error is less than a preset first preset threshold (the threshold can be set to an empirical value of 10 in the exemplary embodiment of the present disclosure), it is considered that the two page images (the current screen image and the desired screen image) may have a first image matching relationship. That is, if the absolute value of the first difference relationship between the first mean square error and the first preset threshold is less than or equal to 0.05 or 0.1, it can be determined that the first image matching relationship exists.
  • a preset first preset threshold the threshold can be set to an empirical value of 10 in the exemplary embodiment of the present disclosure
  • step S130 a first difference map between the current screen image and the expected screen image is calculated, and a second image matching relationship between the current screen image and the expected screen image is determined according to the first difference map.
  • calculating a first difference map between the current screen image and the expected screen image, and determining a second image matching relationship between the current screen image and the expected screen image based on the first difference map can be achieved in the following manner: first, when it is determined that the first image matching relationship exists, generating a first difference map between the current screen image and the expected screen image based on the pixel difference; second, segmenting the first difference map based on a preset image segmentation algorithm to obtain a foreground image and a background image included in the first difference map, and calculating the number of non-zero pixels included in the foreground image; and then, obtaining a second image matching relationship between the current screen image and the expected screen image based on the number of non-zero pixels.
  • the two images when it is determined that there is a first image matching relationship between the current screen image and the expected screen image, the two images can be considered to be two images that are likely to match; therefore, in order to further improve the accuracy of the test results, when it is determined that the first image matching relationship exists, a first difference map between the current screen image and the expected screen image can be calculated; wherein, in the process of calculating the first difference map, the first pixel value of the first pixel point included in the current screen image can be subtracted from the second pixel value of the second pixel point included in the expected screen image, and then the first difference map between the current screen image and the expected screen image can be obtained based on the difference between the first pixel value and the second pixel value; after the first difference map is obtained, the grayscale conversion can be performed on the first difference map, and then the first difference map after the grayscale processing can be processed based on a preset image segmentation algorithm.
  • the value map is segmented to obtain the foreground image and the background image included in the first difference map; wherein, the preset image segmentation algorithm recorded here can be the maximum between-class variance method (OTSU algorithm), of course, it can also be other algorithms, such as Gaussian filtering algorithm, etc., and this example does not impose special restrictions on this; further, after obtaining the foreground image, the number of non-zero pixels included in the foreground image can be counted, and finally, according to the number of non-zero pixels, the second image matching relationship between the current screen image and the expected screen image is obtained; wherein, if the number of non-zero pixels is less than a preset threshold value (the example embodiment of the present disclosure sets the preset threshold value to an empirical value of 500), it is considered that the two page images do have a matching relationship (the second image matching relationship exists), and then it can be considered that the current screen image matches the expected screen image successfully.
  • a preset threshold value the example embodiment of the present disclosure sets the preset threshold value to
  • the first image matching relationship and the second image matching relationship may also be calculated separately, that is, regardless of whether the first image matching relationship exists, the second image matching relationship is calculated, and finally corresponding tests are performed based on the first image matching relationship and the second image matching relationship.
  • step S140 the display interface of the display terminal is tested according to the first image matching relationship and the second image matching relationship.
  • the display interface of the display terminal is tested according to the first image matching relationship and the second image matching relationship, which can be specifically implemented in the following manner: on the one hand, when it is determined that the first image matching relationship exists and the second image matching relationship exists, it is determined that the display function test of the display interface of the display terminal has passed; on the other hand, when it is determined that the first image matching relationship does not exist or the second image matching relationship does not exist, it is determined that the display function test of the display interface of the display terminal has not passed.
  • the display effect of the current screen image displayed on the display interface of the display terminal is consistent with the desired display effect of the current screen image, and it can be considered that the display function of the display interface of the display terminal has no problem and the test has passed; if any image matching relationship does not exist, it can be considered that there is a problem with the display function of the display interface and the test has failed; if the test has failed, the display interface in the display can be corrected.
  • FIG5 schematically shows a flow chart of a method for testing an erase function included in a display interface of a display terminal according to an exemplary embodiment of the present disclosure. Specifically, referring to FIG5 , the method may include the following steps:
  • Step S510 in response to an erasing event caused by a preset event input object acting on a preset area in the display interface, the preset area is erased to obtain a target screen image including the erased area.
  • the preset event input object recorded here can be, for example, a robotic arm, and of course it can also be other input objects, such as an external input device, a finger, or a wireless stylus, etc.
  • This example does not impose any special restrictions on this; the corresponding event input is performed through a robotic arm here in order to weaken the human factors in the test process of the display interface of the display terminal, thereby achieving the goal of improving test efficiency and reducing labor costs on the basis of improving the accuracy of test results.
  • the range of the erasing area can be set and sent to the control unit of the robotic arm, and then the robotic arm is controlled to erase the range of the set erasing area in the display interface; wherein the obtained target screen image including the erasing area can be specifically shown in Figure 6.
  • Step S520 acquiring the erased area in the target screen image and the original area in the display interface corresponding to the preset area, and calculating a second mean square error and a second difference map between the erased area and the original area.
  • the display front end
  • the display can pass the erased page (including the target screen image of the erased area), the original unwritten page (display interface) and the corner point coordinates of the specified erased area to the algorithm bottom layer (processor); then, the processor crops the erased area and the original area, and calculates the second mean square error and the second difference map between the erased area and the original area; wherein, the specific calculation process of the second mean square error and the second difference map is similar to the specific calculation process of the first mean square error and the first difference map, and will not be repeated here.
  • Step S530 determining a first region matching relationship and a second region matching relationship between the erased region and the preset region according to the second mean square error and the second difference map.
  • the specific process of determining the first region matching relationship and the second region matching relationship is similar to the specific process of determining the first image matching relationship and the second image matching relationship, and will not be further elaborated here.
  • Step S540 testing the erase function of the display interface of the display terminal according to the first area matching relationship and the second area matching relationship.
  • the erase function test in the display interface of the display terminal has passed, that is, in the specific application process, the erase function can be executed normally; if either the first area matching relationship or the second area matching relationship does not exist, it is determined that the erase function test in the display interface of the display terminal has failed, and if it fails, further correction is required.
  • FIG7 schematically shows a flow chart of a method for testing the touch function of an interactive control included in a display interface of a display terminal according to an exemplary embodiment of the present disclosure. Specifically, referring to FIG7 , the method may include the following steps:
  • Step S710 obtaining a control screenshot corresponding to the interactive control included in the interactive interface, and matching a template page image of the interactive control corresponding to the control screenshot in a preset image template library.
  • the front end can capture a control screenshot of one or more interactive controls to be tested included in the display interface, and send the spatial screenshot of the one or more interactive controls to be tested and the display interface including the one or more interactive controls to be tested to the processor, and then the processor will match the template page image corresponding to the control screenshot in the preset image template library.
  • the interactive control can include two states, one is the selected state and the other is the unselected state; therefore, when sending the control screenshot of the interactive control to be tested, the control screenshots of both states can be sent to the processor.
  • the specific state diagram of the interactive controls in two different states can be referred to as shown in Figure 8; among them, the selected state can be referred to as shown in 801, and the unselected state can be referred to as shown in 802.
  • Step S720 obtaining the coordinate position of the interactive control in the template page image, and sending the coordinate position to a preset event input object.
  • the coordinate position of the interactive control in the template page image can be obtained, and then the coordinate position is sent to the preset event input object;
  • the preset event input object can be a robotic arm; of course, it can also be other input objects, such as external input devices, fingers, or wireless stylus pens, etc., and this example does not impose special restrictions on this; the corresponding event input is performed through a robotic arm here in order to weaken the human factors in the test process of the display interface of the display terminal, thereby achieving the improvement of test efficiency and reduction of labor costs on the basis of improving the accuracy of test results.
  • Step S730 in response to a touch event of the preset event input object based on the coordinate position in the display interface, obtaining a touch area corresponding to the touch event, and calculating a third mean square error and a third difference map between the touch area and the control screenshot.
  • the robotic arm after the above-mentioned coordinate position, it can touch the area corresponding to the coordinate position in the display interface based on the coordinate position; then, the front end can obtain the touch area and send the touch area to the processor; after the processor receives the touch area, it can calculate the third mean square error and the third difference map between the touch area and the control screenshot to date; wherein, the specific calculation process of the third mean square error and the third difference map is similar to the calculation process of the first mean square error and the first difference map, and will not be further elaborated here.
  • control screenshot can include a screenshot of the control in a selected state and a screenshot of the control in an unselected state, therefore, in the specific calculation process, it is necessary to calculate the corresponding third mean square error and third difference map respectively.
  • Step S740 determining a first control matching relationship and a second control matching relationship between the touch area and the control screenshot according to the third mean square error and the third difference map, and testing the touch function of the interactive control in the display interface of the display terminal according to the first control matching relationship and the second control matching relationship.
  • the first control matching relationship and the second control matching relationship can be calculated; wherein, the specific calculation process of the first control matching relationship and the second control matching relationship is similar to the specific calculation process of the first image matching relationship and the second image matching relationship, and will not be further repeated here; at the same time, after obtaining the first control matching relationship and the second control matching relationship, the touch function of the interactive control in the display interface of the display terminal can be tested; wherein, if both the first control matching relationship and the second control matching relationship exist, it is determined that the touch function test of the interactive control in the display interface of the display terminal has passed, that is, normal interaction can be carried out; if either the first control matching relationship or the second control matching relationship does not exist, it is considered that the touch function test of the interactive control in the display interface of the display terminal has failed, and further correction of the touch function of the interactive control is required.
  • the method for automatically verifying the function buttons on the all-in-one machine page shown in FIG7 supports the rapid identification of the location of the specified button.
  • the front end passes the screenshots to be identified and the specified button screenshots to the bottom layer of the algorithm. Since the button display is generally divided into two states, selected and unselected, the screenshots in both states can be passed; at the same time, the bottom layer of the algorithm uses the button screenshots to perform template matching on the screen page.
  • the matching score reaches a preset threshold (the specific threshold can be set to an empirical value of 0.99)
  • the button location is found; further, the algorithm layer passes the coordinates of the upper left and lower right corners of the matched button area to the robot controller to control the robot to click the button; and then with the page verification function, it can realize the automatic test of whether the button click function is normal.
  • FIG9 schematically shows a flow chart of a method for testing an input function and/or a machine learning function of a display interface of a display terminal according to an exemplary embodiment of the present disclosure. Specifically, referring to FIG9 , the method may include the following steps:
  • Step S910 in response to a first input event in which a preset event input object acts on the display interface to input preset content, original content corresponding to the first input event is generated, and the original content is standardized to obtain standard content.
  • the display terminal i.e., conference all-in-one machine, or all-in-one machine recorded in the exemplary embodiment of the present disclosure provides an AI (Artificial Intelligence) graphic or character recognition function, and the AI algorithm can recognize handwritten graphics or characters and replace them with beautified graphic templates or character templates. Therefore, in the process of testing the AI function, first, in response to the first input event of inputting preset content by the preset time input object acting on the display interface, the original content corresponding to the first input event can be generated; wherein, the preset event input object is a mechanical arm, and the original content can include original graphics, original characters, etc.
  • AI Artificial Intelligence
  • the original graphics can include rectangles, ellipses, triangles, regular polygons, irregular polygons, etc., and of course, other content can also be included, and this example does not impose special restrictions on this.
  • the original content can be standardized to obtain standard content; wherein, taking the original content as the original character as an example, the original character and the standardized character can refer to Figure 10.
  • Step S920 Calculate a fourth difference map between the first target interface including the target content and the display interface, and calculate a sub-content image of each sub-content included in the standard content according to the fourth difference map.
  • a fourth difference map between a first target interface including target content and a display interface is calculated; wherein a specific calculation process of the fourth difference map is similar to that of the first difference map and is not repeated here; further, after obtaining the first difference map, a sub-content image of each sub-content included in the standard content can be calculated according to the fourth difference map.
  • the specific calculation process can be implemented in the following manner: first, grayscale conversion is performed on the fourth difference image to obtain a first binary difference image, and the first binary difference image is segmented using a preset image segmentation algorithm to obtain a first segmented black-and-white image; second, a first original connected area included in the first segmented black-and-white image is obtained, and the first original connected area is filtered to obtain a first target connected area; then, the first target connected area is cropped from the first segmented black-and-white image to obtain a first initial cropping result, and the first pixel point whose third pixel value is greater than a second preset threshold in the first initial cropping result is searched based on a first preset search direction; finally, region growing is performed with the first pixel point as a seed point, and the internal area of the graphic contour of the first initial cropping result is filled to obtain a first target cropping result, and the size of the first target cropping result is adjusted to obtain a sub-content image of each sub-content included in
  • the fourth difference image in the specific calculation process of the sub-content image, first, the fourth difference image can be converted into a grayscale image and then binary segmented using the OTSU algorithm to obtain a first segmented black-and-white image; second, the first original connected area is extracted from the first segmented black-and-white image, and connected areas with an area smaller than a specified threshold (in this example embodiment, the threshold can be set to an empirical value of 600) are filtered out to obtain a first target connected area; further, the areas corresponding to all the first target connected areas are cropped from the entire black-and-white image to obtain a first initial cropping result; wherein the first initial cropping result obtained can specifically refer to As shown in Figure 11; further, for the first initial cropping result corresponding to each first target connected area, the first pixel point whose third pixel value is not zero in the first initial cropping result is searched from top to bottom (first preset search direction); further, region growing is started with the first pixel point as the seed point to fill the internal area of the graphic
  • the testing method of the display interface further includes: first, obtaining the length value of the long side and the length value of the wide side of the rectangle, and calculating a first ratio between the length value of the long side and the length value of the wide side; secondly, when it is determined that the first ratio is greater than a third preset threshold, or less than a fourth preset threshold, determining that the original graphic is a rectangle; finally, when it is determined that the first ratio is between the third preset threshold and the fourth preset threshold, determining that the original graphic is a square.
  • the testing method of the display interface when the original graphic is an ellipse, after calculating the sub-content image of each sub-content included in the standard content according to the fourth difference map, the testing method of the display interface also includes: first, obtaining the length value of the first diameter of the ellipse in the ordinate direction and the length value of the second diameter in the abscissa direction, and calculating the second ratio between the length value of the first diameter and the length value of the second diameter; secondly, when it is determined that the first ratio is greater than a third preset threshold, or less than a fourth preset threshold, determining that the original graphic is an ellipse; finally, when it is determined that the first ratio is between the third preset threshold and the fourth preset threshold, determining that the original graphic is a circle.
  • the example embodiment of the present disclosure does not differentiate between squares and rectangles, circles and ellipses in the above recognition process; instead, after obtaining the recognition result, it differentiates according to the aspect ratio of the cropped result image, and considers that a square with an aspect ratio greater than a specified threshold (the third preset threshold set in the example embodiment of the present disclosure may be an empirical value of 0.9, and the fourth preset threshold may be an empirical value of 1.1) is a rectangle, and a circle is an ellipse; the differentiation based on this method is simple and effective, and in the preliminary recognition process, it only needs to compare the target graphic with the square and circle templates respectively, which saves the amount of calculation.
  • a specified threshold the third preset threshold set in the example embodiment of the present disclosure may be an empirical value of 0.9, and the fourth preset threshold may be an empirical value of 1.1
  • Step S930 calculating a fourth mean square error between the sub-content image and a sub-template image of a sub-template content corresponding to the sub-content in the preset content, and determining a content matching relationship between the sub-content image and the sub-template image according to the fourth mean square error.
  • the fourth mean square error between the sub-content image and the sub-template image can be calculated, and then the fourth mean square error between the sub-content image and the sub-template image can be determined according to the fourth mean square error; wherein, the size of the character template image is consistent with the size of the sub-content image, which can be 256*256, and of course it can also be of other sizes, and this example does not impose special restrictions on this; at the same time, the specific calculation process of the fourth mean square error is similar to the specific calculation process of the first mean square error, which will not be repeated here; further, after the fourth mean square error is obtained, the content matching relationship between the sub-content image and the character template image can be determined according to the fourth mean square error; wherein, in the process of determining the content matching relationship, if the fourth mean square error is less than the specified threshold, it can be considered that the content matching relationship exists, that is, it can be considered that the image drawn by the robot arm is the corresponding template figure; wherein,
  • Step S940 testing the input function and/or machine learning function of the display interface of the display terminal according to the content matching relationship.
  • the input function and/or machine learning function of the display interface of the display terminal can be tested according to the content matching relationship; that is, if the content matching relationship exists, it can be considered that the input function and/or machine learning function of the display interface of the display terminal has passed the test, and in actual application, input can be performed and converted into standard graphics or standard characters for display; if the content matching relationship does not exist, it is considered that the input function and/or machine learning function of the display interface of the display terminal has failed the test and further correction is required.
  • FIG13 schematically shows a flow chart of a method for testing a line input function of a display interface of a display terminal according to an exemplary embodiment of the present disclosure. Specifically, referring to FIG13 , the method may include the following steps:
  • Step S1310 in response to a second input event in which a preset event input object acts on the display interface to input a line shape, an original line shape corresponding to the second input event is generated.
  • the example embodiment of the present disclosure also provides a function of checking the handwritten lines on the all-in-one machine, so as to test the line input function in the all-in-one machine, so as to ensure that when the user uses the all-in-one machine, when inputting lines, the functions such as line color, line smoothness and line width can be guaranteed.
  • the mechanical arm preset event input object
  • the mechanical arm can be controlled to write in the specified area on the all-in-one machine screen; wherein, in the process of line input, one mechanical arm input can be controlled, or multiple mechanical arms input can be controlled at the same time, and this example does not impose special restrictions on this; further, when the display receives the line input event (second input event) of the mechanical arm, the original line shape corresponding to the second input event can be generated; wherein, the original line shape can be specifically shown in Figure 14.
  • Step S1320 calculating a fifth difference map between the second target interface including the original line shape and the display interface, and binarizing the fifth difference map to obtain a second binary difference map.
  • the display can send the second target interface including the original line shape and the display interface (the original unwritten screenshot) to the algorithm bottom layer, wherein the processing flow of the algorithm bottom layer is: calculate the fifth difference map of the two images (the second target interface and the display interface); wherein the specific calculation process of the fifth difference map is similar to the specific calculation process of the first difference map, and will not be further elaborated here; then, the fifth difference map is binarized (that is, grayscale processed) to obtain a second binary difference map.
  • Step S1330 perform image segmentation on the second binary difference image using a preset image segmentation algorithm to obtain a second segmented black-and-white image, and obtain a second original connected region included in the second segmented black-and-white image.
  • the preset image segmentation algorithm (maximum between-class variance OTSU algorithm) can be used to perform image segmentation on the second binary difference map to obtain a second segmented black-and-white image; then, the second original connected area included in the second segmented black-and-white image is extracted.
  • Step S1340 filtering the second original connected area to obtain a second target connected area, and testing the line input function of the display interface of the display terminal based on the second target connected area; wherein the line input function includes at least one of a line color input function, a line smoothness input function, and a line width input function.
  • the second original connected area can be filtered to filter out the second original connected area whose area is smaller than a specified threshold (the specified threshold can be set to an empirical value of 600 or other values, and this example does not impose any special restrictions on this) to obtain the second target connected area.
  • the line input function of the display interface of the display terminal can be tested based on the second target connected area. Among them, the line input function can be tested in the following aspects:
  • the line input function is a line color input function
  • the line input function of the display interface of the display terminal is tested based on the second target connected area, which can be implemented as follows: first, traverse each pixel point inside the area corresponding to the second target interface and the second target connected area, obtain the fourth pixel value of each pixel point inside the area, and calculate the first average value of the fourth pixel value; second, calculate the color matching relationship of the original line shape according to the first average value of the fourth pixel value and the target pixel value of the original line shape; finally, test the line color input function of the display interface of the display terminal according to the color matching relationship.
  • the fourth pixel value of each pixel point inside the area in the writing screenshot image can be traversed, the mean of the three color channels of all pixels can be calculated (that is, the first average value of all fourth pixel values is calculated), and the extracted color value is compared with the target pixel value of the original line shape to obtain the color matching relationship, and the line color input function of the display interface of the display terminal is tested based on the color matching relationship.
  • the mean square error and/or difference map between the first average value and the target pixel value can be calculated to determine the color matching relationship; at the same time, if the color matching relationship exists, it can be determined that the line color input function test has passed; if the color matching relationship does not exist, it can be determined that the line color input function test has failed; if the test fails, it needs to be calibrated again.
  • the line input function is a line width input function
  • the line input function of the display interface of the display terminal is tested based on the second target connected area, which can be achieved in the following manner: first, the second target connected area is cropped from the second segmented black-and-white image to obtain a second initial cropping result, and the first pixel point whose fifth pixel value is greater than a second preset threshold value in the second initial cropping result is scanned based on a second preset search direction and a preset pixel width; secondly, the sixth pixel value and the seventh pixel value of two pixel points adjacent to the first pixel point in the horizontal position are obtained, and a target drawing direction is determined according to the sixth pixel value and the seventh pixel value; then, a square that meets the preset conditions is drawn based on the target drawing direction, and a second average value of the side length of the square that meets the preset conditions is calculated; finally, a line width matching relationship of the original line shape is calculated based on the second average value and the
  • the corresponding area can be cut out from the black-back image after the second segmentation to obtain a second initial cutting result; then, the second initial cutting result is scanned every 10pix (preset pixel width) from left to right (second preset search direction) to find the first non-zero pixel on each scan line; check the pixel values on both sides of the first pixel in the horizontal direction (the sixth pixel value and the seventh pixel value), and select a non-zero direction (target drawing direction, if the left pixel is not zero, then to the lower left, and vice versa) to draw the largest (preset condition) square, so that the square falls entirely within the line area; as shown in Figure 15, for all scanned squares, the second average value of the lengths of all positive directions is calculated as the line width; further, the line width matching relationship of the original line shape can be calculated based on the second average value and the target line width, and the line width input function of the display interface of the display terminal can be
  • the line input function is a line smoothness input function
  • the line input function of the display interface of the display terminal is tested based on the second target connected area, which can be implemented in the following manner: first, the first pixel point whose sixth pixel value is greater than the second preset threshold in the second initial cropping result is searched based on the first preset search direction, and the first pixel point whose sixth pixel value is greater than the second preset threshold in the second initial cropping result is used as the target pixel point; second, the first geodesic distance between all the pixels included in the second initial cropping result and the target pixel point is calculated, and the first endpoint of the original line shape is determined from all the pixels according to the first geodesic distance; then, the second geodesic distance between all the pixels included in the second initial cropping result and the first endpoint is calculated, and the second endpoint of the original line shape is determined from all the pixels according to the second geodesic distance; finally, the line smoothness matching relationship of the original line shape is calculated according to the endpoint position
  • testing the line flow input function in the line input function can also be understood as checking the endpoints of the line.
  • the corresponding second target connected area is cut out from the second segmented black-and-white image to obtain a second initial cut result; then, the first pixel point whose pixel value is not 0 (which can also be understood as a pixel point whose pixel value is greater than zero) in the second initial cut result is searched from top to bottom (first preset search direction), and the first pixel point is used as the target pixel point; further, the first geodesic distance between all points of the second initial cut result and the target pixel point is calculated (wherein, the first geodesic distance can be specifically referred to as shown in Figure 16); the point farthest from the first geodesic distance of the target pixel point is an endpoint of the line (that is, the first endpoint); then, the second geodesic distance between all pixels in the figure and the first
  • Geodesic comes from geodesy, which is a discipline that measures the size and shape of the earth.
  • the original meaning of geodesic is the shortest path between two points on the earth's surface. Therefore, Geodesic Distance originally refers to the shortest distance between two points on the earth's surface, but then this concept was extended to the measurement of mathematical space. For example, in graph theory, Geodesic Distance is the shortest path between two nodes in a graph, which is different from the Euclidean Distance commonly used in geometric space, that is, the shortest distance between two points.
  • the Euclidean Distance of the two black points is the length d15 of the line segment represented by the dotted line
  • the Geodesic Distance as the shortest distance of the actual path, should be the minimum sum of the distances of the solid line segments along the way, that is, d12+d23+d34+d45;
  • the Geodesic Distance is the distance between two vertices along the shortest path of the grid surface; in addition, to calculate the Geodesic Distance of two points in a three-dimensional point cloud, we must first use all the points in the point cloud to construct a graph with a surface structure similar to a grid, and then find the shortest path between the two points in the graph to calculate the Geodesic Distance.
  • the test method of the display interface recorded in the exemplary embodiment of the present disclosure has at least the following advantages: on the one hand, the test method of the display interface recorded in the exemplary embodiment of the present disclosure can be a method for automatically proofreading the all-in-one machine page, which can not only quickly confirm whether the display of the function pages at all levels is accurate, but also support the verification of the erase function of the writing page; on the other hand, the test method of the display interface recorded in the exemplary embodiment of the present disclosure can be an automatic verification method for the function buttons on the all-in-one machine page, supporting the rapid identification of the location of the specified button, thereby controlling the robot arm to perform the point selection operation; on the other hand, the test method of the display interface recorded in the exemplary embodiment of the present disclosure can recognize the beautification graphics on the all-in-one machine; at the same time, for the AI graphic recognition function on
  • the display interface test device may include a first image acquisition module 1710, a first calculation module 1720, a second calculation module 1730, and a display interface test module 1740. Among them:
  • the first image acquisition module 1710 may be used to acquire a current screen image of the display terminal and an expected screen image corresponding to the current screen image;
  • a first calculation module 1720 may be used to calculate a first mean square error between the current screen image and the expected screen image, and determine a first image matching relationship between the current screen image and the expected screen image according to the first mean square error;
  • the second calculation module 1730 may be used to calculate a first difference map between the current screen image and the expected screen image, and determine a second image matching relationship between the current screen image and the expected screen image according to the first difference map;
  • the display interface testing module 1740 may be configured to test the display interface of the display terminal according to the first image matching relationship and the second image matching relationship.
  • calculating a first mean square error between the current screen image and the expected screen image, and determining a first image matching relationship between the current screen image and the expected screen image according to the first mean square error includes:
  • a first difference relationship between the first mean square error and a first preset threshold is calculated, and a first image matching relationship between the current screen image and the expected screen image is obtained according to the first difference relationship.
  • calculating a first difference map between the current screen image and the expected screen image, and determining a second image matching relationship between the current screen image and the expected screen image according to the first difference map includes:
  • Segmenting the first difference image based on a preset image segmentation algorithm to obtain a foreground image and a background image included in the first difference image, and calculating the number of non-zero pixels included in the foreground image;
  • a second image matching relationship between the current screen image and the expected screen image is obtained according to the number of non-zero pixels.
  • testing the display interface of the display terminal according to the first image matching relationship and the second image matching relationship includes:
  • the testing device for the display interface further includes:
  • a first event response module may be used to respond to an erasure event caused by a preset event input object acting on a preset area in the display interface, erase the preset area, and obtain a target screen image including the erased area;
  • a third calculation module may be used to obtain an erased area in the target screen image and an original area in the display interface corresponding to the preset area, and calculate a second mean square error and a second difference map between the erased area and the original area;
  • a fourth calculation module which may be used to determine a first region matching relationship and a second region matching relationship between the erased region and the preset region according to the second mean square error and the second difference map;
  • the erasing function testing module may be used to test the erasing function in the display interface of the display terminal according to the first area matching relationship and the second area matching relationship.
  • the testing device for the display interface further includes:
  • the template page image matching module can be used to obtain a control screenshot corresponding to the interactive control included in the interactive interface, and match the template page image of the interactive control corresponding to the control screenshot in a preset image template library;
  • a coordinate position sending module can be used to obtain the coordinate position of the interactive control in the template page diagram and send the coordinate position to a preset event input object;
  • a second event response module may be configured to respond to a touch event of the preset event input object based on the coordinate position in the display interface, obtain a touch area corresponding to the touch event, and calculate a third mean square error and a third difference map between the touch area and the control screenshot;
  • the touch function testing module can be used to determine the first control matching relationship and the second control matching relationship between the touch area and the control screenshot based on the third mean square error and the third difference map, and test the touch function of the interactive control in the display interface of the display terminal based on the first control matching relationship and the second control matching relationship.
  • the testing device for the display interface further includes:
  • a third event response module may be configured to respond to a first input event in which a preset event input object acts on the display interface to input preset content, generate original content corresponding to the first input event, and perform standardization processing on the original content to obtain standard content;
  • a fifth calculation module which may be used to calculate a fourth difference map between the first target interface including the target content and the display interface, and calculate a sub-content image of each sub-content included in the standard content according to the fourth difference map;
  • a sixth calculation module which may be used to calculate a fourth mean square error between the sub-content image and a sub-template image of a sub-template content corresponding to the sub-content in the preset content, and determine a content matching relationship between the sub-content image and the sub-template image according to the fourth mean square error;
  • the input function testing module can be used to test the input function and/or machine learning function of the display interface of the display terminal according to the content matching relationship.
  • calculating the sub-content image of each sub-content included in the standard content according to the fourth difference map includes:
  • the original content includes original graphics and/or original characters
  • the primitive shape includes any one or more of a rectangle, an ellipse, a triangle, a regular polygon and an irregular polygon.
  • the sixth calculation module can also be configured to: obtain the length value of the long side and the length value of the wide side of the rectangle, and calculate the first ratio between the length value of the long side and the length value of the wide side; when it is determined that the first ratio is greater than a third preset threshold, or less than a fourth preset threshold, determine that the original graphic is a rectangle; when it is determined that the first ratio is between the third preset threshold and the fourth preset threshold, determine that the original graphic is a square.
  • the sixth calculation module can also be configured to: obtain the length value of the first diameter of the ellipse in the longitudinal direction and the length value of the second diameter in the horizontal direction, and calculate the second ratio between the length value of the first diameter and the length value of the second diameter; when it is determined that the first ratio is greater than a third preset threshold, or less than a fourth preset threshold, determine that the original figure is an ellipse; when it is determined that the first ratio is between the third preset threshold and the fourth preset threshold, determine that the original figure is a circle.
  • the testing device for the display interface further includes:
  • a fourth event response module may be configured to generate an original line shape corresponding to a second input event in which a preset event input object acts on the display interface to input a line shape;
  • a seventh calculation module which may be used to calculate a fifth difference map between the second target interface including the original line shape and the display interface, and to perform a binarization process on the fifth difference map to obtain a second binary difference map;
  • an eighth calculation module which may be used to perform image segmentation on the second binary difference image using a preset image segmentation algorithm to obtain a second segmented black-and-white image, and obtain a second original connected region included in the second segmented black-and-white image;
  • the line input function testing module may be used to filter the second original connected area to obtain a second target connected area, and test the line input function of the display interface of the display terminal based on the second target connected area.
  • the line input function includes at least one of a line color input function, a line smoothness input function, and a line width input function.
  • testing the line input function of the display interface of the display terminal based on the second target connected area includes:
  • the line color input function of the display interface of the display terminal is tested according to the color matching relationship.
  • testing the line input function of the display interface of the display terminal based on the second target connected area includes:
  • the line width matching relationship of the original line shape is calculated according to the second average value and the target line width of the original line shape, and the line width input function of the display interface of the display terminal is tested according to the line width matching relationship.
  • testing the line input function of the display interface of the display terminal based on the second target connected area includes:
  • the line smoothness matching relationship of the original line shape is calculated, and the line smoothness input function of the display interface of the display terminal is tested according to the line smoothness matching relationship.
  • the preset event input object includes a robotic arm.
  • an electronic device capable of implementing the above method is also provided.
  • the electronic device 1800 according to this embodiment of the present disclosure is described below with reference to Fig. 18.
  • the electronic device 1800 shown in Fig. 18 is only an example and should not bring any limitation to the functions and scope of use of the embodiment of the present disclosure.
  • the electronic device 1800 is presented in the form of a general-purpose computing device.
  • the components of the electronic device 1800 may include, but are not limited to: the at least one processing unit 1810, the at least one storage unit 1820, a bus 1830 connecting different system components (including the storage unit 1820 and the processing unit 1810), and a display unit 1840.
  • the storage unit stores a program code, and the program code can be executed by the processing unit 1810, so that the processing unit 1810 executes the steps described in the above "Exemplary Method" section of this specification according to various exemplary embodiments of the present disclosure.
  • the processing unit 1810 can execute step S110 as shown in Figure 1: obtaining a current screen image of the display terminal and an expected screen image corresponding to the current screen image; step S120: calculating a first mean square error between the current screen image and the expected screen image, and determining a first image matching relationship between the current screen image and the expected screen image according to the first mean square error; step S130: calculating a first difference map between the current screen image and the expected screen image, and determining a second image matching relationship between the current screen image and the expected screen image according to the first difference map; step S140: testing the display interface of the display terminal according to the first image matching relationship and the second image matching relationship.
  • the storage unit 1820 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 18201 and/or a cache storage unit 18202 , and may further include a read-only storage unit (ROM) 18203 .
  • RAM random access storage unit
  • ROM read-only storage unit
  • the storage unit 1820 may also include a program/utility 18204 having a set (at least one) of program modules 18205, such program modules 18205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
  • program modules 18205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
  • Bus 1830 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
  • the electronic device 1800 may also communicate with one or more external devices 1300 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 1800, and/or may communicate with any device that enables the electronic device 1800 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input/output (I/O) interface 1850.
  • the electronic device 1800 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) via a network adapter 1860.
  • networks e.g., a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet
  • the network adapter 1860 communicates with other modules of the electronic device 1800 via a bus 1830. It should be understood that, although not shown in the figure, other hardware and/or software modules may be used in conjunction with the electronic device 1800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
  • the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
  • a non-volatile storage medium which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.
  • a computing device which can be a personal computer, a server, a terminal device, or a network device, etc.
  • a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored.
  • various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above "Exemplary Method" section of the present specification.
  • the program product for implementing the above method according to the embodiment of the present disclosure, it can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer.
  • a terminal device such as a personal computer.
  • the program product of the present disclosure is not limited to this.
  • the readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
  • the program product may use any combination of one or more readable media.
  • the readable medium may be a readable signal medium or a readable storage medium.
  • the readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
  • Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • the program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
  • Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages.
  • the program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
  • the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
  • LAN local area network
  • WAN wide area network
  • Internet service provider e.g., AT&T, MCI, Sprint, EarthLink, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Quality & Reliability (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • User Interface Of Digital Computer (AREA)
  • Testing, Inspecting, Measuring Of Stereoscopic Televisions And Televisions (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

一种显示界面的测试方法及装置、存储介质、电子设备(1800),涉及自动化测试技术领域,显示界面的测试方法包括:获取显示终端的当前屏幕图像以及与当前屏幕图像对应的预期屏幕图像(S110);计算当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据第一均方误差确定当前屏幕图像与预期屏幕图像之间的第一图像匹配关系(S120);计算当前屏幕图像与预期屏幕图像之间的第一差值图,并根据第一差值图确定当前屏幕图像与预期屏幕图像之间的第二图像匹配关系(S130);根据第一图像匹配关系以及第二图像匹配关系,对显示终端的显示界面进行测试(S140)。该显示界面的测试方法提高了测试效率。

Description

显示界面的测试方法及装置、存储介质、电子设备
相关申请的交叉引用
本公开以申请号为:202211021124.9,申请日为:2022年08月24日,发明名称为:显示界面的测试方法及装置、存储介质、电子设备的申请文件作为优先权,该中国专利申请的全部内容通过引用全部并入本文。
技术领域
本公开实施例涉及自动化测试技术领域,具体而言,涉及一种显示界面的测试方法、显示界面的测试装置、计算机可读存储介质以及电子设备。
背景技术
现有的测试方法中,需要通过人工的方式对显示终端的显示界面进行测试。但是,人工测试会使得测试效率较低,且测试结果的准确度也较低。
但是,由于微裂纹前期不会造成短路,进而使得所检测到的裂纹缺陷的精确度较低。
发明内容
根据本公开的一个方面,提供一种显示界面的测试方法,包括:
获取显示终端的当前屏幕图像以及与所述当前屏幕图像对应的预期屏幕图像;
计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系;
计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系;
根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试。
在本公开的一种示例性实施例中,计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系,包括:
获取所述当前屏幕图像中包括的第一像素点的第一像素值,以及预期屏幕图像的第二像素点的第二像素值;
计算所述第一像素值以及与所述第一像素点对应的第二像素点所具有的第二像素值之间的像素差值,并根据所述像素差值,计算所述第一均方误差;
计算所述第一均方误差与第一预设阈值之间的第一差值关系,并根据所述第一差值关系得到所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系。
在本公开的一种示例性实施例中,计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系,包括:
在确定所述第一图像匹配关系存在时,根据所述像素差值生成所述当前屏幕图像与预期屏幕图像之间的第一差值图;
基于预设的图像分割算法对所述第一差值图进行分割,得到所述第一差值图中包括的前景图像以及背景图像,并计算所述前景图像中所包括的非零像素的像素个数;
根据所述非零像素的像素个数,得到所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系。
在本公开的一种示例性实施例中,根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试,包括:
在确定所述第一图像匹配关系存在且所述第二图像匹配关系存在时,确定所述显示终端的显示界面的显示功能测试通过;
在确定所述第一图像匹配关系不存在或所述第二图像匹配关系不存在时,确定所述显示终端的显示界面的显示功能测试未通过。
在本公开的一种示例性实施例中,所述显示界面的测试方法还包括:
响应于预设事件输入对象作用于所述显示界面中预设区域的擦除事件,对所述预设区域进行擦除,得到包括擦除区域的目标屏幕图像;
获取所述目标屏幕图像中的擦除区域以及所述显示界面中的与所述预设区域对应的原始区域,并计算所述擦除区域与所述原始区域之间的第二均方误差以及第二差值图;
根据所述第二均方误差以及第二差值图确定所述擦除区域以及预设区域之间的第一区域匹配关系以及第二区域匹配关系;
根据所述第一区域匹配关系以及第二区域匹配关系,对所述显示终端的显示界面中所具有的擦除功能进行测试。
在本公开的一种示例性实施例中,所述显示界面的测试方法还包括:
获取与所述交互界面中包括的可交互控件对应的控件截图,并在预设的图像模板库中匹配与所述控件截图对应的可交互控件的模板页面图;
获取所述可交互控件在所述模板页面图中的坐标位置,并将所述坐标位置发送至预设事件输入对象;
响应于所述预设事件输入对象基于所述坐标位置在所述显示界面中的触控事件,获取与所述触控事件对应的触控区域,并计算所述触控区域与所述控件截图之间的第三均方误差以及第三差值图;
根据所述第三均方误差以及第三差值图确定所述触控区域以及控件截图之间的第一控件匹配关系以及第二控件匹配关系,并根据所述第一控件匹配关系以及第二控件匹配关系,对所述显示终端的显示界面中所具有的交互控件的触控功能进行测试。
在本公开的一种示例性实施例中,所述显示界面的测试方法还包括:
响应于预设事件输入对象作用于所述显示界面的对预设内容进行输入的第一输入事件,生成与所述第一输入事件对应的原始内容,并对所述原始内容进行标准化处理,得到标准内容;
计算包括所述目标内容的第一目标界面以及所述显示界面之间的第四差值图,并根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像;
计算所述子内容图像以及所述预设内容中与所述子内容对应的子模板内容的子模板图像之间的第四均方误差,并根据所述第四均方误差确定所述子内容图像与子模板图像之间的内容匹配关系;
根据所述内容匹配关系对所述显示终端的显示界面的输入功能和/或机器学习功能进行测试。
在本公开的一种示例性实施例中,根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像,包括:
对所述第四差值图进行灰度转换,得到第一二值差值图,并利用预设的图像分割算法对所述第一二值差值图进行图像分割,得到第一分割后的黑白图像;
获取所述第一分割后的黑白图像中包括的第一原始连通区域,并对所述第一原始连通区域进行过滤,得到第一目标连通区域;
从所述第一分割后的黑白图像中对所述第一目标连通区域进行裁切,得到第一初始裁切结果,并基于第一预设查找方向查找所述第一初始裁切结果中第三像素值大于第二预设阈值的第一个像素点;
以所述第一个像素点为种子点进行区域生长,对所述第一初始裁切结果所具有的图形轮廓内部区域进行填充,得到第一目标裁切结果,并对所述第一目标裁切结果的大小进行调整,得到所述标准内容中包括的每一个子内容所具有的子内容图像。
在本公开的一种示例性实施例中,所述原始内容包括原始图形和/或原始字符;
所述原始图形包括矩形、椭圆形、三角形、规则的多边形以及不规则的多边形中的任意一种或多种。
在本公开的一种示例性实施例中,当所述原始图形为矩形时,在根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像之后,所述显示界面的测试方法还包括:
获取所述矩形的长边的长度值以及宽边的长度值,并计算所述长边的长度值与宽边的长度值之间的第一比值;
在确定所述第一比值大于第三预设阈值,或小于第四预设阈值时,确定所述原始图形为矩形;
在确定所述第一比值介于所述第三预设阈值以及第四预设阈值之间时,确定所述原始图形为正方形。
在本公开的一种示例性实施例中,当所述原始图形为椭圆形时,在根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像之后,所述显示界面的测试方法还包括:
获取所述椭圆形在纵坐标方向上的第一直径的长度值以及在横坐标方向上的第二直径的长度值,并计算第一直径的长度值以及第二直径的长度值之间的第二比值;
在确定所述第一比值大于第三预设阈值,或小于第四预设阈值时,确定所述原始图形为椭圆形;
在确定所述第一比值介于所述第三预设阈值以及第四预设阈值之间时,确定所述原始图形为圆形。
在本公开的一种示例性实施例中,所述显示界面的测试方法还包括:
响应于预设事件输入对象作用于所述显示界面的对线条形状进行输入的第二输入事件,生成与所述第二输入事件对应的原始线条形状;
计算包括所述原始线条形状的第二目标界面以及所述显示界面之间的第五差值图,并对所述第五差值图进行二值化处理,得到第二二值差值图;
利用预设的图像分割算法对所述第二二值差值图进行图像分割,得到第二分割后的黑白图像,并获取所述第二分割后的黑白图像中包括的第二原始连通区域;
对所述第二原始连通区域进行过滤,得到第二目标连通区域,并基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试。
在本公开的一种示例性实施例中,所述线条输入功能包括线条颜色输入功能、线条流畅性输入功能以及线条宽度输入功能中的至少一种。
在本公开的一种示例性实施例中,当所述线条输入功能为线条颜色输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,包括:
遍历所述第二目标界面与所述第二目标连通区域对应的区域内部的每个像素点,获取所述区域内部的每个像素点的第四像素值,并计算所述第四像素值的第一平均值;
根据所述第四像素值的第一平均值以及所述原始线条形状所具有的目标像素值,计算所述原始线条形状的颜色匹配关系;
根据所述颜色匹配关系对所述显示终端的显示界面所具有的线条颜色输入功能进行测试。
在本公开的一种示例性实施例中,当所述线条输入功能为线条宽度输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,包括:
从所述第二分割后的黑白图像中对所述第二目标连通区域进行裁切,得到第二初始裁切结果,并基于第二预设查找方向以及预设像素宽度扫描所述第二初始裁切结果中第五像素值大于第二预设阈值的第一个像素点;
获取所述第一个像素点在横向位置上与该第一个像素点相邻的两个像素点的第六像素值以及第七像素值,并根据所述第六像素值以及第七像素值确定目标绘制方向;
基于所述目标绘制方向绘制满足预设条件的正方形,并计算所述满足预设条件的正方形的边长的第二平均值;
根据所述第二平均值以及所述原始线条形状所具有的目标线条宽度,计算所述原始线条形状的线条宽度匹配关系,并根据所述线条宽度匹配关系对所述显示终端的显示界面所具有的线条宽度输入功能进行测试。
在本公开的一种示例性实施例中,当所述线条输入功能为线条流畅度输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,包括:
基于第一预设查找方向查找所述第二初始裁切结果中第六像素值大于第二预设阈值的第一个像素点,并将第二初始裁切结果中第六像素值大于第二预设阈值的第一个像素点作为目标像素点;
计算所述第二初始裁切结果中所包括的所有像素点与所述目标像素点之间的第一测地线距离,并根据所述第一测地线距离从所有像素点中确定所述原始线条形状的第一端点;
计算所述第二初始裁切结果中所包括的所有像素点与所述第一端点之间的第二测地线距离,并根据所述第二测地线距离从所有像素点中确定所述原始线条形状的第二端点;
根据所述第一端点的端点位置、第二端点的端点位置以及所述原始线条形状所具有的目标端点的端点位置,计算所述原始线条形状的线条流畅度匹配关系,并根据所述线条流畅度匹配关系对所述显示终端的显示界面所具有的线条流畅度输入功能进行测试。
在本公开的一种示例性实施例中,所述预设的事件输入对象包括机械臂。
根据本公开的一个方面,提供一种显示界面的测试装置,包括:
第一图像获取模块,用于获取显示终端的当前屏幕图像以及与所述当前屏幕图像对应的预期屏幕图像;
第一计算模块,用于计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系;
第二计算模块,用于计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系;
显示界面测试模块,用于根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试。
根据本公开的一个方面,提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任意一项所述的显示界面的测试方法。
根据本公开的一个方面,提供一种电子设备,包括:
处理器;以及
存储器,用于存储所述处理器的可执行指令;
其中,所述处理器配置为经由执行所述可执行指令来执行上述任意一项所述的显示界面的测试方法。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。在附图中:
图1示意性示出根据本公开示例实施例的一种显示界面的测试方法的流程图。
图2示意性示出根据本公开示例实施例的一种显示终端的示例图。
图3示意性示出根据本公开示例实施例的一种非点状网格书写背景的场景示例图。
图4示意性示出根据本公开示例实施例的一种点状网格书写背景的场景示例图。
图5示意性示出根据本公开示例实施例的一种对显示终端的显示界面中包括的擦除功能进行测试的方法流程图。
图6示意性示出根据本公开示例实施例的一种包括擦除区域的目标屏幕图像的场景示例图。
图7示意性示出根据本公开示例实施例的一种对显示终端的显示界面中包括的交互控件的触控功能进行测试的方法流程图。
图8示意性示出根据本公开示例实施例的一种两种不同状态的可交互控件的场景示例图。
图9示意性示出根据本公开示例实施例的一种对显示终端的显示界面的输入功能和/或机器学习功能进行测试的方法流程图。
图10示意性示出根据本公开示例实施例的一种原始字符以及标准化以后的字符的示例图。
图11示意性示出根据本公开示例实施例的一种第一初始裁切结果的场景示例图。
图12示意性示出根据本公开示例实施例的一种第一目标裁切结果的场景示例图。
图13示意性示出根据本公开示例实施例的一种对显示终端的显示界面的所具有的线条输入功能进行测试的方法流程图。
图14示意性示出根据本公开示例实施例的一种原始线条的具体形状的场景示例图。
图15示意性示出根据本公开示例实施例的一种原始线条中包括的正方形的示例图。
图16示意性示出根据本公开示例实施例的一种测地线距离的场景示例图。
图17示意性示出根据本公开示例实施例的一种显示界面的测试装置的框图。
图18示意性示出根据本公开示例实施例的一种用于实现上述显示界面的测试方法的电子设备。
具体实施方式
现在将参照附图更全面地描述示例实施方式。然而,示例实施方式能够以多种形式实施,且不应被理解为限于在此阐述的范例;相反,提供这些实施方式使得本公开将更加全面和完整,并将示例实施方式的构思全面地传达给本领域的技术人员。所描述的特征、结构或特性可以以任何合适的方式结合在一个或更多实施方式中。
此外,附图仅为本公开的示意性图解,并非一定是按比例绘制。图中相同的附图标记表示相同或类似的部分,因而将省略对它们的重复描述。附图中所示的一些方框图是功能实体,不一定必须与物理或逻辑上独立的实体相对应。可以采用软件形式来实现这些功能实体,或在一个或多个硬件模块或集成电路中实现这些功能实体,或在不同网络和/或处理器装置和/或微控制器装置中实现这些功能实体。
近年来,会议一体机的市场不断拓展。一体机在生产过程中,需要对软、硬件的质量进行把控,例如各级页面显示是否正常、笔写效果是否流畅等。传统的质检方法需要产线工人不断点击各项功能菜单进行测试,耗费大量人力。
基于此,本示例实施方式中首先提供了一种显示界面的测试方法,该方法可以运行于显示终端,该显示终端可以应用于会议、教学、商用等各中场景,且该智能交互平板具有触控等交互功能,大尺寸(例如一般大于50寸),且安装有手写、无线投屏以及远程视频会议等等软件;当然,本领域技术人员也可以根据需求在其他平台(例如,服务器、服务器集群或者云服务器等)运行本公开的方法,本示例性实施例中对此不做特殊限定。具体的,参考图1所示,该显示界面的测试方法可以包括以下步骤:
步骤S110.获取显示终端的当前屏幕图像以及与所述当前屏幕图像对应的预期屏幕图像;
步骤S120.计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系;
步骤S130.计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系;
步骤S140.根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试。
上述显示界面的测试方法中,一方面,由于可以根据当前屏幕图像以及预期屏幕图像之间的第一图像匹配关系以及第二图像匹配关系对显示终端的显示界面的显示功能进行测试,进而实现了对显示终端的显示界面进行自动化测试,解决了现有技术中由于通过人工的方式进行测试导致的测试效率较低的问题;另一方面,通过计算当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据第一均方误差确定当前屏幕图像与预期屏幕图像之间的第一图像匹配关系;然后计算当前屏幕图像与预期屏幕图像之间的第一差值图,并根据第一差值图确定当前屏幕图像与预期屏幕图像之间的第二图像匹配关系;最后根据第一图像匹配关系以及第二图像匹配关系,对显示终端的显示界面进行测试,由于在对显示界面进行测试的过程中,同时考虑了第一图像匹配关系以及第二图像匹配关系,进而可以避免仅考虑一种图像匹配关系进而导致的测试结果的准确率较低的问题,提高了测试结果的准确率。
以下,将结合附图对本公开示例实施例显示界面的测试方法进行详细的解释以及说明。
首先,对本公开示例实施例所记载的显示终端进行解释以及说明。具体的,参考图2所示,该显示终端200,可以包括显示器(前端)210、处理器(后端,该后端设置有相应的算法,因此也可以被称为是算法底层)220以及输入组件,该输入组件可以包括触控组件;此处需要补充说明的是,该处理器可以包括云服务器端上设置的处理器,也可以包括智能交互平板上设置的本地处理器,本示例对此不做特殊限制。
此处需要补充说明的是,本公开示例实施例所记载的显示界面的测试方法,可以显示终端的显示界面所具有的显示功能进行测试,当然,还可以对显示界面所具有的擦除功能、显示界面中所包括的可交互控件的触控功能、显示终端的显示界面所具有的图形美化功能(也即AI算法识别功能)以及显示终端的显示界面的线条输入功能进行测试;当然,在实际应用过程中,也可以测试显示终端的显示界面所具有的其他功能,本示例对此不做特殊限制。
其次,在本公开示例实施例所提供的一种显示界面的测试方法中:
在步骤S110中,获取显示终端的当前屏幕图像以及与所述当前屏幕图像对应的预期屏幕图像。
具体的,在实际应用的过程中,由于一体机的每个层级的功能页面都是由前端预先配置好指定内容然后再进行展示的。因此,在进行过自动化测试(也可以被称为自动化校对)时,前端可以将预期内容图片(与当前屏幕图像对应的预期屏幕图像)以及一体机当前的屏幕(当前屏幕图像)传递给算法底层;也即,算法底层(处理器)可以从前端获取显示终端的当前屏幕图像以及与当前屏幕图像对应的预期屏幕图像。其中,当前屏幕图像可以包括图3以及图4所示。进一步的,在图3所示出的当前屏幕图像中,为非点状网格书写背景,也即正常的书写背景板;在图4所示出的当前屏幕图像中,为点状网格书写背景;同时,在图3以及图4中所示出的当前屏幕图像中,该当前屏幕图像的下方显示有相应的交互控件区域301以及交互控件区域401,该交互控件区域所显示的交互控件可以包括但不限于:颜色交互控件、擦除交互控件、删除交互控件、撤回交互控件、线条交互控件、笔迹交互控件等等,在具体的应用过程中可以根据实际需要选取对应的交互控件,本示例对此不做特殊限制。
在步骤S120中,计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系。
在本示例实施例中,计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系,可以通过如下方式实现:首先,获取所述当前屏幕图像中包括的第一像素点的第一像素值,以及预期屏幕图像的第二像素点的第二像素值;其次,计算所述第一像素值以及与所述第一像素点对应的第二像素点所具有的第二像素值之间的像素差值,并根据所述像素差值,计算所述第一均方误差;然后,计算所述第一均方误差与第一预设阈值之间的第一差值关系,并根据所述第一差值关系得到所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系。
在一种示例实施例中,均方差(Mean Square Error),可以用MSE来表示。均方差可以用于表征各数据偏离真实值的距离平方和的平均数,也即误差平方和的平均数。其中,第一均方误差的具体计算公式可以如下公式(1)所示:
其中,n为当前屏幕图像和/或预期屏幕图像中所包括的像素点的个数,Xcsi,i为当前屏幕图像(Current Screen Image)中第i个第一像素点的第一像素值,Xdsi,i为期望屏幕图像(Desired Screen Image)中第i个第二像素点的第二像素值。进一步的,当得到第一均方误差以后,即可根据第一均方误差确定第一图像匹配关系;其中,在具体的应用过程中,当第一均方误差小于预先设置的第一预设阈值(本公开示例实施例可以将阈值设置为经验值10)时,认为两张页面图像(当前屏幕图像以及期望屏幕图像)有可能存在第一图像匹配关系。也即,如果第一均方误差与第一预设阈值之间的第一差值关系的绝对值小于等于0.05或者0.1,则可以确定该第一图像匹配关系存在。
在步骤S130中,计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系。
在本示例实施例中,计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系,可以通过如下方式实现:首先,在确定所述第一图像匹配关系存在时,根据所述像素差值生成所述当前屏幕图像与预期屏幕图像之间的第一差值图;其次,基于预设的图像分割算法对所述第一差值图进行分割,得到所述第一差值图中包括的前景图像以及背景图像,并计算所述前景图像中所包括的非零像素的像素个数;然后,根据所述非零像素的像素个数,得到所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系。
在一种示例实施例中,在确定当前屏幕图像与预期屏幕图像之间存在第一图像匹配关系时,可以认为该两张图像为有可能匹配上的两张图像;因此,为了进一步的提高测试结果的准确率,可以在确定第一图像匹配关系存在是,计算当前屏幕图像与预期屏幕图像之间的第一差值图;其中,在第一差值图计算的过程中,可以利用当前屏幕图像中包括的第一像素点的第一像素值减去预期屏幕图像的中包括的第二像素点的第二像素值,进而根据第一像素值与第二像素值之间的差值,得到当前屏幕图像与预期屏幕图像之间的第一差值图;当得到第一差值图以后,即可对该第一差值图进行灰度转换,再可基于预设的图像分割算法对该灰度处理以后的第一差值图进行分割,得到该第一差值图中包括的前景图像以及背景图像;其中,此处所记载的预设的图像分割算法,可以是最大类间方差法(OTSU算法),当然也可以是其他算法,例如高斯滤波算法等等,本示例对此不做特殊限制;进一步的,当得到前景图像以后,即可统计该前景图像中包括的非零像素的像素个数,最后再根据非零像素的像素个数,得到当前屏幕图像与预期屏幕图像之间的第二图像匹配关系;其中,如果非零像素的像素个数小于预先设置的阈值(本公开示例实施例将预先设置的阈值设置为经验值500)时,认为两张页面图像确实存在匹配关系(第二图像匹配关系存在),则可以认为当前屏幕图像与预期屏幕图像匹配成功。
在一种可能的示例实施例中,也可以分别计算第一图像匹配关系以及第二图像匹配关系,也即,无论是否存在第一图像匹配关系,均对第二图像匹配关系进行计算,最终再根据第一图像匹配关系以及第二图像匹配关系进行相应的测试。
在步骤S140中,根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试。
在本示例实施例中,根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试,具体可以通过如下方式实现:一方面,在确定所述第一图像匹配关系存在且所述第二图像匹配关系存在时,确定所述显示终端的显示界面的显示功能测试通过;另一方面,在确定所述第一图像匹配关系不存在或所述第二图像匹配关系不存在时,确定所述显示终端的显示界面的显示功能测试未通过。也即,如果第一图像匹配关系存在且第二图像匹配关系存在,则可以认为在显示终端的显示界面上所显示的当前屏幕图像所具有的显示效果与该当前屏幕图像所希望的显示效果是一致的,则可以认为该显示终端的显示界面的显示功能是没有问题的,测试通过;如果任一图像匹配关系不存在,则可以认为该显示界面的显示功能存在问题,测试不通过;如果测试不通过,可以对该显示中的显示界面进行校正。
图5示意性示出根据本公开示例实施例的一种对显示终端的显示界面中包括的擦除功能进行测试的方法流程图。具体的,参考图5所示,可以包括以下步骤:
步骤S510,响应于预设事件输入对象作用于所述显示界面中预设区域的擦除事件,对所述预设区域进行擦除,得到包括擦除区域的目标屏幕图像。
具体的,此处所记载的预设事件输入对象,例如可以是机械臂,当然也可以是其他输入对象,譬如外接输入设备、手指或者无线触控笔等等,本示例对此不做特殊限制;此处通过机械臂进行相应的事件输入,是为了弱化在对显示终端的显示界面的测试过程中的人为因素,进而达到在提高测试结果的精确度的基础上提高测试效率,降低人力成本。
进一步的,在具体的测试过程中,首先,可以设定好擦除区域的范围,并将该范围发送至机械臂的控制单元,然后控制机械臂在显示界面中与该设定好的擦除区域的范围进行擦除;其中,所得到的包括擦除区域的目标屏幕图像,具体可以参考图6所示。
步骤S520,获取所述目标屏幕图像中的擦除区域以及所述显示界面中的与所述预设区域对应的原始区域,并计算所述擦除区域与所述原始区域之间的第二均方误差以及第二差值图。
具体的,当得到包括擦除区域的目标图像以后,显示器(前端)即可将擦除后的页面(包括擦除区域的目标屏幕图像)、原始未经书写的页面(显示界面)以及指定擦除区域的角点坐标传递给算法底层(处理器);然后,处理器对擦除区域以及原始区域进行剪裁,并计算擦除区域与原始区域之间的第二均方误差以及第二差值图;其中,第二均方误差以及第二差值图的具体计算过程与第一均方误差以及第一差值图的具体计算过程相似,此处不再赘述。
步骤S530,根据所述第二均方误差以及第二差值图确定所述擦除区域以及预设区域之间的第一区域匹配关系以及第二区域匹配关系。
具体的,第一区域匹配关系以及第二区域匹配关系的具体确定过程,与第一图像匹配关系以及第二图像匹配关系的具体确定过相似,此处不再进一步赘述。
步骤S540,根据所述第一区域匹配关系以及第二区域匹配关系,对所述显示终端的显示界面中所具有的擦除功能进行测试。
具体的,如果第一区域匹配关系以及第二区域匹配关系均存在,则确定显示终端的显示界面中所具有的擦除功能测试通过,也即在具体应用过程中,可以正常的执行擦除功能;如果第一区域匹配关系或者第二区域匹配关系任一不存在,则确定显示终端的显示界面中所具有的擦除功能测试不通过,若不通过,则需要进行进一步的校正。
图7示意性示出根据本公开示例实施例的一种对显示终端的显示界面中包括的交互控件的触控功能进行测试的方法流程图。具体的,参考图7所示,可以包括以下步骤:
步骤S710,获取与所述交互界面中包括的可交互控件对应的控件截图,并在预设的图像模板库中匹配与所述控件截图对应的可交互控件的模板页面图。
具体的,当需要对显示界面中包括的某一个或多个可交互控件进行测试时,首先,前端可以截取显示界面中包括的一个或多个待测试的可交互控件的控件截图,并将该一个或多个待测试的可交互控件的空间截图以及包括一个或多个待测试的可交互控件的显示界面发送至处理器,然后处理器会在预设的图像模板库中匹配与该控件截图对应的模版页面图。此处需要补充说明的是,由于可交互控件可以包括两种状态,一种是,选中的状态,一种是为选中的状态;因此,在发送待测试的可交互控件的控件截图时,可以将两种状态的控件截图均发送至处理器。其中,两种不同状态的可交互控件的具体状态图,可以参考图8所示;其中,选中状态可以参考801所示,未选中状态可以参考802所示。
步骤S720,获取所述可交互控件在所述模板页面图中的坐标位置,并将所述坐标位置发送至预设事件输入对象。
具体的,当获取对应的模板页面图以后,即可获取可交互控件在模版页面图中的坐标位置,进而将该坐标位置发送至预设事件输入对象;其中,该预设事件输入对象可以是机械臂;当然也可以是其他输入对象,譬如外接输入设备、手指或者无线触控笔等等,本示例对此不做特殊限制;此处通过机械臂进行相应的事件输入,是为了弱化在对显示终端的显示界面的测试过程中的人为因素,进而达到在提高测试结果的精确度的基础上提高测试效率,降低人力成本。
步骤S730,响应于所述预设事件输入对象基于所述坐标位置在所述显示界面中的触控事件,获取与所述触控事件对应的触控区域,并计算所述触控区域与所述控件截图之间的第三均方误差以及第三差值图。
具体的,当机械臂接收到上述坐标位置以后,即可基于该坐标位置,触控显示界面中与该坐标位置对应的区域;然后,前端即可获取该触控区域,并将该触控区域发送至处理器;当处理器接收到该触控区域以后,即可计算该触控区域与控件截图至今的第三均方误差以及第三差值图;其中,第三均方误差以及第三差值图的具体计算过程与第一均方误差以及第一差值图的计算过程相似,此处不再进一步的赘述。此处需要补充说明的是,由于控件截图可以包括选中状态的控件截图以及未选中状态的控件截图,因此,在具体的计算过程中,需要分别计算对应的第三均方误差以及第三差值图。
步骤S740,根据所述第三均方误差以及第三差值图确定所述触控区域以及控件截图之间的第一控件匹配关系以及第二控件匹配关系,并根据所述第一控件匹配关系以及第二控件匹配关系,对所述显示终端的显示界面中所具有的交互控件的触控功能进行测试。
具体的,当得到第三均方误差以及第三差值图以后,即可计算第一控件匹配关系以及第二控件匹配关系;其中,第一控件匹配关系以及第二控件匹配关系的具体计算过程与第一图像匹配关系以及第二图像匹配关系的具体计算过程类似,此处不再进一步的赘述;同时,当得到第一控件匹配关系以及第二控件匹配关系以后,即可对该显示终端的显示界面中所具有的交互控件的触控功能进行测试;其中,如果第一控件匹配关系以及第二控件匹配关系均存在,则确定该显示终端的显示界面中所具有的可交互控件的触控功能测试通过,也即可以进行正常的交互;如果第一控件匹配关系或第二控件匹配关系任一不存在,则认为该显示终端的显示界面中所具有的可交互控件的触控功能测试不通过,需要进行进一步的对可交互控件的触控功能进行校正。
此处需要补充说明的是,图7中所示出的对一体机页面上功能按钮进行自动化校验的方法,支持快速识别指定按钮所在位置。在具体的应用过程中,前端将需要识别的屏幕截图和指定的按钮截图传递给算法底层,由于按钮显示一般分为选中和未选中两种状态,所以可以将两种状态下的截图都进行传递;同时,算法底层使用按钮截图对屏幕页面进行模板匹配,当匹配分数达到预先设置的阈值(具体的阈值可以设置为经验值0.99)时,即找到按钮所在位置;进一步的,算法层将匹配到的按钮区域左上角和右下角点坐标传递给机械臂控制器,控制机械臂对按钮进行点选操作;进而配合页面校验功能,能够实现自动化测试按钮点击功能是否正常。
图9示意性示出根据本公开示例实施例的一种对显示终端的显示界面的输入功能和/或机器学习功能进行测试的方法流程图。具体的,参考图9所示,可以包括以下步骤:
步骤S910,响应于预设事件输入对象作用于所述显示界面的对预设内容进行输入的第一输入事件,生成与所述第一输入事件对应的原始内容,并对所述原始内容进行标准化处理,得到标准内容。
具体的,本公开示例实施例所记载的显示终端(也即会议一体机,或者一体机)提供有AI(Artificial Intelligence,人工智能)图形或者字符识别功能,该AI算法可以针对手写图形或字符进行识别并替换成美化后的图形模板或字符模版。因此,在对该AI功能进行测试的过程中,首先,可以响应于预设时间输入对象作用于显示界面的对预设内容进行输入的第一输入事件,生成与第一输入事件对应的原始内容;其中,该预设事件输入对象为机械臂,该原始内容可以包括原始图形、原始字符等等,该原始图形可以包括矩形、椭圆形、三角形、规则的多边形以及不规则的多边形等等,当然也可以包括其他内容,本示例对此不做特殊限制。进一步的,当得到原始内容以后,即可对该原始内容进行标准化处理,得到标准内容;其中,以原始内容为原始字符为例,原始字符以及标准化以后的字符可以参考图10所示。
步骤S920,计算包括所述目标内容的第一目标界面以及所述显示界面之间的第四差值图,并根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像。
在本示例实施例中,首先,计算包括目标内容的第一目标界面以及显示界面之间的第四差值图;其中,第四差值图的具体计算过程与第一差值图的具体计算过程相似,此处不再赘述;进一步的,当得到第一差值图以后,即可根据第四差值图计算该标准内容中包括的每一个子内容所具有的子内容图像。其中,具体的计算过程可以通过如下方式实现:首先,对所述第四差值图进行灰度转换,得到第一二值差值图,并利用预设的图像分割算法对所述第一二值差值图进行图像分割,得到第一分割后的黑白图像;其次,获取所述第一分割后的黑白图像中包括的第一原始连通区域,并对所述第一原始连通区域进行过滤,得到第一目标连通区域;然后,从所述第一分割后的黑白图像中对所述第一目标连通区域进行裁切,得到第一初始裁切结果,并基于第一预设查找方向查找所述第一初始裁切结果中第三像素值大于第二预设阈值的第一个像素点;最后,以所述第一个像素点为种子点进行区域生长,对所述第一初始裁切结果所具有的图形轮廓内部区域进行填充,得到第一目标裁切结果,并对所述第一目标裁切结果的大小进行调整,得到所述标准内容中包括的每一个子内容所具有的子内容图像。
在一些示例实施例中,在子内容图像的具体计算过程中,首先,可以将第四差值图像转换为灰度图后利用OTSU算法进行二值分割得到第一分割后的黑白图像;其次,对得到第一分割后的黑白图像提取第一原始连通区域,并过滤掉面积小于指定阈值(本示例实施例可以将阈值设置为经验值600)的连通域,得到第一目标连通区域;进一步的,将所有第一目标连通域对应的区域从整张黑白图像中裁切出来得到第一初始裁切结果;其中,所得到的第一初始裁切结果具体可以参考图11所示;更进一步的,对于与每一个第一目标连通区域对应的第一初始裁切结果,基于从上向下(第一预设查找方向)的方式查找该第一初始裁切结果中第三像素值不为零的第一个像素点;再进一步的,以该第一个像素点为种子点开始进行区域生长,填充图形轮廓内部区域,得到第一目标裁切结果;其中,所得到的第一目标裁切结果具体可以如图12所示;最后,将该第一目标裁切结果的大小进行调整(Resize)到256*256大小之后即可得到子内容图像。
在一种示例实施例中,当所述原始图形为矩形时,在根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像之后,所述显示界面的测试方法还包括:首先,获取所述矩形的长边的长度值以及宽边的长度值,并计算所述长边的长度值与宽边的长度值之间的第一比值;其次,在确定所述第一比值大于第三预设阈值,或小于第四预设阈值时,确定所述原始图形为矩形;最后,在确定所述第一比值介于所述第三预设阈值以及第四预设阈值之间时,确定所述原始图形为正方形。在另一种示例实施例中,当所述原始图形为椭圆形时,在根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像之后,所述显示界面的测试方法还包括:首先,获取所述椭圆形在纵坐标方向上的第一直径的长度值以及在横坐标方向上的第二直径的长度值,并计算第一直径的长度值以及第二直径的长度值之间的第二比值;其次,在确定所述第一比值大于第三预设阈值,或小于第四预设阈值时,确定所述原始图形为椭圆形;最后,在确定所述第一比值介于所述第三预设阈值以及第四预设阈值之间时,确定所述原始图形为圆形。也即,在具体的应用过程中,由于正方形和矩形、圆形和椭圆形尽在长宽比上有所区分,因此本公开示例实施例在上述识别流程中不针对正方形和矩形、圆形和椭圆形进行区分;而是在得到识别结果后,根据裁切结果图的长宽比进行区分,认为长宽比大于指定阈值(本公开示例实施例所设置的第三预设阈值可以为经验值0.9,第四预设阈值可以为经验值1.1)的正方形为矩形、圆形为椭圆形;基于该方法进行区分,简单有效,且在初步识别流程中只需要将目标图形分别与正方形和圆形模板进行对比即可,节约了计算量。
步骤S930,计算所述子内容图像以及所述预设内容中与所述子内容对应的子模板内容的子模板图像之间的第四均方误差,并根据所述第四均方误差确定所述子内容图像与子模板图像之间的内容匹配关系。
具体的,当得到子内容图像以后,即可计算子内容图像以及子模板图像之间的第四均方误差,进而根据第四均方误差确定子内容图像与子模板图像之间的第四均方误差;其中,字模板图像的大小与子内容图像的大小一致,可以是256*256,当然也可以使其其他大小,本示例对此不做特殊限制;同时,第四均方误差的具体计算过程与第一均方误差的具体计算过程类似,此处不再赘述;进一步的,当得到第四均方误差以后,即可根据该第四均方误差确定子内容图像与字模版图像之间的内容匹配关系;其中,在内容匹配关系的确定过程中,如果第四均方误差小于指定阈值,则可以认为内容匹配关系存在,也即可以认为机械臂所绘制的图像即为对应的模板图形;其中,此处所记载的指定阈值,根据实际需要可以设置为经验值5000,当然也可以设置为其他值,本示例对此不做特殊限制。
步骤S940,根据所述内容匹配关系对所述显示终端的显示界面的输入功能和/或机器学习功能进行测试。
具体的,当得到内容匹配关系以后,即可根据该内容匹配关系对显示终端的显示界面的输入功能和/或机器学习功能进行测试;也即,如果内容匹配关系存在,即可认为该显示终端的显示界面的输入功能和/或机器学习功能测试通过,在实际应用中可以进行输入并转换为标准图形或标准字符进行显示;如果内容匹配关系不存在,则认为该显示终端的显示界面的输入功能和/或机器学习功能测试未通过,需要进行进一步的校正。
图13示意性示出根据本公开示例实施例的一种对显示终端的显示界面的所具有的线条输入功能进行测试的方法流程图。具体的,参考图13所示,可以包括以下步骤:
步骤S1310,响应于预设事件输入对象作用于所述显示界面的对线条形状进行输入的第二输入事件,生成与所述第二输入事件对应的原始线条形状。
具体的,本公开示例实施例还提供了对一体机上的手写线条进行校验的功能,以实现对一体机中的线条输入功能进行测试,以保证在用户对一体机应用的过程中,在输入线条时,可以保证线条颜色、线条流畅性以及线条宽度等功能。在具体的测试过程中,可以控制机械臂(预设事件输入对象)在一体机屏幕上的指定区域进行书写;其中,在进行线条输入的过程中,可以控制一个机械臂输入,也可以同时控制多个机械臂输入,本示例对此不做特殊限制;进一步的,当显示器接收到机械臂的线条输入事件(第二输入事件)时,即可生成与该第二输入事件对应的原始线条形状;其中,该原始线条形状具体可以参考图14所示。
步骤S1320,计算包括所述原始线条形状的第二目标界面以及所述显示界面之间的第五差值图,并对所述第五差值图进行二值化处理,得到第二二值差值图。
具体的,当得到原始线条形状以后,显示器即可将包括该原始线条形状的第二目标界面以及显示界面(原始未经书写的截屏图片)发送至算法底层,其中,算法底层的处理流程为:计算两幅图像(第二目标界面以及显示界面)的第五差值图;其中,第五差值图的具体计算过程与第一差值图的具体计算过程相似,此处不再进一步的赘述;然后,将该第五差值图进行二值化处理(也即灰度处理)进而得到第二二值差值图。
步骤S1330,利用预设的图像分割算法对所述第二二值差值图进行图像分割,得到第二分割后的黑白图像,并获取所述第二分割后的黑白图像中包括的第二原始连通区域。
具体的,当得到第二二值差值图以后,即可利用预设的图像分割算法(最大类间方差OTSU算法)对该第二二值差值图进行图像分割,得到第二分割后的黑白图像;然后,再提取该第二分割后的黑白图像中包括的第二原始连通区域。
步骤S1340,对所述第二原始连通区域进行过滤,得到第二目标连通区域,并基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试;其中,所述线条输入功能包括线条颜色输入功能、线条流畅性输入功能以及线条宽度输入功能中的至少一种。
具体的,当得到第二原始连通区域以后,即可对该第二原始连通区域进行过滤,过滤掉面积小于指定阈值(该指定阈值可以设置为经验值600,也可以设置为其他值,本示例对此不做特殊限制)的第二原始连通区域,得到第二目标连通区域。进一步的,当得到第二目标连通区域以后,即可基于该第二目标连通区域对显示终端的显示界面所具有的线条输入功能进行测试。其中,对线条输入功能进行测试可以包括如下几个方面:
一方面,当所述线条输入功能为线条颜色输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,可以通过如下方式实现:首先,遍历所述第二目标界面与所述第二目标连通区域对应的区域内部的每个像素点,获取所述区域内部的每个像素点的第四像素值,并计算所述第四像素值的第一平均值;其次,根据所述第四像素值的第一平均值以及所述原始线条形状所具有的目标像素值,计算所述原始线条形状的颜色匹配关系;最后,根据所述颜色匹配关系对所述显示终端的显示界面所具有的线条颜色输入功能进行测试。也即,在进行线条颜色输入功能测试的过程中,针对每个第二目标连通区域,可以遍历书写截屏图像(包括原始线条形状的第二目标界面)中位于区域内部的每个像素点的第四像素值,计算所有像素点的颜色三通道的均值(也即计算所有第四像素值的第一平均值),作为提取到的颜色值与原始线条形状所具有的目标像素值进行比对,得到颜色匹配关系,并基于颜色匹配关系对显示终端的显示界面所具有的线条颜色输入功能进行测试。
此处需要补充说明的是,在对第一平均值以及目标像素值进行比对的过程中,可以计算第一平均值与目标像素值之间的均方误差和/或差值图来确定颜色匹配关系;同时,如果颜色匹配关系存在,则可以确定线条颜色输入功能测试通过;如果颜色匹配关系不存在,则可以确定线条颜色输入功能测试不通过;如果测试不通过,则需要再次校正。
另一方面,当所述线条输入功能为线条宽度输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,可以通过如下方式实现:首先,从所述第二分割后的黑白图像中对所述第二目标连通区域进行裁切,得到第二初始裁切结果,并基于第二预设查找方向以及预设像素宽度扫描所述第二初始裁切结果中第五像素值大于第二预设阈值的第一个像素点;其次,获取所述第一个像素点在横向位置上与该第一个像素点相邻的两个像素点的第六像素值以及第七像素值,并根据所述第六像素值以及第七像素值确定目标绘制方向;然后,基于所述目标绘制方向绘制满足预设条件的正方形,并计算所述满足预设条件的正方形的边长的第二平均值;最后,根据所述第二平均值以及所述原始线条形状所具有的目标线条宽度,计算所述原始线条形状的线条宽度匹配关系,并根据所述线条宽度匹配关系对所述显示终端的显示界面所具有的线条宽度输入功能进行测试。也即,在进行线宽校验的过程中,针对每个第二目标连通区域,可以将对应区域从第二分割后的黑背图像中裁切出来得到第二初始裁切结果;然后,自左至右(第二预设查找方向)每隔10pix(预设像素宽度)对该第二初始裁切结果进行扫描,查找每条扫描线上第一个不为零的第一个像素点;查看该第一个像素点在水平方向上两侧的像素值(第六像素值以及第七像素值),选择不为零的一个方向(目标绘制方向,如左侧像素不为零则向左下方,反之亦然)绘制最大(预设条件)正方形,使得该正方形全部落在线条区域内;其中,如图15所示为所有扫描得到的正方形,计算所有正方向边长的第二平均值即为线条宽度;进一步的,可以根据第二平均值与目标线条宽度,计算原始线条形状的线条宽度匹配关系,并根据线条宽度匹配关系对显示终端的显示界面所具有的线条宽度输入功能进行测试。
此处需要补充说明的是,在计算第二平均值与目标线条宽度的线条宽度匹配关系时,可以通过第二平均值与目标线条宽度的均方误差来实现,也可以通过其他方式来实现,本示例对此不做特殊限制。并且,通过线宽校验,不仅能够确认一体机对于不同线宽的选择是否生效;此外,针对一体机上手写美化算法,通常要求根据书写压力和速度调节线宽以实现仿真的效果,本公开也提供了这一场景下自动化测试的技术支持。
再一方面,当所述线条输入功能为线条流畅度输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,可以通过如下方式实现:首先,基于第一预设查找方向查找所述第二初始裁切结果中第六像素值大于第二预设阈值的第一个像素点,并将第二初始裁切结果中第六像素值大于第二预设阈值的第一个像素点作为目标像素点;其次,计算所述第二初始裁切结果中所包括的所有像素点与所述目标像素点之间的第一测地线距离,并根据所述第一测地线距离从所有像素点中确定所述原始线条形状的第一端点;然后,计算所述第二初始裁切结果中所包括的所有像素点与所述第一端点之间的第二测地线距离,并根据所述第二测地线距离从所有像素点中确定所述原始线条形状的第二端点;最后,根据所述第一端点的端点位置、第二端点的端点位置以及所述原始线条形状所具有的目标端点的端点位置,计算所述原始线条形状的线条流畅度匹配关系,并根据所述线条流畅度匹配关系对所述显示终端的显示界面所具有的线条流畅度输入功能进行测试。
在一种示例实施例中,对线条输入功能中的线条流量度输入功能进行测试,也可以被理解为是对线条的端点进行校验。具体的,在进行线条的端点校验过程中,针对每个第二目标连通区域,将对应的第二目标连通区域从第二分割后的黑白图像中裁切出来得到第二初始裁切结果;然后,自上向下(第一预设查找方向)查找第二初始裁切结果中第一个像素值不为0的像素点(也可以被理解为像素值大于零的像素点),并将该第第一个像素点作为目标像素点;进一步的,计算第二初始裁切结果所有点与该目标像素点的第一测地线距离(其中,该第一测地线距离具体可以参考图16所示);与该目标像素点的第一测地线距离最远的点即为线条的一个端点(也即第一端点);然后,再计算图中所有像素点与第一端点的第二测地线距离,选取最远的第二测地线距离点作为为第二端点;最后,再根据第一端点的端点位置、第二端点的端点位置以及原始线条形状所具有的目标端点的端点位置,计算原始线条形状的线条流畅度匹配关系,并根据线条流畅度匹配关系对显示终端的显示界面所具有的线条流畅度输入功能进行测试。并且,通过对比实际书写的线条端点与目标端点位置,能够校验出线条是否存在断线的情况,尤其是针对在一体机屏幕边缘进行书写的情况,有着重要的意义。
此处需要补充说明的是,"geodesic"(测地线)一词来源于geodesy(测地学),是一门测量地球大小和形状的学科;从geodesic的本意来说,就是地球表面两点之间的最短路径;因此,Geodesic Distance最初是指地球表面两点之间的最短距离,但随后这一概念便被推广到了数学空间的测量之中。例如,在图论中,Geodesic Distance就是图中两节点的最短路径的距离,这与平时在几何空间通常用到的Euclidean Distance(欧氏距离),即两点之间的最短距离,有所区别。具体的,在图16中,两个黑点的Euclidean Distance,是用虚线所表示的线段的长度d15,而Geodesic Distance作为实际路径的最短距离,其距离应为沿途实线段距离之和的最小值,即d12+d23+d34+d45;进一步的,在三维网格中,Geodesic Distance就是两顶点沿网格表面最短路径的距离;另外,对于计算三维点云中两点的Geodesic Distance,首先要利用点云中所有点构建出一个类似于网格的表面结构的图,随后通过找到两点在图中的最短路径,再去计算Geodesic Distance。
至此,本公开示例实施例所记载的显示界面的测试方法已经全部完成。基于前述记载的内容可以得知,本公开示例实施例所记载的显示界面的测试方法,至少具有如下优势:一方面,本公开示例实施例所记载的显示界面的测试方法,可以对一体机页面进行自动化校对的方法,不仅可以快速确认各级功能页面的显示是否准确,还可以支持对书写页面擦除功能的校验;另一方面,本公开示例实施例所记载的显示界面的测试方法,可以对一体机页面上功能按钮的自动化校验方法,支持快速识别指定按钮所在位置,从而控制机械臂进行点选操作;再一方面,本公开示例实施例所记载的显示界面的测试方法,可以对一体机上的美化图形进行识别的功能;同时,针对一体机上的AI图形识别功能,快速校验所识别到的图形是否准确无误;进一步的,本公开示例实施例所记载的显示界面的测试方法,可以对一体机上手写线条进行校验的功能,实现对线条颜色、线条流畅性以及线条宽度的检验。
本公开示例实施例还提供了一种显示界面的测试装置。具体的,参考图17所示,该显示界面的测试装置可以包括第一图像获取模块1710、第一计算模块1720、第二计算模块1730以及显示界面测试模块1740。其中:
第一图像获取模块1710,可以用于获取显示终端的当前屏幕图像以及与所述当前屏幕图像对应的预期屏幕图像;
第一计算模块1720,可以用于计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系;
第二计算模块1730,可以用于计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系;
显示界面测试模块1740,可以用于根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试。
在本公开的一种示例性实施例中,计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系,包括:
获取所述当前屏幕图像中包括的第一像素点的第一像素值,以及预期屏幕图像的第二像素点的第二像素值;
计算所述第一像素值以及与所述第一像素点对应的第二像素点所具有的第二像素值之间的像素差值,并根据所述像素差值,计算所述第一均方误差;
计算所述第一均方误差与第一预设阈值之间的第一差值关系,并根据所述第一差值关系得到所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系。
在本公开的一种示例性实施例中,计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系,包括:
在确定所述第一图像匹配关系存在时,根据所述像素差值生成所述当前屏幕图像与预期屏幕图像之间的第一差值图;
基于预设的图像分割算法对所述第一差值图进行分割,得到所述第一差值图中包括的前景图像以及背景图像,并计算所述前景图像中所包括的非零像素的像素个数;
根据所述非零像素的像素个数,得到所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系。
在本公开的一种示例性实施例中,根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试,包括:
在确定所述第一图像匹配关系存在且所述第二图像匹配关系存在时,确定所述显示终端的显示界面的显示功能测试通过;
在确定所述第一图像匹配关系不存在或所述第二图像匹配关系不存在时,确定所述显示终端的显示界面的显示功能测试未通过。
在本公开的一种示例性实施例中,所述显示界面的测试装置还包括:
第一事件响应模块,可以用于响应于预设事件输入对象作用于所述显示界面中预设区域的擦除事件,对所述预设区域进行擦除,得到包括擦除区域的目标屏幕图像;
第三计算模块,可以用于获取所述目标屏幕图像中的擦除区域以及所述显示界面中的与所述预设区域对应的原始区域,并计算所述擦除区域与所述原始区域之间的第二均方误差以及第二差值图;
第四计算模块,可以用于根据所述第二均方误差以及第二差值图确定所述擦除区域以及预设区域之间的第一区域匹配关系以及第二区域匹配关系;
擦除功能测试模块,可以用于根据所述第一区域匹配关系以及第二区域匹配关系,对所述显示终端的显示界面中所具有的擦除功能进行测试。
在本公开的一种示例性实施例中,所述显示界面的测试装置还包括:
模版页面图匹配模块,可以用于获取与所述交互界面中包括的可交互控件对应的控件截图,并在预设的图像模板库中匹配与所述控件截图对应的可交互控件的模板页面图;
坐标位置发送模块,可以用于获取所述可交互控件在所述模板页面图中的坐标位置,并将所述坐标位置发送至预设事件输入对象;
第二事件响应模块,可以用于响应于所述预设事件输入对象基于所述坐标位置在所述显示界面中的触控事件,获取与所述触控事件对应的触控区域,并计算所述触控区域与所述控件截图之间的第三均方误差以及第三差值图;
触控功能测试模块,可以用于根据所述第三均方误差以及第三差值图确定所述触控区域以及控件截图之间的第一控件匹配关系以及第二控件匹配关系,并根据所述第一控件匹配关系以及第二控件匹配关系,对所述显示终端的显示界面中所具有的交互控件的触控功能进行测试。
在本公开的一种示例性实施例中,所述显示界面的测试装置还包括:
第三事件响应模块,可以用于响应于预设事件输入对象作用于所述显示界面的对预设内容进行输入的第一输入事件,生成与所述第一输入事件对应的原始内容,并对所述原始内容进行标准化处理,得到标准内容;
第五计算模块,可以用于计算包括所述目标内容的第一目标界面以及所述显示界面之间的第四差值图,并根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像;
第六计算模块,可以用于计算所述子内容图像以及所述预设内容中与所述子内容对应的子模板内容的子模板图像之间的第四均方误差,并根据所述第四均方误差确定所述子内容图像与子模板图像之间的内容匹配关系;
输入功能测试模块,可以用于根据所述内容匹配关系对所述显示终端的显示界面的输入功能和/或机器学习功能进行测试。
在本公开的一种示例性实施例中,根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像,包括:
对所述第四差值图进行灰度转换,得到第一二值差值图,并利用预设的图像分割算法对所述第一二值差值图进行图像分割,得到第一分割后的黑白图像;
获取所述第一分割后的黑白图像中包括的第一原始连通区域,并对所述第一原始连通区域进行过滤,得到第一目标连通区域;
从所述第一分割后的黑白图像中对所述第一目标连通区域进行裁切,得到第一初始裁切结果,并基于第一预设查找方向查找所述第一初始裁切结果中第三像素值大于第二预设阈值的第一个像素点;
以所述第一个像素点为种子点进行区域生长,对所述第一初始裁切结果所具有的图形轮廓内部区域进行填充,得到第一目标裁切结果,并对所述第一目标裁切结果的大小进行调整,得到所述标准内容中包括的每一个子内容所具有的子内容图像。
在本公开的一种示例性实施例中,所述原始内容包括原始图形和/或原始字符;
所述原始图形包括矩形、椭圆形、三角形、规则的多边形以及不规则的多边形中的任意一种或多种。
在本公开的一种示例性实施例中,当所述原始图形为矩形时,所述第六计算模块还可以被配置为:获取所述矩形的长边的长度值以及宽边的长度值,并计算所述长边的长度值与宽边的长度值之间的第一比值;在确定所述第一比值大于第三预设阈值,或小于第四预设阈值时,确定所述原始图形为矩形;在确定所述第一比值介于所述第三预设阈值以及第四预设阈值之间时,确定所述原始图形为正方形。
在本公开的一种示例性实施例中,当所述原始图形为椭圆形时,所述第六计算模块还可以被配置为:获取所述椭圆形在纵坐标方向上的第一直径的长度值以及在横坐标方向上的第二直径的长度值,并计算第一直径的长度值以及第二直径的长度值之间的第二比值;在确定所述第一比值大于第三预设阈值,或小于第四预设阈值时,确定所述原始图形为椭圆形;在确定所述第一比值介于所述第三预设阈值以及第四预设阈值之间时,确定所述原始图形为圆形。
在本公开的一种示例性实施例中,所述显示界面的测试装置还包括:
第四事件响应模块,可以用于响应于预设事件输入对象作用于所述显示界面的对线条形状进行输入的第二输入事件,生成与所述第二输入事件对应的原始线条形状;
第七计算模块,可以用于计算包括所述原始线条形状的第二目标界面以及所述显示界面之间的第五差值图,并对所述第五差值图进行二值化处理,得到第二二值差值图;
第八计算模块,可以用于利用预设的图像分割算法对所述第二二值差值图进行图像分割,得到第二分割后的黑白图像,并获取所述第二分割后的黑白图像中包括的第二原始连通区域;
线条输入功能测试模块,可以用于对所述第二原始连通区域进行过滤,得到第二目标连通区域,并基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试。
在本公开的一种示例性实施例中,所述线条输入功能包括线条颜色输入功能、线条流畅性输入功能以及线条宽度输入功能中的至少一种。
在本公开的一种示例性实施例中,当所述线条输入功能为线条颜色输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,包括:
遍历所述第二目标界面与所述第二目标连通区域对应的区域内部的每个像素点,获取所述区域内部的每个像素点的第四像素值,并计算所述第四像素值的第一平均值;
根据所述第四像素值的第一平均值以及所述原始线条形状所具有的目标像素值,计算所述原始线条形状的颜色匹配关系;
根据所述颜色匹配关系对所述显示终端的显示界面所具有的线条颜色输入功能进行测试。
在本公开的一种示例性实施例中,当所述线条输入功能为线条宽度输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,包括:
从所述第二分割后的黑白图像中对所述第二目标连通区域进行裁切,得到第二初始裁切结果,并基于第二预设查找方向以及预设像素宽度扫描所述第二初始裁切结果中第五像素值大于第二预设阈值的第一个像素点;
获取所述第一个像素点在横向位置上与该第一个像素点相邻的两个像素点的第六像素值以及第七像素值,并根据所述第六像素值以及第七像素值确定目标绘制方向;
基于所述目标绘制方向绘制满足预设条件的正方形,并计算所述满足预设条件的正方形的边长的第二平均值;
根据所述第二平均值以及所述原始线条形状所具有的目标线条宽度,计算所述原始线条形状的线条宽度匹配关系,并根据所述线条宽度匹配关系对所述显示终端的显示界面所具有的线条宽度输入功能进行测试。
在本公开的一种示例性实施例中,当所述线条输入功能为线条流畅度输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,包括:
基于第一预设查找方向查找所述第二初始裁切结果中第六像素值大于第二预设阈值的第一个像素点,并将第二初始裁切结果中第六像素值大于第二预设阈值的第一个像素点作为目标像素点;
计算所述第二初始裁切结果中所包括的所有像素点与所述目标像素点之间的第一测地线距离,并根据所述第一测地线距离从所有像素点中确定所述原始线条形状的第一端点;
计算所述第二初始裁切结果中所包括的所有像素点与所述第一端点之间的第二测地线距离,并根据所述第二测地线距离从所有像素点中确定所述原始线条形状的第二端点;
根据所述第一端点的端点位置、第二端点的端点位置以及所述原始线条形状所具有的目标端点的端点位置,计算所述原始线条形状的线条流畅度匹配关系,并根据所述线条流畅度匹配关系对所述显示终端的显示界面所具有的线条流畅度输入功能进行测试。
在本公开的一种示例性实施例中,所述预设的事件输入对象包括机械臂。
上述显示界面的测试装置中各模块的具体细节已经在对应的显示界面的测试方法中进行了详细的描述,因此此处不再赘述。
应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元, 但是这种划分并非强制性的。实际上,根据本公开的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。
此外,尽管在附图中以特定顺序描述了本公开中方法的各个步骤,但是,这并非要求或者暗示必须按照该特定顺序来执行这些步骤,或是必须执行全部所示的步骤才能实现期望的结果。附加的或备选的,可以省略某些步骤,将多个步骤合并为一个步骤执行,以及/或者将一个步骤分解为多个步骤执行等。
在本公开的示例性实施例中,还提供了一种能够实现上述方法的电子设备。
所属技术领域的技术人员能够理解,本公开的各个方面可以实现为系统、方法或程序产品。因此,本公开的各个方面可以具体实现为以下形式,即:完全的硬件实施方式、完全的软件实施方式(包括固件、微代码等),或硬件和软件方面结合的实施方式,这里可以统称为“电路”、“模块”或“系统”。
下面参照图18来描述根据本公开的这种实施方式的电子设备1800。图18显示的电子设备1800仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图18所示,电子设备1800以通用计算设备的形式表现。电子设备1800的组件可以包括但不限于:上述至少一个处理单元1810、上述至少一个存储单元1820、连接不同系统组件(包括存储单元1820和处理单元1810)的总线1830以及显示单元1840。
其中,所述存储单元存储有程序代码,所述程序代码可以被所述处理单元1810执行,使得所述处理单元1810执行本说明书上述“示例性方法”部分中描述的根据本公开各种示例性实施方式的步骤。例如,所述处理单元1810可以执行如图1中所示的步骤S110:获取显示终端的当前屏幕图像以及与所述当前屏幕图像对应的预期屏幕图像;步骤S120:计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系;步骤S130:计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系;步骤S140:根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试。
存储单元1820可以包括易失性存储单元形式的可读介质,例如随机存取存储单元(RAM)18201和/或高速缓存存储单元18202,还可以进一步包括只读存储单元(ROM)18203。
存储单元1820还可以包括具有一组(至少一个)程序模块18205的程序/实用工具18204,这样的程序模块18205包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。
总线1830可以为表示几类总线结构中的一种或多种,包括存储单元总线或者存储单元控制器、外围总线、图形加速端口、处理单元或者使用多种总线结构中的任意总线结构的局域总线。
电子设备1800也可以与一个或多个外部设备1300(例如键盘、指向设备、蓝牙设备等)通信,还可与一个或者多个使得用户能与该电子设备1800交互的设备通信,和/或与使得该电子设备1800能与一个或多个其它计算设备进行通信的任何设备(例如路由器、调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口1850进行。并且,电子设备1800还可以通过网络适配器1860与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器1860通过总线1830与电子设备1800的其它模块通信。应当明白,尽管图中未示出,可以结合电子设备1800使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。
通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本公开实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中或网络上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、终端装置、或者网络设备等)执行根据本公开实施方式的方法。
在本公开的示例性实施例中,还提供了一种计算机可读存储介质,其上存储有能够实现本说明书上述方法的程序产品。在一些可能的实施方式中,本公开的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当所述程序产品在终端设备上运行时,所述程序代码用于使所述终端设备执行本说明书上述“示例性方法”部分中描述的根据本公开各种示例性实施方式的步骤。
根据本公开的实施方式的用于实现上述方法的程序产品,其可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在终端设备,例如个人电脑上运行。然而,本公开的程序产品不限于此,在本文件中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
所述程序产品可以采用一个或多个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以为但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。
计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。
可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、有线、光缆、RF等等,或者上述的任意合适的组合。
可以以一种或多种程序设计语言的任意组合来编写用于执行本公开操作的程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、C++等,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户计算设备上部分在远程计算设备上执行、或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算设备,或者,可以连接到外部计算设备(例如利用因特网服务提供商来通过因特网连接)。
此外,上述附图仅是根据本公开示例性实施例的方法所包括的处理的示意性说明,而不是限制目的。易于理解,上述附图所示的处理并不表明或限制这些处理的时间顺序。另外,也易于理解,这些处理可以是例如在多个模块中同步或异步执行的。
本领域技术人员在考虑说明书及实践这里发明的发明后,将容易想到本公开的其他实施例。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未发明的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由权利要求指出。

Claims (20)

  1. 一种显示界面的测试方法,其特征在于,包括:
    获取显示终端的当前屏幕图像以及与所述当前屏幕图像对应的预期屏幕图像;
    计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系;
    计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系;
    根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试。
  2. 根据权利要求1所述的显示界面的测试方法,其特征在于,计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系,包括:
    获取所述当前屏幕图像中包括的第一像素点的第一像素值,以及预期屏幕图像的第二像素点的第二像素值;
    计算所述第一像素值以及与所述第一像素点对应的第二像素点所具有的第二像素值之间的像素差值,并根据所述像素差值,计算所述第一均方误差;
    计算所述第一均方误差与第一预设阈值之间的第一差值关系,并根据所述第一差值关系得到所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系。
  3. 根据权利要求2所述的显示界面的测试方法,其特征在于,计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系,包括:
    在确定所述第一图像匹配关系存在时,根据所述像素差值生成所述当前屏幕图像与预期屏幕图像之间的第一差值图;
    基于预设的图像分割算法对所述第一差值图进行分割,得到所述第一差值图中包括的前景图像以及背景图像,并计算所述前景图像中所包括的非零像素的像素个数;
    根据所述非零像素的像素个数,得到所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系。
  4. 根据权利要求3所述的显示界面的测试方法,其特征在于,根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试,包括:
    在确定所述第一图像匹配关系存在且所述第二图像匹配关系存在时,确定所述显示终端的显示界面的显示功能测试通过;
    在确定所述第一图像匹配关系不存在或所述第二图像匹配关系不存在时,确定所述显示终端的显示界面的显示功能测试未通过。
  5. 根据权利要求1所述的显示界面的测试方法,其特征在于,所述显示界面的测试方法还包括:
    响应于预设事件输入对象作用于所述显示界面中预设区域的擦除事件,对所述预设区域进行擦除,得到包括擦除区域的目标屏幕图像;
    获取所述目标屏幕图像中的擦除区域以及所述显示界面中的与所述预设区域对应的原始区域,并计算所述擦除区域与所述原始区域之间的第二均方误差以及第二差值图;
    根据所述第二均方误差以及第二差值图确定所述擦除区域以及预设区域之间的第一区域匹配关系以及第二区域匹配关系;
    根据所述第一区域匹配关系以及第二区域匹配关系,对所述显示终端的显示界面中所具有的擦除功能进行测试。
  6. 根据权利要求1所述的显示界面的测试方法,其特征在于,所述显示界面的测试方法还包括:
    获取与所述交互界面中包括的可交互控件对应的控件截图,并在预设的图像模板库中匹配与所述控件截图对应的可交互控件的模板页面图;
    获取所述可交互控件在所述模板页面图中的坐标位置,并将所述坐标位置发送至预设事件输入对象;
    响应于所述预设事件输入对象基于所述坐标位置在所述显示界面中的触控事件,获取与所述触控事件对应的触控区域,并计算所述触控区域与所述控件截图之间的第三均方误差以及第三差值图;
    根据所述第三均方误差以及第三差值图确定所述触控区域以及控件截图之间的第一控件匹配关系以及第二控件匹配关系,并根据所述第一控件匹配关系以及第二控件匹配关系,对所述显示终端的显示界面中所具有的交互控件的触控功能进行测试。
  7. 根据权利要求1所述的显示界面的测试方法,其特征在于,所述显示界面的测试方法还包括:
    响应于预设事件输入对象作用于所述显示界面的对预设内容进行输入的第一输入事件,生成与所述第一输入事件对应的原始内容,并对所述原始内容进行标准化处理,得到标准内容;
    计算包括所述目标内容的第一目标界面以及所述显示界面之间的第四差值图,并根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像;
    计算所述子内容图像以及所述预设内容中与所述子内容对应的子模板内容的子模板图像之间的第四均方误差,并根据所述第四均方误差确定所述子内容图像与子模板图像之间的内容匹配关系;
    根据所述内容匹配关系对所述显示终端的显示界面的输入功能和/或机器学习功能进行测试。
  8. 根据权利要求7所述的显示界面的测试方法,其特征在于,根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像,包括:
    对所述第四差值图进行灰度转换,得到第一二值差值图,并利用预设的图像分割算法对所述第一二值差值图进行图像分割,得到第一分割后的黑白图像;
    获取所述第一分割后的黑白图像中包括的第一原始连通区域,并对所述第一原始连通区域进行过滤,得到第一目标连通区域;
    从所述第一分割后的黑白图像中对所述第一目标连通区域进行裁切,得到第一初始裁切结果,并基于第一预设查找方向查找所述第一初始裁切结果中第三像素值大于第二预设阈值的第一个像素点;
    以所述第一个像素点为种子点进行区域生长,对所述第一初始裁切结果所具有的图形轮廓内部区域进行填充,得到第一目标裁切结果,并对所述第一目标裁切结果的大小进行调整,得到所述标准内容中包括的每一个子内容所具有的子内容图像。
  9. 根据权利要求7所述的显示界面的测试方法,其特征在于,所述原始内容包括原始图形和/或原始字符;
    所述原始图形包括矩形、椭圆形、三角形、规则的多边形以及不规则的多边形中的任意一种或多种。
  10. 根据权利要求9所述的显示界面的测试方法,其特征在于,当所述原始图形为矩形时,在根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像之后,所述显示界面的测试方法还包括:
    获取所述矩形的长边的长度值以及宽边的长度值,并计算所述长边的长度值与宽边的长度值之间的第一比值;
    在确定所述第一比值大于第三预设阈值,或小于第四预设阈值时,确定所述原始图形为矩形;
    在确定所述第一比值介于所述第三预设阈值以及第四预设阈值之间时,确定所述原始图形为正方形。
  11. 根据权利要求9所述的显示界面的测试方法,其特征在于,当所述原始图形为椭圆形时,在根据所述第四差值图计算所述标准内容中包括的每一个子内容所具有的子内容图像之后,所述显示界面的测试方法还包括:
    获取所述椭圆形在纵坐标方向上的第一直径的长度值以及在横坐标方向上的第二直径的长度值,并计算第一直径的长度值以及第二直径的长度值之间的第二比值;
    在确定所述第一比值大于第三预设阈值,或小于第四预设阈值时,确定所述原始图形为椭圆形;
    在确定所述第一比值介于所述第三预设阈值以及第四预设阈值之间时,确定所述原始图形为圆形。
  12. 根据权利要求1所述的显示界面的测试方法,其特征在于,所述显示界面的测试方法还包括:
    响应于预设事件输入对象作用于所述显示界面的对线条形状进行输入的第二输入事件,生成与所述第二输入事件对应的原始线条形状;
    计算包括所述原始线条形状的第二目标界面以及所述显示界面之间的第五差值图,并对所述第五差值图进行二值化处理,得到第二二值差值图;
    利用预设的图像分割算法对所述第二二值差值图进行图像分割,得到第二分割后的黑白图像,并获取所述第二分割后的黑白图像中包括的第二原始连通区域;
    对所述第二原始连通区域进行过滤,得到第二目标连通区域,并基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试。
  13. 根据权利要求12所述的显示界面的测试方法,其特征在于,所述线条输入功能包括线条颜色输入功能、线条流畅性输入功能以及线条宽度输入功能中的至少一种。
  14. 根据权利要求13所述的显示界面的测试方法,其特征在于,当所述线条输入功能为线条颜色输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,包括:
    遍历所述第二目标界面与所述第二目标连通区域对应的区域内部的每个像素点,获取所述区域内部的每个像素点的第四像素值,并计算所述第四像素值的第一平均值;
    根据所述第四像素值的第一平均值以及所述原始线条形状所具有的目标像素值,计算所述原始线条形状的颜色匹配关系;
    根据所述颜色匹配关系对所述显示终端的显示界面所具有的线条颜色输入功能进行测试。
  15. 根据权利要求13所述的显示界面的测试方法,其特征在于,当所述线条输入功能为线条宽度输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,包括:
    从所述第二分割后的黑白图像中对所述第二目标连通区域进行裁切,得到第二初始裁切结果,并基于第二预设查找方向以及预设像素宽度扫描所述第二初始裁切结果中第五像素值大于第二预设阈值的第一个像素点;
    获取所述第一个像素点在横向位置上与该第一个像素点相邻的两个像素点的第六像素值以及第七像素值,并根据所述第六像素值以及第七像素值确定目标绘制方向;
    基于所述目标绘制方向绘制满足预设条件的正方形,并计算所述满足预设条件的正方形的边长的第二平均值;
    根据所述第二平均值以及所述原始线条形状所具有的目标线条宽度,计算所述原始线条形状的线条宽度匹配关系,并根据所述线条宽度匹配关系对所述显示终端的显示界面所具有的线条宽度输入功能进行测试。
  16. 根据权利要求15所述的显示界面的测试方法,其特征在于,当所述线条输入功能为线条流畅度输入功能时,基于所述第二目标连通区域对所述显示终端的显示界面所具有的线条输入功能进行测试,包括:
    基于第一预设查找方向查找所述第二初始裁切结果中第六像素值大于第二预设阈值的第一个像素点,并将第二初始裁切结果中第六像素值大于第二预设阈值的第一个像素点作为目标像素点;
    计算所述第二初始裁切结果中所包括的所有像素点与所述目标像素点之间的第一测地线距离,并根据所述第一测地线距离从所有像素点中确定所述原始线条形状的第一端点;
    计算所述第二初始裁切结果中所包括的所有像素点与所述第一端点之间的第二测地线距离,并根据所述第二测地线距离从所有像素点中确定所述原始线条形状的第二端点;
    根据所述第一端点的端点位置、第二端点的端点位置以及所述原始线条形状所具有的目标端点的端点位置,计算所述原始线条形状的线条流畅度匹配关系,并根据所述线条流畅度匹配关系对所述显示终端的显示界面所具有的线条流畅度输入功能进行测试。
  17. 根据权利要求7-16任一项所述的显示界面的测试方法,其特征在于,所述预设的事件输入对象包括机械臂。
  18. 一种显示界面的测试装置,其特征在于,包括:
    第一图像获取模块,用于获取显示终端的当前屏幕图像以及与所述当前屏幕图像对应的预期屏幕图像;
    第一计算模块,用于计算所述当前屏幕图像以及预期屏幕图像之间的第一均方误差,并根据所述第一均方误差确定所述当前屏幕图像与所述预期屏幕图像之间的第一图像匹配关系;
    第二计算模块,用于计算所述当前屏幕图像与预期屏幕图像之间的第一差值图,并根据所述第一差值图确定所述当前屏幕图像与所述预期屏幕图像之间的第二图像匹配关系;
    显示界面测试模块,用于根据所述第一图像匹配关系以及第二图像匹配关系,对所述显示终端的显示界面进行测试。
  19. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-17任一项所述的显示界面的测试方法。
  20. 一种电子设备,其特征在于,包括:
    处理器;以及
    存储器,用于存储所述处理器的可执行指令;
    其中,所述处理器配置为经由执行所述可执行指令来执行权利要求1-17任一项所述的显示界面的测试方法。
PCT/CN2023/113522 2022-08-24 2023-08-17 显示界面的测试方法及装置、存储介质、电子设备 WO2024041443A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211021124.9A CN115359008A (zh) 2022-08-24 2022-08-24 显示界面的测试方法及装置、存储介质、电子设备
CN202211021124.9 2022-08-24

Publications (2)

Publication Number Publication Date
WO2024041443A1 WO2024041443A1 (zh) 2024-02-29
WO2024041443A9 true WO2024041443A9 (zh) 2024-04-18

Family

ID=84005086

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/113522 WO2024041443A1 (zh) 2022-08-24 2023-08-17 显示界面的测试方法及装置、存储介质、电子设备

Country Status (2)

Country Link
CN (1) CN115359008A (zh)
WO (1) WO2024041443A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115359008A (zh) * 2022-08-24 2022-11-18 京东方科技集团股份有限公司 显示界面的测试方法及装置、存储介质、电子设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104133665B (zh) * 2013-11-19 2015-09-30 腾讯科技(深圳)有限公司 基于图像检测的定位方法与装置
CN105302413B (zh) * 2015-10-14 2020-11-13 惠州Tcl移动通信有限公司 控件的ui测试方法及系统
CN111476759B (zh) * 2020-03-13 2022-03-25 深圳市鑫信腾机器人科技有限公司 一种屏幕表面检测方法、装置、终端及存储介质
CN114067740B (zh) * 2020-07-31 2024-04-16 北京小米移动软件有限公司 屏幕校准方法及装置、电子设备及存储介质
WO2022060299A1 (en) * 2020-09-18 2022-03-24 Nanyang Technological University Vision correction of screen images
CN113407461A (zh) * 2021-07-20 2021-09-17 北京达佳互联信息技术有限公司 界面测试方法、装置、电子设备及存储介质
CN115359008A (zh) * 2022-08-24 2022-11-18 京东方科技集团股份有限公司 显示界面的测试方法及装置、存储介质、电子设备

Also Published As

Publication number Publication date
WO2024041443A1 (zh) 2024-02-29
CN115359008A (zh) 2022-11-18

Similar Documents

Publication Publication Date Title
US20240078646A1 (en) Image processing method, image processing apparatus, and non-transitory storage medium
WO2021115181A1 (zh) 手势识别方法、手势控制方法、装置、介质与终端设备
US11113836B2 (en) Object detection method, device, apparatus and computer-readable storage medium
WO2020140698A1 (zh) 表格数据的获取方法、装置和服务器
CN106325737B (zh) 一种书写路径擦除方法及设备
WO2024041443A9 (zh) 显示界面的测试方法及装置、存储介质、电子设备
CN108549643B (zh) 翻译处理方法和装置
WO2019041424A1 (zh) 验证码识别方法、装置、计算机设备及计算机存储介质
KR101032446B1 (ko) 영상의 정점 검출 장치 및 방법
JP6102122B2 (ja) 画像処理装置および方法、並びにプログラム
CN114529837A (zh) 建筑物轮廓提取方法、系统、计算机设备及存储介质
WO2021196013A1 (zh) 单词识别方法、设备及存储介质
JP3795238B2 (ja) 文書画像処理装置及び文書画像処理方法
US9710945B2 (en) Method for cutting out character, character recognition apparatus using this method, and program
WO2023019995A1 (zh) 训练方法、译文展示方法、装置、电子设备以及存储介质
CN113850238B (zh) 文档检测方法、装置、电子设备及存储介质
CN111783561A (zh) 审图结果修正方法、电子设备及相关产品
US11238620B2 (en) Implicit structured light decoding method, computer equipment and readable storage medium
US9418281B2 (en) Segmentation of overwritten online handwriting input
CN116259064B (zh) 表格结构识别方法、表格结构识别模型的训练方法及装置
RU2458396C1 (ru) Способ редактирования статических цифровых комбинированных изображений, включающих в себя изображения нескольких объектов
CN113762455A (zh) 检测模型训练方法、单字检测方法、装置、设备及介质
CN113850239B (zh) 多文档检测方法、装置、电子设备及存储介质
CN113850805B (zh) 多文档检测方法、装置、电子设备及存储介质
CN111582151B (zh) 文档图像朝向检测方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23856533

Country of ref document: EP

Kind code of ref document: A1