Apple does do some processing on the depth data, so there are going to be issues in certain situations around the edges of objects (especially hair!).
There is even more post processing done, if the isDepthDataFiltered property is true. You could try setting it to false and create your own algorithm to fill in the holes in the depth data.
Thanks, implementing this algorithm is not something that is possible at the moment due to logistic issues, but maybe the question I asked in SO is a way to solve this? link to the question:
@toojuice Thank you so much for your replay ⊠Yes I make sure it is in this name test10.jpg and it does not work !.. and I am not sure why I only see the top part of my added images in the original mode ⊠I tried photos with both direction ⊠do you think because I am running this project on mac not iphone? for saving the image could you please give me piece of code ⊠unfortunately I have no clue about this
Thank you so much for your replay.And I have another question,when I use real machine debugging,after I install this app, I cannât find it in the Settings,and I donât know why,hope for your reply.
Hi, do you mean the Settings app on the iPhone? It doesnât show up there because it doesnât have any settings and does not require special permissions (i.e. it doesnât use the camera or have access to the photo library â all photos are packaged with the app)
Ok, that should work too. Thatâs how I created the sample images that come with the tutorial. I have some more questions for you:
Are you using HEIF or converting to JPG?
How are you transferring the images to the Mac? (Airdrop, Image Capture, email, something else?)
When transferring the image, do you have multiple options for the same picture? I.e. do you see two copies of the same image for each portrait-mode shot?
Hi @toojuice
I am using iphone X to capture the portrait images and I used front and back cameras. I tried images with vertical and horizontal positions for the phone⊠I found it in JPG formate so I do not have to convert it ! ⊠then I send it to the mac using Image Capture ⊠and I see 2 images one with E and one without E ⊠so I am using images without E to try this app
Yes your images works perfect⊠the images that I captured cannot be shown completely âŠ
try the image in this link ⊠this is one of my images that I captured with back camera https://ibb.co/kqZFsH
the images with several objects I took them using iphone X⊠one with front camera and one with back camera (portrait mode) âŠbottle image I took it with iphone 7 plus (portrait mode)⊠bottle image I can see just the top part in the app ⊠however, the other images I can see just middle part!
Ok, so the UIImageView in the view controller is set to Aspect Fill, meaning that it will cut off any extra image on the sides or top that doesnât match the phoneâs aspect ratio. Since the tutorial app was created to only work in portrait mode, you will have to make some adjustments to get this to work with landscape images.
I also took a look at the raw data for your image and compared it to the raw data for one of the included images. It seems like itâs in a different format. The metadata seems to be missing. Within one of the included tutorial images, you can find raw text that looks like XML and some attributes that include the string depthData. This is completely absent from your image.
This makes me think that either 1) no depth data was captured or 2) the depth data was corrupted/removed by some post processing (either on the phone or on your Mac â not sure). Actually, the image sharing service you used may have modified the image, too? Maybe I donât get the original that way. You could verify by downloading from your link and diffing it with the original.
OK,I got it.Thank you so much .
There is another problem.Do you know how to save the distance data as a single channel image? I want to use the distance data and RGB image to create its pointcloud file.
In the current project, the image for the depth data is created from a CIImage, which is created from a CVPixelBuffer. This will not allow you to write out the data using a function such as UIImagePNGRepresentation or UIImageJPEGRepresentation.
In order to be able to use those function to save the depth data, you will need to first create a CGImage and then create a UIImage from that. When you create a CGImage, youâll have to be careful with the orientation of the data, so keep that in mind.
If you want to capture from the TrueDepth camera instead of the Dual camera, just change the AVCaptureDevice from .builtInDualCamera to .builtInTrueDepthCamera.