getting the edges of an image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: getting the edges of an image

Post by Bonzo »

Are you running the same code posted and using the same image?
HugoRune
Posts: 90
Joined: 2009-03-11T02:45:12-07:00
Authentication code: 8675309

Re: getting the edges of an image

Post by HugoRune »

perhaps the output file is opened in another program, so convert cannot write to it?
check the last-changed date of "christmas_tree_01_alpha_edge2n.png" to make sure convert actually writes to the file.
Or delete the output file first, and rerun the command.

also
type

convert -version

what does it tell you?
sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

Re: getting the edges of an image

Post by sin »

http://img852.imageshack.us/img852/1784/sneg.png

the above image has some blur and unwanted stuff. how should i clean up this image so that i can get only the outline of the image??
sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

Re: getting the edges of an image

Post by sin »

http://img852.imageshack.us/img852/1784/sneg.png

please tel me how can i clean up this image(like the black ones at the top and around the image.everything should be white except the image) so that i cna get only the outline of the image and i dont want the unwanted stuff around it.
sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

Re: getting the edges of an image

Post by sin »

Bonzo wrote:Are you running the same code posted and using the same image?
yes sir.i ma using the same image.
HugoRune
Posts: 90
Joined: 2009-03-11T02:45:12-07:00
Authentication code: 8675309

Re: getting the edges of an image

Post by HugoRune »

sin wrote:http://img852.imageshack.us/img852/1784/sneg.png

the above image has some blur and unwanted stuff. how should i clean up this image so that i can get only the outline of the image??
If that is the image you are starting with, you could use the conditional erode method used in this thread:
viewtopic.php?f=1&t=18707

However there seems to be little point in tackling that entirely new problem before your old one is solved.
Did you try the suggestions above, and what where the results?
sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

Re: getting the edges of an image

Post by sin »

HugoRune wrote:
sin wrote:http://img852.imageshack.us/img852/1784/sneg.png

the above image has some blur and unwanted stuff. how should i clean up this image so that i can get only the outline of the image??
If that is the image you are starting with, you could use the conditional erode method used in this thread:
viewtopic.php?f=1&t=18707

However there seems to be little point in tackling that entirely new problem before your old one is solved.
Did you try the suggestions above, and what where the results?

no sir.
i have tried for the chistmas tree example also but it is not working :( . the result is complete white or complete black(depending on the background). So i started working in the other way(this is the other way) using "monochrome" and getting the edges(without alpha extraction--because extracting alpha is just giving me the blank image). The recently posted image is the result of getting the edges but you can see there is some noise. the problem in finding the edges without alpha extraction is "it dependent on the design of the dress the person is wearing in the image(hope this won't be a problem with alpha extraction). In the image i have sent you the person is wearing a plane dress."

so please show me a way to overcome these two problems
HugoRune
Posts: 90
Joined: 2009-03-11T02:45:12-07:00
Authentication code: 8675309

Re: getting the edges of an image

Post by HugoRune »

The noise from sneg.png is mostly removed with
convert sneg.png -morphology close diamond sneg_cleaned.png
( http://www.imagemagick.org/Usage/morphology/#basic for details )

however, depending on the original image there are probably better options to get the outline that do not produce that much noise to begin with.

As for the previous problem, please try the sugestions above and report back, in particular these ones:
type

convert -version

what does it tell you?
What is your exact command and what is the exact error message?
check the last-changed date of "christmas_tree_01_alpha_edge2n.png" to make sure convert actually writes to the file.
Or delete the output file first, and rerun the command.
Werty
Posts: 66
Joined: 2010-08-06T05:37:36-07:00
Authentication code: 8675308

Re: getting the edges of an image

Post by Werty »

Works on my Win7 32-bit with IM 6.6.3.0.
Windows 7 user
sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

Re: getting the edges of an image

Post by sin »

Werty wrote:Works on my Win7 32-bit with IM 6.6.3.0.

really?
can you please send me the download link for the above IM version ?

please.
sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

Re: getting the edges of an image

Post by sin »

hi,

please give the download link for IM 6.6.3.0 for windows 7(32-bit).

it seems that the alpha extraction is working well in that version. i am using latest version of imagemagick 6.6.9(windows 7) but i don't understand why it is not working in my pc :( :(

please solve my problem.!!!!

all my work has been halted because of this :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: getting the edges of an image

Post by fmw42 »

sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

Re: getting the edges of an image

Post by sin »

thank you. it is working for the previous version.

but the problem is it is not working only for the images with plane backgrounds or plane transparent ones.
can i get the image outline(like christmas tree) for the following images??

http://img807.imageshack.us/img807/8774/ihbhju.jpg

http://img542.imageshack.us/img542/244/nkjdc.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: getting the edges of an image

Post by fmw42 »

sin wrote:thank you. it is working for the previous version.

but the problem is it is not working only for the images with plane backgrounds or plane transparent ones.
can i get the image outline(like christmas tree) for the following images??

http://img807.imageshack.us/img807/8774/ihbhju.jpg

http://img542.imageshack.us/img542/244/nkjdc.png

Those images will be very hard to remove the background as the background is not uniform. You will likely need to trace the outline manually. Alternately, see background removal at http://www.imagemagick.org/Usage/masking/#bg_remove
sin
Posts: 46
Joined: 2011-04-23T11:06:13-07:00
Authentication code: 8675308

Re: getting the edges of an image

Post by sin »

fmw42 wrote:

Code: Select all

Not Found

The requested URL /openclipart/clipart/recreation/holiday/christmas/christmas_tree_02_l.png was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I searched google and found another image. So here are two possible approaches.

Image

Convert to grayscale, extract edges, flatten alpha channel to black:
convert christmas_tree_01.png -colorspace gray -edge 2 -background black -flatten christmas_tree_01_gray_edge2_flat.png
Image

Extract alpha channel, extract edge from alpha channel:
convert christmas_tree_01.png -alpha extract -edge 2 christmas_tree_01_alpha_edge2.png
Image

see
http://www.imagemagick.org/script/comma ... s.php#edge
http://www.imagemagick.org/Usage/transform/#edge
http://www.imagemagick.org/Usage/masking/#alpha_extract



can you please tell me the perlmagick code for these commands?
Post Reply