Image outlines that preserve grayscale values
Posted: 2012-07-26T11:49:05-07:00
Suppose I have a grayscale image with a bunch of disconnected blobs, and all the pixels in a particular blob have the same (non-zero) grayscale value, and each blob has a different grayscale value associated with it. The blobs may have holes in them. Pixels not in a blob have a grayscale value of zero.
I would like an image of the outlines (say 1 pixel wide) of the blobs that preserves the grayscale values, e.g., the pixels for the outline of blob 7 have a grayscale value of 7. Pixels not in an outline should have a grayscale value of zero.
Using convert with "-edge 1" gives me the outlines, but does not preserve the grayscale values. I've searched around for how to do this with masking or compose, but haven't found or figured out a solution. I'm an IM novice.
I'm using IM 6.6.9-7 2012-02-22 Q16 on linux. Thanks for the help.
I would like an image of the outlines (say 1 pixel wide) of the blobs that preserves the grayscale values, e.g., the pixels for the outline of blob 7 have a grayscale value of 7. Pixels not in an outline should have a grayscale value of zero.
Using convert with "-edge 1" gives me the outlines, but does not preserve the grayscale values. I've searched around for how to do this with masking or compose, but haven't found or figured out a solution. I'm an IM novice.
I'm using IM 6.6.9-7 2012-02-22 Q16 on linux. Thanks for the help.