Jump to content
How to Install Plugins ×

Edge Detect+


ArgusMagnus

Recommended Posts

Effect->Stylize->Edge Detect+

Download: https://forums.getpaint.net/topic/32337-argusmagnus-plugin-pack-20181019/

(Copy the file ArgusPDN.EdgeDetect.dll to the paint.net/Effects folder)

 

This effect uses an edge detection algorithm. It draws edges with given colors and sets the other pixels to transparent.

 

I haven't had any good idea for the name, so I called it Edge Detection for now, the (Argus) is simply to make it better distinguishable from the built in Edge Detect effect. If anyone has an idea for a better name, feel free to share it ?

 

UI Explanation (See example below):

Lower Threshold: All pixels with values (Structur Tensor Eigenvalues) below this threshold are fully transparent: Higher Threshold --> Less Edges detected

Upper Threshold: All pixels with values above this threshold are fully opaque. The range of "good" values really depends on the image. For hard edges (extreme case: black line on white), "good" values may go up to 1, for softer edges (as typically found in photographes), "good" values will usually be below 0.2

Color/Color2/Angle/Hue Direction: Edges with a normal angle the same as the chosen Angle are drawn in the color set in Color, edges with a normal angle perpendicular to Angle are drawn in the color set in Color2, in between the color is interpolated between Color and Color2. Hue Direction determines how the Hue value is interpolated.

Difference Filter: The Kernel used to get the image derivates in x and y direction. I have yet to encounter a situation where I needed to change this value. If you change this value, a lot of calculations have to be redone. Some time may pass before you see something happening.

Smoothing Radius: As expected, smoothes the output.

 

Performance:

Calculating initial values (Structur Tensors) may take some time, therefore, depending on the selection size, it may take some time after the effect dialog pops up before you can see something happening. If you change the value "Difference Filter" these calculations have to be redone.

Smoothing is also somewhat expensive, which you can see if you change the smoothing radius.

Intermediate values (Structur Tensors, eigenvalues of smoothed Tensors) are held in memory so re-rendering the output for different Threshold/Color/Angle values is fast. The cost for that is memory usage: Roughly 24 bytes per Pixel are used (excluding the memory used for the source and destination surface).

 

EdgeDetectionBuilding_zpshxclspuu.png

 

EdgeDetectionFowers_zps9uvmmzzh.png

Edited by ArgusMagnus
Added links to zipped DLL of Null54's updated version
  • Like 1
  • Upvote 8

My batch Image Processor: https://imagenator.codeplex.com

Link to comment
Share on other sites

Interesting effect Argus - thanks for sharing! B)
Clever way of linking the two threshold sliders and limiting the angle chooser.

Unfortunately I managed to crash it! (or rather it crashed Pdn). Threading error below.
I had successfully used the effect. I then used 'undo' (to duplicate my original 1281 by 907 image). Then used 'Effects/repeat Edge detection (Argus)' which caused the crash.


