Brain-teaser: OCR in RR

David Kwinter david at kwinter.ca
Mon May 26 02:48:00 EDT 2003


On 5/26/03 1:26 AM, "Scott Rossi" <scott at tactilemedia.com> wrote:

> Recently, tkuypers at pandora.be wrote:
> 
>> We need to do a ³small² project which involves reading a bunch of tiff files,
>> analyze a small part of it and rename the file according to the result of the
>> analysis...
>> The part to analyze is fixed (right top corner) and the data we can expect is
>> a code-39 barcode.

This is a good start, call this function a couple thousand times from a good
algorithm and you're all set  :-) good luck!

Give it:
a literal image name, x pixel location in image, y pixel location in image

It gives you:
pixel color values red,green,blue (all 0-255)


function getPixelColor imageName,x,y
  put the width of image imageName into imgWidth
  
  set itemDelimiter to comma

  put y into linesDownInImg
  put x into linesRightInImg
  
  put linesDownInImg into i
  put linesRightInImg into j
  
  put ((i-1)*imgWidth)*4+j*4 into lastOfCurrent
   
  put the imageData of image imageName into iData
   
  put charToNum(char lastOfCurrent of iData) into bValue
  put charToNum(char lastOfCurrent-1 of iData) into gValue
  put charToNum(char lastOfCurrent-2 of iData) into rValue
   
  return rValue,gValue,bValue
end getPixelColor



The www.sonsothunder.com site has a great imageData/alphaData page (taught
me everything I know)




More information about the use-livecode mailing list