• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python qimage2ndarray.array2qimage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中qimage2ndarray.array2qimage函数的典型用法代码示例。如果您正苦于以下问题:Python array2qimage函数的具体用法?Python array2qimage怎么用?Python array2qimage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了array2qimage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: grabImage

    def grabImage(self):
        xSlice = slice(660, 1250)
        ySlice = slice(225, 825)

        ret, img_org = self.cam.read()
        img = np.rot90(img_org[ySlice, xSlice], 2)

        if self.circle:
            try:
                qi = qim2np.array2qimage(self.draw_circle(img))
            except IndexError:
                qi = qim2np.array2qimage(img)
        else:
            qi = qim2np.array2qimage(img)


        pixmap = QtGui.QPixmap()
        px = QtGui.QPixmap.fromImage(qi)

        if self.bgImg:
            self.ui.gv_preview.scene().removeItem(self.bgImg)

        self.bgImg = QtGui.QGraphicsPixmapItem(px)
        self.ui.gv_preview.scene().addItem(self.bgImg)
        self.bgImg.setZValue(-100)
        self.bgImg.setPos(0, 0)

        self.ui.gv_preview.ensureVisible(self.bgImg)
        self.ui.gv_preview.fitInView(self.ui.gv_preview.scene().itemsBoundingRect())

        return img
开发者ID:groakat,项目名称:webcamSeriesCapture,代码行数:31,代码来源:acquisition.py


示例2: addTestImage

    def addTestImage(self, color_image):
        self.ocr_areas = OCRAreasFinder(color_image, self.settings["contrast"])
        self.market_width = self.ocr_areas.market_width
        self.valid_market = self.ocr_areas.valid
        if self.settings['gray_preview']:
            img = cv2.imread(unicode(self.hiddentext).encode(sys.getfilesystemencoding()), 0)
            img = array2qimage(img)
            pix = QPixmap.fromImage(img)
        else:
            pix = QPixmap(self.hiddentext)
        width = pix.width()
        height = pix.height()
        if height > 0:
            aspect_ratio = float(width)/height
            if aspect_ratio > 1.78:
                new_w = int(1.77778*height)
                rect = QRect((width-new_w)/2, 0, new_w, height)
                pix = pix.copy(rect)
            
        if self.valid_market:
            points = self.ocr_areas.market_table
            self.market_offset = (points[0][0], points[0][1])
            station = self.ocr_areas.station_name
            self.station_offset = (station[0][0], station[0][1])
            rect = QRect(0, 0, points[1][0] + 20, points[1][1] + 20)
            cut = pix.copy(rect)
            return cut
        else:
            self.market_offset = (0, 0)
            self.station_offset = (0, 0)

        return pix
开发者ID:Marginal,项目名称:EliteOCR,代码行数:32,代码来源:customqlistwidgetitem.py


示例3: addPreviewImage

 def addPreviewImage(self, color_image, parent = None):
     image = color_image
     image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
     if not parent is None:
         parent.progress_bar.setValue(12)
     h, w = image.shape
     self.img_height = h
     self.ocr_areas = OCRAreasFinder(color_image, self.settings["contrast"])
     self.market_width = self.ocr_areas.market_width
     if not parent is None:
         parent.progress_bar.setValue(14)
     
     self.valid_market = self.ocr_areas.valid
     if self.valid_market:
         points = self.ocr_areas.market_table
         self.market_offset = (points[0][0], points[0][1])
         station = self.ocr_areas.station_name
         self.station_offset = (station[0][0], station[0][1])
         cut = image[0:points[1][1] + 20,
                     0:points[1][0] + 20]
     else:
         cut = image[:]
         self.market_offset = (0, 0)
         self.station_offset = (0, 0)
         
     processedimage = array2qimage(cut)
     if not parent is None:
         parent.progress_bar.setValue(16)
     pix = QPixmap()
     pix.convertFromImage(processedimage)
     if not parent is None:
         parent.progress_bar.setValue(18)
     return pix
开发者ID:Marginal,项目名称:EliteOCR,代码行数:33,代码来源:customqlistwidgetitem.py


示例4: loadDatum

    def loadDatum(self, key):
        img = QtGui.QImage()
        img.load(key)

        rawImg = QI2A.recarray_view(img)

        background = np.zeros((rawImg.shape[0], rawImg.shape[1], 4),
                              dtype=rawImg['r'].dtype)

        background[:,:,0] = rawImg['r']
        background[:,:,1] = rawImg['g']
        background[:,:,2] = rawImg['b']
        background[:,:,3] = rawImg['a']

        # crop and rotate background image to show only one vial
        rng = slice(*self.vialROI)
        background = np.rot90(background[:, rng]).astype(np.uint32)

        h = background.shape[0]
        w = background.shape[1]

        # grey conversion
        b = background[:,:,0] * 0.2126 + \
            background[:,:,1] * 0.7152 + \
            background[:,:,2] * 0.0722
        background[:,:,0] = b
        background[:,:,1] = b
        background[:,:,2] = b

        im = QI2A.array2qimage(background)
        im = im.convertToFormat(QtGui.QImage.Format_RGB32)

        return im
