![]() |
How to extract (x,y) coordinates of the boundary of a .tif image? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to extract (x,y) coordinates of the boundary of a .tif image? (/thread-1933.html) |
How to extract (x,y) coordinates of the boundary of a .tif image? - Pythonista - Feb-05-2017 I want to get the (x,y) coordinates of the boundary of this TIF image - goo.gl/Uai8lR I am using Python notebook in Anaconda distribution. I just need the height in pixels, so far I have used this code - foo = misc.imread("90.tif") prof = foo.sum(axis = 0) prof = prof[:,1]/127It reads the green channel of RGB and dividing by 127 gives the height in pixel. But it does not capture overhang regions. I think it will be a good idea to extract the (x,y) coordinates instead. Any help is appreciated. RE: How to extract (x,y) coordinates of the boundary of a .tif image? - Skaperen - Feb-05-2017 do you have a question? RE: How to extract (x,y) coordinates of the boundary of a .tif image? - Pythonista - Feb-05-2017 (Feb-05-2017, 08:26 AM)Skaperen Wrote: do you have a question? Yes, it's in the title. ![]() RE: How to extract (x,y) coordinates of the boundary of a .tif image? - Skaperen - Feb-05-2017 that kind o question needs to go to the bar. RE: How to extract (x,y) coordinates of the boundary of a .tif image? - Larz60+ - Feb-05-2017 This seems to have the answer you seek: http://stackoverflow.com/questions/15800704/python-get-image-size-without-loading-image-into-memory/ RE: How to extract (x,y) coordinates of the boundary of a .tif image? - Pythonista - Feb-05-2017 (Feb-05-2017, 12:22 PM)Larz60+ Wrote: This seems to have the answer you seek: http://stackoverflow.com/questions/15800704/python-get-image-size-without-loading-image-into-memory/ That question is about getting the image size, i.e. 800 * 600 pixels. I want to get the (x,y) coordinates (in terms of pixels) of the pixels located on the boundary (red line). The original TIF file is here - goo.gl/Uai8lR ![]() RE: How to extract (x,y) coordinates of the boundary of a .tif image? - Larz60+ - Feb-05-2017 Sorry, I saw a method of doing that in PyGame here http://stackoverflow.com/questions/20165686/pygame-image-position You may be able to reverse engineer the code for rect if you don't find an easier method. RE: How to extract (x,y) coordinates of the boundary of a .tif image? - micseydel - Feb-05-2017 (Feb-05-2017, 10:53 AM)Skaperen Wrote: that kind o question needs to go to the bar.If we're going to end up with Python code, the Bar isn't the right place. RE: How to extract (x,y) coordinates of the boundary of a .tif image? - Ofnuts - Feb-05-2017 Using the pillow (PIL) module: from PIL import Image im=Image.open('image.tif') im.size
RE: How to extract (x,y) coordinates of the boundary of a .tif image? - Skaperen - Feb-06-2017 (Feb-05-2017, 12:51 PM)Pythonista Wrote:(Feb-05-2017, 12:22 PM)Larz60+ Wrote: This seems to have the answer you seek: http://stackoverflow.com/questions/15800704/python-get-image-size-without-loading-image-into-memory/ maybe the question should have been: how do i get the border outline coordinates of this object (which object?) in an image? do you want every pixel or just the points to draw lines from and to? |