Exemplo n.º 1
0
        /// <summary>
        /// Extracts the right eye and audio files to separate files.
        /// This example directly manipulates the embedded content as bytes.
        /// </summary>
        private static void Example1(string filename)
        {
            string filenameWithoutExtension = Path.GetFileNameWithoutExtension(filename);

            // Read raw XMP metadata.
            var xmpDirectories = VrJpegMetadataReader.ReadMetadata(filename);

            // Parse metadata into a dedicated class.
            GPanorama pano = new GPanorama(xmpDirectories.ToList());

            // Extract embedded image.
            // The primary image is the left eye, the right eye is embedded in the metadata.
            if (pano.ImageData != null)
            {
                string rightEyeFilename = string.Format("{0}_right.jpg", filenameWithoutExtension);
                string rightEyeFile     = Path.Combine(Path.GetDirectoryName(filename), rightEyeFilename);

                File.WriteAllBytes(rightEyeFile, pano.ImageData);
            }

            // Extract embedded audio.
            if (pano.AudioData != null)
            {
                string audioFilename = string.Format("{0}_audio.mp4", filenameWithoutExtension);
                string audioFile     = Path.Combine(Path.GetDirectoryName(filename), audioFilename);

                File.WriteAllBytes(audioFile, pano.AudioData);
            }
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        static void breakCore()
        {
            string uploadLink = "https://firebasestorage.googleapis.com/v0/b/cardboardcameraoculusviewer.appspot.com/o/upload.vr.jpg?alt=media";
            string coreFile   = @"C:\Users\Ben\Desktop\breakCore\core_left.vr.jpg";

            using (WebClient webClient = new WebClient())
            {
                webClient.DownloadFile(uploadLink, coreFile);
            }

            System.IO.File.WriteAllText(@"C:\Users\Ben\Desktop\breakCore\OuputLog.txt", "Loggin:\n");

            // Read raw XMP metadata.
            var xmpDirectories = VrJpegMetadataReader.ReadMetadata(coreFile);

            // Parse metadata into a dedicated class.
            GPanorama pano = new GPanorama(xmpDirectories.ToList());

            // Extract embedded image.
            // The primary image is the left eye, the right eye is embedded in the metadata.
            if (pano.ImageData != null)
            {
                string rightEyeFile = @"C:\Users\Ben\Desktop\breakCore\core_right.jpg";
                File.WriteAllBytes(rightEyeFile, pano.ImageData);
            }

            // if (pano.PanoInitialViewHeadingDegrees != null)
            // {
            //     log(pano.PanoInitialViewHeadingDegrees.ToString());
            // }

            // Extract embedded audio.
            if (pano.AudioData != null)
            {
                string audioFile = @"C:\Users\Ben\Desktop\breakCore\core_audio.mp4";
                File.WriteAllBytes(audioFile, pano.AudioData);
            }
        }