Returns the transformation from camera to object when the object is in the given stable pose.

        Returns
        -------
        :obj:`autolab_core.RigidTransform`
            The desired transform.
481304
def T_obj_camera(self):
        
        if self.stable_pose is None:
            T_obj_world = RigidTransform(from_frame='obj', to_frame='world')
        else:
            T_obj_world = self.stable_pose.T_obj_table.as_frames('obj', 'world')
        T_camera_obj = T_obj_world.inverse() * self.T_camera_world
        return T_camera_obj
391864
def transformToNative(obj):
        
        if obj.isNative:
            return obj
        obj.isNative = True
        obj.value = Name(**dict(zip(NAME_ORDER, splitFields(obj.value))))
        return obj
462281
def reproject(self, projection):
        
        srs_out = crsConvert(projection, 'osr')
        
        if self.srs.IsSame(srs_out) == 0:
            
            # create the CoordinateTransformation
            coordTrans = osr.CoordinateTransformation(self.srs, srs_out)
            
            layername = self.layername
            geomType = self.geomType
            features = self.getfeatures()
            feat_def = features[0].GetDefnRef()
            fields = [feat_def.GetFieldDefn(x) for x in range(0, feat_def.GetFieldCount())]
            
            self.__init__()
            self.addlayer(layername, srs_out, geomType)
            self.layer.CreateFields(fields)
            
            for feature in features:
                geom = feature.GetGeometryRef()
                geom.Transform(coordTrans)
                newfeature = feature.Clone()
                newfeature.SetGeometry(geom)
                self.layer.CreateFeature(newfeature)
                newfeature = None
            self.init_features()
203643
def to_flattened(self, base_frame=None):
        
        if base_frame is None:
            base_frame = self.base_frame

        flat = {}
        for node in self.nodes:
            if node == base_frame:
                continue
            transform, geometry = self.get(
                frame_to=node, frame_from=base_frame)
            flat[node] = {
                'transform': transform.tolist(),
                'geometry': geometry
            }
        return flat
1073488
public void getImageRelativeToViewAbsoluteTransform(Matrix outMatrix) {
    outMatrix.setRectToRect(IDENTITY_RECT, mTransformedImageBounds, Matrix.ScaleToFit.FILL);
  }
1115873
def view_isometric(self):
        
        self.camera_position = self.get_default_cam_pos()
        self.camera_set = False
        return self.reset_camera()
751427
function(d, cx, cy) {
    return this.transform({ rotation: d, cx: cx, cy: cy })
  }
444372
def to_float(self):
        
        return DepthImage(self.data.astype(np.float32), frame=self.frame)
767049
def from_ros_pose_msg(pose_msg,
                          from_frame='unassigned',
                          to_frame='world'):
        
        quaternion = np.array([pose_msg.orientation.w,
                               pose_msg.orientation.x,
                               pose_msg.orientation.y,
                               pose_msg.orientation.z])
        position = np.array([pose_msg.position.x,
                             pose_msg.position.y,
                             pose_msg.position.z])
        pose = RigidTransform(rotation=quaternion,
                              translation=position,
                              from_frame=from_frame,
                              to_frame=to_frame)
        return pose
1064023
def matrixToMathTransform(matrix):
    
    if isinstance(matrix, ShallowTransform):
        return matrix
    off, scl, rot = MathTransform(matrix).decompose()
    return ShallowTransform(off, scl, rot)
1344439
def _update_camera_pos(self):
        

        # transform will be updated several times; do not update camera
        # transform until we are done.
        ch_em = self.events.transform_change
        with ch_em.blocker(self._update_transform):
            tr = self.transform
            tr.reset()

            up, forward, right = self._get_dim_vectors()

            # Create mapping so correct dim is up
            pp1 = np.array([(0, 0, 0), (0, 0, -1), (1, 0, 0), (0, 1, 0)])
            pp2 = np.array([(0, 0, 0), forward, right, up])
            tr.set_mapping(pp1, pp2)

            tr.translate(-self._actual_distance * forward)
            self._rotate_tr()
            tr.scale([1.0/a for a in self._flip_factors])
            tr.translate(np.array(self.center))
790152
def transformToNative(obj):
        
        if obj.isNative:
            return obj
        obj.isNative = True
        obj.value = splitFields(obj.value)
        return obj
