Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ImageProcessing
hi all
i have an image of the desktop,the image size is smaller than the desktop size
how can i find a point on the desktop corresponding to the a point in the image
Posted 24-Oct-11 8:51am
Comments
SAKryukov at 24-Oct-11 14:01pm
   
How corresponding? 1) coordinate transform from bitmap to screen coordinates, 2) image is a reduced image of the desktop and you need to find a point on desktop mapped to a point on the image?
--SA
SAKryukov at 24-Oct-11 14:10pm
   
What, no platform, language, UI library specified? Does not matter much though...
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Please see my comment to the question. In both cases, this is not a problem for gradate students. It means the solution of linear equations which is a work for middle school or early high school student (it depends on your school system, but it requires level well below the required entry level of a college, university or a technical school student). It's reduced to the ability to solve equations like
 

X1 = X0 + K × X2
Y1 = Y0 + K × Y2

 
Wake up and solve them.
 
—SA
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Assuming you have a point on the image relative to the top left hand corner of the image in terms of image coordinates, then it is a simple matter of scaling:
 
Xdesktop = Ximage * (Widthdesktop / Widthimage)
 
Ydesktop = Yimage * (Heightdesktop / Heightimage)
 
Obviously, you won't necessarily get to exactly that point - there will be an error of a pixel or two depending on the relative sizes.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Let the coordinates of point on image be x,y. Then your corresponding point on desktop will be like this.
 
new point = new point(x* Desktopwidth/imagewidth,y*Desktopheight/imageheight)
 
This is in theory, but i hope you get my point. If you don't then reply.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 244
3 BillWoodruff 210
4 Maciej Los 192
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 24 Oct 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100