Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color and depth raw data have incorrect dimensions #4

Open
xyyue opened this issue Sep 19, 2017 · 6 comments
Open

color and depth raw data have incorrect dimensions #4

xyyue opened this issue Sep 19, 2017 · 6 comments

Comments

@xyyue
Copy link

xyyue commented Sep 19, 2017

After getting the raw data for multiple frames, I checked the dimensions of the depth, color and stencil, and this is what happened to me (my screen resolution is 1920 * 1200):

  1. Stencil always have the correct dimension, which is 2304000 = 1920 * 1200
  2. For color buffer, the dimension is not correct, a little larger than 1920 * 1200 * 4 = 9216000, e.g. 9216007. (But I do get 1 out of 8 that has the correct dimension)
  3. For depth buffer, the dimensions are much larger than 1920 * 1200 * 4 = 9216000, e.g. 9240629.

I'm wondering whether anyone has any idea on why this could happen. Is it because of some hardware issue?

@xyyue
Copy link
Author

xyyue commented Sep 19, 2017

image

This is an example of the four channels I got for the color buffer (only use the first 9216000 values), (each image corresponds to one channel)

@xyyue
Copy link
Author

xyyue commented Sep 20, 2017

Actually, I got the error "detected target change, someone else is screwing with our functions". Any idea why this happens to me? Thank you so much!

@JiamingSuen
Copy link

Sorry to be off topic but how did you read the captured RAW data? I tried with normal RAW photo reading methods(PS/rawpy etc..) but nothing works. It would be nice if you can share your piece of code for reading the data. Thanks!

@muaz-git
Copy link

muaz-git commented Oct 3, 2017

@xyyue for your first comment, I was facing something similar. What I was doing, was saving them to disk using only native repository and then calculating the size of file, which was more because of extra tags of particular file format.
But when I used code from managed repository and calculated size of byte array it matched.
@JiamingSuen as in managed repository mentioned above, there is an example code to save byte array to a tiff file format. ImageUtils.WriteToTiff() function saves depth buffer as well stencil buffer along with other weather conditions in to a single tiff file. I hope it helps.

@RealLast
Copy link

Hello,
I know that this issue is quite old, but it seems to not really be solved by now, at least regarding the native-only part of the project. As some people might still face the same problem as of today, I thought I would post the solution I just figured out.
So regarding the native code, the problem is the write operation in the code that is used to get the buffers. This is what I am refering to:

I noticed that the variable "size" always has the correct value, however the amount of bytes written to the files differs from run to run as stated in the explanation of this issue above.
That is simply because the code uses the wrong mode to open the file: It is opened as a text file, but rather should be opened as a binary file! This guarantees that no character translations are performed.
If you simply change fopen("depth.raw", "w") to fopen("depth.raw", "wb"), the file should be written correctly.
The reason why the managed part of the project does not face this problem is obviously that it already uses the correct write operation.

@FlyingTerran
Copy link

Make sure you install eigen 3.3.7. That would solve many graphic problems if not all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants