A powerful PHP library supporting Computer Vision manipulations
, (*1)
CVAPi library is built entirely in PHP to bring the power of computer vision into web development. Under the hood of CVAPi lies OpenCV, which is used extensively for computer vision applications., (*3)
Firstly, make sure you have Composer installed in your system. You can acquire it by clicking here, (*4)
After that, you can require CVAPi by writing out this command in terminal, (*5)
$ composer require cv-api/cv-api
As Composer is done fetching necessary dependencies, make sure to register for an account in CVApi After the confirmation e-mail, open the config file inside vendor/CVApi and edit these settings, (*6)
"public_key" => "your-public-key", "secret_key" => "your-secret-key", "password" => "your-password", "path" => "your-path-to-storage"
In the end we can test whether CVApi is configured properly by trying out this piece of code, (*7)
require_once __DIR__ . 'path_to_autoload_file.php'; use CVApi/CVApi; CVApi::test();
If you receive the welcome message, you are good to go, (*8)
Using CVApi is fairly straightforward. For example, we would like to save a grayscale version of our image. In order to do this you have to type:, (*9)
CVApi::make(['old_image.jpg'])->grayscale()->results(function($new_image) { $new_image->save(); });
As we can see, all methods in CVApi are chainable. We can perform more than one operation at onceP, (*10)
CVApi::make(['old_image.jpg']) ->resize(300, 300) ->brightness(85) ->histogram(['B', 'G', 'R']) ->results(function($new_images) { $new_images->save(); ->results(function($images) { $images->save(); });
CVApi is automatically configured to understand the source of the images. If we leave the make argument empty, CVApi automatically looks for images coming from form requests., (*11)
CVApi::make()->pyrDown(3)->results(function($image) { $image->save(); });
This software is licensed under MIT License, (*12)