开发者ID:groakat,项目名称:videotagger,代码行数:33,代码来源:Cache.py


示例5: addPreviewImage

 def addPreviewImage(self, color_image, parent = None):
     image = color_image
     image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
     if not parent is None:
         parent.progress_bar.setValue(12)
     h, w = image.shape
     self.img_height = h
     self.ocr_areas = OCRAreasFinder(color_image)
     self.market_width = self.ocr_areas.market_width
     self.hud_color = self.ocr_areas.hud_color
     if not parent is None:
         parent.progress_bar.setValue(14)
     points = self.ocr_areas.market_table
     self.valid_market = self.ocr_areas.valid
     if self.valid_market:
         cut = image[0:points[1][1] + 20,
                     0:points[1][0] + 20]
     else:
         cut = image[:]
     processedimage = array2qimage(cut)
     if not parent is None:
         parent.progress_bar.setValue(16)
     pix = QPixmap()
     pix.convertFromImage(processedimage)
     if not parent is None:
         parent.progress_bar.setValue(18)
     return pix
开发者ID:DEBoshir,项目名称:EliteOCR,代码行数:27,代码来源:customqlistwidgetitem.py


示例6: showFrame

 def showFrame(self, i=None):
     """ Display the i^th frame in the viewer.
     Also update the frame slider position and current frame text.
     """
     frame = self.getFrame(i)
     if frame is None:
         return
     # Convert frame ndarray to a QImage.
     qimage = qimage2ndarray.array2qimage(frame, normalize=True)
     self.viewer.setImage(qimage)
     self.currentFrameIndex = i
     # Update frame slider position (hide frame slider if we only have one image frame).
     numFrames = self.numFrames()
     if numFrames > 1:
         self.frameSlider.setRange(1, numFrames)
         self.frameSlider.setValue(i)
         self.frameSlider.show()
         self.prevFrameButton.show()
         self.nextFrameButton.show()
         self.currentFrameLabel.setText(str(i+1) + "/" + str(numFrames))
         self.currentFrameLabel.show()
     else:
         self.frameSlider.hide()
         self.prevFrameButton.hide()
         self.nextFrameButton.hide()
         self.currentFrameLabel.hide()
     self.frameChanged.emit()
     self.frameChanged[int].emit(i)
开发者ID:marcel-goldschen-ohm,项目名称:MultiPageTIFFViewerPyQt,代码行数:28,代码来源:MultiPageTIFFViewerQt.py


示例7: convert_bitmap

def convert_bitmap(image, width=0, height=0):
    if isinstance(image, ImageResource):
        pix = traitsui_convert_bitmap(image)
    elif isinstance(image, (PILImage.Image,)):
        try:
            data = image.tostring('raw', 'RGBA')
        except NotImplementedError:
            data = image.tobytes('raw', 'RGBA')
        im = QImage(data, image.size[0], image.size[1], QImage.Format_ARGB32)
        pix = QPixmap.fromImage(QImage.rgbSwapped(im))
    else:
        s = image.shape
        if len(s) >= 2:
            pix = QPixmap.fromImage(array2qimage(image))
        else:
            pix = QPixmap()

    if pix:
        if width > 0 and height > 0:
            pix = pix.scaled(width, height)
        elif width > 0:
            pix = pix.scaledToWidth(width)
        if height > 0:
            pix = pix.scaledToHeight(height)

    return pix
开发者ID:NMGRL,项目名称:pychron,代码行数:26,代码来源:image_editor.py


示例8: _setImage

 def _setImage(self, image, normalize):
     self.image = image
     if hasattr(image, 'qimage'):
         qImage = image.qimage(normalize)
     else:
         qImage = qimage2ndarray.array2qimage(image, normalize)
     self.viewer.setImage(qImage)
开发者ID:hmeine,项目名称:geomap,代码行数:7,代码来源:mapdisplay.py


