integrated finger process pipeline on remapped 2d image
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import numpy
|
||||
|
||||
from ..domain import MaskedDomain
|
||||
|
||||
|
||||
class MaskedSparseSolver:
|
||||
"""Reference masked Poisson solver via factorized sparse Laplacian."""
|
||||
|
||||
def solve(self, f, domain: MaskedDomain):
|
||||
"""Solve masked Poisson on active domain pixels.
|
||||
|
||||
f: (H, W) scalar source field
|
||||
domain: MaskedDomain with prebuilt Laplacian
|
||||
returns: (H, W) scalar potential; zero outside mask
|
||||
"""
|
||||
rhs = domain.prepare_rhs(f)
|
||||
if rhs.size == 0:
|
||||
return numpy.zeros_like(f, dtype=numpy.float32)
|
||||
|
||||
sol_active = domain.factor(rhs) # (N,) reduced-system potential
|
||||
return domain.scatter(sol_active, f)
|
||||
Reference in New Issue
Block a user