From 26aa35c4b92b780f4f76fcc9e773b0d5f3976815 Mon Sep 17 00:00:00 2001 From: ton Date: Sat, 18 Mar 2023 21:01:58 +0700 Subject: [PATCH] comment here --- src/interface.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/interface.jl b/src/interface.jl index 2bf5246..442de1e 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -27,7 +27,7 @@ vecToDict(vec::Vector{UInt8}) = copy(JSON3.read(String(vec))) # https://pyshine.com/Video-and-bidirectional-text-streaming/ using CondaPkg; CondaPkg.add_pip("pybase64"); CondaPkg.add_pip("opencv-python"); CondaPkg.add("jsons"); CondaPkg.add("numpy"); using PythonCall - cv = pyimport("cv2") + cv2 = pyimport("cv2") base64 = pyimport("pybase64") np = pyimport("numpy") @@ -39,10 +39,10 @@ vecToDict(vec::Vector{UInt8}) = copy(JSON3.read(String(vec))) webcam = cv2.VideoCapture(0) _, frame_1 = webcam.read() # julia's PythonCall python-obj numpy array - # frame_1 = cv.imread("20.jpg") + # cv2_bgr_img = cv2.imread("20.jpg") # compress image data formats in order to make network transfer easier. - _, buffer = cv.imencode(".jpg", frame_1) + _, buffer = cv2.imencode(".jpg", cv2_bgr_img) jpg_as_pyStr = base64.b64encode(buffer).decode("utf-8") jpg_as_juliaStr = pyconvert(String, jpg_as_pyStr) # for base64, python string or julia string is the same @@ -56,7 +56,7 @@ vecToDict(vec::Vector{UInt8}) = copy(JSON3.read(String(vec))) img_str = payload["img"] # payload received thru mqtt buf = base64.b64decode(img_str) buffer = np.frombuffer(buf, dtype=np.uint8) - frame_1 = cv.imdecode(buffer, 1) + frame_1 = cv2.imdecode(buffer, 1) frame_1_julia = pyconvert(Array, frame_1); img_julia_RGB = imageUtils.np2juliaImage(frame_1_julia)