OIIO Test
Posted gearslogy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OIIO Test相关的知识,希望对你有一定的参考价值。
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_()
以上是关于OIIO Test的主要内容,如果未能解决你的问题,请参考以下文章
[React Testing] Use Generated Data in Tests with tests-data-bot to Improve Test Maintainability(代码片段