Denoise
import pyoidn
result = pyoidn.denoise(color)
result = pyoidn.denoise(color, albedo=albedo, normal=normal, hdr=True)
lightmap = pyoidn.denoise(color, filter_type="RTLightmap")
The convenience interface manages commits and reuses native devices and filters.
Each call returns a new output, so later calls do not overwrite earlier results.
The most recent image allocations remain referenced while bound to a cached filter.
OIDN failures within this interface raise RuntimeError; the low-level API keeps
its existing manual error-handling behavior.
Auxiliary images must use the same container type, shape, and device as color.
Use linear RGB color, albedos in [0, 1], and world- or view-space normals in [-1, 1].
Set clean_aux=True only when auxiliary images are already noise-free; this option
does not denoise them separately. RTLightmap always processes HDR lightmaps and
does not accept auxiliary images.
Convenience API for denoising an image in a single call.
denoise
denoise(color: Any, albedo: Optional[Any] = None, normal: Optional[Any] = None, *, hdr: bool = False, clean_aux: bool = False, quality: Union[str, int] = 'high', filter_type: str = OIDN_FILTER_TYPE_RT) -> Any
Denoise an RGB image and return a new image, ready to use.
Reuses an internal device and filter across calls. NumPy and CPU Torch inputs share a CPU device; CUDA resources are cached per device and current stream. Resources are initialized lazily and released when the process exits. Calls are serialized to protect the shared filter configuration. Noncontiguous inputs are copied to contiguous storage on the same device. Inputs are never modified. This operation is synchronous and not differentiable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
Any
|
NumPy array or Torch tensor of shape |
required |
albedo
|
Optional[Any]
|
Optional albedo in [0, 1], with the same shape, container type, and device as color. Its dtype may independently be float16 or float32. |
None
|
normal
|
Optional[Any]
|
Optional world- or view-space normals in [-1, 1], with the same requirements as albedo. |
None
|
hdr
|
bool
|
Whether RT color input is HDR. RTLightmap always processes HDR. |
False
|
clean_aux
|
bool
|
Whether auxiliary images are already noise-free. Does not prefilter them. Supported only by RT. |
False
|
quality
|
Union[str, int]
|
|
'high'
|
filter_type
|
str
|
|
OIDN_FILTER_TYPE_RT
|
Returns:
| Type | Description |
|---|---|
Any
|
A contiguous image with color's shape, dtype, container type, and device. Torch output does not require gradients. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If an input type or dtype is unsupported. |
ValueError
|
If image shapes, devices, or options are incompatible. |
RuntimeError
|
If OIDN reports a failure. |