-
Notifications
You must be signed in to change notification settings - Fork 417
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
ValueError: Buffer dtype mismatch, expected 'unsigned char' but got 'double' #49
Comments
Thank you, I know where is wrong |
Hi @drdlfy, as you have found the mistake, could you please tell us what it was? In that way, other people making the same mistake and googling for it in the future will see this issue and can follow your solution. Also, maybe I can catch the mistake in the code and make the error message clearer. |
Ok, @lucasb-eyer the code is not wrong, it is my use of the error. Image data format should be an unsigned integer can. Thank you very much. |
Thank you for the clarification! |
Hi File "C:/Users/dell/Desktop/Semantic-Shapes-master/singleimage.py", line 88, in File "C:\Users\dell\Desktop\Semantic-Shapes-master\utils.py", line 106, in crf File "pydensecrf\densecrf.pyx", line 126, in pydensecrf.densecrf.DenseCRF2D.addPairwiseBilateral ValueError: Buffer dtype mismatch, expected 'unsigned char' but got 'float' |
Just had the same issue and managed to figure out the problem. So the problem is that the image data is in float32 format or float64 or something like that and you need it in uint8 format. To get to the right format you need something like that img = np.uint8(255 * img) Hope this works for you |
Hello, when I execute this sentence will be incorrect, please help me to solve it, thank you very much:
d.addPairwiseBilateral(sxy=sxy_bilateral, compat=compat_bilateral,
kernel=kernel_bilateral, normalization=normalisation_bilateral,
srgb=srgb_bilateral, rgbim=img[0])
ValueError: Buffer dtype mismatch, expected 'unsigned char' but got 'double'
The text was updated successfully, but these errors were encountered: