You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I then run opendr.demo('point_light'), but only a black image comes up, not the sphere mesh with one point light source. Here is the error message:
Create renderer
import chumpy as ch
from opendr.renderer import ColoredRenderer
from opendr.lighting import LambertianPointLight
rn = ColoredRenderer()
Assign attributes to renderer
from opendr.util_tests import get_earthmesh
m = get_earthmesh(trans=ch.array([0,0,4]), rotation=ch.zeros(3))
w, h = (320, 240)
OPTIMIZING TRANSLATION, ROTATION, AND LIGHT PARMS
0.00e+00 | pyr: 0.00e+00
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/opendr/init.py", line 350, in demo
exec('global np\n' + demos[which], globals(), locals())
File "", line 48, in
File "/home/yifu/.local/lib/python2.7/site-packages/chumpy/optimization.py", line 41, in minimize
return minimize_dogleg(fun, free_variables=x0, on_step=callback, **options)
File "/home/yifu/.local/lib/python2.7/site-packages/chumpy/optimization_internal.py", line 408, in minimize_dogleg
state.updateJ(obj)
File "/home/yifu/.local/lib/python2.7/site-packages/chumpy/optimization_internal.py", line 311, in updateJ
assert(self.J.nnz > 0)
AssertionError
The text was updated successfully, but these errors were encountered:
I am using Ubuntu 18.04, CUDA 10.1 Python 2.7.15. The following issue does not happen in any other machines in my lab but they are Ubuntu 16.
I have followed instructions on https://github.com/mattloper/opendr/wiki/Installation-in-Ubuntu
I then run opendr.demo('point_light'), but only a black image comes up, not the sphere mesh with one point light source. Here is the error message:
Create renderer
import chumpy as ch
from opendr.renderer import ColoredRenderer
from opendr.lighting import LambertianPointLight
rn = ColoredRenderer()
Assign attributes to renderer
from opendr.util_tests import get_earthmesh
m = get_earthmesh(trans=ch.array([0,0,4]), rotation=ch.zeros(3))
w, h = (320, 240)
from opendr.camera import ProjectPoints
rn.camera = ProjectPoints(v=m.v, rt=ch.zeros(3), t=ch.zeros(3), f=ch.array([w,w])/2., c=ch.array([w,h])/2., k=ch.zeros(5))
rn.frustum = {'near': 1., 'far': 10., 'width': w, 'height': h}
rn.set(v=m.v, f=m.f, bgcolor=ch.zeros(3))
Construct point light source
rn.vc = LambertianPointLight(
f=m.f,
v=rn.v,
num_verts=len(m.v),
light_pos=ch.array([-1000,-1000,-1000]),
vc=m.vc,
light_color=ch.array([1., 1., 1.]))
Show it
import matplotlib.pyplot as plt
plt.ion()
plt.imshow(rn.r)
plt.show()
dr = rn.dr_wrt(rn.v) # or rn.vc, or rn.camera.rt, rn.camera.t, rn.camera.f, rn.camera.c, etc
I also cannot get the opendr.demo('optimization') running:
from opendr.simple import *
import numpy as np
import matplotlib.pyplot as plt
w, h = 320, 240
try:
m = load_mesh('earth.obj')
except:
from opendr.util_tests import get_earthmesh
m = get_earthmesh(trans=ch.array([0,0,0]), rotation=ch.zeros(3))
Create V, A, U, f: geometry, brightness, camera, renderer
V = ch.array(m.v)
A = SphericalHarmonics(vn=VertNormals(v=V, f=m.f),
components=[3.,2.,0.,0.,0.,0.,0.,0.,0.],
light_color=ch.ones(3))
U = ProjectPoints(v=V, f=[w,w], c=[w/2.,h/2.], k=ch.zeros(5),
t=ch.zeros(3), rt=ch.zeros(3))
f = TexturedRenderer(vc=A, camera=U, f=m.f, bgcolor=[0.,0.,0.],
texture_image=m.texture_image, vt=m.vt, ft=m.ft,
frustum={'width':w, 'height':h, 'near':1,'far':20})
Parameterize the vertices
translation, rotation = ch.array([0,0,8]), ch.zeros(3)
f.v = translation + V.dot(Rodrigues(rotation))
observed = f.r
np.random.seed(1)
translation[:] = translation.r + np.random.rand(3)
rotation[:] = rotation.r + np.random.rand(3) *.2
A.components[1:] = 0
Create the energy
E_raw = f - observed
E_pyr = gaussian_pyramid(E_raw, n_levels=6, normalization='size')
def cb(_):
import cv2
cv2.imshow('Absolute difference', np.abs(E_raw.r))
cv2.waitKey(1)
print 'OPTIMIZING TRANSLATION, ROTATION, AND LIGHT PARMS'
free_variables=[translation, rotation, A.components]
ch.minimize({'pyr': E_pyr}, x0=free_variables, callback=cb)
ch.minimize({'raw': E_raw}, x0=free_variables, callback=cb)
OPTIMIZING TRANSLATION, ROTATION, AND LIGHT PARMS
0.00e+00 | pyr: 0.00e+00
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/opendr/init.py", line 350, in demo
exec('global np\n' + demos[which], globals(), locals())
File "", line 48, in
File "/home/yifu/.local/lib/python2.7/site-packages/chumpy/optimization.py", line 41, in minimize
return minimize_dogleg(fun, free_variables=x0, on_step=callback, **options)
File "/home/yifu/.local/lib/python2.7/site-packages/chumpy/optimization_internal.py", line 408, in minimize_dogleg
state.updateJ(obj)
File "/home/yifu/.local/lib/python2.7/site-packages/chumpy/optimization_internal.py", line 311, in updateJ
assert(self.J.nnz > 0)
AssertionError
The text was updated successfully, but these errors were encountered: