加入摄像机网格笔画方向优化实验
用邻域差异筛选方向并保留原随机模式。已通过单元测试、纹理重现检查和多分辨率光流探针。
This commit is contained in:
@@ -6,12 +6,19 @@ import random
|
||||
from patch_geometry import clip_halfspace, interpolate_uv
|
||||
|
||||
|
||||
def capsule_in_cell(i, j, nx, ny, seed, width_ratio=0.42, length_ratio=0.84):
|
||||
def stroke_angle(i, j, seed):
|
||||
"""Return the original seeded orientation in radians, modulo a half-turn."""
|
||||
rng = random.Random((seed * 1000003 + i * 9176 + j * 6113) & 0xFFFFFFFF)
|
||||
return rng.uniform(0, math.pi)
|
||||
|
||||
|
||||
def capsule_in_cell(i, j, nx, ny, seed, width_ratio=0.42, length_ratio=0.84,
|
||||
angle=None):
|
||||
"""Return a round-ended stroke wholly inside one normalized camera cell."""
|
||||
if not 0 < width_ratio <= length_ratio < 1:
|
||||
raise ValueError("require 0 < width_ratio <= length_ratio < 1")
|
||||
rng = random.Random((seed * 1000003 + i * 9176 + j * 6113) & 0xFFFFFFFF)
|
||||
angle = rng.uniform(0, math.pi)
|
||||
if angle is None:
|
||||
angle = stroke_angle(i, j, seed)
|
||||
radius = width_ratio / 2
|
||||
half_body = (length_ratio - width_ratio) / 2
|
||||
outline = []
|
||||
|
||||
Reference in New Issue
Block a user