Skip to content

PHP OpenCV Library Issue #24

@markeddolphin

Description

@markeddolphin

Sir.
I did integrating php-opencv to my project. while doing that, I got stuck at php library issue.
when I use your face recognition code sample, I came to face with undefined method error.
Here is error message.
{
"message": "Call to undefined method CV\Mat::data()",
"exception": "Error",
"file": "/var/www/vhosts/fofik.com/dbd.fofik.com/app/Services/CVDNNService.php",
"line": 89,
"trace": [
{
"file": "/var/www/vhosts/fofik.com/dbd.fofik.com/app/Http/Controllers/CelebController.php",
"line": 287,
"function": "recognize",
"class": "App\Services\CVDNNService",
"type": "->"
},
{
"file": "/var/www/vhosts/fofik.com/dbd.fofik.com/app/Http/Controllers/CelebController.php",
"line": 83,
"function": "vision",
"class": "App\Http\Controllers\CelebController",
"type": "->"
},
.........

and here is my code.

foreach ($cvData as $item) {
$label = $item->label;
$photo = $item->photo;
$src = imread(public_path($photo));
$faces = $this->image2faces($src);
foreach ($faces as $i => $face) {
$vec = $this->face2vec($face);
$faceVectors[$label.$i] = $vec->data();
}
}
and It's perfect same as you described on your example code.

I am really clueless about it.
when I print method list of $vec, there wasn't data method on it.

Array
(
[0] => __construct
[1] => type
[2] => depth
[3] => channels
[4] => empty
[5] => print
[6] => size
[7] => clone
[8] => ones
[9] => zeros
[10] => zerosBySize
[11] => isContinuous
[12] => isSubmatrix
[13] => row
[14] => col
[15] => at
[16] => atIdx
[17] => getImageROI
[18] => copyTo
[19] => convertTo
[20] => plus
[21] => divide
[22] => reshape
[23] => setTo
[24] => add
[25] => subtract
)
This is method list of CV\Mat class($vec) what I printed.
I hope you to take care of my trouble. solution for me please.
Thanks. N.J

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