0
$\begingroup$

Setup : Blender 2.82

I want to achieve something similar to what was represented below but through a python script.

If each cube here represents a pixel, what is the fastest way to change its color so it looks exactly like the 2d image?

  1. I wonder if it is possible to put there an actual RGB photo and not just a number?
  2. I am also curios if i can map on a face of an cube a full image like a feature map from a tensorflow model ?

Here is the code that i have atm for creating cubes at different location in different collections

def createCubes(x,y,z, name):
  collection = bpy.data.collections.new(name= name) 
  bpy.context.scene.collection.children.link(collection) 
  k = 0
  l = 0
  for i in range(0,int(z)):
      for j in range(0, int(x)):
        bpy.ops.mesh.primitive_cube_add(location=(k, y,  l ))
        bpy.context.active_object.name = 'cube'
        cube = bpy.context.object
        for ob in cube.users_collection[:]: 
            ob.objects.unlink(cube)
        collection.objects.link(cube) 
        k= k+3
      l = l + 3
      k = 0
$\endgroup$
-1
$\begingroup$

you have to use opencv a python library for image processing so that you can map a full image.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Could you give an example of use? $\endgroup$ – Lukasz-40sth Apr 5 at 10:44

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.