DEV Community

vic
vic

Posted on

2 1

A simple image edge detection method

A simple image edge detection method

General steps:

  1. Zoom pictures to improve efficiency
  2. Picture grayscale
  3. Calculate edges based on brightness

The third step is the most critical. There are many ways to directly contrast the adjacent brightness.

Instructions:

Install

composer require lizhichao/one-img

Enter fullscreen mode Exit fullscreen mode

Example


$img_path = '1.jpg';
$img = new \OneImg\Border();
$img->setImg($img_path)
    ->scale(300, 300)
    ->outline()
    ->save(); //Output to browser

Enter fullscreen mode Exit fullscreen mode

effect

Alt Text
Alt Text

Code warehouse

https://github.com/lizhichao/doImg

My other warehouse welcome star

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more