我知道图像大小和所需的零件数。 例如,图像:9000x6000 (px),需要的部分数:1000。获得正方形大小的公式是什么?
答案 0 :(得分:0)
设维度为Width
,Height
,所需数量为n
,未知大小为x
每行网格包含
nr = Floor(Width / x) // rounding down
每列包含
nc = Floor(Height / x)
写不等式
n <= nc * nr
n <= Floor(Width / x) * Floor(Height / x)
并为未知 x
使用初始近似
x0 = Ceil(Sqrt(Width * Height / n)) //rounding up
并递减 x
值直到不等式成立