原創|使用教程|編輯:龔雪|2014-05-15 09:21:39.000|閱讀 734 次
概述:本文主要介紹如何測試DotImage圖像上的物理距離。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
若要測量DotImage圖像上的物理距離,需要選擇兩個像素。一旦選擇了像素,就可以使用距離公式來計算像素空間距離。
C#
private double Distance(PointF pointF, PointF pointF_2) { return Math.Sqrt(Math.Pow(pointF_2.X - pointF.X, 2) + Math.Pow(pointF_2.Y - pointF.Y, 2)); }
VB.NET
Private Function Distance(ByVal pointF As PointF, ByVal pointF_2 As PointF) As Double Return Math.Sqrt(Math.Pow(pointF_2.X - pointF.X, 2) + Math.Pow(pointF_2.Y - pointF.Y, 2)) End Function
為了獲取基于圖像分辨率的實際距離,計算方法如下:
C#
float distance = Distance(point1,point2)/myAtalaImage.Resolution.X;
VB.NET
Dim distance As Single = Distance(point1, point2) / myAtalaImage.Resolution.X
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn