silviazuffi / smalst

MIT License
161 stars 24 forks source link

How to get training set using opendr? #18

Open ChiyuanFeng opened 3 years ago

ChiyuanFeng commented 3 years ago

Hello Silvia, I was trying to generate the training set of another kind of animal, but I failed to use opendr to create the training set. I can't find much tutorial about opendr. Could you kindly share you code of generating the training set?

Yours sincerely, Will

silviazuffi commented 3 years ago

Hi,

Below is the opendr code.

Best,

Silvia

def setup_camera(h, w, flength=2000, rt=np.zeros(3), t=np.zeros(3), k=np.zeros(5)): from opendr.camera import ProjectPoints center = np.array([w / 2, h / 2]) f = np.array([flength, flength]) cam = ProjectPoints( f=f, rt=rt, t=t, k=k, c=center)

return cam

cam = setup_camera(img.shape[0], img.shape[1], flength=flength) cam.v = model frustum = {'near': ch.min(model, axis=0)[2], 'far': ch.max(model, axis=0)[2], 'width': img.shape[1], 'height': img.shape[0]}

trend = TexturedRenderer( vc=np.ones_like(model.r), v=model, f=model.f, camera=cam, frustum=frustum, texture_image=texture_image, vt=mesh.vt, ft=mesh.ft, bgcolor=ch.array([0, 0.5, 0]))

On 23. Feb 2021, at 11:11, ChiyuanFeng notifications@github.com wrote:

Hello Silvia, I was trying to generate the training set of another kind of animal, but I failed to use opendr to create the training set. I can't find much tutorial about opendr. Could you kindly share you code of generating the training set?

Yours sincerely, Will

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/silviazuffi/smalst/issues/18, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNYVFNWWZ5PHZ7OOOMBA43TAN5NFANCNFSM4YCGDVHQ.

ChiyuanFeng commented 3 years ago

Awesome! Thank you for your immediate reply.

Best, Will