/// <summary> /// Extract both eyes and creates a stereo equirectangular image. /// The resulting image is suitable for viewing in viewers supporting omni-stereo content. /// </summary> private static void Example3(string filename) { // Extract both eyes and create an equirectangular stereo image. int maxWidth = 8192; bool fillPoles = true; Bitmap composite = VrJpegHelper.CreateStereoEquirectangular(filename, EyeImageGeometry.OverUnder, fillPoles, maxWidth); // Save the result. string compositeFilename = string.Format("{0}_TB.png", Path.GetFileNameWithoutExtension(filename)); string compositeFile = Path.Combine(Path.GetDirectoryName(filename), compositeFilename); composite.Save(compositeFile); }
private static void ConvertStereoImageSBS(string sourceFilename, string destinationName) { // Extract both eyes and create an equirectangular stereo image. bool fillPoles = true; Bitmap composite = VrJpegHelper.CreateStereo(sourceFilename, EyeImageGeometry.LeftRight, fillPoles); if (composite == null) { throw new Exception("Failed to create stereo image."); } // Save the result. string compositeFilename = destinationName; string compositeFile = Path.Combine(Path.GetDirectoryName(sourceFilename), compositeFilename); composite.Save(compositeFile); }
/// <summary> /// Extract the right eye panorama and creates a full equirectangular image from it. /// The resulting image is suitable for viewing in a spherical viewer. /// </summary> private static void Example2(string filename) { // Read raw XMP metadata. var xmpDirectories = VrJpegMetadataReader.ReadMetadata(filename); // Parse metadata into a dedicated class. GPanorama pano = new GPanorama(xmpDirectories.ToList()); // Extract right eye to a Bitmap. Bitmap right = VrJpegHelper.ExtractRightEye(pano); // Generate an equirectangular image. int maxWidth = 8192; bool fillPoles = true; Bitmap rightEquir = VrJpegHelper.Equirectangularize(right, pano, fillPoles, maxWidth); // Save the result. string rightEquirFilename = string.Format("{0}_right_equir.png", Path.GetFileNameWithoutExtension(filename)); string rightEquirFile = Path.Combine(Path.GetDirectoryName(filename), rightEquirFilename); rightEquir.Save(rightEquirFile); }