[Tutor] 200 dollar questions!

elis aeris hunter92383 at gmail.com
Sun Jul 1 05:30:13 CEST 2007


Yes, I am trying to write a OCR algorithm with neural network, but the
theories of NN is of little importance, what I am trying to get ready for
the project is run speed.


the problem comes in a number of ways:


first, as you mentioned,   image.getpixel   is not very fast,  according to
PIL
http://www.pythonware.com/products/pil/

so an alternative should be searched for,


also, I loop (x,y)

x = 0 -1023
y = 0- 768  through

and currently i use this:



x = 0
y = 0
for x in xrange(1, 1024, 1):
    for y in xrange(1, 768, 1):
        rgb = image.getpixel ((10, 12))





according to
http://www.python.org/doc/essays/list2str.html


a while loop is slow than for, and then map is faster.








as for that this:

image.getpixel ((10, 12))


currently i only use the shell window itself, so i can't really loop
1024*768, that's why it's only
10 12,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070630/d5b66649/attachment.htm 


More information about the Tutor mailing list