<body> <h1>@xingwangdev/jsface</h1>
npm install @xingwangdev/jsfaceThis is a powerful JavaScript library that provides face detection and landmark extraction functionalities for your applications. It allows you to easily integrate face-related features into your projects, enabling you to detect faces in images and extract landmarks with ease.
To install the @xingwangdev/jsface package, simply run the following command:
npm install @xingwangdev/jsface
To begin detecting faces, you need to load the detection model. Use the following function:
loadDetectionModel()
Once the detection model is loaded, you can detect faces in an image by invoking the detectFace function:
detectFace(session, canvas_id)
Here, session represents the current session, which is the result of loadDetectionModel or loadLandmarkModel and canvas_id is the ID of the canvas element where the image is displayed.
To extract face landmarks, you must first load the landmark extraction model. Use the following function:
loadLandmarkModel()
After loading the landmark extraction model, you can extract face landmarks using the detection result. Invoke the predictLandmark function as shown below:
predictLandmark(session, canvas_id, bbox)
In the above code, session represents the current session, which is the result of loadDetectionModel or loadLandmarkModel and canvas_id is the ID of the canvas element displaying the image, and bbox is the bounding box obtained from the face detection process.
Feel free to explore the provided functionalities and integrate them into your applications.