Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-005
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hasini Piumika Alwis
2021-005
Commits
c53e567c
Commit
c53e567c
authored
Nov 26, 2021
by
Hasini Piumika Alwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
component.ts
parent
967d2d2e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
Frontend/facial-expression.component.ts
Frontend/facial-expression.component.ts
+68
-0
No files found.
Frontend/facial-expression.component.ts
0 → 100644
View file @
c53e567c
import
{
Output
}
from
'
@angular/core
'
;
import
{
EventEmitter
}
from
'
@angular/core
'
;
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
ChartDataSets
,
ChartType
,
plugins
}
from
'
chart.js
'
;
import
{
Color
,
Label
}
from
'
ng2-charts
'
;
import
{
WebcamImage
,
WebcamInitError
,
WebcamUtil
}
from
'
ngx-webcam
'
;
import
{
Observable
,
Subject
}
from
'
rxjs
'
;
@
Component
({
selector
:
'
app-facial-expression
'
,
templateUrl
:
'
./facial-expression.component.html
'
,
styleUrls
:
[
'
./facial-expression.component.css
'
],
})
export
class
FacialExpressionComponent
implements
OnInit
{
@
Output
()
getPicture
=
new
EventEmitter
<
WebcamImage
>
();
showWebcam
=
true
;
isCameraExist
=
true
;
errors
:
WebcamInitError
[]
=
[];
// webcam snapshot trigger
private
trigger
:
Subject
<
void
>
=
new
Subject
<
void
>
();
private
nextWebcam
:
Subject
<
boolean
|
string
>
=
new
Subject
<
boolean
|
string
>
();
constructor
()
{
}
ngOnInit
():
void
{
WebcamUtil
.
getAvailableVideoInputs
()
.
then
((
mediaDevices
:
MediaDeviceInfo
[])
=>
{
this
.
isCameraExist
=
mediaDevices
&&
mediaDevices
.
length
>
0
;
});
}
takeSnapshot
():
void
{
this
.
trigger
.
next
();
}
onOffWebCame
()
{
this
.
showWebcam
=
!
this
.
showWebcam
;
}
handleInitError
(
error
:
WebcamInitError
)
{
this
.
errors
.
push
(
error
);
}
changeWebCame
(
directionOrDeviceId
:
boolean
|
string
)
{
this
.
nextWebcam
.
next
(
directionOrDeviceId
);
}
handleImage
(
webcamImage
:
WebcamImage
)
{
this
.
getPicture
.
emit
(
webcamImage
);
this
.
showWebcam
=
false
;
}
get
triggerObservable
():
Observable
<
void
>
{
return
this
.
trigger
.
asObservable
();
}
get
nextWebcamObservable
():
Observable
<
boolean
|
string
>
{
return
this
.
nextWebcam
.
asObservable
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment