码迷,mamicode.com
首页 > 其他好文 > 详细

OIIO Test

时间:2020-01-01 18:59:48      阅读:61      评论:0      收藏:0      [点我收藏+]

标签:get   app   hid   ann   format   lap   %s   ati   nump   

Read OIIO->Qt QImage

 

技术图片
import sys,os
import OpenImageIO as oiio
from PySide2 import QtWidgets,QtCore,QtGui
import numpy as np



if __name__ == "__main__":
    img_input = oiio.ImageInput.open(timg.jpg)
    img_spec = img_input.spec()
    nchans = img_spec.nchannels # JPG is 3 / PNG is 4
    width = img_spec.width
    height = img_spec.height
    print("img width:%s,height:%s"%(width,height))
    #pixels = []
    pixels = img_input.read_image(oiio.UINT8)
    pixels = pixels.flatten()
    print(len(pixels) ) 
    print(width*height*nchans)


    app = QtWidgets.QApplication(sys.argv)
    qtimg = QtGui.QImage(pixels,width,height,QtGui.QImage.Format_RGB888)  # CREATGE QT IMAGE
    #qtimg.save(‘test.jpg‘)



    print(Create Pixmap)
    qtimg = QtGui.QPixmap.fromImage(qtimg)
    label = QtWidgets.QLabel()
    label.resize(500,500)
    label.setPixmap(qtimg)
    label.show()

    app.exec_()
View Code

 

OIIO Test

标签:get   app   hid   ann   format   lap   %s   ati   nump   

原文地址:https://www.cnblogs.com/gearslogy/p/12129234.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!