def __showImage(self): ''' Shows image on graphics view ''' if self._img != None: self.__scene.clear() self.__scene.addPixmap(imageToPixmap(self._img)) self.__gview.fitInView(self.__scene.sceneRect(), Qt.KeepAspectRatio) self.__gview.show()
def _updateScene(self, gview, scene, img, convert=False, keepRatio=True): ''' Updates scene ''' img = copy(img) if img != None and scene != None and gview != None: # convert image to rgb if convert: img = cvtColor( img, COLOR_GRAY2RGB) # clear scene and add image pixmap scene.clear() scene.addPixmap( imageToPixmap(img) ) # fit image into scene if keepRatio: gview.fitInView( scene.sceneRect(), Qt.KeepAspectRatio ) else: gview.fitInView( scene.sceneRect() ) # show scene gview.show()
def _updateScene(self, gview, scene, img, convert=False, keepRatio=True): ''' Updates scene ''' img = copy(img) if img != None and scene != None and gview != None: # convert image to rgb if convert: img = cvtColor(img, COLOR_GRAY2RGB) # clear scene and add image pixmap scene.clear() scene.addPixmap(imageToPixmap(img)) # fit image into scene if keepRatio: gview.fitInView(scene.sceneRect(), Qt.KeepAspectRatio) else: gview.fitInView(scene.sceneRect()) # show scene gview.show()