Description Go to top

The Picture Block Compare device contains a set of functions and variables for controlling the Picture Block Compare device. The Picture Block Compare device is not a physical device which appears in the system, but an implementation of the picture compare algorithm which is used for calculating picture quality. The algorithm performs comparison of two pictures (grabbed and referent) as well as comparison of regions of interest, which could be defined in two different ways:

  • by using macros that define a region of interest for comparation
  • by using masked images, that define different parts of images that should be taken into the consideration in image comparation

The real example usage of the Picture Block Compare device can be seen at:

 

Device info Go to top

In order to initialize the Picture Block Compare (PBC) device properly, several parameters must be set. The following example presents a proper definition of the PBC algorithm instance inside the test_env.ini (test environment description) configuration file.

MANDATORY INITIALIZATION:
[device]
alias = PictureAlgorithm
name = PICTUREBLOCKCOMPARE

The following text describes optional settings. Config is a name of the file with macros for the PictureBlockCompare device. Pixels_to_shift is a number in pixels used to find best match of two pictures. BlockHeight and BlockWidth is block size for comparing. Reffile_path is a path for referent pictures in case if referent pictures are not in the same folder as a captured picture. See below example of optional initialization.

OPTIONAL INITIALIZATION:
[device]
alias = PictureAlgorithm
name = PICTUREBLOCKCOMPARE
config = PictureAlgorithm.ini
pixels_to_shift = 5
BlockHeight = 50
BlockWidth = 40
reffile_path = D:\Folder_With_Referent_Pictures\

alias – is a tag name which will be used in the test case.
name – presents a unique identifier for the PBC device and must be set as PICTUREBLOCKCOMPARE.
config – is the name of the file which contains additional configuration (macro commands) related to the PBC device (this parameter is optional). The example of config file (macro file) will be presented in the Appendix A.
pixels_to_shift – is a number of pixels used to find the best match of two pictures.
BlockHeight and BlockWidth – block size for comparing.
reffile_path – path for referent pictures in case if referent pictures are not in the same folder as a captured picture.

 

Device parameters Go to top

For proper functioning of each device, following parameters should be set:

  • point1_x – start x coordinate of the region of interest. Possible values are 1 – 1920.
  • point2_x– end x coordinate of the region of interest. Possible values are 1 – 1080.
  • point1_y – start y coordinate of the region of interest. Possible values are 1 – 1920.
  • point2_y– end y coordinate of the region of interest. Possible values are 1 – 1080.

The easiest way of getting the coordinates for the Picture Block Compare device is by using a tool called Reference Creator

Other device parameters also available in the Picture Block Compare device are:

  • testpicture – a string containing the name of the captured picture including the “.bmp” file extension. In case that captured picture is not in the same folder as a referent picture, this string should contain the absolute path to the captured picture.
  • refpicture – a string containing the name of the referent picture including the “.bmp” file extension. In case that referent picture is not in the same folder as a captured picture, string should contain absolute path to the referent picture.
  • BlockHeight – height of block used during process of comparison.  Possible values are 0 – 1920. Default value is 40.
  • BlockWidth – width of block used during process of comparison.  Possible values are 0 – 1920. Default value is 50.
  • diffpicture – string containing the path to the file in which the difference picture will be stored. Default value is “diff.bmp”.
  • lastError – contains info about last occurred error
  • movement_h – horizontal movement of tested image according referent
  • movement_v – vertical movement of tested image according referent
  • pixels_to_shift – value which represent maximum number of pixels for test picture that will be shifted to align with referent picture.  Possible values are 0 – 20. Default value is 0 (Don’t shift).
  • reffile_path – path to folder with referent files
  • reffile_tree – folder structure include in path. Possible values are 0 – 1. Default value is 0 (No tree folder structure).
  • result– this is the value calculated by the PBC algorithm. Possible values are 0 – 100. Default value is 0 (Pictures not the same).
  • save_to_jpeg – value which represent should differential pictures be stored in BMP or JPEG format. Possible values are 0 – 1. Default value is 1 (JPEG format).
 

Device usage Go to top

When configuring and controlling devices from the test itself, such tests often become less readable as well as too large and very complicated for maintenance. To avoid this situation, macros are used.  User can use previously prepared macro definitions (set of commands which will be sent to the PBC device) which are stored in the PBC.ini file. This kind of device controlling makes test cases shorter and clearer (more readable), particularly when macros are intuitively named ([PREVIEW_WINDOW_ROI], [SETTINGS_SUBMENU]…). Also, this approach allows easy adjustment of large number of test cases without changing of test scripts by simple modification of macro definitions (modifications will affect all test scripts where particular macro is used).

One example of the macro that can be used by the Picture Block Compare device is given here:

[CHANNEL_LOGO] "point1_x 1803" "point1_y 75" "point2_x 1841" "point2_y 88"

You can note here where the exact location of the channel logo is on the screen.

 

PictureAlgorithm.ini Go to top

Here you can find a full example of the macro configuration file that is created for the previously described device.

****************************************************** Picture Alghorithm macros *********************************************************************************************************
[FULL_SCREEN]   "point1_x 0" "point1_y 0" "point2_x 1920" "point2_y 1080"
[LOGO]          "point1_x 39" "point1_y 28" "point2_x 207" "point2_y 177"
[HOME_TOP]      "point1_x 20" "point1_y 8" "point2_x 1904" "point2_y 121"