Open GeorgeAdamon opened 5 years ago
I have the same problem on Pixel 3 with Android 11 and Google Camera 7.5.107. Any chance to get this solved?
Pixel phone portrait mode photo is concatenated of 4 JFIF structure https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format . Each JFIF structure is an jpeg image.
A JFIF structure starts with marker 0xFFD8 and ends with marker 0xFFD9. Therefore, we can split a portrait mode image into 4 jpeg files.
The following python code prints the marker positions and splits PXL_20210107_114027740.PORTRAIT.jpg into,
with open('PXL_20210107_114027740.PORTRAIT.jpg', mode='rb') as infile:
buffer = infile.read()
bufferlen = len(buffer)
pos = 0
pos_d8 = 0
n = 0
i = 0
while i < bufferlen:
if buffer[i] == 0xff:
pos = i
i += 1
if buffer[i] == 0xd8:
print('ffd8: {0}'.format(pos))
pos_d8 = pos
elif buffer[i] == 0xd9:
print('ffd9: {0} len: {1}'.format(pos, pos - pos_d8 + 2))
with open('pxl_out_{0}.jpg'.format(n), mode='wb') as outfile:
n += 1
outfile.write(buffer[pos_d8: pos + 2])
i += 1
I'm trying to extract depth from Portrait mode images taken with a Pixel 4 (Android 10), but when uploading the images to the depth extractor, I get a no depth data found message. The metadata of the images suggest that the depth data is indeed encoded.
`