Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/18/2022 in all areas

  1. smbape

    Dlib UDF

    After the opencv udf, Dlib seems to be a missing library for image processing. This UDF provides a way to use dlib in AutoIt The usage is similar to the python usage of dlib Prerequisites Download and extract autoit-dlib-19.24.4-opencv-4.10.0-com-v1.4.3.7z into a folder Sources Here Documentation A generated documentation for functions is available here Examples More examples can be found here To run them, please follow these instructions Face detection #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Misc.au3> #include "autoit-dlib-com\udf\dlib_udf_utils.au3" _Dlib_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-dlib-com\autoit_dlib_com-19.24-470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local Const $dlib = _Dlib_get() If Not IsObj($dlib) Then Return Local $detector = $dlib.get_frontal_face_detector() Local $win = _Dlib_ObjCreate("image_window") Local $image_path = _Dlib_FindFile("examples\faces\2008_002470.jpg") Local $img = $dlib.load_rgb_image($image_path) $win.set_image($img) ; The 1 in the second argument indicates that we should upsample the image ; 1 time. This will make everything bigger and allow us to detect more ; faces. Local $dets = $detector.call($img, 1) ConsoleWrite("Number of faces detected: " & UBound($dets) & @CRLF) Local $d For $i = 0 To UBound($dets) - 1 $d = $dets[$i] ConsoleWrite(StringFormat("Detection %d: Left: %d Top: %d Right: %d Bottom: %d", _ $i, $d.left(), $d.top(), $d.right(), $d.bottom()) & @CRLF) Next $win.add_overlay($dets) hit_to_continue() EndFunc ;==>Example Func hit_to_continue() ToolTip("Hit ESC to continue", 0, 0) ConsoleWrite("Hit ESC to continue" & @CRLF) Do Sleep(50) Until _IsPressed("1B") EndFunc ;==>hit_to_continue Func _OnAutoItExit() _Dlib_Close() EndFunc ;==>_OnAutoItExit Camera face detection using opencv First, download the opencv UDF from here #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Misc.au3> #include "autoit-dlib-com\udf\dlib_udf_utils.au3" #include "autoit-opencv-com\udf\opencv_udf_utils.au3" _Dlib_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-dlib-com\autoit_dlib_com-19.24-470.dll") _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local Const $dlib = _Dlib_get() If Not IsObj($dlib) Then Return Local Const $cv = _OpenCV_get() If Not IsObj($cv) Then Return Local $detector = $dlib.get_frontal_face_detector() Local $cam = _OpenCV_ObjCreate("VideoCapture").create(0) Local $color_green = _OpenCV_Tuple(0, 255, 0) Local $line_width = 3 Local $img, $dets, $det While True If $cam.read() Then $img = $cv.extended[1] $dets = $detector.call($img) For $i = 0 To UBound($dets) - 1 $det = $dets[$i] $cv.rectangle($img, _OpenCV_Tuple($det.left(), $det.top()), _OpenCV_Tuple($det.right(), $det.bottom()), $color_green, $line_width) Next ;; Flip the image horizontally to give the mirror impression $cv.imshow("my webcam", $cv.flip($img, 1)) EndIf If _IsPressed("1B") Then ExitLoop ; esc to quit EndIf Sleep(1) WEnd $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _OpenCV_Close() _Dlib_Close() EndFunc ;==>_OnAutoItExit
    2 points
  2. mikell

    Loop

    Hint $s = "" For $i = 1 to 3 $s &= $i & @crlf Next Msgbox(0,"", $s)
    1 point
  3. smbape

    OpenCV v4 UDF

    Update opencv to 4.6.0
    1 point
  4. Hi Jpm, imho it would be great to add the explanation you just indicated, to warn users so they won't ask themselves why the result isn't what they expected : If Negative : all columns, except the first one set to 55, will be set to Abs($iDesired_Colwidth). But remember, the column size is always adapted to the length of the element displayed to show the entry data's. Thanks.
    1 point
  5. Jos

    Autoit IDE tool option

    That is because you are in a comment block at that time and then the autocomplete is disabled. I always use #ce (short and sweet)
    1 point
  6. ashraful089, That is AutoIt itself. The problem you show is within the "IDE", a modified version of SciTE, which you can download from the "Resources" link at the top of the page. Jos has recently released a slew of new Beta files, so you might like to download them from the Beta link at the bottom of the linked page. M23
    1 point
  7. Updated DLL and WebP Advanced Encoder GUI code. If you are interested, have a look to the post #1 for download link.
    1 point
  8. From MiniMax to Machine Learning ... Tic Tac Toe is a good game for studying AI algorithm because it's simple! I use Tabular Q Learning to implement this game, Every time a game finished, it will use the Q function to update the score of each steps it played. Q(S,A) = Q(S,A) + α ∗ (γ ∗ maxaQ(S′,a) − Q(S,A)) S being the current state, A the current action, S′ the state after doing A, α being the learning rate, γ being the discount factor, and maxaQ(S′,a) the highest Q value of any move in the next state S′, i.e. the Q value of the best move in the following state. It's funny to see that it plays better and better. That's why people were charmed by Machine Learning! Thank you! Download: tic_tac_toe.zip
    1 point
  9. I have started to rewrite the Excel Pivot Tables UDF with the following goals: Function headers should adhere to the UDF specification. Magic numbers should be replaced by constants used by MS. I would like to rename function names so they start with the object name (SCRIPT BREAKING CHANGE). e.g. _ExcelPivot_CreateCache becomes _ExcelPivot_CacheCreate. So you can easily see which functions are provided by the UDF for each Pivot object. Sensible default values for parameters should be added (similar to the Excel UDF) e.g. If Range is not specified the UsedRange property is used. Parameters should allow multiple formats e.g. Worksheet can be the name, the index or the worksheet object. Error handling should be enhanced so @error and @extended are set. The function header documentation should be extended. The documentation for the UDF should be available as CHM so it can be added to the Advanced Help tool. A COM error handler should be added.
    1 point
  10. Version 0.1.0

    810 downloads

    ATTENTION! THIS IS STILL WORK IN PROGRESS! This is the modified version of MrCreatoR's "Simple Library Docs Generator". It allows to create CHM help files that look like the AutoIt help file. In additon this CHM files can then be used with Advanced.Help. This a very early alpha version - so it is miles away from being perfect. It's just something for you to play with. The documentation is in the making and will be published as soon as possible. BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    1 point
×
×
  • Create New...