Canny Edge Detector #57893

Closed
opened 2018-11-17 17:00:38 +01:00 by Takahiro Komatsu · 5 comments

diff : diff.txt

I made a Compositor for Canny Edge Detector.
It is placed in the filter menu.
ss0.png

This can be useful to produce pictures such as the following.
demo0.png

demo1.png

This is basically the same as the following link.
https://docs.opencv.org/3.4/da/d22/tutorial_py_canny.html

However, there are 3 differences.

  1. No Noise Reduction
  2. High/Low Thresholds can be determined for each pixel
  3. Constant Width

1. No Noise Reduction

Compared to real images, CG images are free of noises. (especially on EEVEE)
In addition, Blender already has plenty of noise reduction filter.
This is why I decided to omit the noise reduction filter.

2. High/Low Thresholds can be determined for each pixel

The high/low threshold is 0.2/0.1 by default. This follows the python skimage default value.
In the original algorithm, the thresholds was something global around the image. However, the algorithm does not necessarily require a shared value, I decided to allow socket inputs.
Since the thresholds determines the sensitivity, one can detect edges densely in some areas while leaving the other areas sparse.

3. Constant Width

inconstant.png Constant Width Off (Original algorithm)

VS

constant.png Constant Width On

When the Constant Width is on, the angles will be rounded to 0 or 90 (originally, one among 0,45,90 or 135)

I personally prefer the constant width on, but not quite sure what this causes. (I couldn't find much differences in detected edges during my tests. However, there should be a good reason why the original algorithm runs this way)

There are several other changes in the actual calculation for speed up but the results should be the same.

demo file:
canny.blend

diff : [diff.txt](https://archive.blender.org/developer/F5603021/diff.txt) I made a Compositor for Canny Edge Detector. It is placed in the filter menu. ![ss0.png](https://archive.blender.org/developer/F5603140/ss0.png) This can be useful to produce pictures such as the following. ![demo0.png](https://archive.blender.org/developer/F5603178/demo0.png) ![demo1.png](https://archive.blender.org/developer/F5603181/demo1.png) This is basically the same as the following link. https://docs.opencv.org/3.4/da/d22/tutorial_py_canny.html However, there are 3 differences. 1. No Noise Reduction 2. High/Low Thresholds can be determined for each pixel 3. Constant Width # 1. No Noise Reduction Compared to real images, CG images are free of noises. (especially on EEVEE) In addition, Blender already has plenty of noise reduction filter. This is why I decided to omit the noise reduction filter. # 2. High/Low Thresholds can be determined for each pixel The high/low threshold is 0.2/0.1 by default. This follows the [python skimage default value](http://scikit-image.org/docs/dev/api/skimage.feature.html#canny). In the original algorithm, the thresholds was something global around the image. However, the algorithm does not necessarily require a shared value, I decided to allow socket inputs. Since the thresholds determines the sensitivity, one can detect edges densely in some areas while leaving the other areas sparse. # 3. Constant Width ![inconstant.png](https://archive.blender.org/developer/F5603415/inconstant.png) Constant Width Off (Original algorithm) VS ![constant.png](https://archive.blender.org/developer/F5603420/constant.png) Constant Width On When the Constant Width is on, the angles will be rounded to 0 or 90 (originally, one among 0,45,90 or 135) I personally prefer the constant width on, but not quite sure what this causes. (I couldn't find much differences in detected edges during my tests. However, there should be a good reason why the original algorithm runs this way) There are several other changes in the actual calculation for speed up but the results should be the same. demo file: [canny.blend](https://archive.blender.org/developer/F5603636/canny.blend)
Campbell Barton was assigned by Takahiro Komatsu 2018-11-17 17:00:38 +01:00
Author
Member

Added subscriber: @TakahiroKomatsu

Added subscriber: @TakahiroKomatsu

Added subscriber: @velocity

Added subscriber: @velocity
Author
Member

I guess I'll just make an diff

I guess I'll just make an diff
Author
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Author
Member
moved to https://developer.blender.org/D4105
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#57893
No description provided.