0

元の質問:元の質問

にサイズ変更されたサイズの画像I1があります。height x width = (1500,500)(500,300)

I1には、座標によって特徴付けられる境界ボックスが含まれます(Top, Left, Bottom, Right)


I1のサイズが変更されたときに境界ボックスの座標を再スケーリングするにはどうすればよいですか? これらの式は正しいですか?

   double newTop = Math.Ceiling((top) * (double)pictureBox1.Height / (double)image1.Height);
   double newLeft = Math.Ceiling((left) * (double)pictureBox1.Width / (double)image1.Width);
   double newBottom = Math.Ceiling((bottom + 1) * (double)pictureBox1.Height / (double)image1.Height) - 1;
   double newRight = Math.Ceiling((right + 1) * (double)pictureBox1.Width / (double)image1.Width) - 1;

4

1 に答える 1