There are a couple ways of doing this ... doing the entire thing in VB is possible but will be slow.
1. The structure of the GetPixels is litterally a red, green and blue number from 0 to 255 for every pixel in the current image. So one can expect that array to be width * height * 3 big.
2. There are many ways of doing this. A quick answer is to just use the green value (i.e. 2nd value in each pixel triplet) since that represents gray the best or use (red + green + blue)/3 as the gray/intensity value. You can try both to see which way better suits you.
Alternatively, I would use the Crop module to remove all but the part of the image that you want to check. Then you don't have to worry about the region limits from then on.
I would then use the Threshold module to eliminate all the pixels not inbetween Min and Max.
Finally, adding the Color_Statistics module would give me "Area" or the number of non-black pixels ... which is therefore the number of pixels that lay between min and max.
Then you don't need any VBScript at all and its operating near realtime!
See attached example.
If you have any questions/issues about RoboRealm or image processing this is your chance to ask a question.
Your question and any responses will be posted to the forum section of the website for others to read and learn from.
Note that any submission will be considered property of RoboRealm. If you do not wish your images to be
displayed as part of the RoboRealm site please do not submit those images.
Any submission may be removed from the website at the discretion of RoboRealm personnel.