小编Red*_*wan的帖子

例外:版本不匹配:这是“cffi”包版本 1.13.1,

我尝试使用 CUDA 运行代码,出现此错误,系统似乎有问题

完整代码:我知道了CUDACast #10a - 你的第一个 CUDA Python 程序没有名为 numbapro 的模块

import numpy as np
from timeit import default_timer as timer
from numba import vectorize

@vectorize(["float32(float32, float32)"], target='cuda')


def VectorAdd(a, b):
        return a + b

def main():
    N = 32000000

    A = np.ones(N, dtype=np.float32)
    B = np.ones(N, dtype=np.float32)
    C = np.zeros(N, dtype=np.float32)

    start = timer()
    C = VectorAdd(A, B)
    vectoradd_timer = timer() - start

    print("C[:5] = " + str(C[:5]))
    print("C[-5:] = " + str(C[-5:]))

    print("VectorAdd took …
Run Code Online (Sandbox Code Playgroud)

python pip numba

4
推荐指数
2
解决办法
2941
查看次数

类型错误:不支持 mat 数据类型 = 0

我想用cv2.imshow("Otsu img", binary)而不是plt.imshow( binary)

我收到错误

完整代码:

import matplotlib.pyplot as plt
from skimage import io
from skimage.filters.rank import entropy
from skimage.morphology import disk
import numpy as np
from skimage.filters import threshold_otsu
import cv2

img = io.imread("scratch.jpg")
entropy_img = entropy(img, disk(10))
thresh = threshold_otsu(entropy_img)

binary = entropy_img <= thresh



cv2.imshow("Otsu img", binary)

cv2.waitKey(0)
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)

如何修复这个错误?

 cv2.imshow("Otsu img", binary)
TypeError: mat data type = 0 is not supported
Run Code Online (Sandbox Code Playgroud)

python opencv image-processing python-2.7 imshow

4
推荐指数
1
解决办法
3154
查看次数

标签 统计

python ×2

image-processing ×1

imshow ×1

numba ×1

opencv ×1

pip ×1

python-2.7 ×1