737906
def on_draw(self):
        
        self._update_meshes()
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
        gl.glLoadIdentity()

        # pull the new camera transform from the scene
        transform_camera = self.scene.graph.get(
            frame_to='world',
            frame_from=self.scene.camera.name)[0]

        # apply the camera transform to the matrix stack
        gl.glMultMatrixf(rendering.matrix_to_gl(transform_camera))

        # we want to render fully opaque objects first,
        # followed by objects which have transparency
        node_names = collections.deque(self.scene.graph.nodes_geometry)
        # how many nodes did we start with
        count_original = len(node_names)
        count = -1

        # if we are rendering an axis marker at the world
        if self._axis:
            # we stored it as a vertex list
            self._axis.draw(mode=gl.GL_TRIANGLES)

        while len(node_names) > 0:
            count += 1
            current_node = node_names.popleft()

            # get the transform from world to geometry and mesh name
            transform, geometry_name = self.scene.graph[current_node]

            # if no geometry at this frame continue without rendering
            if geometry_name is None:
                continue

            # if a geometry is marked as fixed apply the inverse view transform
            if self.fixed is not None and geometry_name in self.fixed:
                # remove altered camera transform from fixed geometry
                transform_fix = np.linalg.inv(
                    np.dot(self._initial_camera_transform, transform_camera))
                # apply the transform so the fixed geometry doesn't move
                transform = np.dot(transform, transform_fix)

            # get a reference to the mesh so we can check transparency
            mesh = self.scene.geometry[geometry_name]
            if mesh.is_empty:
                continue

            # add a new matrix to the model stack
            gl.glPushMatrix()
            # transform by the nodes transform
            gl.glMultMatrixf(rendering.matrix_to_gl(transform))

            # draw an axis marker for each mesh frame
            if self.view['axis'] == 'all':
                self._axis.draw(mode=gl.GL_TRIANGLES)

            # transparent things must be drawn last
            if (hasattr(mesh, 'visual') and
                hasattr(mesh.visual, 'transparency')
                    and mesh.visual.transparency):
                # put the current item onto the back of the queue
                if count < count_original:
                    # add the node to be drawn last
                    node_names.append(current_node)
                    # pop the matrix stack for now
                    gl.glPopMatrix()
                    # come back to this mesh later
                    continue

            # if we have texture enable the target texture
            texture = None
            if geometry_name in self.textures:
                texture = self.textures[geometry_name]
                gl.glEnable(texture.target)
                gl.glBindTexture(texture.target, texture.id)

            # get the mode of the current geometry
            mode = self.vertex_list_mode[geometry_name]
            # draw the mesh with its transform applied
            self.vertex_list[geometry_name].draw(mode=mode)
            # pop the matrix stack as we drew what we needed to draw
            gl.glPopMatrix()

            # disable texture after using
            if texture is not None:
                gl.glDisable(texture.target)
359371
def copy(self):
        
        copied = TransformForest()
        copied.base_frame = copy.deepcopy(self.base_frame)
        copied.transforms = copy.deepcopy(self.transforms)

        return copied
293866
def applyTransform(self):
        

        fn = self.function_table.applyTransform
        pOutputPose = TrackedDevicePose_t()
        pTrackedDevicePose = TrackedDevicePose_t()
        pTransform = HmdMatrix34_t()
        fn(byref(pOutputPose), byref(pTrackedDevicePose), byref(pTransform))
        return pOutputPose, pTrackedDevicePose, pTransform
1328074
def fit(self, X, y=None):
        
        moving_images = X if isinstance(X, (list,tuple)) else [X]
        moving_labels = y if y is not None else [i for i in range(len(moving_images))]
        fixed_image = self.fixed_image

        self.fwdtransforms_ = {}
        self.invtransforms_ = {}
        self.warpedmovout_ = {}
        self.warpedfixout_ = {}
        
        for moving_image, moving_label in zip(moving_images, moving_labels):
            fit_result = interface.registration(fixed_image,
                                                moving_image,
                                                type_of_transform=self.type_of_transform,
                                                initial_transform=None,
                                                outprefix='',
                                                mask=None,
                                                grad_step=0.2,
                                                flow_sigma=3,
                                                total_sigma=0,
                                                aff_metric='mattes',
                                                aff_sampling=32,
                                                syn_metric='mattes',
                                                syn_sampling=32,
                                                reg_iterations=(40,20,0),
                                                verbose=False)

            self.fwdtransforms_[moving_label] = fit_result['fwdtransforms']
            self.invtransforms_[moving_label] = fit_result['invtransforms']
            self.warpedmovout_[moving_label]  = fit_result['warpedmovout']
            self.warpedfixout_[moving_label]  = fit_result['warpedfixout']

        return self
379966
def get_transform(self):
        
        return self.aux_transform + \
            self.ref_offset_transform + \
            self.dpi_transform + \
            self.offset_transform