Skip to content

Image related methods #1323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fujiisoup opened this issue Mar 24, 2017 · 9 comments
Closed

Image related methods #1323

fujiisoup opened this issue Mar 24, 2017 · 9 comments
Labels

Comments

@fujiisoup
Copy link
Member

Currently I'm using xarray to handle multiple images (typically, a sequence of images),
and I feel it would be convenient if xarray supports image related functions.

There may be many possibilities, but particular methods I want to have in xarray are

  1. xr.open_image(File)
    Currently, I open image by PILLOW, convert to np.ndarray, extract its attributes, then construct xr.DataArray from them.
    If I can do it by 1 line, it would be very great.

  2. xr.DataArray.expand_dims(dim)
    I want to add additional channel dimension to grey scale images (size [W x H] -> [W x H x 1]),
    in order to pass them into convolutional neural network, which usually accepts 4-dimensional tensor [Batch x W x H x channel].

Image (possibly also video?) is naturally high-dimensional and
I guess it would fit xarray's concept.
Is this sufficiently broad interest?

@shoyer
Copy link
Member

shoyer commented Mar 24, 2017

xr.open_image(File)

What metadata would you get from images? [row, column, channel] for a typical color image? I guess this would usually follow skimage's coordinate conventions

If we added this, we would want to defer all the image reading out to an external library such as skimage, e.g., by leveraging skimage.io.imread

xr.DataArray.expand_dims(dim)

You're definitely not the first person to ask about this:
http://stackoverflow.com/questions/34987972/expand-dimensions-xray

Yes, this would definitely be welcome in some form.

@fujiisoup
Copy link
Member Author

@shoyer Thank you for the comment.

What metadata would you get from images?

I'm currently use tag data in tiff files. I guess some people may use exif metadata in jpg files.

If we added this, we would want to defer all the image reading out to an external library

Yes, I agree.
skimage is the best candidate?
I did not know much about skimage, but this library looks great.

open_image method is possibly overkill...?
I will keep this issue just open for a while until similar request comes out.

You're definitely not the first person to ask about this:

My second request seems more general.
I will post it as a separate issue.

@ebo
Copy link

ebo commented Mar 12, 2018

When I open up a tiff file, it only shows a few attributes. I have some images which have extensive provenance metadata. How do you access them?

eg:
NITF_CSEXRA_SENSOR=PAN
NITF_PIAIMC_SENSNAME=QB02
...

@jhamman
Copy link
Member

jhamman commented Mar 16, 2018

@ebo - I think your issue falls more in line with what was discussed in #1582. Can you read over that issue and perhaps comment there?

@ebo
Copy link

ebo commented Mar 16, 2018

thank you. I had stumbled onto the "tags" yesterday and had not had time to post back here that I had found it, and sorted through all the tags(), tags(1), and tags(ns="something"). The thing that was quite confusing was you access them in GDAL via GetMetadata, and not GetTags. So, I think I am sorted now. I would agree that there needs to be more info there, but it is possible that it is already available, but not in a single place.

@scollis
Copy link

scollis commented Jun 22, 2018

Hey Devs and Users... Just about to embark on a project where I want to populate an X-Array data set with a set of images.. Did this progress? Just trying to save an hour building my own hook to skimage

@ebo
Copy link

ebo commented Jun 22, 2018 via email

@stale
Copy link

stale bot commented May 22, 2020

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity

If this issue remains relevant, please comment here or remove the stale label; otherwise it will be marked as closed automatically

@stale stale bot added the stale label May 22, 2020
@stale stale bot closed this as completed Jun 21, 2020
@dschneiderch
Copy link

I am looking at using xarray for managing image data. it looks like the equivalent of an xr.open_image hasn't been developed so consider this a vote in favor 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants