Quantcast

Jump to content


Photo

OCR in python?


  • Please log in to reply
52 replies to this topic

#1 shrouded

shrouded
  • lil'cluck

  • 1250 posts


Users Awards

Posted 28 March 2012 - 11:38 AM

I want it to be known that I'm working from scratch here and haven't researched any ideas on how existing code has been written. That said I'm assuming you download the image as a .jpeg and then scan for the darkest pixel. Once the darkest pixel is found add/subtract a random value from the found coordinates and send them in the post data? :whistling:

Edit: I feel successful. I found raredaredevil's tutorial for the method. Of course I still don't know how to scan for color in images with python. I suspect it isn't too difficult. But brb calc III test..

Edited by Shrouded, 28 March 2012 - 11:40 AM.


#2 Icey Defeat

Icey Defeat
  • 8298 posts


Users Awards

Posted 28 March 2012 - 11:40 AM

I want it to be known that I'm working from scratch here and haven't researched any ideas on how existing code has been written. That said I'm assuming you download the image as a .jpeg and then scan for the darkest pixel. Once the darkest pixel is found add/subtract a random value from the found coordinates and send them in the post data? :whistling:


I wouldn't add or subtract anything. But yup. Also feel free to skip like every other pixel for speed reasons.

This is MY old code in VB6. Apparently, I used the LIGHTEST pixel.

Public Sub iOCR(iPicture As PictureBox)
On Error Resume Next
Dim iDark As Long
Dim iCur As Long
Dim Q As Double

iPicture.Cls
Q = GetTickCount

iDark = 9999999

For i = 15 To iPicture.ScaleHeight - 15 Step lngY
    For o = 15 To iPicture.ScaleWidth - 15 Step lngX
        iCur = GetPixel(iPicture.hDC, o, i)
        If iCur < 0 Then GoTo huh:
        If iCur < iDark Then
            iDark = iCur
            x = o
            y = i
        End If
huh:
    Next
    MyDoEvents
Next

Corners iPicture, x, y

Q = GetTickCount - Q

lblOCRTime.Caption = Q & " ms"

End Sub

Edited by Icey Defeat, 28 March 2012 - 11:42 AM.


#3 Pyro699

Pyro699
  • 1543 posts


Users Awards

Posted 28 March 2012 - 11:41 AM

Lol, whats your question?

#4 shrouded

shrouded
  • lil'cluck

  • 1250 posts


Users Awards

Posted 28 March 2012 - 11:43 AM

Lol, whats your question?


Are there built in functions in python for evaluating the pixels in an image. You don't really have to answer if you don't want to because I think google might have the answer. I'm just curious as to what would maximize speed. Skipping a pixel would increase speed but skipping 2,3,4 may have a detrimental impact regardless of speed gains.

#5 Icey Defeat

Icey Defeat
  • 8298 posts


Users Awards

Posted 28 March 2012 - 11:44 AM

Are there built in functions in python for evaluating the pixels in an image. You don't really have to answer if you don't want to because I think google might have the answer. I'm just curious as to what would maximize speed. Skipping a pixel would increase speed but skipping 2,3,4 may have a detrimental impact regardless of speed gains.


http://stackoverflow...n-programaticly

#6 Nymh

Nymh
  • Keeper of Secrets

  • 4626 posts


Users Awards

Posted 28 March 2012 - 11:46 AM

No idea

Good luck on your test! :innocent:

(gogogo)

#7 shrouded

shrouded
  • lil'cluck

  • 1250 posts


Users Awards

Posted 28 March 2012 - 11:46 AM

<3 incredibly easy. They could at least change the RS system occasionally. Some ab'ers made years ago still function.

Edited by Shrouded, 28 March 2012 - 11:46 AM.


#8 Pyro699

Pyro699
  • 1543 posts


Users Awards

Posted 28 March 2012 - 11:46 AM

a) Dont skip any pixels.
b) Look into PIL and the im.load() feature.

#9 shrouded

shrouded
  • lil'cluck

  • 1250 posts


Users Awards

Posted 28 March 2012 - 01:26 PM

a) Dont skip any pixels.
b) Look into PIL and the im.load() feature.


Thank you sir. Wouldn't TnT be able to thwart ab'ing by removing the black boarder around the pet? Legit users would be able to tell where to click by the shape of the color..

#10 Pyro699

Pyro699
  • 1543 posts


Users Awards

Posted 28 March 2012 - 01:36 PM

Thank you sir. Wouldn't TnT be able to thwart ab'ing by removing the black boarder around the pet? Legit users would be able to tell where to click by the shape of the color..


Its not always the border, infact more often than not its their eyes or nose.

#11 shrouded

shrouded
  • lil'cluck

  • 1250 posts


Users Awards

Posted 28 March 2012 - 01:44 PM

Its not always the border, infact more often than not its their eyes or nose.


