I have a camera and a pile of up to 10 cubes. I know the position and orientation of the cubes and the camera. Now I would like to figure out what pixel belongs to what cube and create a labeled image where every pixel belongs to either a cube or nothing. Now I saw this question and the last answer gives a nice list of options. Now the thing is this is just a means to generate a dataset to train a model. The only way I know how I could do that would be to insert the coordinates of my cubes into some game/modeling engine like unity/blender and use existing functions, but this would only be by hand.

What I'm looking for is a small and simple library(c++/python) that let's me insert a few cubes and let's me determine the visibility of the pixels programmatically. Right now the only thing I can think of is writing my own ray casting plus polygonisation algorithm, which can't be the right approach.


I ended up using blender to do what I wanted. I guess it is not the smallest and simplest framework, but it does the job after a (bit ;) ) of compiling it as a python module and another user helped me render all cubes with the same color.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.