Platforms to show: All Mac Windows Linux Cross-Platform

Back to Picture class.

Picture.CompareBrightnessMBS(other as picture, mode as Integer, threshold as Integer) as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 10.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compares two pictures in brightness.
Example
dim p as picture = New Picture(100,100,32)
dim q as Picture = New Picture(100,100,32)

dim diff as Double = p.CompareBrightnessMBS(q, 0, 0)

MsgBox str(Diff) // shows 0 = equal

Returns the percent of difference: Number of pixels where the squared color difference is bigger than the threshold divided by the total number of pixels.
If width and height are not equal, the result is 1.0.
If you need to check the mask also, please call this method a second time for the masks.

Modes:
0y = 0.33 * R + 0.5 * G + 0.16 * BFaster version of 3
1y = 0.375 * R + 0.5 * G + 0.125 * BFaster version of 3
2y = 0.2126 * R + 0.7152 * G + 0.0722 * BPhotometric/digital ITU-R
3y = 0.299 * R + 0.587 * G + 0.114 * BDigital CCIR601

Mode 2 and 3 uses doubles and mode 0 and 1 use integers so they should be faster.
Still Mode 0 and 1 are just approximation formulas which trade accuracy for perfomance.

Only compares raw pixels without checking mask or alpha channel.

The items on this page are in the following plugins: MBS Picture Plugin.


The biggest plugin in space...