Would like to calculate distance of a image using VB, anyone can help me to start off as i have struggle for quite some time!
What do you mean, precisely, by "distance of an image"? And what version of VB are you using?
If you mean the distance between two points on an image, it's usually quite simple. You calculate the horizontal distance (difference between the two X coordinates) and the vertical distance (difference between Y coordinates) then use Pythagorus' theorem (you know, the old "hypotenuse " thing" to calculate the straight-line distance.
You've got me interested now. I think I'll write a little sample function to do this, and post it in the VB Articles area. This will be written in VB6, but should work in any version.
Hi Killer ,Thanks for your help.
FYI, i am using VB6.
As i am still very green in this area, i am actually don't know where to start.
Question.
1) where should i load the picture?? is the picturebox or image in VB able to perform this ?
2) how am i going to determine the coordinate??
I think you need to give us a bit more detail on what you are trying to achieve.
Generally, i have an image which i need to determine the changes of x and y.
I need to import the image to a "place", which i don't know whether picturebox or imagebox can do the job? can the image or picturebox tell the coordinate??
Generally, i have an image which i need to determine the changes of x and y.
I need to import the image to a "place", which i don't know whether picturebox or imagebox can do the job? can the image or picturebox tell the coordinate??
I still don't understand the question. What coordinate? If you mean the coordinate where you loaded the image, it doesn't need to tell you. You just told it, so you must already have that information.
Hang on... when you say the "distance" of an image, you don't mean the size of the image, do you?
I still don't understand the question. What coordinate? If you mean the coordinate where you loaded the image, it doesn't need to tell you. You just told it, so you must already have that information.
Hang on... when you say the "distance" of an image, you don't mean the size of the image, do you?
The process is to determine the offset distance of the objects.
let's assume that i have loaded the picture in the picture box.The first image that i loaded in x1=90, y1=100. next i will load in the second image which x2=200,y2=-200. how am i going to determine the offset distance between the two image?
Calculate the difference in X values, the difference in Y values, then use whatie's theorem to get the actual distance. Anyone who has ever done geometry has to know the old "A squared plus B squared" thing.
Also, post #3 links to a function which will give you the answer.
Comment