Exemplo n.º 1
0
 def __init__(self, model, Qxx, paramBool, paramList, pathToData, xyzUnProjected):
     QtGui.QDialog.__init__(self)
     self.ui = Ui_ReportGCP()
     self.ui.setupUi(self)
     self.center()
     self.pathToData = pathToData
     self.xyzUnProjected = xyzUnProjected
     self.totalPointsOnHill = 0
     
     self.model = model
     rowCount = model.rowCount()
     errorsPixels = zeros((rowCount,1))
     errors3D = []
     n_outOfHorizon = 0
     for row in range(0,rowCount):
         if model.checkValid(row)==0:
              continue
         index = model.index(row, 6)
         error3D = model.data(index)
         if error3D > 0:
             errors3D.append(error3D)
         else:
             n_outOfHorizon += 1
         index = model.index(row,7)
         errorsPixels[row] = model.data(index)
     if len(errors3D)>0:
         text = ''
         text += 'Projections errors:'
         
         text += '\n   mean: ' + str(round(mean(errorsPixels),2)) + ' [pixel]'
         text += '\n   min: ' + str(min(errorsPixels)) + ' [pixel]'
         text += '\n   max: ' + str(max(errorsPixels)) + ' [pixel]'
         text += '\n   std: ' + str(round(std(errorsPixels),2)) + ' [pixel]'
         text += '\n\n3D reprojections errors:'
         text += '\n   mean: ' + str(round(mean(errors3D),2)) + ' [m]'
         text += '\n   min: ' + str(min(errors3D)) + ' [m]'
         text += '\n   max: ' + str(max(errors3D)) + ' [m]'
         text += '\n   std: ' + str(round(std(errors3D),2)) + ' [m]'
         """
         text += '\n' + str(round(mean(errorsPixels),2))
         text += '\n' + str(min(errorsPixels)) 
         text += '\n' + str(max(errorsPixels))
         text += '\n' + str(round(std(errorsPixels),2))
         text += '\n' + str(round(mean(errors3D),2))
         text += '\n' + str(min(errors3D))
         text += '\n' + str(max(errors3D))
         text += '\n' + str(round(std(errors3D),2)) 
         """
         text += '\n\nPose estimation parameters:'
         paramText = ['X position','Y Position','Z Position','Tilt [rad]','Heading [rad]', 'Swing [rad]', 'Focal [pixel]']
         for name, bool, value, prec in zip(paramText, paramBool, paramList, Qxx):
             if bool:
                 text += '\n'+ name + ', Free :' + ' ' + str(round(value,6)) + ' (Precision : '+ str(round(prec,6))  + ")"
             else:
                 text += '\n'+ name + ', Fixed: ' + ' ' + str(round(value,6))
             
         self.ui.reportBrowser.setText(text)
         self.ui.saveButton.pressed.connect(self.saveReport)
         test = self.isBehindHill(paramList,errors3D)
         if test:
             QMessageBox.warning(self, "Reprojection - Warning",
                     "%i GCP seems to be not visible from the camera location! The computed position could be behind relief or within the ground." % self.totalPointsOnHill)
     else: 
         QMessageBox.warning(self, "Reprojection - Warning",
                 "inconsistent pose, consider to provide apriori values")