Does anybody have any hints or ideas how to solve the following problem:
I have a
Showbase envrironment in which I dynamically load different actor models. Let’s say I load two actors:
actors1 = Actor(‘models/actor_model1’)
actors2 = Actor(‘models/actor_model2’)
taskMgr.add(update_environment) I am able to update the position of actors dynamically inside the function
update_environment(). Additionally, every time I am inside
update_environment(), I extract the image (as a numpy array) of the current window of the ShowBase environment (I basically get the same image I see in the ShowBase window). To do this I initialize a texture object
self.texture = Texture()
self.win.addRenderTexture(self.texture, GraphicsOutput.RTM_copy_ram, GraphicsOutput.RTP_color)
in the constructor and every time I am inside the
update_environment() function, I call
image = np.frombuffer(data, np.uint8)
to obtain my image (I skipped some of the post-processing steps).
Now to the question: Is there a way to obtain the information about which pixels of the
image a occupied by which actor. So additionally to the RGB
image I would also like to get information about pixels occupied by
actor2. I need this to solve a classification task where every actor as well as the empty space belongs to a different class.
Thanks in advance!