Script needed to measure length of image
Script needed to measure length of image
In my script, I'm using Pixel Search to find one end of a short, solid yellow line on a complex background. Once the script has found the start point of the line, I need it to measure the total length in pixels. Can anyone point me to an already-written script I can add/edit/modify that would return the length in pixels?
Last edited by scripts on 28 Jan 2014, 05:39, edited 1 time in total.
Re: Script needed to meaure length of image
Is your yellow line vertical, horizontal, or neither?
If neither:
If neither:
- Can you specify its general orientation, or will it be random?
- How many pixels thick will the line be?
Re: Script needed to meaure length of image
BGR = 0xB3B300
Clarification: I have a hollow square here, formed by a thin yellow line. I want the script to return a variable containing the length in pixels of the horizontal and vertical lines that form the square. I don't know how thick the line is; maybe about 5 pixels.
Clarification: I have a hollow square here, formed by a thin yellow line. I want the script to return a variable containing the length in pixels of the horizontal and vertical lines that form the square. I don't know how thick the line is; maybe about 5 pixels.
Re: Script needed to measure length of image
scripts wrote:Can anyone point me to an already-written script I can add/edit/modify that would return the length in pixels?
This will find the pixel length of your yellow, horizontal line (I think your BGR is a shade of cyan.)Guest wrote:BGR = 0xB3B300
Code: Select all
UpperLeftX := 0
UpperLeftY := 0
LowerRightX := A_ScreenWidth
LowerRightY := A_ScreenHeight
ColorID := 0x00B3B3
Variation := 0
CoordMode Pixel, Screen
PixelSearch FoundX, FoundY, UpperLeftX, UpperLeftY, LowerRightX, LowerRightY
, ColorID, Variation, Fast
If ( ErrorLevel != 0 )
{
MsgBox Color not found on screen
Return
}
StartX := FoundX
Loop
{
PixelToRight := FoundX + 1
PixelSearch FoundX, FoundY, PixelToRight, FoundY, PixelToRight, FoundY
, ColorID, Variation, Fast
} Until ( ErrorLevel != 0 )
MsgBox % "LineLength = " (PixelToRight - StartX)
Return
Re: Script needed to measure length of image
Thanks you very much - I sure appreciate it!
Who is online
Users browsing this forum: Bing [Bot] and 206 guests