Skip to content

Example works great. But in the model - ERR_EMPTY_RESPONSE #6

@Toutlemond

Description

@Toutlemond

Good day Vladimir !

Tell me what's wrong with my code.
Example- Recognition_face_by_lbph.php is at the root of the site - it works great.
But if I want to do the same in the my model, I get the error ERR_EMPTY_RESPONSE.



<?php
use CV\Face\LBPHFaceRecognizer, CV\CascadeClassifier, CV\Scalar, CV\Point;
use function CV\{imread, cvtColor, equalizeHist};
use const CV\{COLOR_BGR2GRAY};

class opencv_model extends Model
{
    function __construct()
    {
    }
    function recognize_face()
    {

        $faceClassifier = new CascadeClassifier();
        $faceClassifier->load(URL . 'phpocv/models/lbpcascades/lbpcascade_frontalface.xml');

        $faceRecognizer = LBPHFaceRecognizer::create();

        $filenam = __DIR__.'/faces.jpg';
        $labels = ['unknown', 'vadim', 'alice'];

        $src = cv\imread($filenam);
        $gray = cvtColor($src, COLOR_BGR2GRAY);
      // until this - everyfing work fine
       $faceClassifier->detectMultiScale($gray, $faces); // if i uncomment this line - all broke down...

        var_dump($faces);
      
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions