7 Replies Latest reply on Apr 27, 2017 4:21 AM by MartyG

    How To Save PXCImage using file format (bmp or png)

    lucie93

      Hello ,

       

      I am currently working with the RealSense R200 and I am trying to save and open the depth stream. I am using Visual Studio, C++.

      I am using "void RecordORPlayback(pxcCHAR *file, bool record)" that I found online. The depth stream seems to be save but I don't know how to convert it on a image format (like bmp or png).

      I tried a lot of things that I found on internet but I'm blocked

       

      Thanks for your help,

      Lucie

        • 1. Re: How To Save PXCImage using file format (bmp or png)
          MartyG

          Streams are recorded in RealSense as a video file in .RSSDK format (this stands for RealSense SDK).  .RSSDK files use the H.264 video format, also known as MPEG-4 Part 10.

           

          Often, people want to convert a video to an animated GIF sequence because that makes the video easier to share on the internet.  So there are H.264 to GIF conversion programs.  Here's an example:

           

          How to Convert H264 to GIF - H264 to GIF Converter Tutorial

           

          Other converters include FileZigZag and Zamzar.  Please remember though that video converter programs downloaded from the internet can be a vehicle for malicious files such as viruses and malware / spamware, so please research reputable download sources before downloading such a program.

           

          I have never actually tried myself to convert a RealSense RSSDK video file to an image like this.  But a converter program seems the best way to find out if it is possible to do so.

           

          Edit: some people have written scripts to convert RealSense data to a bitmap image, which is a safer option than a converter program.  Example:

           

          How to save an image in Intel RealSense(Visual C++) - Stack Overflow

          • 2. Re: How To Save PXCImage using file format (bmp or png)
            lucie93

            Thanks MartyG for you answer

             

            Actually I saw the scripts to convert RealSense data to a bitmap image but I don't really understand how does it work.

            I will continue to try.

            Do you know if there is also some way to convert the .RSSDK video to another video format?

             

            Thanks,

            Lucie

             

            • 3. Re: How To Save PXCImage using file format (bmp or png)
              MartyG

              I find that the best way to learn how a complex script works is to get the entire script working without changing it and then change one small bit at a time to see what happens, and doing Undo if the change causes the program to break.  Eventually, you learn enough about how it works to make your own program.    Back in the 80's, home computer users used to do this trial and error experimentation with little programs called POKEs that changed the variables in a game to give infinite lives, skip game levels, etc.

               

              Here's what I said to someone else who wanted to convert RSSDK video to another video format.

               

              How Convert .rssdk to .mp4 or .Avi ?

              • 4. Re: How To Save PXCImage using file format (bmp or png)
                lucie93

                Thanks for you answer.

                Unfortunately, I tried to use the bmp.cpp script without modifications like you said, but it doesn't work.

                I will continue my research,

                 

                Thanks

                Lucie

                • 5. Re: How To Save PXCImage using file format (bmp or png)
                  MartyG

                  Reading back through this discussion, I realized that it was never confirmed whether you were using the Librealsense SDK in Linux or the official RealSense SDK.

                   

                  I had another look at the bmp.cpp script in more detail.  It seems to be a standalone C++ utility script for converting RGB video to bmp, and actually has nothing to do with the RealSense or Librealsense SDKs, though someone posted it in a forum question about RealSense.

                   

                  If that script doesn't work for you, you may have to fall back on option B, converting the RSSDK video into another format (e.g H.264 to GIF) using a pre-made converter tool.

                  • 6. Re: How To Save PXCImage using file format (bmp or png)
                    lucie93

                    I am using the official RealSense SDK on Windows 10, Visual Studio and C++

                    Ok, I will go back on option B.

                     

                    Before working with this camera, I worked with ffmpeg on H264 videos, and I was wondering why I'm not able to read the .rssdk with ffplay or with VLC like I did with my .h264 files.

                    I will use a pre-made converter tool and let you know.

                     

                    Thanks,

                    Lucie

                    • 7. Re: How To Save PXCImage using file format (bmp or png)
                      MartyG

                      The trouble is that whilst .RSSDK files are supposed to be in H.264 format, there is not enough information about how .RSSDK video files are encoded compared to H.264 ones to know if the differences between these RealSense videos and regular H.264 videos are minor or significantly large.

                       

                      Yes, please do let us know how you get on with a pre-made converter.  Good luck.