Face-Detection-JavaScript icon indicating copy to clipboard operation
Face-Detection-JavaScript copied to clipboard

how to save photo of detected face?

Open amurad90 opened this issue 5 years ago • 1 comments

how can I get the detected faces in photos. example: I would like to save faces that were detected in the video

thanks

amurad90 avatar Feb 11 '20 10:02 amurad90

Not exactly this but somewhere along these lines of code. This is an old project where I uploaded the image to a site and the site then detected faces from the picture it was given.

`onButtonSubmit = () => {
    this.setState({imageUrl: this.state.input});
      fetch('http://localhost:3000/imageurl', {
        method: 'post',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': window.sessionStorage.getItem('token')
        },
        body: JSON.stringify({
          input: this.state.input
        })
      })
      .then(response => response.json())
      .then(response => {
        if (response) {
          fetch('http://localhost:3000/image', {
            method: 'put',
            headers: {
              'Content-Type': 'application/json',
              'Authorization': window.sessionStorage.getItem('token')
            },
            body: JSON.stringify({
              id: this.state.user.id
            })
          })
            .then(response => response.json())
            .then(count => {
              this.setState(Object.assign(this.state.user, { entries: count}))
            })
            .catch(console.log)

        }
        console.log(response)
        this.displayFaceBoxes(this.calculateFaceLocations(response))
      })
      .catch(err => console.log(err));
  }`

jcrommar avatar Feb 17 '20 07:02 jcrommar