I am creating a simulation to later on use with OpenCV to detect black and white square markers on an outdoor terrain. For the markers I am using the following texture:

enter image description here

The markers are applied to a terrain using a shrinkwrap modifier in my simulation. In order to verify my openCV algorithms I would like to know the exact position of the inner corner of the markers.

Is it possible to somehow mark the inner corner in my UV texture and be able to retrieve its position in the 3D object (after using the shrinkwrap modifier)?

Alternatively, how could I at least find the center of the marker object after the shrinkwrap is used (as I need the actual position of the marker on the rendered image)? This would assume that the inner corner stays in the center of the marker, which is not necessarily the case with the modifier. However, it is at least a starting point.

Thanks in advance,



1 Answer 1


I figured out a way, although I am not sure if it's the simplest solution:

In order to locate the inner corner of the marker I need a vertex at that point. Therefore I seperated the marker into two faces and created a UV map like this:

enter image description here

Next, using a script (see related lines below) I select the marker and apply the shrinkwrap modifier (it is important to apply it so that the positions of the mesh/vertices are actually affected).

Since these markers only consist of now five vertices, it is fairly simple to select the one in the center of the marker and read out its local coordinates. Finally, with the object's world matrix I can calculate the inner corner's global position.

# make the active object the current marker
bpy.context.scene.objects.active = marker

# apply the shrinkwrap modifier to access the exact marker position
bpy.ops.object.modifier_apply (modifier='Shrinkwrap')

# get the local position of the inner corner of the marker
# (assuming the additional vertex in the center is at index 4)
local_inner_corner_pos = marker.data.vertices[4].co 

# calculate marker position with respect to the global coordinate system  
global_inner_corner_pos = marker.matrix_world * local_inner_corner_pos

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .