Take Seb's plan and modify it slightly: Have a list of rects, one for each checkbox on the form. Be sure each rect is big enough to handle variations in the printing and scanning of the form. If you can, be sure the form is designed with these problems in mind (lots of white space around the check boxes).
Cycle through the list of rects and use them in place of 'startImg.rect' in line 2 of the second section of Seb's averaging technique (below) to look at each rect and see if it is dark enough to be considered marked. It would be a very good idea to have a portion (or two or three) of the form that is supposed to be white, then you can check those first and use the result for a reference. If someone copies the form on a crappy copier or colored paper, you want to be able to handle it. - Carl Sebastien Portebois wrote: > > Hi rodrigo, > > > I don't need to compare two images but confirm if the checkbox is > > filled or > > not. For example, someone fill a test and then I scan the page and check > > throw the checkboxes for it answers and returns that was filled, so I can > > compute if the answer is right or not. > > if your working from scans, then checking for identical images would return > wrong values, as two scans of the same image might differ. > > IMHO an other approach would be to test the average value of this checkbox : > if it's still withe/light gray (e.g. it's not ckecked), the value will be > very different from a checked box (darker color) > > the idea then is to read the average color of the image, and then compare > with a threshold. > > To set this threshold, the best thing is to choose a set of various scans, > then read all the average values, and see where unfilled values are > situated, as well as checked ones. > > at last, here comes a little handler to return you a 1x1 image filled with > the average colo of the input image. you just have to getPixel this single > pixel to know the avergae color of the whole image you've send to this > function > > hope that make sensen > seb > > on average (startImg) ------------------------------------------------ > -- ACTION : > -- return a image which color is the average of the whole pixel > -- panel of the startImg given. > -- > -- INPUT : > -- startImg <#image> : the image to parse > -- > -- RETURN : > -- VOID : startImg is not an image > -- #image : the resulting image > ------- > > -- 1 - check input > if (ilk(startImg) <> #image) then return VOID > > -- 2 - do the average stuffs > average = image(1,1,startImg.depth) > average.copyPixels(startImg, average.rect, startImg.rect) > returnImg = image(startImg.width, startImg.height, startImg.depth) > returnImg.copyPixels(average, returnImg.rect, average.rect) > > -- 3 - return the result > return returnImg > end -- average method -- Carl West [EMAIL PROTECTED] http://eisen.home.attbi.com I have no superfluous leisure; my stay must be stolen out of other affairs; but I will attend you awhile. - Isabella, Measure for Measure, Act 3 Scene 1 - [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
