Add new tests and functionality for image processing and geometry handling
- Introduced color_image.py for preparing standalone color images for tests. - Added hdr_image.py to create HDR textures for testing. - Implemented test_image_depth_panorama.py to evaluate panorama topology, UVs, and depth discontinuities. - Created test_shadeless.py to validate the opacity and HDR color endpoints of the Shadeless group. - Developed moge3_export.py for exporting dynamic MoGe-3 backbone and ONNX graphs. - Added material.py to inherit material slots onto generated geometry. - Built image_depth_panorama.py to construct a quad panorama with depth separation and sampling.
This commit is contained in:
11
tests/support/color_image.py
Normal file
11
tests/support/color_image.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""Prepare a standalone color image for material and geometry tests."""
|
||||
|
||||
from anyimage.common.color_image import prepare_material_color_input, load_material_color_image, cleanup_material_color_input
|
||||
|
||||
|
||||
def color_image(source, bounds=None, rgba=None):
|
||||
path = prepare_material_color_input(source, bounds, rgba)
|
||||
try:
|
||||
return load_material_color_image(path)
|
||||
finally:
|
||||
cleanup_material_color_input(path)
|
||||
15
tests/support/hdr_image.py
Normal file
15
tests/support/hdr_image.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import bpy
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def hdr_texture(texture):
|
||||
image = bpy.data.images.new("HDR source", width=4, height=3, alpha=True, float_buffer=True)
|
||||
image.alpha_mode = "PREMUL"
|
||||
rgba = np.tile([4.0, 2.0, -0.25, 0.5], (3, 4, 1)).astype(np.float32)
|
||||
rgba[0, 0] = [9, 3, -0.5, 0]
|
||||
rgba[2, 3] = [25, 12, 6, 1]
|
||||
image.pixels.foreach_set(np.flipud(rgba).ravel())
|
||||
texture.image = image
|
||||
return texture
|
||||
@@ -7,6 +7,7 @@ from anyimage.common import object as object_data
|
||||
from anyimage.common.selection import SelectionMask
|
||||
from anyimage.operators.cutout_tool import geometry as cutout_geometry
|
||||
from anyimage.operators.cutout_tool import object as cutout_object
|
||||
from tests.support.color_image import color_image as prepared_color_image
|
||||
|
||||
|
||||
def _inputs(group):
|
||||
@@ -43,8 +44,8 @@ def _create_cutout_shape(
|
||||
selection_values = np.ones((bottom - top, right - left), dtype=np.float32)
|
||||
selection_mask = SelectionMask(selection_values, bounds)
|
||||
source_rgba = image_data.image_rgba(source.data)
|
||||
color_image = cutout_object.create_cropped_color_image(
|
||||
source,
|
||||
color_image = prepared_color_image(
|
||||
source.data,
|
||||
selection_mask.bounds,
|
||||
source_rgba,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user