Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.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
Matlab默认颜色空间&;与YUV合作_Matlab_Rgb_Yuv - Fatal编程技术网

Matlab默认颜色空间&;与YUV合作

Matlab默认颜色空间&;与YUV合作,matlab,rgb,yuv,Matlab,Rgb,Yuv,我对在Matlab中使用YUV颜色空间图像感兴趣,但是(如果我错了,请纠正我),我相信Matlab使用的默认颜色空间是RGB 因此,我可能会误导自己,以为我在亮度(Y)通道上工作,例如,当我实际在红色(R)通道上工作时。我说得对吗?是否可以更改正在使用的颜色空间 我知道转换,但目前我很好奇是否有可能告诉Matlab使用YUV颜色空间,例如,简单地改变一行中的亮度通道(而不是改变RGB中的红色强度) 我遇到:(ReturnedColorSpace),但我不知道如何实现它 编辑: 我也在Matlab

我对在Matlab中使用YUV颜色空间图像感兴趣,但是(如果我错了,请纠正我),我相信Matlab使用的默认颜色空间是RGB

因此,我可能会误导自己,以为我在亮度(Y)通道上工作,例如,当我实际在红色(R)通道上工作时。我说得对吗?是否可以更改正在使用的颜色空间

我知道转换,但目前我很好奇是否有可能告诉Matlab使用YUV颜色空间,例如,简单地改变一行中的亮度通道(而不是改变RGB中的红色强度)

我遇到:(ReturnedColorSpace),但我不知道如何实现它

编辑:

我也在Matlab中尝试过这段代码,但我不确定我是否正确地假设它将Cr通道读取为灰度,因为它假设涉及RGB颜色空间?(该图显示图像的灰度版本)

编辑(28/3/16)-我的YUV文件的imfinfo输出

                 FileSize: 353500
                   Format: 'tif'
            FormatVersion: []
                    Width: 720
                   Height: 243
                 BitDepth: 24
                ColorType: 'YCbCr'
          FormatSignature: [73 73 42 0]
                ByteOrder: 'little-endian'
           NewSubFileType: 0
            BitsPerSample: [8 8 8]
              Compression: 'PackBits'
PhotometricInterpretation: 'YCbCr'
             StripOffsets: [1x49 double]
          SamplesPerPixel: 3
             RowsPerStrip: 5
          StripByteCounts: [1x49 double]
              XResolution: 72
              YResolution: 72
           ResolutionUnit: 'Inch'
                 Colormap: []
      PlanarConfiguration: 'Chunky'
                TileWidth: []
               TileLength: []
              TileOffsets: []
           TileByteCounts: []
              Orientation: 1
                FillOrder: 1
         GrayResponseUnit: 0.0100
           MaxSampleValue: [255 255 255]
           MinSampleValue: [0 0 0]
             Thresholding: 1
                   Offset: 353302
                 Software: 'Lavc56.60.100'
         YCbCrSubsampling: [2 1]
      ReferenceBlackWhite: [15 235 128 240 128 240]
但是,下面的代码片段将“Y”、“U”、“V”图像当作RGB写入(每个输出都是每个RGB颜色通道的灰度版本)


将这个“YUV”图像转换为YUV(通过rgb2yuv代码)并重复上面的4行代码输出我所期望的视觉效果。a1为亮度通道,其他为色度通道

通过本页阅读,我建议


ReturnedColorSpace
videoinput
对象的属性
imread
不返回
videoinput
对象。您正在将图像处理工具箱和图像采集工具箱混合在一起。使用
imread
无法执行此操作
imread
只返回像素的原始矩阵。返回的不是对象/结构,因此此赋值无效。我无法理解您的问题。如果您阅读RGB图像,除了转换颜色空间,您还想做什么来获得YUV?对不起。我正在读取YUV颜色空间图像(tiff格式),并希望对其执行操作。在不做任何事情的情况下,操作是否与YUV或RGB系统一起工作?例如,对于YUV,U从-128变为128,对于RGB,G从0变为255。因此,根据我所做的操作,会有差异。我不确定Matlab在默认情况下是否与RGB一起工作,或者实际上是否识别出它是YUV并与YUV一起工作@Daniel@DragonDance27你能在你的图片上发布
imfinfo
的输出吗?很抱歉回复太晚。我已经对这个问题进行了编辑,包括imfinfo的输出以及它如何看起来不是YUV图像的解释@阿姆罗
                 FileSize: 353500
                   Format: 'tif'
            FormatVersion: []
                    Width: 720
                   Height: 243
                 BitDepth: 24
                ColorType: 'YCbCr'
          FormatSignature: [73 73 42 0]
                ByteOrder: 'little-endian'
           NewSubFileType: 0
            BitsPerSample: [8 8 8]
              Compression: 'PackBits'
PhotometricInterpretation: 'YCbCr'
             StripOffsets: [1x49 double]
          SamplesPerPixel: 3
             RowsPerStrip: 5
          StripByteCounts: [1x49 double]
              XResolution: 72
              YResolution: 72
           ResolutionUnit: 'Inch'
                 Colormap: []
      PlanarConfiguration: 'Chunky'
                TileWidth: []
               TileLength: []
              TileOffsets: []
           TileByteCounts: []
              Orientation: 1
                FillOrder: 1
         GrayResponseUnit: 0.0100
           MaxSampleValue: [255 255 255]
           MinSampleValue: [0 0 0]
             Thresholding: 1
                   Offset: 353302
                 Software: 'Lavc56.60.100'
         YCbCrSubsampling: [2 1]
      ReferenceBlackWhite: [15 235 128 240 128 240]
a = imread('3d008.tiff');
a1 = a(:,:,1); imwrite(a1,'xdel1.tiff');
a2 = a(:,:,2); imwrite(a2,'xdel2.tiff');
a3 = a(:,:,3); imwrite(a3,'xdel3.tiff');
I = imread('image.tiff');
I.ReturnedColorSpace = 'YCbCr';