Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image processing 火炬:rgb图像中每个通道的最大值_Image Processing_Lua_Torch - Fatal编程技术网

Image processing 火炬:rgb图像中每个通道的最大值

Image processing 火炬:rgb图像中每个通道的最大值,image-processing,lua,torch,Image Processing,Lua,Torch,我试图获得rgb图像中每个通道的最大值。 目前,我分别迭代每个通道,如下所示: r_max = rgb[1]:max() g_max = rgb[2]:max() b_max = rgb[3]:max() 有没有办法在Torch中把它理解为一个单独的语句?有人能帮我找到可能的解决方案吗?Max采用可选的“维度”参数。 在通道以外的维度上使用此选项将得到3x1x1张量,如果需要,可以将其展平,例如: rgb_max = rgb:max(2):max(3):reshape(3) Max接受可选

我试图获得rgb图像中每个通道的最大值。 目前,我分别迭代每个通道,如下所示:

r_max = rgb[1]:max()
g_max = rgb[2]:max()
b_max = rgb[3]:max()

有没有办法在Torch中把它理解为一个单独的语句?有人能帮我找到可能的解决方案吗?

Max采用可选的“维度”参数。 在通道以外的维度上使用此选项将得到3x1x1张量,如果需要,可以将其展平,例如:

 rgb_max = rgb:max(2):max(3):reshape(3)

Max接受可选的“维度”参数。 在通道以外的维度上使用此选项将得到3x1x1张量,如果需要,可以将其展平,例如:

 rgb_max = rgb:max(2):max(3):reshape(3)

没有太好,但是你可以移动到一行:r_max,g_max,b_max=rgb[1]:max(),rgb[2]:max(),rgb[3]:max()没有太好,但是你可以移动到一行:r_max,g_max,b_max=rgb[1]:max(),rgb[2]:max(),rgb[3]:max()