P is for Practical | |
PerlMonks |
Re^3: PDL: Looking for efficient way to extract sub-images, by finding bounding boxes of "objects" (1700xfaster)by BrowserUk (Patriarch) |
on Nov 20, 2016 at 10:39 UTC ( [id://1176193]=note: print w/replies, xml ) | Need Help?? |
You might try this. It expects a reference to the raw string, and the width & height available in globals -- adapt to your preferences:
In my simulated tests, it performs 224 times faster than your posted code on a 1000x1000x1byte image and 1700 times faster on a 2000x2000:
It is also trivially adaptable to images that use short/word/doubleword/quadword sized pixels. I have a couple of ideas for a faster version, which I'll post if they pan out. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|