PHP Classes

How to Implement a PHP Image Edge Detection to Find Shapes using the Redstart Graphic BoxAction Classes - Redstart Graphic Library package blog

Recommend this page to a friend!
  All package blogs All package blogs   Redstart Graphic Library Redstart Graphic Library   Blog Redstart Graphic Library package blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Implement a PH...  
  Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)  

Author:

Viewers: 829

Last month viewers: 6

Package: Redstart Graphic Library

Many people take pictures of other people, animals or objects that are important to the person that take the pictures.

Finding the edges of those people, animals or object may be useful to create contour lines around them or to create image clips cutting the image following the lines that connect the edges.

Read this short article to learn how to find the edges of images using the Redstart Graphic library package capabilities to detect those edges using builtin filter classes.




Loaded Article

In this article you will learn:

What is the Redstart Graphic Library Package
What is the Box Action

Example Code of Applying a Box Action Effect to Apply a Filter to Find Image Edges

How to Download the Redstart Graphic Library Package or Install it With PHP Composer


What is the Redstart Graphic Library Package

The Redstart Graphic Library Package is a library of PHP classes that can perform several types of operations by loading and processing images in order to apply one or more useful effects.

What is the Box Action

The box action is a special action implemented by the Redstart Graphic Library that can be used to apply any other actions or filters on selected area of the resource (Image).

Example Code of Applying a Box Action Effect to Apply a Filter to Find Image Edges

The following example show code to demonstrate how apply the findEdge filter on selected area of an image resource.

<?php

require '../autoload.php';

use Redstart\Graphic\Jpeg;
use Redstart\Graphic\Dimension;
use Redstart\Graphic\Action\BoxAction;
use Redstart\Graphic\Box;
use Redstart\Graphic\Action\Filter\ConvolutionFactor;

// load the resource (image) from file
$j = new Jpeg();
$j->loadFromFile('sample.jpg');

// create findeFilter from the ConvolutionFactor object
$findEdge = ConvolutionFactor::findEdge();

// create the box action and apply the findEdge filter to the second half of the 
// resource

$b = new BoxAction($findEdge, new Box(new Dimension(150, 400)));
$b->executeAction($j);

// save the created resource
try {
    header('Content-type:image/jpeg');
    $j->save(null);
} catch (Exception $e) {
    header('Content-type:text/html;charset=UTF-8');
    throw $e;
}

How to Download the Redstart Graphic Library Package or Install it With PHP Composer

The Redstart Graphic Library package is available for you to download as a ZIP archive by going to the download page or install it using the PHP Composer Tool by going to the installation instructions page.




You need to be a registered user or login to post a comment

Login Immediately with your account on:



Comments:

No comments were submitted yet.



  Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)  
  All package blogs All package blogs   Redstart Graphic Library Redstart Graphic Library   Blog Redstart Graphic Library package blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Implement a PH...