Toggle navigation
Toggle navigation
This project
Loading...
Sign in
공태현
/
healthcare-with-webcam
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
공태현
2022-06-08 02:57:24 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d01df7e3be6a5dcd501cedc2070987c0f5da879f
d01df7e3
1 parent
7561630b
Update count-save
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
5 deletions
server.js
views/squatPage/squat.html
views/squatPage/squat.js
로그인회원가입기능/healthcare-with-webcam
server.js
View file @
d01df7e
...
...
@@ -47,7 +47,39 @@ app.get('/', (req,res) => {
})
// 음성 소리 파일 전송
app
.
get
(
'/sound/0.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/0.wav'
)
})
app
.
get
(
'/sound/1.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/1.wav'
)
})
app
.
get
(
'/sound/2.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/2.wav'
)
})
app
.
get
(
'/sound/3.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/3.wav'
)
})
app
.
get
(
'/sound/4.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/4.wav'
)
})
app
.
get
(
'/sound/5.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/5.wav'
)
})
app
.
get
(
'/sound/6.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/6.wav'
)
})
app
.
get
(
'/sound/7.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/7.wav'
)
})
app
.
get
(
'/sound/8.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/8.wav'
)
})
app
.
get
(
'/sound/9.wav'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/9.wav'
)
})
app
.
get
(
'/sound/bad.mp3'
,
(
req
,
res
)
=>
{
res
.
sendFile
(
__dirname
+
'/views/squatPage/sound/bad.mp3'
)
})
...
...
@@ -175,6 +207,13 @@ app.get('/api/users/logout', (req,res) => {
})
app
.
get
(
'/api/users/name'
,
(
req
,
res
)
=>
{
return
res
.
json
({
user
:
req
.
session
.
user
})
})
// 스쿼트 갯수 업데이트 API
app
.
post
(
'/api/users/countupdate'
,
(
req
,
res
)
=>
{
var
userName
=
req
.
body
.
name
...
...
views/squatPage/squat.html
View file @
d01df7e
...
...
@@ -6,12 +6,15 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
rel=
"stylesheet"
href=
"squat.css"
>
<title>
Squat Page
</title>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
></script>
</head>
<body
bgcolor=
"#353535"
>
<div
id=
"title"
class=
"Title"
>
Squat Page
<center>
<button
class=
"w-btn w-btn-indigo"
type=
"button"
onclick=
"init()"
>
WEBCAM START
</button>
<button
id =
"savecount"
class=
"w-btn w-btn-indigo"
type=
"button"
onclick=
""
>
스쿼트 횟수 저장
</button>
<div>
<canvas
id=
"canvas"
></canvas>
<iframe
...
...
@@ -28,6 +31,7 @@
</center>
</div>
<div
id=
"label-container"
class=
"label-container"
></div>
<script
src=
"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.3.1/dist/tf.min.js"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/@teachablemachine/pose@0.8/dist/teachablemachine-pose.min.js"
></script>
<script
src=
"./squat.js"
></script>
...
...
views/squatPage/squat.js
View file @
d01df7e
// More API functions here:
// https://github.com/googlecreativelab/teachablemachine-community/tree/master/libraries/pose
// the link to your model provided by Teachable Machine export panel
const
URL
=
"https://teachablemachine.withgoogle.com/models/xymjZj4q-/"
;
// 임시 URI - stand , squart, bent(허리 굽은 자세) 학습.
let
model
,
webcam
,
ctx
,
labelContainer
,
maxPredictions
;
// 상태 : 서있는 상태로 초기화
let
status
=
"stand"
;
// 갯수 count
let
count
=
0
;
var
counter
=
document
.
getElementById
(
"counter"
);
...
...
@@ -99,4 +99,52 @@ function drawPose(pose) {
tmPose
.
drawSkeleton
(
pose
.
keypoints
,
minPartConfidence
,
ctx
);
}
}
}
\ No newline at end of file
}
// 사용자 정보 API
let
userName
=
0
$
.
get
(
'/api/users/name'
,
function
(
data
)
{
userName
=
data
.
user
.
user_name
console
.
log
(
data
.
user
.
user_name
)
})
$
(
document
).
ready
(
function
(){
$
(
'#savecount'
).
click
(
function
(){
$
.
ajax
({
contentType
:
"application/json; charset=utf-8"
,
type
:
'get'
,
url
:
'/api/users/name'
,
dataType
:
'JSON'
,
success
:
function
(
datas
)
{
let
user_name
=
datas
.
user_name
$
.
ajax
({
contentType
:
"application/json; charset=utf-8"
,
type
:
'post'
,
url
:
'/api/users/countupdate'
,
dataType
:
'JSON'
,
data
:
JSON
.
stringify
({
"name"
:
userName
,
"count"
:
count
}),
success
:
function
(
datas
)
{
if
(
datas
.
success
)
{
alert
(
"저장 성공 !"
)
}
}
})
}
})
})
})
...
...
healthcare-with-webcam
@
381096f7
Subproject commit 381096f776f0756063d2f9e77ceaca7d5fc7fcdc
Please
register
or
login
to post a comment