qwertylol Posted May 1, 2007 Share Posted May 1, 2007 how do I load a picture into a variable and then use pixelgetcolor to search for it? doesn't pixelgetcolor only work for pixel on the screen? Link to comment Share on other sites More sharing options...
evilertoaster Posted May 1, 2007 Share Posted May 1, 2007 in example scripts there are some udfs for picture management.One i wrote a while ago that using bitmaps- http://www.autoitscript.com/forum/index.php?showtopic=27362probly newer ones if you look that do jpegs and such also Link to comment Share on other sites More sharing options...
qwertylol Posted May 1, 2007 Author Share Posted May 1, 2007 work this one then. I am reading your thread. Link to comment Share on other sites More sharing options...
qwertylol Posted May 1, 2007 Author Share Posted May 1, 2007 can you tell me very simply how to do getpixelcolor with a screenshot shot by auto3lib that's stored in a variable? Link to comment Share on other sites More sharing options...
qwertylol Posted May 2, 2007 Author Share Posted May 2, 2007 how do I search for a image stored in the variable ? Link to comment Share on other sites More sharing options...
qwertylol Posted May 2, 2007 Author Share Posted May 2, 2007 Ok, I figure this is the best general tool ever for potential OCR scientists. I want to code a tool that will produce pictures like below based on your definition. So, please lend me a hand in creating this. How can this be acomplished? First, a window has to be created, and then the enlargement of the area slected will be displayed. how do I do this ? Link to comment Share on other sites More sharing options...
qwertylol Posted May 2, 2007 Author Share Posted May 2, 2007 how do i use au3 to creat image? Link to comment Share on other sites More sharing options...
qwertylol Posted May 3, 2007 Author Share Posted May 3, 2007 is anyone interested in a jointed project for a gui for OCR ? Link to comment Share on other sites More sharing options...
qwertylol Posted May 3, 2007 Author Share Posted May 3, 2007 Pixelgetcolor will get a point on the screen, yet, for OCR, to fit into any application, it must be able to load a picture into a variable, and then do the search there. How can it be done, pixelcolor on a image saved in a variable? Link to comment Share on other sites More sharing options...
themax90 Posted May 3, 2007 Share Posted May 3, 2007 I do not know how to do this... thus I didn't post. Search the forum for OCR. There have been a few made in the past for Diablo/Diablo II. -AutoIt Smith Link to comment Share on other sites More sharing options...
qwertylol Posted May 4, 2007 Author Share Posted May 4, 2007 expandcollapse popup#include<array.au3> Global $color = 14018275 Dim $string Dim $x = 0 Dim $y = 767 Dim $x_size = @DesktopWidth Dim $y_size = @DesktopHeight Dim $display_string = "" Dim $array_order = 0 Dim $avRET $avRET = search_for_this_color($x_size, $y_size, $color) MsgBox (0, "the color is at", $avRET[0] ) MsgBox (0, "the color is at", $avRET[1] ) $string = ocr_string ( $avRET) $matches = StringRegExp($string, '[^0]{1,}', 3) _ArrayDisplay($matches, 'found') Do ;check definition If check_definition( $matches[$array_order] ) == 2 Then MsgBox ( 0, "Unknown string", $matches[$array_order] ) EndIf $display_string = $display_string & check_definition( $matches[$array_order] ) $array_order = $array_order + 1 Until $array_order = 2;size of the array. MsgBox ( 0, "The string says", $display_string ) Func search_for_this_color($x_size , $y_size, $color) ; $avRET[0] = X, $avRET[1] = Y Local $avRET[2] = [0, $y_size] Do Do If PixelGetColor($avRET[0], $avRET[1]) = $color Then Return $avRET EndIf $avRET[1] = $avRET[1] - 1 Until $avRET[1] = 0 $avRET[1] = $y_size $avRET[0] = $avRET[0] + 1 Until $avRET[0] = $x_size MsgBox (0, "title", "found nothing." ) Return SetError(1, 0, -1) EndFunc ;==>search_for_this_color Func ocr_string ( $avRET) Local $x_offset = 0 Local $y_offset = -4 Local $box = 0 Do Do If PixelGetColor ( ($avRET[0] + $x_offset) , ($avRET[1] + $y_offset ) ) = $color Then $box = $box + 1 EndIf $y_offset = $y_offset + 1 Until $y_offset = 7 $y_offset = -4 $string = $string &$box $x_offset = $x_offset + 1 $box = 0 Until $x_offset = 147 ;this is how long this string can be, at most. MsgBox (0, "147", $string ) Return $string EndFunc Func check_definition( $string ) If $string == "" Then Return "-" EndIf If $string == "" Then Return "0" EndIf If $string == "" Then Return "1" EndIf If $string == "" Then Return "2" EndIf If $string == "" Then Return "3" EndIf If $string == "" Then Return "4" EndIf If $string == "" Then Return "5" EndIf If $string == "" Then Return "6" EndIf If $string == "" Then Return "7" EndIf If $string == "" Then Return "8" EndIf If $string == "" Then Return "9" EndIf If $string == "" Then Return "0" EndIf Return 2 ;if nothing matched, return 2 EndFunc I haven't defined the numbers yet, what I am confused about is, the 3rd item in the found msgbox should be "243385" but instead of that, the number is strange, andto_search.bmp Link to comment Share on other sites More sharing options...
qwertylol Posted May 4, 2007 Author Share Posted May 4, 2007 just open the picture in mspaint, and then run the script with the picture visible. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now