2

I am taking image from camera. So i want to get object original width and height.For that I am using UIImagePickerController.

e.g If 15 inch monitor is placed on table. so when I took image from camera then i
want orginal size i.e. 15 inch. Does anyone have idea ? how can i achieve this ?.

EDIT I dont't want image size. I want actual object size....

EDIT 2 I want this type of app:-https://itunes.apple.com/us/app/easymeasure-measure-your-camera!/id349530105?mt=8

Thanks In Advance....

Kalpesh
  • 5,336
  • 26
  • 41
  • 1
    @popeye I want original object width and height.. Not image size.... – Kalpesh Feb 18 '13 at 10:28
  • @Popeye Please take a step back and then reread the question. The question is about the real-world object's size, not the image's size. – Nikolai Ruhe Feb 18 '13 at 10:38
  • @NikolaiRuhe Yeah just re-read it, that's why I added the comment on Fonix and was commenting here. The question seems a bit misleading really I would possible think about changing the way its asked. As it seems a lot of people think it's about image size not the object in the image its self. – Popeye Feb 18 '13 at 10:40
  • 2
    I have had a look around and found some links that maybe of interest. http://stackoverflow.com/questions/13190932/how-to-find-out-focal-length-of-camera-in-ios-and-what-is-the-sensor-height http://stackoverflow.com/questions/11920285/how-to-determine-the-size-of-a-physical-object-image-on-a-phones-screen http://stackoverflow.com/questions/11913355/scaling-ar-pictures-based-on-the-distance-from-the-camera – Popeye Feb 18 '13 at 13:18

2 Answers2

1

what you are asking for is not possible to determine with only a picture from a camera, acquiring the actual size of an object through a picture cannot be done without some other information telling you how far away the object is (which the camera cannot tell you).

edit: well actually not impossible to determine, bad choice of words... just very difficult. (vuforia augmented reality for example can determine the distance away an object is from the camera, but the object recognition is done as a preprocess and not just any old object)

Fonix
  • 11,447
  • 3
  • 45
  • 74
  • @NikolaiRuhe someone must of misinterpreted the question and thought i was way of course with my answer heh – Fonix Feb 18 '13 at 10:30
  • That's why I added the comment. It's frustrating to see correct answers being downvoted without explanation. – Nikolai Ruhe Feb 18 '13 at 10:33
  • @Fonix I didn't downvote as I don't like the downvote system. But there are ways around this so you can get the original sizes. I haven't done it my self personally but someone I work with has done it for one of our apps. – Popeye Feb 18 '13 at 10:36
  • @Popeye true and and in my haste with answer the question i completely forgot about systems that i have even worked with that do that sort of thing, but i dont think its what Kaplesh actually wanted – Fonix Feb 18 '13 at 10:40
  • 1
    @Kalpesh I cant really answer that, but have a look at vuforia, maybe there is a way using that. I havent done it myself though. – Fonix Feb 18 '13 at 10:41
  • @Kalpesh one problem with vuforia though is it needs what the object looks like preloaded/preprocessed. Dont know if that is a problem for what you are trying to do. – Fonix Feb 18 '13 at 10:53
  • I want this type of app https://itunes.apple.com/us/app/easymeasure-measure-your-camera!/id349530105?mt=8.... – Kalpesh Feb 18 '13 at 12:48
  • 1
    @Kalpesh ah i see how they did it, but that is not a very accurate way of getting a measurement. all they do is measure the angle of the camera, and they assume the height of the camera off the ground and make an approximation off that. Im not going to be able to go into detail about how its done, but its like having 2 out of the 3 lines of a triangle, and the distance is the 3rd line, you can infer it from the other 2, except the length of the one line is assumed to be X (maybe an average standing height). play around with the app close to the ground and you will see its quite off. – Fonix Feb 18 '13 at 14:18
-8

in ImagePickerController delegate method pick original image

UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage];

Where info is dictionary of ImagePickerController delegate.

 NSLog(@"ImageSize = %@", image.size);

It will provide original image size.

Madhu
  • 1,542
  • 1
  • 14
  • 30
  • This isn't what the user is asking I made this mistake. The user wants to know if they took a picture of a monitor (15") they want to know how big that monitor in the image is. So there is a load of complications with it as the user could be zoomed out so it looks small or zoomed in so it looks bigger but they still want to be able to tell how big that monitor is. – Popeye Feb 18 '13 at 11:54
  • Ok. not seen d edited part while answering. How it will possible, it is not possible i guess.. – Madhu Feb 18 '13 at 11:59
  • It is possible just really complicated. See comments for Fonix answer. – Popeye Feb 18 '13 at 12:12
  • @Popeye I want this type of .. https://itunes.apple.com/us/app/easymeasure-measure-your-camera!/id349530105?mt=8 – Kalpesh Feb 18 '13 at 12:44
  • @Kalpesh Even though we do this in one of our apps where I work, I have not done this my self. This is above my head I just know it can be done. Sorry. – Popeye Feb 18 '13 at 12:53