Jump to content

Sand

Members
  • Posts

    2
  • Joined

  • Last visited

Sand's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi all i want to do this but i dont want the image to be blured i need it to be exat Zoom of the origin - can you tell me how to do it ? change the image with whatever image you need my idea is to make a program with wich i open a image with all characters and specify where each char ends so my program will cut each char and generate an array with the chars after someone helps me showing the zoomed part normaly i will need to read the specified image bytes colors and put them in array #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> $FileName = @ScriptDir & "\small.png"; $width = 790 $height = 450 $last_char_pos = 0 $start_pos = 0 $current_char = 33 $zoom = 16 $hMain = GUICreate("Font character extractor", 800, 500) ; Labels $hCharLabel = GUICtrlCreateLabel("Current char: " & Chr ($current_char), 8, 460, 90) ; Buttons $b_left = GUICtrlCreateButton("<", 100, 460, 50) $b_right = GUICtrlCreateButton(">", 150, 460, 50) $b_next = GUICtrlCreateButton("Apply", 210, 460, 60) $b_generate = GUICtrlCreateButton("Generate", 270, 460, 60) ; Display the window GUISetState(@SW_SHOW, $hMain) _GDIPlus_Startup() ; Load Image $Image = _GDIPlus_ImageLoadFromFile($FileName) $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hMain) Func Draw () _GDIPlus_GraphicsDrawImageRectRect ($hGraphic, $Image, $start_pos, 0, $width/$zoom, $height/$zoom, 5, 5, $width, $height) ;_WinAPI_stretchBlt($hGraphic,5,5,$width,$height,$Image,$start_pos,0,$width/$zoom,$height/$zoom,$SRCCOPY) EndFunc ;Author(s) : Prog@ndy, after _WinAPI_BitBlt Func _WinAPI_stretchBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iROP) Local $aResult $aResult = DllCall("GDI32.dll", "int", "StretchBlt", "hwnd", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidth, "int", $iHeight, _ "hwnd", $hSrcDC, "int", $iXSrc, "int", $iYSrc,"int",$iWidthSrc,"int",$iHeightSrc, "int", $iROP) If @error Then Return SetError(@error, 0, False) Return $aResult[0] <> 0 EndFunc ;==>_WinAPI_BitBlt ; Run the GUI until the dialog is closed Draw () While 1 $msg = GUIGetMsg() Select Case $msg = $b_generate Case $msg = $b_left If ($start_pos > 0) Then $start_pos = $start_pos - 1 Draw () EndIf Case $msg = $b_right If ($start_pos < 100) Then $start_pos = $start_pos + 1 Draw () EndIf Case $msg = $b_next If ($current_char < 127) Then $current_char = $current_char + 1 if ($last_char_pos < $start_pos) Then $last_char_pos = $start_pos GUICtrlSetData ($hCharLabel, "Current char: " & Chr($current_char)) EndIf Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Func OnAutoItExit() _GDIPlus_GraphicsDispose ($hGraphic) _GDIPlus_ImageDispose ($Image) _GDIPlus_Shutdown() EndFunc
  2. Hello it's just me or when i give a small areas to OCR i get COM Error ? for example OCR_Region (19,619,49,707) and i get the COM Error is this normal ? Here is my function Func OCR_Region($x,$y,$x1,$y1) Const $miLANG_ENGLISH = 9 $file_name = "C:\VRT_Temp.png" _GDIPlus_Startup () _ScreenCapture_Capture ($file_name, $x,$y, $x1,$y1, False) Dim $miDoc = ObjCreate("MODI.Document") $miDoc.Create($file_name) $miDoc.Ocr($miLANG_ENGLISH, True, True) Dim $str = $miDoc.Images(0).Layout.Text FileDelete($file_name) _GDIPlus_ShutDown () Return $str EndFunc
×
×
  • Create New...