{"id":13700139,"url":"https://github.com/hihozhou/php-opencv","last_synced_at":"2025-04-05T04:13:17.796Z","repository":{"id":41579866,"uuid":"84619636","full_name":"hihozhou/php-opencv","owner":"hihozhou","description":"PHP extensions for OpenCV","archived":false,"fork":false,"pushed_at":"2020-05-23T00:53:34.000Z","size":932,"stargazers_count":570,"open_issues_count":33,"forks_count":97,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-03-29T03:09:14.172Z","etag":null,"topics":["computer-vision","face-detection","face-recognition","opencv","php-extension","php-facedetect","php-opencv","php7","phpopencv"],"latest_commit_sha":null,"homepage":"https://phpopencv.org","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hihozhou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-11T03:05:22.000Z","updated_at":"2025-03-02T13:45:08.000Z","dependencies_parsed_at":"2022-08-20T12:41:04.687Z","dependency_job_id":null,"html_url":"https://github.com/hihozhou/php-opencv","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hihozhou%2Fphp-opencv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hihozhou%2Fphp-opencv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hihozhou%2Fphp-opencv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hihozhou%2Fphp-opencv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hihozhou","download_url":"https://codeload.github.com/hihozhou/php-opencv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284951,"owners_count":20913704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","face-detection","face-recognition","opencv","php-extension","php-facedetect","php-opencv","php7","phpopencv"],"created_at":"2024-08-02T20:00:48.975Z","updated_at":"2025-04-05T04:13:17.768Z","avatar_url":"https://github.com/hihozhou.png","language":"C++","readme":"# PHP-OPENCV - PHP extension for Opencv\n\n\n\n[![Build Status](https://travis-ci.org/hihozhou/php-opencv.svg?branch=master)](https://travis-ci.org/hihozhou/php-opencv) [![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.0-8892BF.svg)](https://php.net/)\n\n\n\u003e **⚠️⚠️ NO LONGER IN ACTIVE DEVELOPMENT | 项目不再维护 ⚠️⚠️** \n\u003eDue to personal scheduling reasons, the project has been suspended for maintenance and it is hoped that the project code will provide useful value.\n\n\n## Document\n- [PHP OpenCV Document](https://doc.phpopencv.org)\n\n\n## Requirements\n\n- OpenCV 4.0.0+\n- PHP7.0+\n\n\n\n## Installation\n\n### Use OpenCV docker(commendatory)\n\nIf you don't know how to install OpenCV, you can use my OpenCV docker image(only 300M, including opencv_contrib).\n\n```bash\ndocker pull hihozhou/php-opencv\n```\n\n### Compile and install php-opencv extension\n\n```bash\ngit clone https://github.com/hihozhou/php-opencv.git\ncd php-opencv\nphpize\n./configure --with-php-config=your php-config path\nmake\nmake install\n```\n\n## Configure\n\nphp.ini\n\n```\nextension=\"your opencv.so path\"\n```\n## Example\n\n### LBPH face recognition\n\n```php\nuse CV\\Face\\LBPHFaceRecognizer;\n//use ...;\n\n$src = imread('facePic.jpg');\n$gray = cvtColor($src, COLOR_BGR2GRAY);\nequalizeHist($gray, $gray);\n$faceRecognizer = LBPHFaceRecognizer::create();\n/* ... */ //get $images and $labels for train\n$faceRecognizer-\u003etrain($images, $labels);//How to get $image and $labels, see the document\n/* ... */ //Face detection using CascadeClassifier\n$faceLabel = $faceRecognizer-\u003epredict($gray);\n/* ... */ //draw face and name\n```\n\nresult:\n\n![predict](tests/face_recognizer.jpg)\n\n\n### Image Processing\n\n```php\n//Obama.php\nuse function CV\\{ imread, imshow, waitkey, namedWindow};\n\n$im = imread('Obama.png');//load image\nnamedWindow('This is Obama id card',WINDOW_FULLSCREEN);//create window\nimshow('This is Obama id card',$im);//show image on window\n\nwaitkey(0);\n\n```\n\nresult:\n\n![Obama](tests/Obama.png)\n\nLoad image by gray\n\n```php\n$gray = imread('Obama.png',IMREAD_GRAYSCALE);\n//or\nuse  function CV\\{ cvtColor};\n$gray = cvtColor($im, COLOR_BGR2GRAY);\n\n```\n\n![Obama_gray](tests/Obama_gray.png)\n\n\nYou can draw something.  \ne.g:  \n\n```php\nuse CV\\{Mat,Scalar, Point, Size};\nuse function CV\\{ellipse, imwrite, waitKey};\nuse const CV\\{CV_8UC3};\n\n$windowWidth = 600;\n$thickness = 2;\n$lineType = 8;\n$matScalar = new Scalar(0,0,0);\n$mat = new Mat($windowWidth, $windowWidth, CV_8UC3, $matScalar);\n$point=new Point($windowWidth/2, $windowWidth/2);\n$size=new Size($windowWidth/4, $windowWidth/16);\n$scalar=new Scalar(255, 129, 0);\nfor($i = 0; $i \u003c= 360; $i += 45){\n    ellipse($mat,$point,$size,$i,0,360,$scalar,$thickness,$lineType);\n}\nimwrite('./tests/ellipse.png',$mat);\n\n```\n\nresult:\n\n![ellipse](tests/ellipse.png)\n\n\n\n## Features\n- [x] 1.[core](http://phpopencv.org/zh-cn/docs/mat.html)\n- [x] 2.[imgproc](http://phpopencv.org/zh-cn/docs/gausian_median_blur_bilateral_filter.html)\n- [x] 3.highgui\n- [ ] 4.contrib\n- [ ] 5.features2d\n- [ ] 6.flann\n- [ ] 7.gpu\n- [ ] 8.calib3d\n- [ ] 9.legacy\n- [x] 10.ml\n- [ ] 11.nonfree\n- [x] 12.objdetect\n- [ ] 13.ocl\n- [ ] 14.photo\n- [ ] 15.stitching\n- [ ] 16.superres\n- [ ] 17.ts\n- [x] 18.video\n- [ ] 19.Videostab\n\n\n\n## Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](https://github.com/hihozhou/php-opencv/graphs/contributors)].\n    \n## 感谢\n\n感谢[韩天峰](https://github.com/matyhtf)老大的指导，  \n感谢[韩天峰](https://github.com/matyhtf)老大的指导，\n感谢[盘古大叔](https://github.com/pangudashu)的[php7-internal](https://github.com/pangudashu/php7-internal)项目以及平常的指导，\n感谢`木桶技术升级交流群`和`黑夜路人技术群`、以及`PHP内核交流`的群友对技术的帮助。\n","funding_links":[],"categories":["图片处理"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhihozhou%2Fphp-opencv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhihozhou%2Fphp-opencv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhihozhou%2Fphp-opencv/lists"}