Face detection in PHP

前端 未结 6 622
一整个雨季
一整个雨季 2020-12-25 08:49

Does anybody know of a good way to do face detection in PHP? I came across some code here that claims to do this, but I can\'t seem to get it to work properly. I\'d like to

6条回答
  •  甜味超标
    2020-12-25 09:14

    The project has been upgraded on github repository by following this link Face detection

    The problem was on the loop, this code works fine :

    for ($i=1; $i<$ii_h-1; $i++) {
            $ii[$i*$ii_w] = 0;
            $ii2[$i*$ii_w] = 0;
            $rowsum = 0;
            $rowsum2 = 0;
            for ($j=1; $j<$ii_w-1; $j++) {
                $rgb = ImageColorAt($canvas, $j, $i);
                $red = ($rgb >> 16) & 0xFF;
                $green = ($rgb >> 8) & 0xFF;
                $blue = $rgb & 0xFF;
                $grey = (0.2989*$red + 0.587*$green + 0.114*$blue)>>0;  // this is what matlab uses
                $rowsum += $grey;
                $rowsum2 += $grey*$grey;
    
                $ii_above = ($i-1)*$ii_w + $j;
                $ii_this = $i*$ii_w + $j;
    
                $ii[$ii_this] = $ii[$ii_above] + $rowsum;
                $ii2[$ii_this] = $ii2[$ii_above] + $rowsum2;
            }
        }
    

    Good luck

提交回复
热议问题