dejhost

Overlaying images

1 post in this topic

Hi!

I am not very experienced when it comes to handling images in autoit, so I thought I save myself a lot of painfull try&error, and ask prior scripting: What is a good way to script the following. Find my suggestions in brackets after each step. 

  1. The user choses an image from the harddrive, which then gets opened in full screen. See code below.
  2. The user clicks into the image, (GUIGetCursorInfo)
  3. AutoIT zooms into this point and centers it. The zoomfactor is predefined. (_GUICtrlRichEdit_SetZoom)
  4. The image shall be overlayed with a grid. (_GDIPlus_GraphicsDrawLine or _WinAPI_SetLayeredWindowAttributes)
  5. The user can pan the image below the grid in order to center an object in the image. (???)
  6. Another mouse-click, the coordinates of the center pixel are recorded. (GUIGetCursorInfo)
  7. AutoIT zooms out again - the user can repeat step 2 to 7 if he wishes to. (_GUICtrlRichEdit_SetZoom)
Func ViewImage($Image) ; $Image is the Image chosen by user
Local $hiGUI = GUICreate("Image Viewer", @DesktopWidth, @DesktopHeight,Bitor($WS_EX_APPWINDOW, $WS_EX_TOPMOST), -1,-1)
    GUISetState ( @SW_MAXIMIZE, $hiGUI )
Local $Pic = GUICtrlCreatePic($Image, 1, 1, @DesktopWidth, @DesktopHeight)

; Display the GUI.
GUISetState(@SW_SHOW, $hiGUI)

; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case     $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

GUIDelete($hiGUI)

EndFunc   ;==>ViewImage

What I want to achieve is that the user can determine the center-coordinates of symmetric objects in the image. These objects are roughly equally large. The grid is a visual aid and shall be static, while the user pans the orignal image so that it appears centered.

Should I draw the grid (_GDIPlus_GraphicsDrawLine), or rather superimpose two images (the user specified one and an image that contains the grid) (_WinAPI_SetLayeredWindowAttributes)?

Will I get there using the functions I suggested, or can you suggest a better attempt?
dejhost

 

Share this post


Link to post
Share on other sites



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 account

Sign in

Already have an account? Sign in here.


Sign In Now