-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add compile, camera, api fetch axios and doc update
- Loading branch information
Showing
5 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// type command line | ||
export GOROOT=/usr/local/go | ||
export GOPATH=$HOME/go | ||
export PATH=$PATH:$GOROOT/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# pip install opencv-python | ||
import cv2 | ||
|
||
camera = cv2.VideoCapture(0) # use 0 for web camera | ||
# for cctv camera'rtsp://username:password@ip_address:554/user=username_password='password'_channel=channel_number_stream=0.sdp' | ||
def camera_stream(): | ||
while True: | ||
# Capture frame-by-frame | ||
success, frame = camera.read() | ||
if not success: | ||
break | ||
else: | ||
ret, buffer = cv2.imencode('.jpg', frame) # or return cv2.imencode('.jpg', frame)[1].tobytes() | ||
return buffer.tobytes() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pip install Cython | ||
from distutils.core import setup | ||
from distutils.extension import Extension | ||
from Cython.Distutils import build_ext | ||
from Cython.Build import cythonize | ||
|
||
|
||
ext_modules = [ | ||
Extension("test", ["test.py"]), | ||
] | ||
|
||
setup( | ||
name='Test Compile', | ||
cmdclass={'build_ext': build_ext}, | ||
ext_modules=cythonize(ext_modules, | ||
compiler_directives={'always_allow_keywords': True}, # 'always_allow_keywords' for avoid flask error | ||
) | ||
|
||
) | ||
# than call | ||
# add a main.py where flask app is call and run main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// for csrf use axios , build in function fetch for axios install axios | ||
const fetchTest = fetch("http://127.0.0.1:5000/api/v1/todos/") | ||
.then((data)=> data.json()); | ||
console.log(fetchTest); | ||
const axiosTest = axios({ | ||
method: 'get', | ||
url: 'http://127.0.0.1:5000/api/v1/todos/' | ||
}); | ||
console.log(axiosTest); |