### Tags: agic, area, boundary, function, implement, implementation, inphotoshop, magic, matlab, programming, similar, similar-graylevel, tool, wand

# Magic Wand Implementation

On Programmer » Matlab

3,368 words with 3 Comments; publish: Wed, 07 May 2008 04:02:00 GMT; (20062.50, « »)

Hi there,

I am trying to implement a function similar to the 'magic wand' tool in

Photoshop to find the boundary of similar-graylevel area starting from a

point within it. So basically I want to start from a pixel in the region

which has a very similar gray level not varying by more than 5 gray values

and find its ends in all directions.

Could you please tell me where I can find such an implementation or an

efficient algorithm to do the same.

Thanks a ton,

Soumyadip.

*http://matlab.todaysummary.com/q_matlab_35133.html*

All Comments

Leave a comment...

- 3 Comments
- Soumyadip Rakshit wrote:
>

> Hi there,

> I am trying to implement a function similar to the 'magic wand'

> tool in

> Photoshop to find the boundary of similar-graylevel area starting

> from a

> point within it. So basically I want to start from a pixel in the

> region

> which has a very similar gray level not varying by more than 5 gray

> values

> and find its ends in all directions.

> Could you please tell me where I can find such an implementation or

> an

> efficient algorithm to do the same.

> Thanks a ton,

> Soumyadip.

Search in the FEX

#1; Wed, 07 May 2008 04:03:00 GMT

- Soumyadip Rakshit wrote:
- In article <ItGF3p.8Eu.matlab.todaysummary.com.bath.ac.uk>, "Soumyadip Rakshit"
<soumyadiprakshit.matlab.todaysummary.com.gmx.net> wrote:

> Hi there,

> I am trying to implement a function similar to the 'magic wand' tool in

> Photoshop to find the boundary of similar-graylevel area starting from a

> point within it. So basically I want to start from a pixel in the region

> which has a very similar gray level not varying by more than 5 gray values

> and find its ends in all directions.

> Could you please tell me where I can find such an implementation or an

> efficient algorithm to do the same.

> Thanks a ton,

> Soumyadip.

--

If you have the Image Processing Toolbox, you could convert your image to

binary by defining an acceptable interval of greylevels. Then use

'imfill' to start at the desired pixel and fill out the region surrounding

it, and finally use 'bwboundaries' to find the regions's boundary.

Confession: I am having to speculate here, since I don't have that toolbox

myself to try any of this out.

(Remove "xyzzy" and ".invalid" to send me email.)

Roger Stafford

#2; Wed, 07 May 2008 04:04:00 GMT

- In article <ItGF3p.8Eu.matlab.todaysummary.com.bath.ac.uk>, "Soumyadip Rakshit"
- Thanks so much. This has been of great help. :)!
"Roger Stafford" <ellieandrogerxyzzy.matlab.todaysummary.com.mindspring.com.invalid> wrote in

message

news:ellieandrogerxyzzy-2101061218050001.matlab.todaysummary.com.pool0873.cvx4-bradley.dialup.earthlink.net...[colo

r=darkred]

> In article <ItGF3p.8Eu.matlab.todaysummary.com.bath.ac.uk>, "Soumyadip Rakshit"

> <soumyadiprakshit.matlab.todaysummary.com.gmx.net> wrote:

>

> --

> If you have the Image Processing Toolbox, you could convert your image to

> binary by defining an acceptable interval of greylevels. Then use

> 'imfill' to start at the desired pixel and fill out the region surrounding

> it, and finally use 'bwboundaries' to find the regions's boundary.

> Confession: I am having to speculate here, since I don't have that toolbox

> myself to try any of this out.

> (Remove "xyzzy" and ".invalid" to send me email.)

> Roger Stafford[/color]

#3; Wed, 07 May 2008 04:05:00 GMT

- Thanks so much. This has been of great help. :)!