magicwand

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
ratneshsoni
Posts: 38
Joined: 2010-12-14T03:56:10-07:00
Authentication code: 8675308

magicwand

Post by ratneshsoni »

i want to Isolates a contiguous region of an image based upon a color determined from a user specified image coordinate.
exec("./magicwand.sh 160,200 -t 25 -f image -r outside -c wheat 1front.jpg 1frontcolor.jpg");
please provide correct way to write this code.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: magicwand

Post by anthony »

Code: Select all

convert image -fill red -fuzz 1% -draw 'color 10,10 floodfill' result
See... Replacing Colors Floodfill (draw)
http://www.imagemagick.org/Usage/color_ ... dfill_draw

Also Draw Color Fill Primitives
http://www.imagemagick.org/Usage/draw/#color

However more detail of exactly what your situation is would help.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: magicwand

Post by fmw42 »

ratneshsoni wrote:i want to Isolates a contiguous region of an image based upon a color determined from a user specified image coordinate.
exec("./magicwand.sh 160,200 -t 25 -f image -r outside -c wheat 1front.jpg 1frontcolor.jpg");
please provide correct way to write this code.

There was a bug that was fixed recently. Please download the current version and try again with a current version of IM. You may also need to provide the full path to magicwand.sh and possibly your images if they are not in the same directory. Also see how to get error messages from the exec command. See Rubblewebs.com

Or use the more direct method pointed out by Anthony above in his examples.
Last edited by fmw42 on 2010-12-21T19:46:47-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: magicwand

Post by anthony »

Apologies I did not realize you were talking about one of Fred Weinhaus's scripts.
For those trying to follow this discussion see the script provided at
http://www.fmwconcepts.com/imagemagick/magicwand/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
jumpjack
Posts: 69
Joined: 2010-12-10T05:29:16-07:00
Authentication code: 8675308

Re: magicwand

Post by jumpjack »

i want to Isolates a contiguous region of an image based upon a color determined from a user specified image coordinate.
exec("./magicwand.sh 160,200 -t 25 -f image -r outside -c wheat 1front.jpg 1frontcolor.jpg");
please provide correct way to write this code.
I want to perform same task, but on multiple areas in the image, to isolate them (just like when you do "invert selection" after using "magic wand" in graphic programs).

Can ImageMagick produce as output all the coordinates of the groups of pixels, in such a way I can process them to determine edges of each box which include each area?

I have a scanned text page; I want to"detect" each single word and save each one of them to a separate file.
I'm currently merging all letters of each word into single "blobs" using this command:

Code: Select all

convert test.gif -morphology Erode Rectangle:8x3 test2.gif
Now I want to "enclose" each blob into a box to crop it.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: magicwand

Post by anthony »

What you want is to segment the image! Nothing to do with this topic.

Look in Users Forum. There is discussions on this there.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: magicwand

Post by fmw42 »

You could try my script separate to get each segment as a separate binary image, then edge detect, then convert that to txt: format and read out all the edge pixels. See link below. But without seeing your image, I don't know if it is conducive to my script.
jumpjack
Posts: 69
Joined: 2010-12-10T05:29:16-07:00
Authentication code: 8675308

Re: magicwand

Post by jumpjack »

anthony wrote:What you want is to segment the image! Nothing to do with this topic.
.
no, i want to select white background with magicwand and then invert selection: is this feasible?

@fmw42:
Image
this pic shows how I "melt" all chars of a word into single blobs; then I want to enclose each one into a box. Can your scripts be used together to get this result?
Post Reply