Python Forum
How to extract (x,y) coordinates of the boundary of a .tif image?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to extract (x,y) coordinates of the boundary of a .tif image?
#1
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]/127
It 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.
Reply
#2
do you have a question?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#3
(Feb-05-2017, 08:26 AM)Skaperen Wrote: do you have a question?

Yes, it's in the title.  Smile
Reply
#4
that kind o question needs to go to the bar.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
This seems to have the answer you seek: http://stackoverflow.com/questions/15800...to-memory/
Reply
#6
(Feb-05-2017, 12:22 PM)Larz60+ Wrote: This seems to have the answer you seek: http://stackoverflow.com/questions/15800...to-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

[Image: 9MpDhXj.png]
Reply
#7
Sorry, I saw a method of doing that in PyGame here http://stackoverflow.com/questions/20165...e-position
You may be able to reverse engineer the code for rect if you don't find an easier method.
Reply
#8
(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.
Reply
#9
Using the pillow (PIL) module:
from PIL import Image
im=Image.open('image.tif')
im.size
Output:
(127, 16)
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#10
(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/15800...to-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

[Image: 9MpDhXj.png]

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?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Get the image's coordinates not the canvas' when navigate on an image hobbyist 9 1,837 Jul-21-2022, 03:29 PM
Last Post: deanhystad
  Crop Image to Bounding Box Coordinates sallyjc81 2 5,056 Jul-23-2020, 08:46 AM
Last Post: sallyjc81
  periodic boundary contions grknkilicaslan 1 1,916 Jul-18-2020, 10:16 PM
Last Post: Gribouillis
  How to extract temperature value of pixels of a thermal image recorded by IR camera hamacvan 1 14,476 Jan-13-2019, 06:06 PM
Last Post: Larz60+
  How to extract digits in table of image using python SuSeegio 3 3,094 Dec-05-2018, 10:47 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020