Oldschool Posted January 13, 2008 Share Posted January 13, 2008 There is an open source program called Openscrape written C/C++ that uses an "in memory" OCR technique of interest. Particularly they are using an Alpha Channel separation technique to drop an image background, and obtain a clean foreground.The color cube specifications (as in the C transform) are used to separate the foreground from the background pixels.// Load entire foreground pixel array into memory ::ZeroMemory(&bmi, sizeof(BITMAPINFO)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biWidth = width; bmi.bmiHeader.biHeight = -height; bmi.bmiHeader.biBitCount = 32; bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biCompression = BI_BITFIELDS; bmi.bmiHeader.biSizeImage = width * height * 4; pBits = ::new BYTE[bmi.bmiHeader.biSizeImage]; ::ZeroMemory(pBits, bmi.bmiHeader.biSizeImage * sizeof(BYTE)); hbm = (HBITMAP) GetCurrentObject(hdc, OBJ_BITMAP); ::GetDIBits(hdc, hbm, 0, height, pBits, &bmi, DIB_RGB_COLORS); for (x = 0; x < width; x++) { for (y = 0; y < height; y++) { alpha = pBits[y*width*4 + x*4 + 3]; red = pBits[y*width*4 + x*4 + 2]; green = pBits[y*width*4 + x*4 + 1]; blue = pBits[y*width*4 + x*4 + 0];I'm pretty sure this can be done with A3L, just not entirely sure how at this point.Maybe ImageMagick will be required...http://www.autoitscript.com/forum/index.ph...52178&st=15Does anyone have any ideas on how to do this in AutoIt? Link to comment Share on other sites More sharing options...
Zedna Posted January 13, 2008 Share Posted January 13, 2008 I'm pretty sure this can be done with A3L, just not entirely sure how at this point.Maybe ImageMagick will be required...http://www.autoitscript.com/forum/index.ph...52178&st=15Does anyone have any ideas on how to do this in AutoIt?Just note: All A3L (Auto3Library) functionality was ported to standard UDF in AutoIt 3.2.10 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now