Refines a mesh until no triangle has an edge longer than max_edge, by repeatedly bisecting the longest edge (one triangle becomes two). Only coarse regions grow, so it costs about half the triangles a uniform 1->4 subdivision needs for the same result. This exists for cv2.rapid: extractControlPoints interpolates its 3D control points LINEARLY between consecutive silhouette VERTICES, using a blend factor taken from screen-space distance - so a control point between two far-apart vertices is wrong by roughly L_px^2/(16*fx) in depth, and its 2D position by the chord sagitta L_px^2/(8*R_px) on a curved silhouette, where L_px is the ON-SCREEN spacing of silhouette vertices. Neither error shrinks if you render at a higher resolution - they are geometric, not raster. Measured on a 3624-triangle vehicle at fx=900, 8 m away: the untouched mesh puts control points up to 23 px off their own 3D points and tracking DIVERGES; at L_px<=80 (5960 triangles, +14% tracking time) that error is 0.9 px and the same sequence tracks to 3 px. Rule of thumb: max_edge = 80 * distance / fx. Below L_px~20 the raster quantization floor takes over and further splitting buys nothing.
By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Mesh Split Long Edges
pts3d
tris
pts3d
tris
triangle_count
◄max_edge0.70►
◄max_rounds24►
Categoryimage/CV/low-level
Inputs (4)
Name
Type
Default
Description
pts3d
NPARRAY
Nx3 vertices, from 'CV Mesh From 3D Model'.
tris
NPARRAY
Mx3 int triangle indices. Winding is preserved.
max_edge
FLOAT
0.700–1000000000
Longest edge allowed, IN THE MESH'S OWN UNITS. Convert from the on-screen budget with max_edge = L_px * distance / fx (L_px = 80 is the knee) - a 'Math Expression' node keeps that visible in the graph. 0 disables splitting and passes the mesh through unchanged, which is how you A/B the effect.
max_roundsopt
INT
241–64
Safety stop. Each round splits every triangle still over budget, so the longest edge roughly halves per round and 24 rounds is far more than any sane budget needs. Lower it to cap the triangle count on a pathological model.
Outputs (3)
Name
Type
Description
pts3d
NPARRAY
Nx3 float32 vertices: the originals unchanged, plus one new vertex per split edge. Existing indices keep their meaning, so anything indexed against the input mesh stays valid.
tris
NPARRAY
Mx3 int32 triangles of the refined mesh. Bisection leaves T-junctions where a neighbour was not split - harmless for silhouette extraction, since the neighbour's rasterized edge still passes over the new vertex.
triangle_count
INT
Triangles after splitting. Watch it against the input count: this is the cost you are paying, and past L_px~20 it grows fast for no accuracy.