終於知道是一開始的想法就錯了!
改了之後,就比較好了!
先建立textbox1讓使用者自己設定ruler
//校正影像function
double adjust(double line,double ruler)
{
double adjust_line = line / ruler;
return adjust_line;
}
將算出來的line,單位是pixels 和 ruler(textbox輸入,設定單位為mm)
line/ruler 將ruler的尺寸帶入
例如 ruler=2.5 pixels/mm
line =150 pixels
adjust_line= 60 mm
____________________________________________________________
//校正影像 pixels->inch->cm
width
Single width3 = pictureBox1.Width;
Single width2 = pictureBox1.Image.Width;
Single zoomx = width2 / width3;
height
Single height3 = pictureBox1.Height;
Single height2 = pictureBox1.Image.Height;
Single zoomy = height2 / height3;
dpi
Single dpi_x = pictureBox1.Image.HorizontalResolution;
Single dpi_y = pictureBox1.Image.VerticalResolution;

picturebox1 size = 400,500

image size = 600, 533

假設是 point1 和 point2的長度校正
arrow
arrow
    全站熱搜

    雀悦 發表在 痞客邦 留言(0) 人氣()