How to get coodinates of border to txt file
How to get coodinates of border to txt file
I am Windows user. I have image, where I have deleted background and would like to get the edge of image into txt file. I mean, there would be need to make inner border to the image, which is 1px wide, and then to write the x,y coordinates to txt file. For example, if I have picture of figure with removed background, I would get the edge of the picture. I believe, it would not be hard to do it with help of border function. But what if the image is more hard, and has more empty areas like a ladder? Would it be possible to separate every empty area (inner borders would be separated as loops)? Then the output could have x,y list followed by empty line, then next x,y list , and so on. I am interested if this would be possible. I would like to use the list in macro to use in one program.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to get coodinates of border to txt file
Make everything black that you want to get coordinates for and the rest white. Then in unix you could do
convert image txt:- | tail -n +2 | grep "black"
I do not know if Windows supports pipes, tail or grep. But see
http://www.imagemagick.org/Usage/files/#txt
http://www.imagemagick.org/Usage/windows/
convert image txt:- | tail -n +2 | grep "black"
I do not know if Windows supports pipes, tail or grep. But see
http://www.imagemagick.org/Usage/files/#txt
http://www.imagemagick.org/Usage/windows/
Re: How to get coodinates of border to txt file
What function to use to generate inner border around the areas that are not empty?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to get coodinates of border to txt file
VanGog wrote:What function to use to generate inner border around the areas that are not empty?
either -edge or -morphology edgin
you may need to threshold the result to make binary black/white