キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Floodfill Algorithm

Hi,
 
I need a floodfill algorithm in LabVIEW version 7.1 that uses purely LabVIEW commands, no CINs or DLLs.  I'd use IMAQ, but it is too complicated to use, and also I don't have the full package.  If I could just get the algorithm, because I don't need a subvi, just something that can perform floodfill.  I would really appreciate your help!  Thanks!
 
7J1L1M
0 件の賞賛
メッセージ1/19
6,800件の閲覧回数

"7J1L1M" <x@no.email> wrote in message news:1162942807406-437957@exchange.ni.com...
Hi,
&nbsp;
I need a floodfill algorithm in LabVIEW version 7.1 that uses purely LabVIEW commands, no CINs or DLLs.&nbsp; I'd use IMAQ, but it is too complicated to use, and also I don't have the full package.&nbsp; If I could just get the algorithm, because I don't need a subvi, just something that can perform floodfill.&nbsp; I would really appreciate your help!&nbsp; Thanks!
&nbsp;
7J1L1M




http://en.wikipedia.org/wiki/Flood_fill


Regards,


Wiebe.
0 件の賞賛
メッセージ2/19
6,787件の閲覧回数

Thanks Wiebe.  Would someone else have a LabVIEW program as well?  スマイリー 平静

7J1L1M

0 件の賞賛
メッセージ3/19
6,779件の閲覧回数

"7J1L1M" <x@no.email> wrote in message news:1162995008897-438264@exchange.ni.com...
Thanks Wiebe.&nbsp; Would someone else have a LabVIEW program as well?&nbsp; スマイリー 平静
7J1L1M



OK, I though that was to easy..


Why do you need the algorithm? Is it just to color the picture? Do you need the total nr of connecting pixels?


Also important... How fast should it be?


Normally, I'd use NI Vision to do a threshold (bandpass) on the color, and then a blob analysis. That would get you you the same result as a floodfill.


Here is some source code, but it's in C. Converting it to LabVIEW can be tricky (if it has to be fast):


http://student.kuleuven.be/~m0216922/CG/floodfill.html


Here's some in depth information:


http://www.math.tau.ac.il/~dcor/Graphics/cg-slides/flood-fill03.pdf


Regards,


Wiebe.
0 件の賞賛
メッセージ4/19
6,765件の閲覧回数

Wiebe,

Thanks for you reply.  I have two main reasons for the floodfill thing.  For one program, I need it for a picture editor, but I can't use IMAQ (hard to use) and I don't have quite all the commands.  I also need to use the algorithm to tailor up a mask for a picture interface.  I was also hoping to use something that doesn't require outside files (just in case it causes a computer failure, my LabVIEW doesn't seem to like them very much...).  I will try the C-Code, but how would I implement it into LabVIEW?  I am not very good at the DLL interface node, everytime I do it myself, I always mess up.  Thanks for your help, and I look forward to your next email.

7J1L1M

0 件の賞賛
メッセージ5/19
6,758件の閲覧回数

Oh, sorry, I forgot to specify the speed and other things.

I would prefer it to be a nice, fast, and simple algorithm.

Also, I need its sensitivity to be definable (4 and 8 connectivity).  Sorry I forgot to say that!

 

7J1L1M

0 件の賞賛
メッセージ6/19
6,756件の閲覧回数

Ok... It's not that hard. Just don't try to do it with recursion, that would complicate things a lot! I might want to use the algorithm myself, so I made the vi. Although it spoils your fun of making the vi, I'll post it here.

 

This implementation uses the naive, simple algorithm. The scanline algorithm should be much ("orders of magnitude", wikipedia) faster, but harder to implement. So simple and fast are, as often, mutualy exclusive.

 

Regards,

 

Wiebe.

 

メッセージ7/19
6,736件の閲覧回数

Wow!  Thanks!  スマイリー とてもハッピー

I was trying to make something that would recursively follow the outline of the fill thing.  Would that have worked as well?  Thanks again!

7J1L1M

0 件の賞賛
メッセージ8/19
6,731件の閲覧回数

By the way, I tried out the floodfill vi.  It works great, but at first it seemed to have trouble coloring in a line when it got long.  This was when the pixel selector was set to 8 and the line I tried to floodfill was at a 45 degree angle.  It only partially colored it, then its like it got to a limit of pixels it could color in.  Now it suddenly works.  Maybe it was just me, but just in case, I thought you should know.  Other than that, it works great!  Thanks again!

7J1L1M

0 件の賞賛
メッセージ9/19
6,723件の閲覧回数

"7J1L1M" <x@no.email> wrote in message news:1163085009236-438967@exchange.ni.com...
Wow!&nbsp; Thanks!&nbsp; スマイリー とてもハッピー
I was trying to make something that would recursively follow the outline of the fill thing.&nbsp; Would that have worked as well?&nbsp; Thanks again!
7J1L1M



This problem seems very simple. But searching the web, you'll soon find that great mind have thought about it (over and over again). I think that inventing a fast, low memory profile, elegant algorithm would get you noticed. I didn't even try to come up with something for myself.


Following an outline is tricky, because (for one) there might be an area inside the outlined area that should not be filled.


While testing, I thought it didn't work. It turned out I didn't pick the same color, althought they looked the same. Perhaps that happened to you too (in the other thread). Otherwise I don't know what it might have been.


Regards,


Wiebe.
0 件の賞賛
メッセージ10/19
6,711件の閲覧回数