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

xfuse with black and white image #59

Open
simonmfr opened this issue Nov 23, 2022 · 1 comment
Open

xfuse with black and white image #59

simonmfr opened this issue Nov 23, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@simonmfr
Copy link

Hi, xfuse convert visium works perfectly on colour images, but fails when using a black and white image. I get the same error as mentioned in #17:

WARNING : UserWarning (/home//.local/lib/python3.8/site-packages/xfuse/utility/mask.py:74): Failed to mask tissue
OpenCV(4.6.0) /io/opencv/modules/imgproc/src/grabcut.cpp:557: error: (-5:Bad argument) image must have CV_8UC3 type in function 'grabCut' 

I am not confident with OpenCV, it would be much appreciated if you could help out here!

Best,
Simon

@ludvb
Copy link
Owner

ludvb commented Mar 30, 2023

Hi Simon,

Sorry for my late reply. I would guess your image is probably single channel but opencv expects it to have three channels. The easiest way to fix this would be to convert your image to RGB. This can for example be done using imagemagick: convert -colorspace RGB input.jpg output.jpg. RGB is redundant for grayscale images, though, so we should think about fixing this in the code if this is a common use case.

@ludvb ludvb added the bug Something isn't working label Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants