Python + OpenCV + tkinter Image Import Problems

Recently there have been two problems with tkinter when writing small image software, import pictures found.

① When OpenCV read the image, the default channel is BGR format, and the format is now mainstream channel RGB format, tkinter is also true.

Before treatment:
Here Insert Picture Description

dst=cv.cvtColor(resize_image,cv.COLOR_BGR2RGB)

After treatment:
Here Insert Picture Description

Mainly due to reading problems in OpenCV imread, you can also use tkinter read picture.

②tkinter pictures is not the form of a matrix. So deal with it particularly troublesome, so in advance to deal with OpenCV, and then by function into tkinter format, and then displayed in the GUI.

new_image=Image.fromarray(dst)
Released three original articles · won praise 0 · Views 127

Guess you like

Origin blog.csdn.net/weixin_45645281/article/details/104263473