Fix missing background_image argument
This commit is contained in:
@@ -34,6 +34,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_curve_outline/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_curve_outline/target.png', gamma=2.2)
|
||||||
@@ -65,6 +66,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_curve_outline/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_curve_outline/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -86,6 +88,7 @@ for t in range(200):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_curve_outline/iter_{}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_curve_outline/iter_{}.png'.format(t), gamma=2.2)
|
||||||
@@ -121,6 +124,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
202, # seed
|
202, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_curve_outline/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_curve_outline/final.png')
|
||||||
|
@@ -34,6 +34,7 @@ img = render(256, # width
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img /= 256.0
|
img /= 256.0
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
@@ -63,6 +64,7 @@ img = render(256, # width
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img /= 256.0
|
img /= 256.0
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_curve_sdf/init.png', gamma=1.0)
|
pydiffvg.imwrite(img.cpu(), 'results/single_curve_sdf/init.png', gamma=1.0)
|
||||||
@@ -84,6 +86,7 @@ for t in range(100):
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img /= 256.0
|
img /= 256.0
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
@@ -113,6 +116,7 @@ img = render(256, # width
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
102, # seed
|
102, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img /= 256.0
|
img /= 256.0
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
|
@@ -40,6 +40,7 @@ img = render(256, # width
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
|
|
||||||
path.points[:, 1] += 1e-3
|
path.points[:, 1] += 1e-3
|
||||||
@@ -51,6 +52,7 @@ img2 = render(256, # width
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
|
|
||||||
# diff = img2 - img
|
# diff = img2 - img
|
||||||
@@ -70,6 +72,7 @@ img = render_grad(torch.ones(256, 256, 1), # grad_img
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img = img[:, :, 0]
|
img = img[:, :, 0]
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
@@ -109,6 +112,7 @@ plt.show()
|
|||||||
# 1, # num_samples_x
|
# 1, # num_samples_x
|
||||||
# 1, # num_samples_y
|
# 1, # num_samples_y
|
||||||
# 1, # seed
|
# 1, # seed
|
||||||
|
# None, # background_image
|
||||||
# *scene_args)
|
# *scene_args)
|
||||||
# img /= 256.0
|
# img /= 256.0
|
||||||
# pydiffvg.imwrite(img.cpu(), 'results/single_curve_sdf/init.png', gamma=1.0)
|
# pydiffvg.imwrite(img.cpu(), 'results/single_curve_sdf/init.png', gamma=1.0)
|
||||||
@@ -130,6 +134,7 @@ plt.show()
|
|||||||
# 1, # num_samples_x
|
# 1, # num_samples_x
|
||||||
# 1, # num_samples_y
|
# 1, # num_samples_y
|
||||||
# t+1, # seed
|
# t+1, # seed
|
||||||
|
# None, # background_image
|
||||||
# *scene_args)
|
# *scene_args)
|
||||||
# img /= 256.0
|
# img /= 256.0
|
||||||
# # Save the intermediate render.
|
# # Save the intermediate render.
|
||||||
@@ -160,6 +165,7 @@ plt.show()
|
|||||||
# 1, # num_samples_x
|
# 1, # num_samples_x
|
||||||
# 1, # num_samples_y
|
# 1, # num_samples_y
|
||||||
# 102, # seed
|
# 102, # seed
|
||||||
|
# None, # background_image
|
||||||
# *scene_args)
|
# *scene_args)
|
||||||
# img /= 256.0
|
# img /= 256.0
|
||||||
# # Save the images and differences.
|
# # Save the images and differences.
|
||||||
|
@@ -22,6 +22,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse/target.png', gamma=2.2)
|
||||||
@@ -42,6 +43,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@ for t in range(50):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse/iter_{}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse/iter_{}.png'.format(t), gamma=2.2)
|
||||||
@@ -94,6 +97,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
52, # seed
|
52, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse/final.png')
|
||||||
|
@@ -24,6 +24,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse_transform/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse_transform/target.png', gamma=2.2)
|
||||||
@@ -49,6 +50,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse_transform/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse_transform/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -68,6 +70,7 @@ for t in range(150):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse_transform/iter_{}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse_transform/iter_{}.png'.format(t), gamma=2.2)
|
||||||
@@ -97,6 +100,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
52, # seed
|
52, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse_transform/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_ellipse_transform/final.png')
|
||||||
|
@@ -27,6 +27,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_gradient/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_gradient/target.png', gamma=2.2)
|
||||||
@@ -54,6 +55,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_gradient/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_gradient/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -77,6 +79,7 @@ for t in range(100):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_gradient/iter_{}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_gradient/iter_{}.png'.format(t), gamma=2.2)
|
||||||
@@ -116,6 +119,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
52, # seed
|
52, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_gradient/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_gradient/final.png')
|
||||||
|
@@ -13,7 +13,6 @@ points = torch.tensor([[120.0, 30.0], # base
|
|||||||
[ 60.0, 218.0]]) # base
|
[ 60.0, 218.0]]) # base
|
||||||
path = pydiffvg.Path(num_control_points = num_control_points,
|
path = pydiffvg.Path(num_control_points = num_control_points,
|
||||||
points = points,
|
points = points,
|
||||||
thickness = None,
|
|
||||||
is_closed = False,
|
is_closed = False,
|
||||||
stroke_width = torch.tensor(5.0))
|
stroke_width = torch.tensor(5.0))
|
||||||
shapes = [path]
|
shapes = [path]
|
||||||
@@ -30,6 +29,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve/target.png', gamma=2.2)
|
||||||
@@ -54,6 +54,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -74,6 +75,7 @@ for t in range(200):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve/iter_{}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve/iter_{}.png'.format(t), gamma=2.2)
|
||||||
@@ -106,6 +108,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
202, # seed
|
202, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve/final.png')
|
||||||
|
@@ -32,6 +32,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve_thickness/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve_thickness/target.png', gamma=2.2)
|
||||||
@@ -57,6 +58,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve_thickness/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve_thickness/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -77,6 +79,7 @@ for t in range(200):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve_thickness/iter_{}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve_thickness/iter_{}.png'.format(t), gamma=2.2)
|
||||||
@@ -109,6 +112,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
202, # seed
|
202, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve_thickness/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_open_curve_thickness/final.png')
|
||||||
|
@@ -20,6 +20,7 @@ img = render(510, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_path/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_path/target.png', gamma=2.2)
|
||||||
@@ -40,6 +41,7 @@ img = render(510, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_path/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_path/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -59,6 +61,7 @@ for t in range(100):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_path/iter_{:02}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_path/iter_{:02}.png'.format(t), gamma=2.2)
|
||||||
@@ -88,6 +91,7 @@ img = render(510, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
102, # seed
|
102, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_path/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_path/final.png')
|
||||||
|
@@ -21,6 +21,7 @@ img = render(510, # width
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img = img / 510 # Normalize SDF to [0, 1]
|
img = img / 510 # Normalize SDF to [0, 1]
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_path_sdf/target.png', gamma=1.0)
|
pydiffvg.imwrite(img.cpu(), 'results/single_path_sdf/target.png', gamma=1.0)
|
||||||
@@ -42,6 +43,7 @@ img = render(510, # width
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img = img / 510 # Normalize SDF to [0, 1]
|
img = img / 510 # Normalize SDF to [0, 1]
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_path_sdf/init.png', gamma=1.0)
|
pydiffvg.imwrite(img.cpu(), 'results/single_path_sdf/init.png', gamma=1.0)
|
||||||
@@ -63,6 +65,7 @@ for t in range(100):
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img = img / 510 # Normalize SDF to [0, 1]
|
img = img / 510 # Normalize SDF to [0, 1]
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
@@ -94,6 +97,7 @@ img = render(510, # width
|
|||||||
1, # num_samples_x
|
1, # num_samples_x
|
||||||
1, # num_samples_y
|
1, # num_samples_y
|
||||||
102, # seed
|
102, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_path_sdf/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_path_sdf/final.png')
|
||||||
|
@@ -27,6 +27,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_polygon/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_polygon/target.png', gamma=2.2)
|
||||||
@@ -49,6 +50,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_polygon/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_polygon/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -68,6 +70,7 @@ for t in range(100):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_polygon/iter_{}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_polygon/iter_{}.png'.format(t), gamma=2.2)
|
||||||
@@ -97,6 +100,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
102, # seed
|
102, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_polygon/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_polygon/final.png')
|
||||||
|
@@ -22,6 +22,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_rect/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_rect/target.png', gamma=2.2)
|
||||||
@@ -42,6 +43,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_rect/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_rect/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@ for t in range(100):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_rect/iter_{}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_rect/iter_{}.png'.format(t), gamma=2.2)
|
||||||
@@ -91,6 +94,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
102, # seed
|
102, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_rect/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_rect/final.png')
|
||||||
|
@@ -30,6 +30,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_stroke/target.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_stroke/target.png', gamma=2.2)
|
||||||
@@ -54,6 +55,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_stroke/init.png', gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_stroke/init.png', gamma=2.2)
|
||||||
|
|
||||||
@@ -74,6 +76,7 @@ for t in range(200):
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the intermediate render.
|
# Save the intermediate render.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_stroke/iter_{}.png'.format(t), gamma=2.2)
|
pydiffvg.imwrite(img.cpu(), 'results/single_stroke/iter_{}.png'.format(t), gamma=2.2)
|
||||||
@@ -106,6 +109,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
202, # seed
|
202, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/single_stroke/final.png')
|
pydiffvg.imwrite(img.cpu(), 'results/single_stroke/final.png')
|
||||||
|
@@ -21,9 +21,9 @@ for x in range(100000):
|
|||||||
print(outmat)
|
print(outmat)
|
||||||
print(decomp)"""
|
print(decomp)"""
|
||||||
|
|
||||||
#infile='../../data/test_data/linear_grad_alpha_aspaths.svg'
|
|
||||||
#infile='../../data/note_small.svg'
|
infile='./imgs/note_small.svg'
|
||||||
infile='linux.svg'
|
|
||||||
|
|
||||||
canvas_width, canvas_height, shapes, shape_groups = \
|
canvas_width, canvas_height, shapes, shape_groups = \
|
||||||
pydiffvg.svg_to_scene(infile)
|
pydiffvg.svg_to_scene(infile)
|
||||||
@@ -35,6 +35,7 @@ img = render(canvas_width, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
# The output image is in linear RGB space. Do Gamma correction before saving the image.
|
||||||
pydiffvg.imwrite(img.cpu(), 'test_old.png', gamma=1.0)
|
pydiffvg.imwrite(img.cpu(), 'test_old.png', gamma=1.0)
|
||||||
@@ -50,6 +51,7 @@ img = render(scene[0], # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
0, # seed
|
0, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img = img / 256 # Normalize SDF to [0, 1]
|
img = img / 256 # Normalize SDF to [0, 1]
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/test_eval_positions/target.png')
|
pydiffvg.imwrite(img.cpu(), 'results/test_eval_positions/target.png')
|
||||||
@@ -45,6 +46,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
1, # seed
|
1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img = img / 256 # Normalize SDF to [0, 1]
|
img = img / 256 # Normalize SDF to [0, 1]
|
||||||
pydiffvg.imwrite(img.cpu(), 'results/test_eval_positions/init.png')
|
pydiffvg.imwrite(img.cpu(), 'results/test_eval_positions/init.png')
|
||||||
@@ -60,7 +62,7 @@ for t in range(200):
|
|||||||
circle.center = center_n * 256
|
circle.center = center_n * 256
|
||||||
circle_group.fill_color = color
|
circle_group.fill_color = color
|
||||||
# Evaluate 1000 positions
|
# Evaluate 1000 positions
|
||||||
eval_positions = torch.rand(1000, 2) * 256
|
eval_positions = torch.rand(1000, 2).to(img.device) * 256
|
||||||
# for grid_sample()
|
# for grid_sample()
|
||||||
grid_eval_positions = (eval_positions / 256.0) * 2.0 - 1.0
|
grid_eval_positions = (eval_positions / 256.0) * 2.0 - 1.0
|
||||||
scene_args = pydiffvg.RenderFunction.serialize_scene(\
|
scene_args = pydiffvg.RenderFunction.serialize_scene(\
|
||||||
@@ -72,6 +74,7 @@ for t in range(200):
|
|||||||
0, # num_samples_x
|
0, # num_samples_x
|
||||||
0, # num_samples_y
|
0, # num_samples_y
|
||||||
t+1, # seed
|
t+1, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
samples = samples / 256 # Normalize SDF to [0, 1]
|
samples = samples / 256 # Normalize SDF to [0, 1]
|
||||||
target_sampled = torch.nn.functional.grid_sample(\
|
target_sampled = torch.nn.functional.grid_sample(\
|
||||||
@@ -103,6 +106,7 @@ img = render(256, # width
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
102, # seed
|
102, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
img = img / 256 # Normalize SDF to [0, 1]
|
img = img / 256 # Normalize SDF to [0, 1]
|
||||||
# Save the images and differences.
|
# Save the images and differences.
|
||||||
|
@@ -1028,6 +1028,7 @@ class OptimizableSvg:
|
|||||||
2, # num_samples_x
|
2, # num_samples_x
|
||||||
2, # num_samples_y
|
2, # num_samples_y
|
||||||
seed, # seed
|
seed, # seed
|
||||||
|
None, # background_image
|
||||||
*scene_args)
|
*scene_args)
|
||||||
return img
|
return img
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user