This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Exporting(TXT/CSV)/Reading .vxl files generated by Voxel Viewer

Other Parts Discussed in Thread: OPT8241

In many application it may be required to capture the scene/stream from Voxel viewer. Here are some examples of such sitations...

  • Further analysis like standard deviation, median, FFT of data captured
  • Testing/Developing new algorithms on depth or Point cloud data 
  • Visualization in a different software
  • Reconstruction of 3D mesh

The best way to do this would be to use voxelSDK and capture. This however required setting up voxelSDK to control the Hardware and catpure.

In cases where one likes to do this quickly can use the attached method, which doesn't involve setting up voxelSDK for control and capture, instead Voxel Viewer is used to capture/record the scene as such to .vxl file. This captured .vxl file can then be exported to various streams (.bin files) explained in the attache document. 

Once extracted the .bin files can be read using simple computer programs as shown in the attached example codes(Python and C codes are given). 

ExtractionOfCSVFromVoxelViewer.zip

  • Hi ,

    Very useful information. Thank you for sharing.
    I have a question.

    When I tried to view the raw exported data from voxel viewer (using matlab), The ground plane seems to have an inclination.While in reality, our ground plane is flat. Any reasons as to what might cause this?

    -Ashwini
  • The camera was not particularly positioned exactly perpendicular to the wall. So, some inclination can be expected.

    Regards

  • Thank you Bharath. I will check that.

    I had one more question in this regard-

    When the depth data was observed along a single row, It exhibited a large variation in value. Our understanding is, when looking at a flat object, the 'DEPTH' data along a single row needs to be constant and the 'DISTANCE' must vary uniformly on either side about the center of the image. Is the assumption right here?if it is so, What causes the variation in depth along one row?

    -Ashwini
  • Hi,

    Can you tell me where can I found the matlab program that allow me to view the raw exported data from voxel viewer as a jpg or other format ?

  • HI,

    Just used DpethCapture from voxelsdk-examples to get out.bin file in raw format.
    Then try to use python file (above downloaded) to get csv.

    the result is
    ERROR: File size [307467] for file [out.bin] not a multiple of frame size [4800] X nQuantities [1]
    Traceback (most recent call last):
    File "vxnBin2CSVExtractor.py", line 147, in <module>
    data=data.reshape(nFrames,deviceResolution[device][1],deviceResolution[device][0],nQuantities).swapaxes(-1,-3)
    NameError: name 'nFrames' is not defined

    Would you please help to find a solution?

    Thanks
  • Hi

    Just use depthcapture from voxelsdk-examples to get Ambient.bin in raw format.

    Tried to use python file (above downloaded) to get csv

    the result is
    ERROR: File size [307467] for file [Ambient.bin] not a multiple of frame size [4800] X nQuantities [1]
    Traceback (most recent call last):
    File "vxnBin2CSVExtractor.py", line 147, in <module>
    data=data.reshape(nFrames,deviceResolution[device][1],deviceResolution[device][0],nQuantities).swapaxes(-1,-3)
    NameError: name 'nFrames' is not defined

    Would you please help to find a solution?

    Thanks
  • I use the c program (vxnBin2CSVExtractor.cpp) to convert the bin file to csv file, it is ok. But please remember to change the values of NROWS, NCOLS, NFRAMES if necessary.

    But after get the csv file, do you know how to convert it into image file (such as jpg file). I wrote a matlab program to do the conversion, but the output image consists of only some noise.

  • Do the file from depthcapture and that from voxel viewer share the same format?

    you could try png format, which might be better

  • How to change the csv file to png format ?
  • The code need to be made minor modification.

    240*320*8=614400

    240*320*4=307200

    but the file size is 614412 and 307212 respectively. 12 bytes more.

    fread(frame, sizeof(float), NFRAMES*NCOLS*NROWS, inFile);
    fprintf(csvFile,"%f,",frame[i][k][j]);

    Any one who could give the detail of depth file format in detail?

    Thanks

  • Anyone try to display the csv file as a image using opencv ?

  • Hi,

    The extra 12 bytes is due to the d->id(4 bytes) and timestamp(8 bytes).....

    if you want to ignore the id and timestamp .....go to DepthCapture.cpp and comment the respective lines(283,284 incase of "depth").....

    Now the sizes will surely match......

  • Hi Karthik,

    Information that describes how to extract specific data from binary files that have been extracted from the .vxl file is very useful, but....

    We are trying to evaluate the sensor using the OPT8241 EVM. The evaluation involves running the EVM through its paces under different test scenarios, and collecting sensor output. For data collection, Voxel Viewer is very convenient.

    However, given the amount of data that we are dealing with, it would be very convenient to have some sort of command line interface to the exporter. That would allow us to perform batch processing and batch conversions, rather than extracting individual bin files using the GUI application.

    From what I can tell, Voxel Exporter does not accept any command-line arguments.

    Is it possible to obtain the format of the .VXL file so that I can write my own exporter suitable for batch processing?

    Thank you,

    Dmitry.
  • Hi Dmitry, 

    Have you explored voxellCLI?

    github.com/.../Voxel-CLI

    This should give you the command line interface. I will get back on the best way to do batch processing. 

    thanks

    Karthik

  • Hi Karthik,

    Thank you very much for your response.

    Yes, I have explored Voxel CLI, and am in the middle of taking it apart.

    I noticed that Voxel CLI and Voxel Exporter do not produce data in the same format. Specifically, it appears that X and Y axis are reversed when I try to capture amplitude and phase data directly using Voxel CLI.

    Can I get a bit more insight into how they two applications differ, and what, if any, data massaging is performed by Voxel Exporter?

    From what can tell, it is the Voxel Exporter that introduces changes. I take a .VXL file captured by Voxel Viewer and convert it using Voxel CLI and Voxel Exporter, and I get different results. Same happens if I take .VXL file captured by Voxel CLI.

    I can post specific examples, if you would like.

    Best Regards,

    Dmitry.
  • Hi Dmitry,

    We have an example program in VoxelSDK that demonstrates how to extract frames from a VXL (see Test/CameraSystemReadStreamTest).

    This program can read a .vxl - it does not currently save frames to disk, but only prints the timestamp and frame size, but it can be adapted to do save frames with minor changes.


    We will update this program shortly to add this feature - this should give you the command-line equivalent of VoxelExporter.

    We will check the X,Y axis swap behavior - this might be due to a different convention followed by VoxelExporter.