如何计算正确的缩放系数? [英] How to calculate the correct zoom factor?
问题描述
大家好,
我有问题。
我有一张来自相机的图片。
我将图片拉伸到里面一个877 * 877像素大的Viewbox。
相机图像的分辨率可以从100 * 100像素到3000 * 3000像素。
现在完整的图像是在Windows.ScaleTransform的帮助下在ViewBox内部拉伸。
我在软件中也有一个可以正常工作的缩放功能。它也适用于Windows.ScaleTransform。
它看起来像这样:
http://i.stack.imgur.com/tZJGI.png [ ^ ]
现在我的问题:当相机图像为877时,缩放系数必须为100%(1) 877,但是当变焦不起作用时总是100%。
当Viewbox显示拉伸的3000x3000像素图像时,缩放应该是29%而不是100%。
我知道如何管理这个吗?
我期待着回答。
问候< br $>
Richard
我尝试过:
我试图计算图像和视图框之间的分辨率差异
和
我试图计算缩放系数
Hello everyone,
I have a problem.
I have an image that comes from a camera.
I stretch the image inside a Viewbox which is 877*877 px big.
The camera image can have a resolution fromm 100*100 px to 3000*3000 px.
Right now the complete image is stretched inside the ViewBox with the help of Windows.ScaleTransform.
I also have a zoom function in the software which works correctly. It also works with Windows.ScaleTransform.
It looks like this:
http://i.stack.imgur.com/tZJGI.png[^]
Now to my problem: The zoom factor has to be 100% (1) when the camera is image is 877*877, but it is always 100% when the zoom is not working.
When the Viewbox show's a stretched 3000x3000 px image the zoom should be 29% and not 100%.
Any idea how I can manage this?
I am looking forward to an answer.
Greetings
Richard
What I have tried:
I tried to calculate the resolution difference between the Image and the Viewbox
And
I tried to calculate the zoom factor
推荐答案
我找到了解决方案。这是我的想法中的一个错误。我认为在使用ScaleFactor完成Scale之前,我必须使用Stretch。所以我的公式很简单:
Viewboxsize / Imagesize * 100 * ScaleFactor
I found the solution. It was a mistake in my thoughts. I thought that the before the Scale were done with the ScaleFactor i had to work with the Stretch. So my "formula" was easy:
Viewboxsize/Imagesize*100*ScaleFactor
这篇关于如何计算正确的缩放系数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!