Jump to content

Working With Pictures


Sublime
 Share

Recommended Posts

Goal:

A)Identify Mark On Either Screen or a Rendered BMP of the screen

B)So I can accertain a triangular angle.

I just can not seem to visualize or even come up with a starting point on how to do part A.... part B is easy enough as I already have the code setup to do

just that given some minor tweaking based on what I have to do for part a.

Hypothetical Example:

You got a clock shaped widget on your computer that displays wind speed and direction with a arrow. (LINE B[1-3] IS LAYING DOWN THE CENTER OF SAID ARROW)

90 (3)

----/---\

---/B----\C(Unknown)

--/---------\

(1)=====(2) 0

_____A

270

You kind of get the idea.....

Ok Kind Of How I Have This Pictured In My Head....

Take A ScreenShot

Draw a cross on it and marked 3 red points. (1, 2, 3)

Together they form a triangle. To know the angle (a)formed by

the legs 1-2 and 1-3 (wich is the wind angle) we use the tangent formula

which is: tan(a)= c / b. Now we need to measure, in pixels, the lenght of c and b and make

such division. The result is not the angle yet, but the tangent of the angle. To get the angle

you have to calculate the arctan of the previous result.

Easy! Lets see: c=3 and b=21.

Then 3 / 21 = 0,14285 which is the tangent of the angle. Finaly, arctan(0,14285)= 8 degrees.

That's what we were lookin for!!!

Here is my question one more time so there is no confusion as to what I am asking

>>How exactly could I take my screenshot and lay down a line on it, so the arrow was

where line 1-3 in my example above is......

>>Measure That Lines Pixels

>>Measure Angles Hypoteneus Pixels

If what I am asking for still isnt clear enough I will post a picture or something

Edited by Sublime
Link to comment
Share on other sites

I guess nodody answered, because it isn't clear enough. :)

screenshot - no problem

draw a cross - no problem (getting the correct position I don't know)

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I guess nodody answered, because it isn't clear enough. :)

screenshot - no problem

draw a cross - no problem (getting the correct position I don't know)

Mega

I think it was clear... But my problem is this..

I managed to dig up something out of the scripts and scraps and example sections.. To Capture/Render an image of the screen.

And using GDI+ to create an axis is easy enough.. I just can not wrap my head around whether or not Autoit has the

capability to identify shapes...

I was thinking if maybe I could identify 1 color shade with a slightly loose method to identify the top than identify the

other 2 corners in a similiar fasion, but now I am stuck trying to figure out how to do that.

I Just Have This Ominous Feeling I Am Going To Have To Write A UDF for this :)

So I guess my plan of action right now is going to be:

==Capture/Render a BMP of the screen

==Locate Points 1, 2, 3 (Using PixelSearch)

==Measure Pixels Between The Points (Being its an isosceles triangle)

==Find The Direction The Arrow Is Pointing In Based On Those Measurements (Point Adjacent To The Short End)

==Take The Center Of The Short End And Draw A Line From There Extending Through/Past the Point Adjacent

==Measure Pixels Of Bolth That Line and Distance From That Line To X Axis (Giving Me Lengths B and C)

==Do Tan(A)= C / B

==Do ArcTan(A)= "Angle"

I Also Am Not Sure If PixelSearch Is Still A Viable Solution Or Not, I Guess I Am Just Going To Have To Code It Out To

Find Out.

Is There An Easier Way To Do This.... I Guess For Now I Have It Figured Out But I Would Imaging Someone With More Knowledge

Than Me, Would Have A Simpler Solution....

Edited by Sublime
Link to comment
Share on other sites

 Hi,

I guess nodody answered, because it isn't clear enough. :)

Thats it....

@Sublime, you are asking for help of (in general) image processing (ok, of a "special" image), and what we do not have is.....the image?! :)

"one picture is worth a thousand words"....2 or 3 pictures are better :P.

==Locate Points 1, 2, 3 (Using PixelSearch)

I think this is the point, but without have seen the "Arrow" everything else is speculation.

Andy

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...