示例9: drawStationName

 def drawStationName(self):
     """Draw station name snippet to station_name_img"""
     res = self.current_result
     name = res.station.name
     #self.station_name.setText('')
     #self.station_name.clear()
     #self.station_name.addItems(name.optional_values)
     if not self.file_list.currentItem().station is None:
             self.station_name.setText(self.file_list.currentItem().station)
     else:
         self.station_name.setText(name.value)
     #font = QFont("Consolas", 11)
     #self.station_name.lineEdit().setFont(font)
     #self.setConfidenceColor(self.station_name, name)
     img = self.cutImage(res.contrast_station_img, name)
     if self.dark_theme: 
         img = 255 - img
     processedimage = array2qimage(img)
     pix = QPixmap()
     pix.convertFromImage(processedimage)
     if self.station_name_img.height() < pix.height():
         pix = pix.scaled(self.station_name_img.size(),
                          Qt.KeepAspectRatio,
                          Qt.SmoothTransformation)
     scene = QGraphicsScene()
     scene.addPixmap(pix)
     
     self.station_name_img.setScene(scene)
     self.station_name_img.show()
开发者ID:DEBoshir,项目名称:EliteOCR,代码行数:29,代码来源:EliteOCRcmd.py


示例10: wait

 def wait( self ):
     for i, req in enumerate(self._requests):
         a = self._requests[i].wait()
         a = a.squeeze()
         self._data[:,:,i] = a
     img = array2qimage(self._data)
     return img.convertToFormat(QImage.Format_ARGB32_Premultiplied)        
开发者ID:lcroitor,项目名称:volumeeditor,代码行数:7,代码来源:imagesources.py


示例11: updateLabelWithSpectrogram

 def updateLabelWithSpectrogram(self, spec):
     # clrSpec = np.uint8(plt.cm.binary(spec / np.max(spec)) * 255)#To change color, alter plt.cm.jet to plt.cm.#alternative code#
     clrSpec = np.uint8(self.cm(spec / 18.0) * 255)#To change color, alter plt.cm.jet to plt.cm.#alternative code#
     clrSpec = np.rot90(clrSpec, 1)
     # clrSpec = spmisc.imresize(clrSpec, 0.25)
     qi = qim2np.array2qimage(clrSpec)#converting from numpy array to qt image
     self.setBackgroundImage(qi)
开发者ID:groakat,项目名称:AudioTagger,代码行数:7,代码来源:audioTagger.py


示例12: SetImage

 def SetImage(self, data):
     import qimage2ndarray
     image = qimage2ndarray.array2qimage(data)
     pixmap = QtGui.QPixmap(image)
     scene = QtGui.QGraphicsScene()
     scene.addPixmap(pixmap)
     self.ui.graphicsView.setScene(scene)
开发者ID:giuseppecalderaro,项目名称:python-hacks,代码行数:7,代码来源:main.py


示例13: from_numpy

    def from_numpy(self, data):

        self._qimage = array2qimage(data)
        # safe the data for garbage collection
        # do I really need this??
        self._qimage.ndarray = data
        self._update()
开发者ID:bobi5rova,项目名称:cecog,代码行数:7,代码来源:imageviewer.py


示例14: changeindexcombo5

    def changeindexcombo5(self):
        """méthode exécutée en cas de changement d'affichage du combo5
        """
        #self.combo5.clear()#surtout pas!!
        #quel le parent?
        #recup l'item actif de combo4
        print "combo5 cur Index",self.combo5.currentIndex()
        #identifier le node correspondant4
        ## suppossons que ce soit==self.combo1.currentIndex()
        ##parent est un etree.Element, son nom devrait être l'item courant de combo1
        #parent=self.node5[self.combo5.currentIndex()]
        #demander ses enfants,
        ##demander le nom des enfants
#        childrenlist=self.GetChildrenName(parent)
#        print "from changeindex combo5",childrenlist
#        self.combo5.addItems(QtCore.QStringList(childrenlist))
        pathto=os.path.join(str(self.combo1.currentText()),\
                            str(self.combo2.currentText()),\
                            str(self.combo3.currentText()),\
                            str(self.combo4.currentText()),\
                            str(self.combo5.currentText()))
        self.lbl.setText(str(pathto))
        workdir="/home/simon/MFISH/"
        ndimage=imread.imread(workdir+str(pathto))
        convert=qnd.array2qimage(ndimage[::2,::2],normalize=True)
        qpix = QtGui.QPixmap(convert)
        image = QtGui.QLabel(self)
        image.setPixmap(qpix)
        #posit = QtGui.QGridLayout()
        self.posit.addWidget(image, 2, 0)
        self.setLayout(self.posit)
        self.setWindowTitle('Cascade Menus')
        self.show()
开发者ID:jeanpat,项目名称:pyFISH,代码行数:33,代码来源:FlyFISH_002.py


