[問題] 如何將透過post收到的影像直接做處理
大家好, 小妹python新手
目前遇到一些問題不知道該從何下手
希望各位大大可以不吝嗇提供一些方向
或是提供一些搜尋關鍵字等等
因為現在真的沒什麼頭緒
--------------------------------------
目前有一個簡易的flask server程式
就只是單純可以接收影像並把他儲存起來
內容如下
@app.route('/postImage', methods=['POST'])
def postImage():
if request.method == 'POST':
upload_file = request.files['file']
old_file_name = upload_file.filename
if upload_file:
file_path = os.path.join('./image/', old_file_name)
upload_file.save(file_path)
print('file saved to %s' % file_path)
result = imagePreProcess(file_path)
return result
else:
return 'error'
else:
return 'error'
現在想要先經過一些簡單的影像處理後再儲存
但目前能做到的前處理的function大概像這樣
def imagePreProcess(path):
img = plt.imread(str(path))
...
...
...
需要先把影像存起來再讀出來做二次處理
不知道有沒有方法可以省略先把影像儲存起來這個步驟
就是直接把post過來的影像upload_file直接放進imagePreProcess處理呢?
(目前使用的影像檔案是PNG類型)
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.227.181.167
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1549788622.A.8C2.html
→
02/10 17:13,
6年前
, 1F
02/10 17:13, 1F
→
02/10 17:14,
6年前
, 2F
02/10 17:14, 2F
→
02/10 17:14,
6年前
, 3F
02/10 17:14, 3F
→
02/10 17:51,
6年前
, 4F
02/10 17:51, 4F
→
02/10 17:52,
6年前
, 5F
02/10 17:52, 5F
推
02/11 02:13,
6年前
, 6F
02/11 02:13, 6F
Python 近期熱門文章
PTT數位生活區 即時熱門文章