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

All segmap images are black #1

Closed
Sangwon91 opened this issue May 12, 2021 · 4 comments
Closed

All segmap images are black #1

Sangwon91 opened this issue May 12, 2021 · 4 comments

Comments

@Sangwon91
Copy link

I just realized all the segmap images are black. Is this normal? When I load a segmap.jpg, all pixel values are 0.

@by256
Copy link
Owner

by256 commented May 12, 2021

Hi,

If you try to view a segmap as an image, the particle instance class values will be interpreted as image pixel values. This means that particles with class 1 or 2 for example will be essentially invisible in the image since these are very low pixel values.

I would suggest visualizing the segmap with matplotlib using plt.imshow or plt.matshow with a discrete colormap so that the individual classes are visible. The colormap I usually use is tab20, but you can choose this to your taste.

Please let me know if this solves your problem so that I can close the issue. If not, let me know and we can discuss it further.

Batuhan

@by256
Copy link
Owner

by256 commented May 12, 2021

I also just remembered that the segmaps are 32bit integer images as opposed to 8 bits. This is because some images contained greater than 256 particles, and 8 bits were not enough to encode these values in a segmap. This may explain why they appear as black.

@Sangwon91
Copy link
Author

You are right. The problem was that cv.imread() automatically converts image type to np.uint8 .
All problems are resolved.

Thank you!

@by256
Copy link
Owner

by256 commented May 12, 2021

Glad to help.

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

No branches or pull requests

2 participants