简体   繁体   English

尝试制作黑色图像但 np.unit8 出错

[英]try to make black image but getting error for np.unit8

I have just started to learn OpenCV.我刚开始学习OpenCV。 trying to make a black window by the code:试图通过代码制作黑色 window:

img=np.zeros((512,512,3),np.unit8)

but get the error:但得到错误:

module 'numpy' has no attribute 'unit8'

numpy has no datatype such as unit8 . unit8没有诸如 unit8 之类的数据类型。

it must be uint8 .它必须是uint8

have a look at numpy docs datatypes看看numpy 文档数据类型

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么 np.ones 创建黑色图像? - Why np.ones creates a black image? 当我尝试使用 np.expand_dim() 时,键入一个类似字节的对象或一个 > 数字,而不是“图像”错误 - type error a bytes-like object or a > number, not 'Image' when i try to use np.expand_dim() np.fft.ifft2 将图像完全变黑 - np.fft.ifft2 turns image completely black 我收到错误: np.append(Image()) TypeError: __init__() missing 1 required positional argument: 'imgtype' - I am getting the error: np.append(Image()) TypeError: __init__() missing 1 required positional argument: 'imgtype' np.savetxt 得到这个(没有这样的文件或目录)错误 - np.savetxt getting this (No such file or directory) Error 我得到索引超出范围错误,即使我尝试为列表减去一个(单元测试) - Im getting an index out of bounds error even when i try subtractin one for a list (Unit testing) 尝试 np.where() 但“无法将字符串转换为浮点数”错误 - Try np.where() but "could not convert string to float" error 为什么从 np.ones 和 np.zeros 创建的图像都显示黑色空白图像,而将两者结合起来会按预期给出黑白混合图像? - Why both image created from np.ones and np.zeros shows black blank image while combining both gives black and white mixed image as expected? 我的程序无法运行,而不是使用黑色背景,而是尝试将图像用作背景错误:pygame.surface'对象不可调用 - My program will not run, when instead of using a black background i try to use a image as background ERROR: pygame.surface' object is not callable 使用图像透明度使出现黑色的“东西” - Using image transaprency make appear black “things”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM