Git Product home page Git Product logo

google-vision's Introduction

Manage Google Vision for Laravel applications

Latest Stable Version Total Downloads

This package makes working with Google Vision a breeze. Once it has been set up you can do these things:

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->text($imagePath);

// statically
use Pkboom\GoogleVision\Facades\GoogleVision;

GoogleVision::face($imagePath);

Installation

You can install the package via composer:

composer require pkboom/google-vision

You must publish the configuration with this command:

php artisan vendor:publish --provider="Pkboom\GoogleVision\GoogleVisionServiceProvider"

This will publish a file called google-vision.php in your config-directory with these contents:

return [
    /*
     * Path to the json file containing the credentials.
     */
    'service_account_credentials_json' => storage_path('app/service-account/credentials.json'),
];

How to obtain the credentials to communicate with Google Vision

how to obtain the credentials to communicate with google calendar

google vision set up

Usage

Detect text or handwriting

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->text($imagePath);

Detect logos

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->logo($imagePath);

// with extension
$result = $googleVision->logo($imagePath, $imageExtension);

// with file output
$result = $googleVision
    ->output($outputFilePath);
    ->logo($imagePath);

Detect crop hints

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->cropHints($imagePath);

Detect document

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->document($imagePath);

Detect face

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->face($imagePath, $extension, $outputPath);

// with extension
$result = $googleVision->face($imagePath, $imageExtension);

// with file output
$result = $googleVision
    ->output($outputFilePath);
    ->face($imagePath);

Detect image properties

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->imageProperty($imagePath);

Detect image labels

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->label($imagePath);

Detect landmarks

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->landmark($imagePath);

// with extension
$result = $googleVision->landmark($imagePath, $imageExtension);

// with file output
$result = $googleVision
    ->output($outputFilePath);
    ->landmark($imagePath);

Detect objects

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->object($imagePath);

Detect explicit content

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->safeSearch($imagePath);

Detect Web entities and pages

use Pkboom\GoogleVision\GoogleVisionFactory;

$googleVision = GoogleVisionFactory::create();

$result = $googleVision->web($imagePath);

// with geo results
$result = $googleVision
    ->includeGeoResult()
    ->web($imagePath);

Detect pdf

You can detect pdf and store it as Json on Google Cloud Storage. Destination is set to gs://your-bucket/results by default.

use Pkboom\GoogleVision\GoogleVisionFactory;

$path = 'gs://your-bucket/file.pdf';
$output = 'gs://your-bucket/any/';

$googleVision = GoogleVisionFactory::create();

$googleStorage->pdf($path, $output);

// with destination
$googleStorage
    ->to($output)
    ->pdf($path, $output);

google-vision's People

Contributors

pkboom avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.