I've seen very few of the images personally hehe Will varying from the exact coordinates of the darkest color effect accuracy? I would think TnT could track where you clicked in each image and see that you click on the black every time.

#12 Waser Lave

Waser Lave

  • 25516 posts


Users Awards

Posted 28 March 2012 - 02:04 PM

I've seen very few of the images personally hehe Will varying from the exact coordinates of the darkest color effect accuracy? I would think TnT could track where you clicked in each image and see that you click on the black every time.


You overestimate TNT.

#13 RitzWin

RitzWin
  • 241 posts

Posted 28 March 2012 - 02:23 PM

You overestimate TNT.


There are much easier ways for TNT to determine if you're cheating lol.

Edited by RitzWin, 28 March 2012 - 02:24 PM.


#14 shrouded

shrouded
  • lil'cluck

  • 1250 posts


Users Awards

Posted 28 March 2012 - 02:24 PM

There are much easier ways for TNT to determine if you're ABing lol.


That's very true. If only there were ways of making NP that weren't supersaturated at this point -_-

#15 RitzWin

RitzWin
  • 241 posts

Posted 28 March 2012 - 02:39 PM

That's very true. If only there were ways of making NP that weren't supersaturated at this point -_-


I've an idea that I'm pretty sure is not super saturated... involves the habit.

#16 shrouded

shrouded
  • lil'cluck

  • 1250 posts


Users Awards

Posted 28 March 2012 - 03:04 PM

Habi's max out at 300k a day right? PM me :)

#17 Icey Defeat

Icey Defeat
  • 8298 posts


Users Awards

Posted 28 March 2012 - 03:08 PM

a) Dont skip any pixels.


Why? Speed is everything with abing. I used to have mine skip every 4 pixels and it was still almost 99.9% accurate.

#18 Waser Lave

Waser Lave

  • 25516 posts


Users Awards

Posted 28 March 2012 - 03:16 PM

Why? Speed is everything with abing. I used to have mine skip every 4 pixels and it was still almost 99.9% accurate.


You're talking about an extra few milliseconds for checking every pixel, it's not going to make you miss a buy. Also, if you're using the darkest pixel method it's not even 99.9% even with checking every pixel. ;) I think when we looked into it the darkest pixel method was somewhere around 97% accurate if you analyse every pixel.

#19 Pyro699

Pyro699
  • 1543 posts


Users Awards

Posted 28 March 2012 - 03:19 PM

Why? Speed is everything with abing. I used to have mine skip every 4 pixels and it was still almost 99.9% accurate.


I have a collection of 900 ocr images, if you can pass 899.1 of those images by using a 4 pixel skip method; ill buy you a steak dinner.

#20 Icey Defeat

Icey Defeat
  • 8298 posts


Users Awards

Posted 28 March 2012 - 03:20 PM

I have a collection of 900 ocr images, if you can pass 899.1 of those images by using a 4 pixel skip method; ill buy you a steak dinner.


You caught my exaggeration. *clap clap*

#21 Waser Lave

Waser Lave

  • 25516 posts


Users Awards

Posted 28 March 2012 - 03:22 PM

I have a collection of 900 ocr images, if you can pass 899.1 of those images by using a 4 pixel skip method; ill buy you a steak dinner.


I think at least one of the two methods we developed could pass 899 of them. :p

#22 Pyro699

Pyro699
  • 1543 posts


Users Awards

Posted 28 March 2012 - 03:22 PM

Im not sure why you were exaggerating.... I have a 98.5% success rate... Out of all 900 images, i have only failed on 13 of them, i was taking you quite serious... i apologize for over-estimating your abilities.

Edit: Waser, i am using your method.

#23 Waser Lave

Waser Lave

  • 25516 posts


Users Awards

Posted 28 March 2012 - 03:25 PM

Im not sure why you were exaggerating.... I have a 98.5% success rate... Out of all 900 images, i have only failed on 13 of them, i was taking you quite serious... i apologize for over-estimating your abilities.

Edit: Waser, i am using your method.


Which one? I think the one we currently don't use in Abrosia is the most accurate.

#24 Pyro699

Pyro699
  • 1543 posts


Users Awards

Posted 28 March 2012 - 03:25 PM

Ill share my 13 failures with you; see if your methods work better. Who knows waser, maybe this is one test where the darkest pixel would have been better.

Waser: RunOCR_LaserWave <-- That method

Attached Files



#25 Icey Defeat

Icey Defeat
  • 8298 posts


Users Awards

Posted 28 March 2012 - 03:31 PM

Ill share my 13 failures with you; see if your methods work better. Who knows waser, maybe this is one test where the darkest pixel would have been better.

Waser: RunOCR_LaserWave <-- That method


Just to see what happens I'll run my method over those images later. My stomach is full and I can hardly move (too full).


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users