示例15: changeindexcombo4

 def changeindexcombo4(self):
     """méthode exécutée en cas de changement d'affichage du combo4
     """
     self.combo5.clear()
     print "combo4 cur Index",self.combo4.currentIndex()
     self.node4=self.node3[self.combo3.currentIndex()].getchildren()
     parent=self.node4[self.combo4.currentIndex()]
     #demander ses enfants,
     ##demander le nom des enfants
     childrenlist=self.GetChildrenName(parent)
     self.combo5.addItems(QtCore.QStringList(childrenlist))
     pathto=os.path.join(str(self.combo1.currentText()),\
                         str(self.combo2.currentText()),\
                         str(self.combo3.currentText()),\
                         str(self.combo4.currentText()),\
                         str(self.combo5.currentText()))
     self.lbl.setText(str(pathto))
     workdir="/home/simon/MFISH/"
     ndimage=imread.imread(workdir+str(pathto))
     convert=qnd.array2qimage(ndimage[::2,::2],normalize=True)
     qpix = QtGui.QPixmap(convert)
     image = QtGui.QLabel(self)
     image.setPixmap(qpix)
     #posit = QtGui.QGridLayout()
     self.posit.addWidget(image, 2, 0)
     self.setLayout(self.posit)
     self.setWindowTitle('Cascade Menus')
     self.show()
开发者ID:jeanpat,项目名称:pyFISH,代码行数:28,代码来源:FlyFISH_002.py


示例16: paintEvent

 def paintEvent(self, event):
     paint = QtGui.QPainter()
     paint.begin(self)
     paint.setPen(QtGui.QColor(168, 34, 3))
     paint.setFont(QtGui.QFont('Decorative', 10))
     paint.drawText(event.rect(), QtCore.Qt.AlignCenter, self.text)
     paint.drawImage(0,0,array2qimage(self.model.dat_s, True))
     paint.end()
开发者ID:lordi,项目名称:dantien,代码行数:8,代码来源:qtdantien.py


示例17: imshow

def imshow(arr):
    if not isinstance(arr,vigra.VigraArray):
        arr = arr.swapaxes(0,1).view(numpy.ndarray)
    im = qimage2ndarray.array2qimage(arr)
    d = QtGui.QDialog()
    l = QtGui.QLabel(d)
    l.setPixmap(QtGui.QPixmap.fromImage(im))
    d.resize(l.sizeHint())
    d.exec_()
开发者ID:LimpingTwerp,项目名称:lazyflow,代码行数:9,代码来源:imshow.py


示例18: toImage

 def toImage( self ):
     a = self._arrayreq.getResult()
     shape = a.shape + (4,)
     d = np.empty(shape, dtype=np.uint8)
     d[:,:,0] = a[:,:]*self._tintColor.redF()
     d[:,:,1] = a[:,:]*self._tintColor.greenF()
     d[:,:,2] = a[:,:]*self._tintColor.blueF()
     d[:,:,3] = a[:,:]
     img = array2qimage(d, self._normalize)
     return img.convertToFormat(QImage.Format_ARGB32_Premultiplied)        
开发者ID:LimpingTwerp,项目名称:volumina,代码行数:10,代码来源:imagesources.py


示例19: drawSnippet

 def drawSnippet(self, graphicsview, snippet):
     """Draw single result item to graphicsview"""
     processedimage = array2qimage(snippet)
     pix = QPixmap()
     pix.convertFromImage(processedimage)
     pix = pix.scaled(graphicsview.width(), graphicsview.height()-1, Qt.KeepAspectRatio, Qt.SmoothTransformation)
     scene = QGraphicsScene()
     scene.addPixmap(pix)
     graphicsview.setScene(scene)
     graphicsview.show()
开发者ID:specialsymbol,项目名称:EliteOCR,代码行数:10,代码来源:learningwizard.py


示例20: CompletedJulia

 def CompletedJulia(self, data):
     import qimage2ndarray
     elapsed = self.time.elapsed()
     if elapsed > 1000000:
         self.ui.labelTime.setText("Time: %ds" % (self.time.elapsed() / 1000))
     else:
         self.ui.labelTime.setText("Time: %dms" % self.time.elapsed())
     self.ui.progressBar.setHidden(True)
     self.image = qimage2ndarray.array2qimage(data)
     self.SetImage(self.image)
开发者ID:giuseppecalderaro,项目名称:python-hacks,代码行数:10,代码来源:main.py



注:本文中的qimage2ndarray.array2qimage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python qimage2ndarray.byte_view函数代码示例发布时间:2022-05-26
下一篇:
Python ebi.EBISubmission类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap