Commit f7e2848
committed
New Effects > Edge > Gradient flow tool
I'm doing some promising prototyping on a magnetic lasso tool, but testing the results interactively has proven difficult because it's hard to see how PD si analyzing object boundaries when attempting to "magnetize" the lasso to nearby boundaries.
So I wrote a visualizer for showing gradient flow calculations in the current image, and it's been so helpful that I may as well expose it to users. I've cleaned up the prototype code a bit and added some options to make output easier to understand.
In this context, "gradient" doesn't refer to the Photoshop-esque term of smoothly fading between colors - instead it refers to something closer to edge-detection:
https://en.wikipedia.org/wiki/Image_gradient
PD uses various internal functions to calculate gradient magnitude and direction for each pixel in an image, and those results are used as inputs for all kinds of other effects. The purpose of this new tool is to paint those gradient calculations directly onto the image, so you can see where object boundaries lay, at least as far as PD knows.
The most interesting setting on this new tool is the "direction" output, which paints little arrows across the image, with each arrow's direction and length showing where PD detects an object boundary (and how strong it thinks that boundary is). For an obvious example of how it works, paint a black-and-white reflection gradient using PD's gradient tool, then run this new Effects > Edge > Gradient tool on the result, with the "direction" setting active. (If your base image is large, you may need to crank up the boost and/or sample radius settings.)1 parent 0c8e628 commit f7e2848
File tree
18 files changed
+1285
-111
lines changed- App/PhotoDemon/Languages
- Master
- Classes
- Forms
- Modules
18 files changed
+1285
-111
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
2002 | 2002 | | |
2003 | 2003 | | |
2004 | 2004 | | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
2005 | 2010 | | |
2006 | 2011 | | |
2007 | 2012 | | |
| |||
2287 | 2292 | | |
2288 | 2293 | | |
2289 | 2294 | | |
2290 | | - | |
| 2295 | + | |
2291 | 2296 | | |
2292 | 2297 | | |
2293 | 2298 | | |
| |||
5304 | 5309 | | |
5305 | 5310 | | |
5306 | 5311 | | |
5307 | | - | |
| 5312 | + | |
5308 | 5313 | | |
5309 | 5314 | | |
5310 | 5315 | | |
| |||
13560 | 13565 | | |
13561 | 13566 | | |
13562 | 13567 | | |
| 13568 | + | |
| 13569 | + | |
| 13570 | + | |
| 13571 | + | |
| 13572 | + | |
| 13573 | + | |
| 13574 | + | |
| 13575 | + | |
| 13576 | + | |
| 13577 | + | |
| 13578 | + | |
| 13579 | + | |
| 13580 | + | |
| 13581 | + | |
| 13582 | + | |
| 13583 | + | |
| 13584 | + | |
| 13585 | + | |
| 13586 | + | |
| 13587 | + | |
| 13588 | + | |
| 13589 | + | |
| 13590 | + | |
| 13591 | + | |
| 13592 | + | |
| 13593 | + | |
| 13594 | + | |
| 13595 | + | |
| 13596 | + | |
| 13597 | + | |
| 13598 | + | |
| 13599 | + | |
| 13600 | + | |
| 13601 | + | |
| 13602 | + | |
| 13603 | + | |
| 13604 | + | |
| 13605 | + | |
| 13606 | + | |
| 13607 | + | |
| 13608 | + | |
| 13609 | + | |
13563 | 13610 | | |
13564 | 13611 | | |
13565 | | - | |
| 13612 | + | |
13566 | 13613 | | |
13567 | | - | |
13568 | | - | |
13569 | | - | |
| 13614 | + | |
| 13615 | + | |
| 13616 | + | |
13570 | 13617 | | |
13571 | 13618 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
1428 | 1428 | | |
1429 | 1429 | | |
1430 | 1430 | | |
1431 | | - | |
| 1431 | + | |
1432 | 1432 | | |
1433 | 1433 | | |
1434 | 1434 | | |
1435 | 1435 | | |
1436 | | - | |
| 1436 | + | |
1437 | 1437 | | |
1438 | 1438 | | |
1439 | 1439 | | |
| |||
2001 | 2001 | | |
2002 | 2002 | | |
2003 | 2003 | | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
2004 | 2009 | | |
2005 | 2010 | | |
2006 | 2011 | | |
| |||
2286 | 2291 | | |
2287 | 2292 | | |
2288 | 2293 | | |
2289 | | - | |
| 2294 | + | |
2290 | 2295 | | |
2291 | 2296 | | |
2292 | 2297 | | |
| |||
5304 | 5309 | | |
5305 | 5310 | | |
5306 | 5311 | | |
5307 | | - | |
| 5312 | + | |
5308 | 5313 | | |
5309 | 5314 | | |
5310 | 5315 | | |
| |||
9444 | 9449 | | |
9445 | 9450 | | |
9446 | 9451 | | |
9447 | | - | |
| 9452 | + | |
9448 | 9453 | | |
9449 | 9454 | | |
9450 | 9455 | | |
| |||
9681 | 9686 | | |
9682 | 9687 | | |
9683 | 9688 | | |
9684 | | - | |
| 9689 | + | |
9685 | 9690 | | |
9686 | 9691 | | |
9687 | 9692 | | |
| |||
10437 | 10442 | | |
10438 | 10443 | | |
10439 | 10444 | | |
10440 | | - | |
| 10445 | + | |
10441 | 10446 | | |
10442 | 10447 | | |
10443 | 10448 | | |
| |||
11093 | 11098 | | |
11094 | 11099 | | |
11095 | 11100 | | |
11096 | | - | |
| 11101 | + | |
11097 | 11102 | | |
11098 | 11103 | | |
11099 | 11104 | | |
11100 | 11105 | | |
11101 | | - | |
| 11106 | + | |
11102 | 11107 | | |
11103 | 11108 | | |
11104 | 11109 | | |
| |||
11254 | 11259 | | |
11255 | 11260 | | |
11256 | 11261 | | |
11257 | | - | |
| 11262 | + | |
11258 | 11263 | | |
11259 | 11264 | | |
11260 | 11265 | | |
11261 | 11266 | | |
11262 | | - | |
| 11267 | + | |
11263 | 11268 | | |
11264 | 11269 | | |
11265 | 11270 | | |
11266 | 11271 | | |
11267 | | - | |
| 11272 | + | |
11268 | 11273 | | |
11269 | 11274 | | |
11270 | 11275 | | |
11271 | 11276 | | |
11272 | | - | |
| 11277 | + | |
11273 | 11278 | | |
11274 | 11279 | | |
11275 | 11280 | | |
11276 | 11281 | | |
11277 | | - | |
| 11282 | + | |
11278 | 11283 | | |
11279 | 11284 | | |
11280 | 11285 | | |
11281 | 11286 | | |
11282 | | - | |
| 11287 | + | |
11283 | 11288 | | |
11284 | 11289 | | |
11285 | 11290 | | |
11286 | 11291 | | |
11287 | | - | |
| 11292 | + | |
11288 | 11293 | | |
11289 | 11294 | | |
11290 | 11295 | | |
11291 | 11296 | | |
11292 | | - | |
| 11297 | + | |
11293 | 11298 | | |
11294 | 11299 | | |
11295 | 11300 | | |
11296 | 11301 | | |
11297 | | - | |
| 11302 | + | |
11298 | 11303 | | |
11299 | 11304 | | |
11300 | 11305 | | |
11301 | 11306 | | |
11302 | | - | |
| 11307 | + | |
11303 | 11308 | | |
11304 | 11309 | | |
11305 | 11310 | | |
11306 | 11311 | | |
11307 | | - | |
| 11312 | + | |
11308 | 11313 | | |
11309 | 11314 | | |
11310 | 11315 | | |
11311 | 11316 | | |
11312 | | - | |
| 11317 | + | |
11313 | 11318 | | |
11314 | 11319 | | |
11315 | 11320 | | |
| |||
13543 | 13548 | | |
13544 | 13549 | | |
13545 | 13550 | | |
| 13551 | + | |
| 13552 | + | |
| 13553 | + | |
| 13554 | + | |
| 13555 | + | |
| 13556 | + | |
| 13557 | + | |
| 13558 | + | |
| 13559 | + | |
| 13560 | + | |
| 13561 | + | |
| 13562 | + | |
| 13563 | + | |
| 13564 | + | |
| 13565 | + | |
| 13566 | + | |
| 13567 | + | |
| 13568 | + | |
| 13569 | + | |
| 13570 | + | |
| 13571 | + | |
| 13572 | + | |
| 13573 | + | |
| 13574 | + | |
| 13575 | + | |
| 13576 | + | |
| 13577 | + | |
| 13578 | + | |
| 13579 | + | |
| 13580 | + | |
| 13581 | + | |
| 13582 | + | |
| 13583 | + | |
| 13584 | + | |
| 13585 | + | |
| 13586 | + | |
| 13587 | + | |
| 13588 | + | |
| 13589 | + | |
| 13590 | + | |
| 13591 | + | |
| 13592 | + | |
13546 | 13593 | | |
13547 | 13594 | | |
13548 | | - | |
| 13595 | + | |
13549 | 13596 | | |
13550 | | - | |
13551 | | - | |
13552 | | - | |
| 13597 | + | |
| 13598 | + | |
| 13599 | + | |
13553 | 13600 | | |
13554 | 13601 | | |
0 commit comments