Skip to content
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

dtype not recognized/unsupported #74

Closed
nightrook779 opened this issue Mar 11, 2020 · 6 comments
Closed

dtype not recognized/unsupported #74

nightrook779 opened this issue Mar 11, 2020 · 6 comments
Labels

Comments

@nightrook779
Copy link

I am following the example in tutorial.
I am getting a dtype not recognized/unsupported exception at

bkg_image = bkg.back()

when I execute

bkg = sep.Background(data)
bkg_image = bkg.back()

What am I doing wrong?

@kbarbary
Copy link
Owner

What is the dtype of data? You can see this by doing data.dtype.

@nightrook779
Copy link
Author

nightrook779 commented Mar 12, 2020

dtype of data:
<class 'numpy.ndarray'>

dtype of bkg:
<class 'sep.Background'>

@kbarbary
Copy link
Owner

You should see something like dtype('float64'). I'm not sure how you could get that result for data.dtype. Is data a numpy array? Maybe you could post a minimal example.

@nightrook779
Copy link
Author

Oh. I see what happened.
I am using openCV to import and manipulate the image, since I can't use fitsio. My bad.
Any alternatives/thoughts on how to do this?

@kbarbary
Copy link
Owner

Regardless of the method you use to read the data, you need to get it in the form of a 2-d numpy array of floats or ints. This should be possible with opencv, but I'm not that familiar with the library.

@nightrook779
Copy link
Author

nightrook779 commented Mar 14, 2020

Alright. I was able to get the code working. Whats happening is that since I am reading jpeg files, numpy array is uint8. Converting to float64 fixed the issue. Code I used:

data = cv2.imread('pinwheel.jpg')
data = cv2.cvtColor(data,cv2.COLOR_BGR2GRAY)
data = data.astype(np.float64)

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

2 participants