Skip to content
Snippets Groups Projects
Commit 1e45c6c3 authored by wce's avatar wce
Browse files

update

parent b250ffd2
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,6 @@
<component name="ChangeListManager">
<list default="true" id="568b48a6-ca7f-4dc8-b0ca-a3d09f437fa9" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/app.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
......@@ -38,7 +37,7 @@
<recent name="D:\大三下\iot\作业\大作业\edge" />
</key>
</component>
<component name="RunManager" selected="Python.test (1)">
<component name="RunManager" selected="Python.app">
<configuration name="app" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="edge" />
<option name="INTERPRETER_OPTIONS" value="" />
......@@ -156,45 +155,53 @@
<option name="project" value="LOCAL" />
<updated>1656231388322</updated>
</task>
<option name="localTasksCounter" value="6" />
<task id="LOCAL-00006" summary="update">
<created>1656315889671</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1656315889671</updated>
</task>
<option name="localTasksCounter" value="7" />
<servers />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="修改了dockerfile" />
<MESSAGE value="修改了数据格式" />
<MESSAGE value="加入了camera请求" />
<option name="LAST_COMMIT_MESSAGE" value="加入了camera请求" />
<MESSAGE value="update" />
<option name="LAST_COMMIT_MESSAGE" value="update" />
</component>
<component name="WindowStateProjectService">
<state x="409" y="6" key="CommitChangelistDialog2" timestamp="1656315850091">
<state x="409" y="6" key="CommitChangelistDialog2" timestamp="1656318104200">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="409" y="6" key="CommitChangelistDialog2/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1656176204394" />
<state x="409" y="6" key="CommitChangelistDialog2/0.0.1536.824@0.0.1536.824" timestamp="1656315850091" />
<state x="409" y="6" key="CommitChangelistDialog2/0.0.1536.824@0.0.1536.824" timestamp="1656318104200" />
<state x="549" y="167" key="FileChooserDialogImpl" timestamp="1656170973860">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="549" y="167" key="FileChooserDialogImpl/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1656170973860" />
<state width="1515" height="288" key="GridCell.Tab.0.bottom" timestamp="1656315519219">
<state width="1515" height="288" key="GridCell.Tab.0.bottom" timestamp="1656318029522">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1515" height="259" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1656276357461" />
<state width="1515" height="288" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1656315519219" />
<state width="1515" height="288" key="GridCell.Tab.0.center" timestamp="1656315519219">
<state width="1515" height="288" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1656318029522" />
<state width="1515" height="288" key="GridCell.Tab.0.center" timestamp="1656318029522">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1515" height="259" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1656276357461" />
<state width="1515" height="288" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1656315519219" />
<state width="1515" height="288" key="GridCell.Tab.0.left" timestamp="1656315519218">
<state width="1515" height="288" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1656318029522" />
<state width="1515" height="288" key="GridCell.Tab.0.left" timestamp="1656318029522">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1515" height="259" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1656276357461" />
<state width="1515" height="288" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1656315519218" />
<state width="1515" height="288" key="GridCell.Tab.0.right" timestamp="1656315519219">
<state width="1515" height="288" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1656318029522" />
<state width="1515" height="288" key="GridCell.Tab.0.right" timestamp="1656318029522">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1515" height="259" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1656276357461" />
<state width="1515" height="288" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1656315519219" />
<state width="1515" height="288" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1656318029522" />
<state width="1515" height="261" key="GridCell.Tab.1.bottom" timestamp="1656276357457">
<screen x="0" y="0" width="1536" height="824" />
</state>
......@@ -224,6 +231,10 @@
</state>
<state x="449" y="236" key="com.intellij.ide.util.TipDialog/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1656255857724" />
<state x="449" y="236" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1656309609576" />
<state x="562" y="329" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1656318098623">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="562" y="329" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.1536.824@0.0.1536.824" timestamp="1656318098623" />
<state x="431" y="145" width="672" height="678" key="search.everywhere.popup" timestamp="1656270090002">
<screen x="0" y="0" width="1536" height="824" />
</state>
......
......@@ -5,7 +5,7 @@ import json
import base64
import oss2
import os
import cv2
# import cv2
import numpy as np
app = Flask(__name__)
......@@ -42,16 +42,16 @@ def connect_mqtt():
client = connect_mqtt()
def base64_2_image(base64_encode):
base64_encode2 = base64_encode[2:-1] # 解码步骤从此处开始
base64_decode = base64.b64decode(base64_encode2) # base64解码
img_array = np.frombuffer(base64_decode, np.uint8) # 转化成np数组
img_decode = cv2.imdecode(img_array, cv2.IMREAD_COLOR) # cv2解码,转换成opencv可用格式
# 以下为cv2展示及保存操作
cv2.imshow("img", img_decode) # 展示
cv2.waitKey(1000) # 设置展示时长
cv2.imwrite("test/image1.png", img_decode) # 保存,第一个参数为文件名(包含相对路径),注意点:1. 一定要有拓展名,如磁此例中的'.png'。
# 2. 路径不能包含中文。3. 文件夹要先创建好,如此例中test文件夹。
# def base64_2_image(base64_encode):
# base64_encode2 = base64_encode[2:-1] # 解码步骤从此处开始
# base64_decode = base64.b64decode(base64_encode2) # base64解码
# img_array = np.frombuffer(base64_decode, np.uint8) # 转化成np数组
# img_decode = cv2.imdecode(img_array, cv2.IMREAD_COLOR) # cv2解码,转换成opencv可用格式
# # 以下为cv2展示及保存操作
# cv2.imshow("img", img_decode) # 展示
# cv2.waitKey(1000) # 设置展示时长
# cv2.imwrite("test/image1.png", img_decode) # 保存,第一个参数为文件名(包含相对路径),注意点:1. 一定要有拓展名,如磁此例中的'.png'。
# # 2. 路径不能包含中文。3. 文件夹要先创建好,如此例中test文件夹。
@app.route("/doorStatus", methods=["GET"])
......@@ -82,10 +82,18 @@ def cameraUpdate():
data = request.json
nameList = data['nameList']
status = client.publish("incoming/data/camera/nameList", str(nameList))
imageUrl = data['imageUrl']
status = client.publish("incoming/data/camera/imageUrl", str(imageUrl))
base64_encode = data['base64']
base64_2_image(base64_encode)
return '{"code":200}'
@app.route("/getImageUrl",methods=["GET"])
def getImageUrl():
res = requests.get(url="http://114.116.217.108:59882/api/v2/device/name/camera/imageUrl")
imageUrl = json.loads(res.text)['event']['readings'][0]['value']
Data = '{"url":"'+str(imageUrl)+'"}'
return Data
app.run(host="0.0.0.0", port=7001)
Flask==2.1.2
numpy==1.19.5
opencv_python==4.6.0.66
oss2==2.15.0
paho_mqtt==1.6.1
requests==2.25.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment