Improve image process (2006-05-22 01:00 by drhu00 #22178)
When examining the image process, I find that it not efficient. There are so many entire image loop. The first one is in QRCodeUtility parseImage. The second one is in imageToGrayScale. The third one is in findAreaMiddle. The fourth is in grayScaleToBitmap. The basic idea convert from image RGB value to bitmap is to a good halftone. Since QR image is black (RGB value =0) and white (RGB value = 255), therefore the default halftone is 255/2=127 which is good enough for most image. When doing snapshot, the minRGB value is always 0, and the maxRGB value is most likely around 200. And therefore a good guess of halftone is 100. It's too time-consuming to execute grayScaleToBitmap, especially with a large value of numSqrtArea. Using the logical of findAreaMiddle of an image is not help too much for QR decoding in my experience.
I am thinking of give the end user the option to choice the halftone which is fit to the category pre-image processing (including the rotation, cut edge etc). In this way, we can reduce the loop to one. I tested to set the halftone =100, and it works great. The speed improved.