Opencv & PyGi : how to display an image read by opencv
问题 I want to display an image in PyGi, the image is read first by opencv. But,it fails. from gi.repository import Gtk, GdkPixbuf import cv2 import numpy as np window = Gtk.Window() image = Gtk.Image() image.show() window.add(image) window.show_all() im = cv2.imread("file.bmp") a = np.ndarray.tostring(img) h, w, d = img.shape p = GdkPixbuf.Pixbuf.new_from_data(a,GdkPixbuf.Colorspace.RGB, False, 8, w, h, w*3, None, None) image.set_from_pixbuf(p) Gtk.main() But the result is a black image. Moreover