I am generating images using matplotlib and opencv. I would like to put the edges image directly in Blender's image editor instead of having to save it to a file. I am planning to add a slider input for the threshold parameters, to allow me to see how the image changes with different values. If is saves a new image and loads it into the image editor every time I change a parameter, I would create a large number of images in the image editor very quickly. Is it possible to load the image directly into the Image Editor without saving it to a file?

Here is my current code:

import cv2
filename = r"C:\Users\xxx\Documents\IMG_3293.jpg"
outfile = r"C:\Users\xxx\Documents\edges.png"
img = cv2.imread(filename)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img_blur = cv2.GaussianBlur(img_gray, (3,3), 0)
edges = cv2.Canny(image=img_blur, threshold1 = 50, threshold2 = 150)
result_img = bpy.data.images.get("edges.png")



You must log in to answer this question.

Browse other questions tagged .