Quantcast
Channel: PTC Community : Discussion List - PTC Mathcad
Viewing all articles
Browse latest Browse all 2936

Floodfill algorithm

$
0
0

Hi!

 

I am working on a project regarding image analysis (object counting, area dimensions, etc..)

Using 'canny edge detector' I isolate edges and fill object or background which interests me.

I have tried using 'floodfill algorithm' from here: https://www.ptcusercommunity.com/thread/53398
but with bigger matrix, I have encountered 'not enough memory' issue.

 

So I wrote my own 'scanline floodfill algorythm'.

Algorithm is colouring next pixels until it reaches pixel with value '1', then depending on direction in which it colours, and free space, it leaves

seed with value 255(x+1) or 250(x-1). Then it checks the location of seeds and continues with colouring starting from this seed.

s3.bmp

(image is stripy because when writing, it was easier for me to find the loop which leaved UNcolored pixels)

While I was writing my algorythm, it looked promising in terms of performance, but in final form it is very slow.

I have no experience in programming so If anyone would have any idea or advice how to make it faster, it would be perfect.


Viewing all articles
Browse latest Browse all 2936

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>