Try my new website:
www.urcho.com
- the new SIMPLE social network
Sign up
|
287
members |
114
snippets
Search for:
ALL
POPULAR
File Controls
Multiplayer Code
2D Effects
3D Effects
Oldskool demos
Basic Functions
Maths/Physics
Sound
Tutorials
Misc
Username:
Password:
Sign up
Ocr example (cc)
[
back
]
Author:
Nebula
| Viewed:
519
times | Language:
BlitzPlus
| Category:
Basic Functions
AppTitle "Optical character recognition . Match 1. Press space to check char vs char a=a" ; ; Optische karakter herkenning met behulp van ; de is gelijk aan methode. ; Oftewel overtrekken. ; Optical character recognition with help ; of the is equal method. ; Optische karakter herkenning - optical character recognition (step 1) ; 09 Jul 2007 ; 05:26:29 ;f=WriteFile("mytxt.txt") ;WriteLine f,";"+CurrentDate() ;WriteLine f,";"+CurrentTime() ;CloseFile(f) ;ExecFile "notepad.exe mytxt.txt" Graphics 640,480,16,2 SetBuffer BackBuffer() Dim com(20,20) ; comparisment board Cls Color 255,255,255 tc$ = "a" Text 0,20,"total amount of pixels in original char : " + tc + " : " + telpixelsinkarakter(tc) Text 50,50,"a" Text 50,100,"Press space to compare" Flip While KeyDown(1) = False If KeyHit(57) = True Then putchar 50,50,"a" If ischar(50,50,"a") = True Then Cls Color 255,255,255 Text 0,20,"Comparisment pixels count : " + tc + " : " + telpixelsinkarakter(tc) Text 50,50,"a" Text 0,90,"One match with " + telpixelsinkarakter(tc) + " Pixels" Flip End If End If Wend End Function telpixelsinkarakter(in$) Local im = CreateImage(20,20) Local cnt = 0 SetBuffer ImageBuffer(im) ; Color 255,255,255 Text 0,0,in$ ; For x1=0 To 20 For y1=0 To 20 GetColor x1,y1 If ColorRed()>100 Then cnt=cnt+1 Next:Next ; SetBuffer BackBuffer() Color 255,255,255 FreeImage im Return cnt End Function Function putchar(x,y,in$) Text x,y,in$ End Function Function ischar(x,y,in$) Local im = CreateImage(20,20) SetBuffer ImageBuffer(im) ; Color 255,255,255 Text 0,0,in$ ; For x1=0 To 20 For y1=0 To 20 GetColor x1,y1 If ColorRed()>100 Then com(x1,y1) = 1 Next:Next ; SetBuffer BackBuffer() ; For x1=0 To 20 For y1=0 To 20 GetColor x1+x,y1+y If ColorRed()>50 Then If com(x1,y1) > 0 Then cnt=cnt+1 DebugLog cnt End If End If Next:Next ; If telpixelsinkarakter(in$) = cnt Then Return True ; End Function
Author Comments:
Ocr example (count compare method)
Login or
create an account
to comment on this snippet