@abdeslam_gacemi/capacitor-arcore-measuror
v0.0.8
Published
A capacitor plugin that exploits ARCore android feature for a cropped area measurements and distance
Downloads
89
Maintainers
Readme
measuror
A capacitor plugin that exploits ARCore android feature for cropped area measurements and distance
Install
npm install @abdeslam_gacemi/capacitor-arcore-measuror
npx cap syncAPI
start()stop()setCropArea(...)addListener('onMeasurement' | 'measurementChange' | 'onMeasurementUpdate', ...)startListening()stopListening()capturePhoto()measureNow()- Interfaces
start()
start() => anyStart the AR session and camera
Returns: any
stop()
stop() => anyStop the AR session and release resources
Returns: any
setCropArea(...)
setCropArea(options: MeasurorCropAreaOptions) => anySet the crop area for measurements
| Param | Type | Description |
| ------------- | --------------------------------------------------------------------------- | ------------------------- |
| options | MeasurorCropAreaOptions | - Crop area configuration |
Returns: any
addListener('onMeasurement' | 'measurementChange' | 'onMeasurementUpdate', ...)
addListener(eventName: 'onMeasurement' | 'measurementChange' | 'onMeasurementUpdate', listenerFunc: (data: MeasurorCapturedMeasurements) => void) => anyAdd listener for measurement updates
| Param | Type | Description |
| ------------------ | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| eventName | 'onMeasurement' | 'measurementChange' | 'onMeasurementUpdate' | - Event type to listen for |
| listenerFunc | (data: MeasurorCapturedMeasurements) => void | - Callback function to handle measurement data |
Returns: any
startListening()
startListening() => anyStart emitting measurement updates via listeners
Returns: any
stopListening()
stopListening() => anyStop emitting measurement updates
Returns: any
capturePhoto()
capturePhoto() => anyCapture a single measurement with photo
Returns: any
measureNow()
measureNow() => anyRequest a single measurement without photo
Returns: any
Interfaces
MeasurorStartResult
| Prop | Type |
| --------------------- | -------------------- |
| success | boolean |
| status | string |
| message | string |
| textureId | number |
| displayRotation | number |
| width | number |
| height | number |
MeasurorCropAreaOptions
| Prop | Type |
| ------------ | -------------------- |
| left | number |
| top | number |
| width | number |
| height | number |
| center | boolean |
MeasurorCropAreaResult
| Prop | Type |
| -------------------- | -------------------- |
| success | boolean |
| cropLeft | number |
| cropTop | number |
| cropWidth | number |
| cropHeight | number |
| centerCropMode | boolean |
| density | number |
MeasurorCapturedMeasurements
| Prop | Type |
| -------------------------- | ------------------------------------------------------------------------------------- |
| hasValidMeasurement | boolean |
| trackingConfidence | number |
| photoBase64 | string |
| imageWidth | number |
| imageHeight | number |
| realWidth | number |
| realHeight | number |
| smoothedWidth | number |
| smoothedHeight | number |
| smoothedWidthUnit | string |
| smoothedHeightUnit | string |
| distance | number |
| smoothedDistance | number |
| note | string |
| croppedPhotoBase64 | string |
| hasCroppedPhoto | boolean |
| planeRotationY | number |
| planeRotationX | number |
| orientation | 'portrait' | 'portrait-reversed' | 'landscape' | 'landscape-reversed' |
| isPortrait | boolean |
| physicalOrientation | number |
| deviceOrientedWidth | number |
| deviceOrientedHeight | number |
| timestamp | number |
| trackingState | string |
| detectedPlanes | number |
| trackingPlanes | number |
| stable | number |
| hitX | number |
| hitY | number |
| hitZ | number |
| measurementPointX | number |
| measurementPointY | number |
| cropLeft | number |
| cropTop | number |
| cropWidth | number |
| cropHeight | number |
| croppedWidth | number |
| croppedHeight | number |
| viewWidth | number |
| viewHeight | number |
| focalLengthX | number |
| focalLengthY | number |
| principalPointX | number |
| principalPointY | number |
| cameraImageWidth | number |
| cameraImageHeight | number |
| calculationMethod | 'intrinsics' | 'texture_intrinsics' | 'fov_fallback' |
| rotationApplied | number |
| errorCode | string |
| reason | string |
| emitAllowed | boolean |
MeasurorListeningResult
| Prop | Type |
| --------------- | -------------------- |
| listening | boolean |
