示例#1
0
  def plot_vdirs(self, ax, spacing, Lorientation, labrange=[0,1,2]):
    '''
    Plot the vanishing point directions at various pixels. ax is a
    matplotlib axes, taken with "gca()". Spacing the separation
    between the points, and myR the rotation matrix.

    '''

    orientation = Quat(array(Lorientation))

    qq = spacing * 0.45 * array([-1, +1])
    bx = 0.+(self.Iwidth/2)%spacing
    by = 0.+(self.Iheight/2)%spacing
    qL = np.mgrid[bx:self.Iwidth:spacing,by:self.Iheight:spacing].T.reshape((-1,2))
    Nq = qL.shape[0]
    # vL = equidistant_vdirs(self.middlex, self.middley, self.fd,
    #                             orientation.q, array(qL, dtype=np.float32))
    vL = corisco_aux.calculate_vdirs(orientation.q, array(qL, dtype=np.float32), self.i_param)
    LL = zeros((3,Nq,4))
    for lab in labrange:
      for num in range(Nq):
        vx,vy = vL[lab,num]
        k,j = qL[num]
        LL[lab,num,:] = np.r_[k+vx*qq, j+vy*qq]
    for lab in range(3):
      ax.plot( LL[lab,:,:2].T, LL[lab,:,2:].T, dir_colors[lab], lw=3)
示例#2
0
 def plot_vps(self, ax, qopt):
     #############################################################
     ## Plot the vanishing point directions at various pixels. ax
     ## is a matplotlib axes, taken with "gca()". Spacing the
     ## separation bweteen the points, and myR the rotation matrix.
     Iheight, Iwidth = (480, 640)
     spacing = 50
     qq = spacing*0.45*np.array([-1,+1])
     bx = 0.+(Iwidth/2)%spacing
     by = 0.+(Iheight/2)%spacing
     qL = np.mgrid[bx:Iwidth:spacing,by:Iheight:spacing].T.reshape((-1,2))
     Nq = qL.shape[0]
     vL = corisco_aux.calculate_vdirs(qopt.q, np.array(qL, dtype=np.float32), self.i_param)
     LL = np.zeros((3,Nq,4))
     for lab in range(3):
         for num in range(Nq):
             vx,vy = vL[lab,num]
             k,j = qL[num]
             LL[lab,num,:] = np.r_[k+vx*qq, j+vy*qq]
     for lab in [2,1,0]:
         #ax.plot( LL[lab,:,:2].T, LL[lab,:,2:].T, dir_colors[lab], lw=3, alpha=1.0 if lab<2 else 0.3)
         ax.plot( LL[lab,:,:2].T, LL[lab,:,2:].T, dir_colors[lab], lw=3)