File: C:\Program Files\paint.net\Effects\ArgusPaintNet.EdgeDetection.dll
      Name: ArgusPaintNet.EdgeDetection.EdgeDetectionEffect
      Version: 1.0.5744.32049
      Author: Argus Magnus
      Copyright: Copyright © ArgusMagnus 2015
      Website: http://www.getpaint.net/redirect/plugins.html
      Full error message: PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at ArgusPaintNet.EdgeDetection.EdgeDetectionEffect.OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
   at PaintDotNet.Effects.Effect`1.OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs) in d:\src\pdn\paintdotnet\src\Effects\Effect`1.cs:line 67
   at PaintDotNet.Effects.BackgroundEffectRenderer.ThreadFunction() in d:\src\pdn\paintdotnet\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 218
   --- End of inner exception stack trace ---
   at PaintDotNet.Effects.BackgroundEffectRenderer.DrainExceptions() in d:\src\pdn\paintdotnet\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 431
   at PaintDotNet.Menus.EffectMenuBase.DoEffect(Effect effect, EffectConfigToken token, PdnRegion selectedRegion, PdnRegion regionToRender, IRenderer`1 clipMaskRenderer, Surface originalSurface, Exception& exception) in d:\src\pdn\paintdotnet\src\PaintDotNet\Menus\EffectMenuBase.cs:line 1527

  • Upvote 1

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

Great effect, much better than the one built-in to PDN. You really should zip your files instead of leaving open xxx.dll's on a server somewhere, it's a bit unsettling to download them like that....

 

oRe9jVT.gif

 

Here is another cool one. It looks almost frozen.....

 

7iNcHSo.gif

Edited by racerx
  • Upvote 2

Plane_Sig2.gif

Link to comment
Share on other sites

Small Update: I changed the range of the threshold values and improved cancelling behaviour.

 

I'm not sure this is the optimum yet. The problem is, that the range which makes sense really depends on the image. For an image with hard edges (black on white), one would want a large range, possibly with a maximum even above 1. For images with softer edges (photographes, realistic drawings, etc.) chosen values will likely be below 0.2 or even 0.1. Of course these values can be chosen even if the range is [0,1] but its less confortable if you have a slider going from 0 to 1 but you are only interested in values between 0 and 0.1.

 

So if you think, I should allow another range for the sliders, tell me :)

 

 

@racerx: The assemblies are not zipped up, because... well... essentially because it's easier for me (I would need to have multiple zip files of which most would contain the ArgusPaintNet.Shared.dll file, so I would need to update every zip if I updated the shared dll and wanted all zips to contain the newest version). But if you select multiple files or download the whole folder, OneDrive will zip it up for you ;)

Edited by ArgusMagnus

My batch Image Processor: https://imagenator.codeplex.com

Link to comment
Share on other sites

Would "Edge Detect+" be a better name? According to the plugin index it is not taken yet.

 

Does anyone use the "Corner" mode? (This plugin originally started out as a corner detection plugin, but as I kept going and tested the plugin, I began to see, that edge detection yields much more interesting results than corner detection and the math is almost identical, so switching between the two modes requires very little code changes). If not, I might remove the option altogether and instead add an option to perform the algorithm and different versions of the image. Currently the algorithm is performed on a grayscale image, but it could just as easily be run on individual channels

My batch Image Processor: https://imagenator.codeplex.com

Link to comment
Share on other sites

  • 2 years later...

I have installed the new paint dot net update and now this plug in is crashing:

 

File: E:\Program Files\paint.net\Effects\ArgusPaintNet.EdgeDetection.dll
      Name: ArgusPaintNet.EdgeDetection.EdgeDetectionEffect
      Version: 1.0.5744.38119
      Author: Argus Magnus
      Copyright: Copyright © ArgusMagnus 2015
      Website: http://www.getpaint.net/redirect/plugins.html
      Full error message: PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.TypeLoadException: Could not load type 'PaintDotNet.Rendering.VectorFloat' from assembly 'PaintDotNet.Base, Version=4.101.6828.39058, Culture=neutral, PublicKeyToken=null'.
   at ArgusPaintNet.Shared.StructurTensor.GetCharacteristics()
   at ArgusPaintNet.EdgeDetection.EdgeDetectionEffect.GetCharacteristics(Rectangle rect, TensorCharacteristics[,] values)
   at ArgusPaintNet.Shared.CachedValues`1.GetValues(Rectangle roi)
   at ArgusPaintNet.EdgeDetection.EdgeDetectionEffect.OnRender(Rectangle[] renderRects, Int32 startIndex, Int32 length)
   at PaintDotNet.Effects.Effect`1.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length) in D:\src\pdn\src\Effects\Effect`1.cs:line 98
   at PaintDotNet.Effects.BackgroundEffectRenderer.RenderWithClipMask(Effect effect, EffectConfigToken token, RenderArgs dstArgs, RenderArgs srcArgs, RectInt32[] rois, IRenderer`1 clipMaskRenderer) in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 196
   at PaintDotNet.Effects.BackgroundEffectRenderer.RendererContext.RenderTile(EffectConfigToken token, Int32 tileIndex) in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 175
   at PaintDotNet.Effects.BackgroundEffectRenderer.RendererContext.RenderNextTile(EffectConfigToken token) in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 167
   at PaintDotNet.Effects.BackgroundEffectRenderer.ThreadFunction() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 267
   --- End of inner exception stack trace ---
   at PaintDotNet.Effects.BackgroundEffectRenderer.DrainExceptions() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 443
   at PaintDotNet.Effects.BackgroundEffectRenderer.Abort() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 399
   at PaintDotNet.Effects.BackgroundEffectRenderer.Start() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 345
   at PaintDotNet.Menus.EffectMenuBase.<>c__DisplayClass45_5.<RunEffectImpl>b__5() in D:\src\pdn\src\PaintDotNet\Menus\EffectMenuBase.cs:line 1094
 

Any help would be appreciated 

Thanks

Jeanette

Link to comment
Share on other sites

@Tuckeroo, the plugin will need to be updated for Paint.NET v4.1 or newer. Some types were moved/renamed -- in this case, VectorFloat is now Vector2Float.

 

(technically plugins were/are not supposed to use types like that, although that should be changing soon ... just not yet)

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

6 hours ago, Tuckeroo said:

Thanks Rick. Looking forward this plugin being updated. I use it regularly! 

 

I recompiled the plugin for Paint.NET 4.1.1 using the source code @ArgusMagnus posted.

 

Changes:

  • Added a replacement VectorFloat structure to ArgusPaintNet.Shared.
  • Changed ArgusPaintNet.EdgeDetection to get the "Stylize" menu name from the SubmenuNames class.

 

Edge Detection.zip

Source.zip

  • Like 4
  • Upvote 1

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

On 9/18/2018 at 1:57 PM, null54 said:

I recompiled the plugin for Paint.NET 4.1.1 using the source code @ArgusMagnus posted.

 

Added to the first post. Thanks @null54!

Link to comment
Share on other sites

Hi @ArgusMagnus   Thanks for updating your plugin pack!  ?

 

I have two observations.  On this particular plugin (Edge Detect+), you altered the UI and added a 'Tensor Smoothing Radius' slider.

I don't know what that does. Could you update the images in the first post and explain it? 

 

And, point #2, your 'Convolution' plugin is no longer in the pack.  I use this quite frequently on certain 'styles' of artwork.

It still works fine, but you should mention that everyone is still going to need to keep your 'Shared' .dll in the effects folder for it to work.

 

Thank you for all your hard work.  :star:

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...