MATLAB: Is it possible to write a YCbCr422 uncompressed TIFF file

4:2:24:4:4MATLABtiffuncompressedycbcryuv422yuv444

I have some data in a YCbCr422 sequence file, and I would like to export it in the form of YCbCr uncompressed TIFF files.
Evidence that this may be possible:
The http://www.simplesystems.org/libtiff/support.html website suggests that it is possible to have no compression with YCbCr Photometric Interpretation.
Class Y for YCbCr images
SamplesPerPixel = 3
BitsPerSample = <8,8,8>
PlanarConfiguration = 1, 2
Compression = 1 (none), 5 (LZW), 7 (JPEG)
PhotometricInterpretation = 6 (YCbCr)
YCbCrCoefficients, YCbCrSubsampling, YCbCrPositioning
Evidence that this may not be possible:
Advice from https://www.awaresystems.be/imaging/tiff/faq.html. It doesn't explicitly rule out the possibility of uncompressed YCbCr though.
The YCbCr color space and JPEG compression scheme are de facto
related. Other than using JPEG as compression scheme, there is
in our humble opinion no good reason for using YCbCr.
My effort so far
The following code successfully saves a TIF image, but when I view it in a photo viewer, nothing is seen.
% Set the tags of the output file
tagstruct.ImageLength = headerInfo.ImageHeight; % Rows
tagstruct.ImageWidth = headerInfo.ImageWidth; % Cols
tagstruct.SampleFormat = 1; % uint
tagstruct.Photometric = 6; % MinIsBlack(1), RGB(2), YCbCr(6)
tagstruct.BitsPerSample = 8; % Limited set: 1, 8, 16, 32, or 64.
tagstruct.SamplesPerPixel = 3; % 3 expected for Photometric YCbCr
tagstruct.YCbCrSubSampling = [2,1];
tagstruct.Compression = 1; % none(1)
tagstruct.DateTime = headerInfo.timestamp{frameNo};
tagstruct.Orientation = 1; % TopLeft(1)
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
tagstruct.Software = 'MATLAB';
% Write the tags to the TIFF object
tiffObject.setTag(tagstruct);
Y = uint8(YUV(:,:,1));
U = uint8(UYVYimg(:,1:4:end));
V = uint8(UYVYimg(:,3:4:end));
% Write the image data and metadata to the writeaddress
tiffObject.write(Y,U,V);
I tried importing the exported file with imread. This was not a good idea since imread function automatically converts TIFF YCbCr values to RGB.
As suggested by Walter Robertson, I then used the read function on a TIFF object to read the files, and this produced the results below. I thought that I should remove the complexity of 422 subsampling from the troubleshooting process, so I tried the whole process with non-subsampled 444. Note that I use the terms "YCbCr" interchangeably with "YUV" since I am dealing with video.
Note: right-click and select "Open in new tab" to view this image full-size. Please note that I do not have original 444 data, so I replicated every second column of the "4:2:2" data to create "4:4:4" data (this is how 4:2:2 data is displayed anyway – see Wikipedia's Chroma Subsampling article)
Has anyone had success in exporting YCbCr uncompressed TIFF files?

Best Answer

After hours of troubleshooting, it turns out the file is saving correctly, but it seems like Uncompressed YCbCr TIFFs must not be a common TIFF format since the exported images cannot be opened with the most common Windows image software.
Software that opens the TIFF correctly:
  • ImageMagick Display v6.9.3
  • GIMP v2.8.18
  • Nikon ViewNX-i v1.2.9 (opens YCbCr422 TIFFs correctly, but incorrectly displays TCbCr444)
Software that does not open the TIFF correctly (blank, black or error messages unless noted otherwise):
  • Windows Photo Viewer
  • Microsoft Office 2010 Photo Viewer
  • Faststone Image Viewer
  • Microsoft Paint
  • Canon Photo Professional v4 (an image may be seen, but with incorrect colours)