问题标签 [uint16]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - numpy 数组将 uin8 lsb 转换为 uint16 msb
我已经在这里问过了,但我只是想知道这是否不能用 numpy 本地完成,因为我稍后将使用 numpy 与读取 numpy 数组的 cv2 一起使用。
背景是,我从 USB 相机读取了 13 块 13680 字节,直到我得到 177840 字节,这是一个原始帧。我通过附加块来做到这一点:
然后用 0-255 值填充列表,其中两个值应形成一个 0-65535 值。所以我的问题是如何将(我假设)uint8 LSB 列表转换为列表一半大小的 uint16 numpy 数组。
假设我有那个列表:
然后我想要一个numpy数组:
或者有没有办法直接用我的 USB 设备读取的 13 次填充一个 numpy 数组,以便它最后有 177840/2 uint16 值?
matlab - 使用 UINT16 数据类型时。matlab和opencv之间调整大小有什么区别?
看了上面的问题,发现为什么opencv和matlab的resize结果不一样。
但是,当输入数据类型为 UINT16 时,结果仍然不同。
我想知道为什么会这样。
- 调整插值:双三次(修改后的 opencv 因子:0.75 -> 0.5)。
- Matlab 抗锯齿选项错误。
matlab(2016a)示例
openCV(2.4.13.5) 示例
c++11 - 如何在 C++ 中将 uint16_t 转换为浮点数
我在 MacOS High Sierra 上运行 C++14。
我有一个uint16_t
从方法返回的值,该值的范围可以从 100 到 8000 奇数。
我想将其转换为float
. 所以,如果是 289,那么float
应该是 289.0。我正在尝试所有不同的方法来投射,uint16_t
但我的float
变量总是为零。
试过这个:
浮动 f_value = static_cast(i_value);
并尝试了这个:
浮动 f_value = (float)i_value;
但没有任何效果。
问题:
我怎样才能uint16_t
转换成一个float
?
ios - 如何从 ByteArray 数组中转换 2 个值到 Swift 4 中的 16 位整数 UInt16?
使用 Xcode 9.4.1 和 Swift 4.1
我有一个函数,它读取一个数组作为输入参数(参见我的代码中的 messageData)。现在我想将 2 个特定字节(即 ByteArray 的 2 个值)分配给一个 UInt16。所以我看到了0xff
更多问题的方法,但它对我不起作用。我要转换的 16 位整数是 28281。
- commandType 是一个枚举,它有多个包含 HEX 值的案例
- messageData是一个ByteArray,这个函数的参数
- NWPFunction 是一个包含函数“forCommandId”的类,它将返回给定 16 位整数“ctValue”的特定值
- ++() 是我添加的前缀函数,因此它的编译
c# - c# ushort uint16 选择哪种类型
我不明白为什么我们可以拥有ushort
和uint16
……两个字节。但是如果我想使用 Convert. 如果我记得很清楚,那是ushort.parse(stringtype)
whileconvert.touint16
需要一个对象。
我搜索了但找不到原因......过去我使用了ushort类型,但我开始认为因为我需要这个时间来将object转换为ushort,所以使用ushort不是一个好主意。我发现转换为字符串然后转换为 ushort 有点奇怪……或者转换为 uint16 然后转换为 ushort。也许我错过了什么?
这不是关键点,但我想知道。
c++ - Casting int16_t to uint_8t*
I have a library driven result stored as an int16_t value (and it is a negative, which I can use the absolute value of) and another library function that requires this value a few steps later in the form uin8_t*. How can this be done without using String?
The following code works, but uses dreaded Strings. Is there a way to do this without invoking String or std::string?
So, how can I turn int16_t into uint8_t*?
It has been pointed out in comments below that
Serial.println(static_cast<unsigned>(*finalVal));
works, but this solution converts the uint8_t to an unsigned int and the method requires uint8_t*.
I come from Java and the like and it seems crazy that it is so hard to convert an integer to a string.
javascript - 将 Base64 字符串转换为 Javascript Uint16Array?
我正在一个接收 base64 数组的 Javascript 应用程序中工作。该数组对每像素 16 位的原始图像进行编码。
因此,我想在其中做一些计算。为此,我需要将这个 Base64 字符串解压缩到 Uint16Array 中,这样我就可以遍历像素并执行所需的计算。
我有什么选择这样做?
c - 提取无符号 32 位整数的高位和低位字
要提取无符号 32 位整数的高位和低位字并将每个字存储在单独的 uint16_t 变量中,我执行以下操作(nbr是无符号 32 位整数):
是否不需要显式转换为 uint16_t?如果有任何其他更有效的方法,您是否建议获得所需的结果而不是这种方法?
javascript - 从可读流中获取 Uint16
在以下示例中,我获取 2 个原始字节。
知道如何使用 2 个字节转换生成的可读流 Uint16 整数吗?