Yoonit-Labs / Nativescript Yoonit Camera
Licence: mit
The most advanced and modern NativeScript Camera module for Android and iOS with a lot of awesome features
Stars: ✭ 69
Programming Languages
typescript
32286 projects
Projects that are alternatives of or similar to Nativescript Yoonit Camera
Spherelayout
a layout which supports 3d rotate and enable its childview has z-depth for android
Stars: ✭ 55 (-20.29%)
Mutual labels: camera
Cameramanager
Simple Swift class to provide all the configurations you need to create custom camera view in your app
Stars: ✭ 1,130 (+1537.68%)
Mutual labels: camera
Onvifcamera
Pod and example on how to connect to an ONVIF camera
Stars: ✭ 66 (-4.35%)
Mutual labels: camera
Opengl4android
OpenGL运用在Android上的Demo,结合Camera和MediaCodec实现预览和渲染,用于实现视频的裁剪,翻转,缩放,滤镜功能。
Stars: ✭ 56 (-18.84%)
Mutual labels: camera
App Media
Elements for accessing data from media input devices and visualizing that data for users
Stars: ✭ 60 (-13.04%)
Mutual labels: camera
Node Blink Security
This is an npm module for communicating with Blink Home Security System
Stars: ✭ 54 (-21.74%)
Mutual labels: camera
Kontax Cam
Instant camera hybrid with multiple effects and filters written in Swift.
Stars: ✭ 69 (+0%)
Mutual labels: camera
Nativescript Keyboard Toolbar
⌨️🛠Add a customizable toolbar on top of the soft keyboard
Stars: ✭ 66 (-4.35%)
Mutual labels: nativescript
Camerabackground
Show camera layer as a background to any UIView
Stars: ✭ 57 (-17.39%)
Mutual labels: camera
Testcoreml
A camera object recognition demo using the CoreML & AVCam framework. Required XCode 9 & iOS 11.
Stars: ✭ 60 (-13.04%)
Mutual labels: camera
Nativescript Admob
NativeScript plugin to earn some precious 💰💰 with ads by Google AdMob
Stars: ✭ 64 (-7.25%)
Mutual labels: nativescript
Mtbbarcodescanner
A lightweight, easy-to-use barcode scanning library for iOS 8+
Stars: ✭ 1,085 (+1472.46%)
Mutual labels: camera
Esp32 Ov7670 Hacking
Based on https://github.com/igrr/esp32-cam-demo extended with an ILI9341 display, with a Telnet interface to change OV7670 settings on the fly. Streams BMP files from RGB565 and YUV422 (encoded to RGB565) picture formats. Compile with latest esp-idf. Check out new telnet command "video 1" to auto capture to LCD as fast as possible for videocam mode, "video 0" to stop or "video Z" where Z is delay in ms between each capture / LCD refresh.
Stars: ✭ 55 (-20.29%)
Mutual labels: camera
Sitting Posture Recognition
Detects the sitting position of a person
Stars: ✭ 64 (-7.25%)
Mutual labels: camera
Nativescript Dev Appium
A package to help with writing and executing e2e Appium tests in NativeScript apps
Stars: ✭ 69 (+0%)
Mutual labels: nativescript
Picker
Picker - A CameraX based WhatsApp Style Image-Video Picker
Stars: ✭ 69 (+0%)
Mutual labels: camera
Nativescript Ionic Template
📱 🖥 Create Mobile First apps, Web and Native sharing the code with Angular 🎉
Stars: ✭ 65 (-5.8%)
Mutual labels: nativescript
NativeScript Yoonit Camera
A NativeScript plugin to provide:
- Modern Android Camera API Camera X
- Camera preview (Front & Back)
- Google MLKit integration
- PyTorch integration (Soon)
- Computer vision pipeline
- Face detection, capture and image crop
- Understanding of the human face (Soon)
- Frame capture
- Capture timed images
- QR Code scanning
Table Of Contents
Installation
npm i -s @yoonit/nativescript-camera
Usage
All the functionalities that the @yoonit/nativescript-camera
provides is accessed through the YoonitCamera
component, that includes the camera preview. Below we have the basic usage code, for more details, your can see the Methods, Events or the Demo Vue.
VueJS Plugin
main.js
import Vue from 'nativescript-vue'
import YoonitCamera from '@yoonit/nativescript-camera/vue'
Vue.use(YoonitCamera)
After that, you can access the camera object in your entire project using this.$yoo.camera
Vue Component
App.vue
<template>
<Page @loaded="onLoaded">
<YoonitCamera
ref="yooCamera"
initialLens="front"
captureType="face"
numberOfImages=10
timeBetweenImages=500
saveImageCaptured=true
faceDetectionBox=true
@faceDetected="doFaceDetected"
@imageCaptured="doImageCaptured"
@endCapture="doEndCapture"
@qrCodeContent="doQRCodeContent"
@status="doStatus"
@permissionDenied="doPermissionDenied"
/>
</Page>
</template>
<script>
export default {
data: () => ({}),
methods: {
async onLoaded() {
console.log('[YooCamera] Getting Camera view')
this.$yoo.camera.registerElement(this.$refs.yooCamera)
console.log('[YooCamera] Getting permission')
if (await this.$yoo.camera.requestPermission()) {
console.log('[YooCamera] Permission granted, start preview')
this.$yoo.camera.preview()
}
},
doFaceDetected({ x, y, width, height }) {
console.log('[YooCamera] doFaceDetected', `{x: ${x}, y: ${y}, width: ${width}, height: ${height}}`)
if (!x || !y || !width || !height) {
this.imagePath = null
}
},
doImageCaptured({
type,
count,
total,
image: {
path,
source
}
}) {
if (total === 0) {
console.log('[YooCamera] doImageCreated', `${type}: [${count}] ${path}`)
this.imageCreated = `${count}`
} else {
console.log('[YooCamera] doImageCreated', `${type}: [${count}] of [${total}] - ${path}`)
this.imageCreated = `${count} de ${total}`
}
this.imagePath = source
},
doEndCapture() {
console.log('[YooCamera] doEndCapture')
},
doQRCodeContent({ content }) {
console.log('[YooCamera] doQRCodeContent', content)
},
doStatus({ status }) {
console.log('[YooCamera] doStatus', status)
},
doPermissionDenied() {
console.log('[YooCamera] doPermissionDenied')
}
}
}
</script>
API
Props
Props | Input/Format | Default value | Description |
---|---|---|---|
lens |
"front" or "back"
|
"front" |
The camera lens to use "front" or "back". |
captureType |
"none" , "front" , "frame" or "qrcode"
|
"none" |
The capture type of the camera. |
imageCapture | boolean |
false |
Enable/disabled save image capture. |
imageCaptureAmount | number |
0 |
The image capture amount goal. |
imageCaptureInterval | number |
1000 |
The image capture time interval in milliseconds. |
imageCaptureWidth | "NNpx" |
"200px" |
The image capture width in pixels. |
imageCaptureHeight | "NNpx" |
"200px" |
The image capture height in pixels. |
colorEncoding |
"RGB" or "YUV"
|
"RGB" |
Only for android. The image capture color encoding type: "RGB" or "YUV" . |
faceDetectionBox | boolean |
false |
Show/hide the face detection box. |
faceMinSize | "NN%" |
"0%" |
The face minimum size percentage to capture. |
faceMaxSize | "NN%" |
"100%" |
The face maximum size percentage to capture. |
faceROI | boolean |
false |
Enable/disable the region of interest capture. |
faceROITopOffset | "NN%" |
"0%" |
Distance in percentage of the top face bounding box with the top of the camera preview. |
faceROIRightOffset | "NN%" |
"0%" |
Distance in percentage of the right face bounding box with the right of the camera preview. |
faceROIBottomOffset | "NN%" |
"0%" |
Distance in percentage of the bottom face bounding box with the bottom of the camera preview. |
faceROILeftOffset | "NN%" |
"0%" |
Distance in percentage of the left face bounding box with the left of the camera preview. |
faceROIMinSize | "NN%" |
"0%" |
The minimum face size related within the ROI. |
faceROIAreaOffset | boolean |
false |
Enable/disable ROI area visibility |
faceROIAreaOffsetColor | string |
'#ffffff73' |
Set ROI area color by hexadecimal value |
faceContours - Android Only
|
boolean |
false |
Enable/disable face contours |
faceContoursColor - Android Only
|
string |
'#FFFFFF' |
Set face contours color |
computerVision - Android Only
|
boolean |
false |
Enable/disable computer vision model |
Methods
Function | Parameters | Valid values | Return Type | Description |
---|---|---|---|---|
requestPermission | - | - | promise | Ask the user to give the permission to access camera. |
hasPermission | - | - | boolean | Return if application has camera permission. |
preview | - | - | void | Start camera preview if has permission. |
startCapture | type: string |
|
void | Set capture type "none", "face", "qrcode" or "frame". Default value is "none" . |
stopCapture | - | - | void | Stop any type of capture. |
destroy | - | - | void | Destroy preview. |
toggleLens | - | - | void | Toggle camera lens facing "front"/"back". |
setCameraLens | lens: string |
"front" or "back"
|
void | Set camera to use "front" or "back" lens. Default value is "front" . |
getLens | - | - | string | Return "front" or "back". |
setImageCapture | enable: boolean |
true or false
|
void | Enable/disabled save image capture. Default value is false
|
setImageCaptureAmount | amount: Int |
Any positive Int value |
void | For value 0 , save infinity images. When the capture image amount is reached, the event onEndCapture is triggered. Default value is 0 . |
setImageCaptureInterval | interval: number |
Any positive number that represent time in milliseconds | void | Set the image capture time interval in milliseconds. |
setImageCaptureWidth | width: string |
Value format must be in NNpx
|
void | Set the image capture width in pixels. |
setImageCaptureHeight | height: string |
Value format must be in NNpx
|
void | Set the image capture height in pixels. |
setImageCaptureColorEncoding | colorEncoding: string |
"YUV" or "RGB"
|
void | Only for android. Set the image capture color encoding type: "RGB" or "YUV" . |
setFaceDetectionBox | enable: boolean |
true or false
|
void | Set to show/hide the face detection box. |
setFacePaddingPercent | percentage: string |
Value format must be in NN%
|
void | Set face image capture and detection box padding in percentage. |
setFaceCaptureMinSize | percentage: string |
Value format must be in NN%
|
void | Set the face minimum size percentage to capture. |
setFaceCaptureMaxSize | percentage: string |
Value format must be in NN%
|
void | Set the face maximum size percentage to capture. |
setFaceROIEnable | enable: boolean |
true or false
|
void | Enable/disable face region of interest capture. |
setFaceROITopOffset | percentage: string |
Value format must be in NN%
|
void | Distance in percentage of the top face bounding box with the top of the camera preview. |
setFaceROIRightOffset | percentage: string |
Value format must be in NN%
|
void | Distance in percentage of the right face bounding box with the right of the camera preview. |
setFaceROIBottomOffset | percentage: string |
Value format must be in NN%
|
void | Distance in percentage of the bottom face bounding box with the bottom of the camera preview. |
setFaceROILeftOffset | percentage: string |
Value format must be in NN%
|
void | Distance in percentage of the left face bounding box with the left of the camera preview. |
setFaceROIMinSize | percentage: string |
Value format must be in NN%
|
void | Set the minimum face size related within the ROI. |
setFaceROIAreaOffset | enable: boolean |
true or false
|
void | Set ROI area visibility |
setFaceROIAreaOffsetColor | color: string |
Hexadecimal color | void | Set ROI area color |
setFaceContours (Android Only ) |
enable: boolean |
true or false
|
void | Enable/disable face contours |
setFaceContoursColor (Android Only ) |
color: string |
Hexadecimal color | void | Set face contours color |
setComputerVision (Android Only ) |
enable: boolean |
true or false
|
void | Enable/disable computer vision model |
setComputerVisionLoadModels (Android Only ) |
modelPaths: Array<string> |
Valid system path file to a PyTorch computer vision model | void | Set model to be used when image is captured. To se more about it, Click Here |
computerVisionClearModels (Android Only ) |
- | - | void | Clear models that was previous added using `setComputerVisionLoadModels |
Events
Event | Parameters | Description |
---|---|---|
imageCaptured | { type: string, count: number, total: number, image: object = { path: string, source: any, binary: any }, inferences: [{ ['model name']: model output }] } |
Must have started capture type of face/frame. Emitted when the face image file saved:
|
faceDetected | { x: number, y: number, width: number, height: number } |
Must have started capture type of face. Emit the detected face bounding box. Emit all parameters null if no more face detecting. |
endCapture | - | Must have started capture type of face/frame. Emitted when the number of image files created is equal of the number of images set (see the method setImageCaptureAmount ). |
qrCodeContent | { content: string } |
Must have started capture type of qrcode (see startCapture ). Emitted when the camera read a QR Code. |
status | { type: 'error'/'message', status: string } |
Emit message error from native. Used more often for debug purpose. |
permissionDenied | - | Emit when try to preview but there is not camera permission. |
Messages
Pre-define message constants used by the status
event.
Message | Description |
---|---|
INVALID_CAPTURE_FACE_MIN_SIZE | Face width percentage in relation of the screen width is less than the set (setFaceCaptureMinSize ). |
INVALID_CAPTURE_FACE_MAX_SIZE | Face width percentage in relation of the screen width is more than the set (setFaceCaptureMaxSize ). |
INVALID_CAPTURE_FACE_OUT_OF_ROI | Face bounding box is out of the set region of interest (setFaceROIOffset ). |
INVALID_CAPTURE_FACE_ROI_MIN_SIZE | Face width percentage in relation of the screen width is less than the set (setFaceROIMinSize ). |
Contribute and make it better
Clone the repo, change what you want and send PR.
Contributions are always welcome, some people that already contributed!
Code with ❤ by the Cyberlabs AI Front-End Team
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].