all groups > dotnet drawing api > july 2007 >
You're in the

dotnet drawing api

group:

Sparkling Lasoo Wand Tool !


Sparkling Lasoo Wand Tool ! ohs
7/16/2007 10:10:04 AM
dotnet drawing api:
I'm looking for a way to 'Lasoo' a section of an image.

Similar to the sparkling wand mask tools in Photoshop and the likes...

Hopefully to return a region object.

Any pointers ?





Any ideas ?
Re: Sparkling Lasoo Wand Tool ! Bob Powell [MVP]
7/16/2007 8:53:57 PM
The accumulation of the points would be done in the classic way. See various
implementations of Scribble C#.

The "marching ants" lasso can be drawn using a GraphicsPath taken from the
points gathered and using a custom brush that changes the custom dash
pattern a fwe times a second.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.



[quoted text, click to view]

Re: Sparkling Lasoo Wand Tool ! ohs
7/17/2007 2:06:04 AM
The 'Classic Way' ?
What / where is Scribble C# ? Do you mean the MS freehand drawing demo ?

Sorry don't think my original post was clear... the key was in the
'sparkling wand'.

I didn't want to elaborate incase I steered the response in the wrong
direction.

What I need is the functionality of a tool that when clicked on an point on
an image 'lasoos' a Region of similar coloured pixels (possibley with some
form of edge detection).

A basic implementation would be to create a Region from a blue circle (of
unknown location and dimension) on a green background.

Ultimately I would like to be able to tune the detection parameters to mask
a photographic object, say a face in a portrait.

Does that make more sense ?


[quoted text, click to view]
Re: Sparkling Lasoo Wand Tool ! ohs
7/17/2007 7:50:03 AM
Tried that already.

Inspiration ?

It gave me a huge headache !
Couldn't follow it there's so many variables and constants.

Any more ideas folks ?


[quoted text, click to view]
Re: Sparkling Lasoo Wand Tool ! SharpCoderMP
7/17/2007 3:16:32 PM
take a look at code behind paint.net - guys did great job there, you can
find lots of inspiration as the source code is made public available.
though i imagine you may get a bit confused when you first time take a
look at their code ;)

[quoted text, click to view]
Re: Sparkling Lasoo Wand Tool ! Andrew Brook
7/17/2007 4:25:20 PM
how about a recursive function, starting with the pixel you click on like

sorry for the rubbish pseudo code :)

function CheckPixel (pixel start_ pixel)
for each adjacent pixel as adj_pixel
if pixel passes criteria (e.g in colour range)
include pixel in selection
CheckPixel(adj_pixel)
if not
recursion unravels. (do nothing)

I guess you'd have to calculate the outerbounds of the selected pixels
somehow as well.
Also, it may be a bit overkill to use recursion, perhaps it would lead to
stack overflows and the like :)

Andrew

[quoted text, click to view]

AddThis Social Bookmark Button