0

so, I am new to ARKit and trying to figure it out. I have ARWorldTrackingConfiguration, with reference images (as shown below)

enter image description here

ARKit gives me the image as ARImageAnchor and its position in 3d space. But I want to know it's position(CGRect) in my ARSCNView, after I am done with this. I would like to convert my CGRect to 3d space again. I have applied these but couldn't get any valid results. The last one gives the correct x but y, width and height are not accurate.

Thanks.

ysnzlcn
  • 558
  • 6
  • 18
  • How exactly are you checking wether width and height are correct? One potential issue is that your image can be rotated in your view – jlsiewert Apr 21 '19 at 10:30
  • Hey @jlsiewert, this napkin is an example, my original object has a rectangular shape. Also, I have another validation process to check if it's rotated correctly. You see those ripple shapes on a napkin, let's say I want to know where the 15. row and 4. column ripple is and put some 3d object over it. – ysnzlcn Apr 21 '19 at 10:41
  • I had the same issue and solved it. [Check this](https://stackoverflow.com/q/49443228/5567142) – Alok Subedi Apr 22 '19 at 04:13
  • What kind of content do you want to present over the napkin? 2D? 3D? Just an image? – beyowulf Apr 22 '19 at 15:44
  • Hey @AlokSubedi, i saw your answer but and tried it but it still return bigger rect than my screen. – ysnzlcn Apr 22 '19 at 15:49
  • Hey @beyowulf, let's say I give napkin image to ML Model and it returned me the position of every ripple and I would like to put 3d object over a couple of ripples. For this, I need to know where the napkin is in the buffer(get its 2d rect) and after I find my ripples I need to convert those 2d rects to 3d space position to put them over the napkin. – ysnzlcn Apr 22 '19 at 15:52
  • You're asking how to create an ML Model that will do image segmentation on the ripples in the napkin? – beyowulf Apr 22 '19 at 16:02
  • Nope, I am already able to get location and count of ripples over the napkin. But, I need to know the exact location of the napkin in the image before giving it to ML Model. – ysnzlcn Apr 22 '19 at 16:09
  • Are you using a `CoreML` model? – beyowulf Apr 22 '19 at 16:34
  • Yeap, there is no problem with ML, the only problem I have is that I couldn't convert the 3d position to 2d rect, then convert it back to 3d position. – ysnzlcn Apr 22 '19 at 16:44
  • You might look here https://github.com/Rightpoint/ARKit-CoreML/blob/master/Library/ARKit+Utilities.swift – beyowulf Apr 22 '19 at 18:11
  • I guess this is the example project i have been looking for, i will examine it and will tell you which part is the answer so you can write it as the answer and i can mark it as excepted. Thank you very much. – ysnzlcn Apr 22 '19 at 20:01
  • Hi @ysnzlcn! Did you get an answer for this? I need some help as I am working to get 3D to 2D point in ARkit as well! – swiftlearneer Jul 31 '20 at 21:31
  • 1
    @swiftlearneer no man if i had the answer, i would post it here. – ysnzlcn Aug 01 '20 at 07:19

0 Answers0