使用WIndows 10中的pip在Virtualenv中安装Python 3.6.3?(Install Python 3.6.3 in Virtualenv using pip in WIndows 10?)
如何在Windows 10中使用pip在virtualenv中安装Python 3.6.x?
pip install python,pip install python3,pip install python3.6不起作用。
How do you install Python 3.6.x in a virtualenv using pip in Windows 10?
pip install python, pip install python3, pip install python3.6 don't work.
原文:https://stackoverflow.com/questions/46869528
最满意答案
一些选择:
如果您不太担心内存(您没有打开大量或非常大的位图),则可以将其存储为32位数字。 通常,第四个字节被解释为“alpha”(在背景上渲染图像时的混合说明符。)大多数现代图像处理库现在以这种方式处理彩色图像。
您可以将颜色打包到字节数组中并单独访问它们。 RGB和BGR是两种最常见的包装订单。 通常,您最终也会在每行的末尾添加填充字节,以便以字节为单位的宽度与DWORD(4字节)边界对齐。
您可以将图像分成三个独立的字节数组“平面”,这些平面基本上分别是红色,绿色和蓝色的8位图像。 这是进行图像处理时的另一种常见格式,因为您的过滤步骤通常独立地对通道进行操作。
A few options:
If you're not too worried about memory (you don't have a large number or very large bitmaps open), you can store it as 32-bit numbers instead. Often the fourth byte is then interpreted as "alpha" (a blending specifier when rendering the image on a background.) Most modern image manipulation libraries treat color images in this way now.
You can pack the colors into a byte array and access them individually. RGB and BGR are the two most common packing orders. Usually you also end up putting padding bytes at the end of each row so that the width in bytes lines up with DWORD (4-byte) boundaries.
You can split the image into three separate byte array 'planes', which are basically 8-bit images for Red, Green and Blue respectively. This is another common format when doing image processing, as often your filtering steps operate on channels independently.
相关问答
更多-
这不是一个在Python中处理的好文件! Python非常适合处理文本文件,因为它在内部缓冲区中以大块的形式读取它们,然后在线上进行迭代,但不能轻松访问文本读取之后出现的二进制数据。 此外, struct模块不支持24位值。 我能想象的唯一方法是一次读取一个字节的文件,首先在行尾跳过52个字节,然后每次读取3个字节,并将它们连接成4个字节的字节串并将其解压缩。 可能的代码可能是: eol = b'\n' # or whatever is the end of line in your fi ...
-
在Python结构模块格式字符中 , x被定义为填充字节。 你在那里的格式字符串表示读取3个字节,然后丢弃它们。 还没有一个格式说明符来处理24位数据,所以自己构建一个: >>> def unpack_24bit(bytes): ... return bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) ... >>> bytes '\x02\x00\x00' >>> unpack_24bit(struct.unpack('BBB', bytes)) 2 In ...
-
只需使用除法来获取数组中的索引,其余部分将是要设置的位数。 int N = 24; int index = N / 16; int bit = N % 16; words[index] |= (1 << bit); Just use division to obtain the index in the array, and the remainder will be the bit number to set. int N = 24; int index = N / 16; int bit = N % ...
-
将浮点值转换为24位(Conversion of Float value to 24 Bit)[2022-07-23]
基于我给你的其他响应 ,唯一的问题是将Int32 Int24为Int24 。 最简单的方法是使用返回byte[4]然后删除最后一个byte[4]的BitConverter.GetBytes(int) ...或者我们可以使用一些特殊的struct ,如: [StructLayout(LayoutKind.Explicit)] struct Int32ToBytes { [FieldOffset(0)] public int Int32; [FieldOffset(0)] pu ... -
将32位bmp转换为24位(Converting 32 bit bmp to 24 bit)[2023-09-15]
试试这段代码: public static Bitmap ConvertTo24bpp(Image img) { var bmp = new Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); using (var gr = Graphics.FromImage(bmp)) gr.DrawImage(img, new Rectangle(0, 0, img.Width, img.H ... -
不,通常2对齐的非功率将为硬件单元创建各种各样的havok。 一些负载单元将发生总线故障,其他负载单元以1/4速度运行。 出于这个原因,Vec3类型都被存储,就像它们是vec4一样。 No, Typically non-power of 2 alignment will create all sorts of havok for hardware units. Some load units will bus fault, other runs at 1/4 speed. For this reason t ...
-
我假设你的意思是左移8,而不是右移8。 在这种情况下,符号扩展的概念是不必要的。 想象一下,你有一个负的24位值0x800000。 然后左移版本将是0x80000000。 没有任何符号扩展,但它仍然有正确的负号。 总之,我认为大胆的做法应该完全按照它应该做的那样,就是简单地把这些比特换掉。 除非由于某种原因,否则您的数据是无符号的,这是非常不寻常的。 Upon more search was pointed a way to do this is using sox - on linux. sox -t s ...
-
将24位signed int信号转换为16位signed int信号(Convert 24 bit signed int signal to 16 bit signed int signal)[2023-06-06]
该方法将根据您是24位数据打包还是仅存储在32位字中的24位而变化。 我将假设它没有打包并在整数内左对齐,因为这是最常见的。 该技术只是简单地将数据转换为16位数据类型 ABCDEFxx => ABCD 这里我展示了一个32位整数的半字节,其中ABCDEF包含24位音频数据,而xx字节不包含任何值。 向右移动16将丢弃EFxx 。 short outBuffer[256] int* inBuffer = ((int*)bufferRawData); for (int i = 0 ; i < 256 ; ... -
一些选择: 如果您不太担心内存(您没有打开大量或非常大的位图),则可以将其存储为32位数字。 通常,第四个字节被解释为“alpha”(在背景上渲染图像时的混合说明符。)大多数现代图像处理库现在以这种方式处理彩色图像。 您可以将颜色打包到字节数组中并单独访问它们。 RGB和BGR是两种最常见的包装订单。 通常,您最终也会在每行的末尾添加填充字节,以便以字节为单位的宽度与DWORD(4字节)边界对齐。 您可以将图像分成三个独立的字节数组“平面”,这些平面基本上分别是红色,绿色和蓝色的8位图像。 这是进行图像处理 ...
-
24位音频文件具有3 *通道数的块对齐。 为什么不去寻找100ms的音频: int blockSize = 3 * channels * (sampleRate / 10); 这适用于24位WAV。 您的FLAC阅读器是否允许您读取该粒度取决于其内部实现。 24 bit audio files have a block align of 3 * number of channels. Why not go for 100ms of audio: int blockSize = 3 * channels * ...