发布于 2017-02-02 01:56:27
以下代码适用于一般的Python程序。我不确定用wit.ai做这件事是不是正确的方法。
如果你想对图像进行图像处理,我推荐使用OpenCV library。使用该库和easygui库,您可以提示用户输入图像、读取并显示图像。下面的代码显示了如何处理它。该对话框默认为文件夹"c:\“,并具有用于png和jpg文件的过滤器。您需要弄清楚如何在您的UI中显示图像。
import numpy as np
import cv2
import easygui
# Prompt the user to open a file.
file_path = easygui.fileopenbox(msg='Locate an image file',
filetypes=["*.png", "*.jpg"],
title='Specify the image file to upload',
default='c:\*.png')
# Load an image
img = cv2.imread(file_path)
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
https://stackoverflow.com/questions/41881648
复制相似问题