Copy link to clipboard
Copied
I've spent more time than I anticipated.. After creating my LED board generator (which is much more complex than this simple problem) I though this would be a piece of cake... but alas..
In the end I want the bounding box of an arbitrary shape (whole shape, if the image got two disjoint shapes, then the total bounding box)
So naturally the easiest (not the most efficeint I presume) way I could think was, Scan the input from all four sides and stop at the first pixel encounter..
But I just couldn't.. from any one side. Attaching my failed attempts along with an SS for better explanation.
Hello Ayush,
your approach is going in the right direction, but is as you mentioned not very optimized, in the value processor alone you won't have another chance but if you are using a Pixelprocessor instead, it gets actually very easy and optimized, because the Pixelprocessor calculates every pixel in parallel and you can exploit this, in order to get the total bounding box of an input very fast.
Here is an overview over the compete graph, ignore the first section, it's just an input, you wo
...Copy link to clipboard
Copied
Hello Ayush,
your approach is going in the right direction, but is as you mentioned not very optimized, in the value processor alone you won't have another chance but if you are using a Pixelprocessor instead, it gets actually very easy and optimized, because the Pixelprocessor calculates every pixel in parallel and you can exploit this, in order to get the total bounding box of an input very fast.
Here is an overview over the compete graph, ignore the first section, it's just an input, you would probably use an input Node for it and do this in a subgraph, in order to reuse it, whenever you need it.
The Algorithm:
Stay healthy and creative Marco
 
Copy link to clipboard
Copied
Thank you Marco for the in-depth solution. I'll try this and some other algorithms too.
I believe thinking like this would be easier if I learn intermediate level of graphics programming and building shaders... Also a ton of maths. Gotta refresh many things I learned and forgot after high school.
Cheers :clinking_glasses:
Find more inspiration, events, and resources on the new Adobe Community
Explore Now