调整大小后图像中的X,Y位置。 [英] X, Y position in an image after resize.

查看:71
本文介绍了调整大小后图像中的X,Y位置。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,如果我在图片中有一个位置(x,y),那就是在图片框内,

如果我改变图像的大小,我怎么能知道相同的位置? br />
非常感谢.re>



我会尝试更好地解释我需要做什么:

在一个图像(这是一个平面)上,我想标记一个火灾探测器所在的红点。

用鼠标点击。

我采取和存储坐标(x,y)以便每次显示该平面(有很多)将每个传感器放在其位置。

我的问题是如果我改变了图片框的大小(sizemode = StretchImage)那些坐标不再有效。感谢您的回复如此之快



我尝试过:



获取如果更改图像大小,位置(x,y)不会改变。

解决方案

处理图像控件的resize事件,并重新计算所需的值基于图像两边变化率的坐标。


引用:

你好,如果我在图像中有一个位置(x,y),就在图片框内,

如果我改变图像的大小,我怎么能知道相同的位置?



这是非常简单的数学。

第一个解决方案:获得一张真实的图片,找出一个特定的点来测量它在图片中的位置,制作一个改变大小的副本,并测量新位置。

比较旧尺寸和新尺寸,旧位置和新位置,找到数学。



第二个解决方案:你的问题和数学是一样的s:

你是收银员,你收取的每一美元就赚3美分。

如果你开账单,你赚多少钱?


< BLOCKQUOTE> 10,

Hello, if I have a position (x, y) in an image, that is inside a picturebox,
how can I know the same position if i change the size of the image?
Thank you very much.re>

I will try to explain better what I need to do:
On an image (which is a plane) I want to mark a red dot where a fire detector goes.
That doing click with the mouse.
I take and store coordinates (x, y) so that each time that plane is shown (there are many) place each sensor in its place.
My problem is that if I change the size of the picturebox (sizemode = StretchImage) those coordinates are no longer valid. Thanks for answering so fast

What I have tried:

Get a position (x, y) that does not change if you change the size of an image.

解决方案

Handle the resize event for the image control, and recalculate the desired coordinate(s) based on the change ratio for both sides of the image.


Quote:

Hello, if I have a position (x, y) in an image, that is inside a picturebox,
how can I know the same position if i change the size of the image?


It is really simple maths.
First solution: get a real picture, spot a particular point measure its position in picture, make a copy with a change of size, and measure new position.
Compare old size and new size, old position and new position, find the maths.

Second solution: your problem and the maths are the same as:
you are a cashier and you earn 3 cents for every dollar you bill.
How much do you earn if you bill


10,


这篇关于调整大小后图像中的X,Y位置。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