Agisoft Metashape

Agisoft Metashape => Face and Body Scanning => Topic started by: Mfranquelo on February 25, 2014, 02:49:02 PM

Title: 35mm for head scans
Post by: Mfranquelo on February 25, 2014, 02:49:02 PM
Do you think that 35mm will introduce geometric distortions on head scans ? does photoscan correct the lens distortion successfully on this kind of focal distance ?

http://www.amazon.es/gp/product/B0050I7AGO/ref=ox_sc_act_title_1?ie=UTF8&psc=1&smid=A1AT7YVPFBWXBL

I was thinking on changing my head scanning set up to 35mm to make it smaller...
Title: Re: 30mm for head scans
Post by: Infinite on February 25, 2014, 03:21:15 PM
Anything below 35mm and you will get distortion in the point clouds.

Photoscan can only compensate so much. I've tested with 28mm and 20mm, Primes. Not only was the image quality terrible but Photoscan produced a huge amount of distortion. Very unreliable.

35mm, 40mm, 50mm + are the way to go.

But 35mm primes can produce poor image quality, like the 40mm pancakes. Chromatic aberration, vignetting, some distortion, softness but they're not too bad.

50mm primes are king IMHO.
Title: Re: 30mm for head scans
Post by: David Cockey on February 25, 2014, 04:20:57 PM
My experience is very different than Infinite's. I have had excellent results in PhotoScan with images taken using lenses with focal lengths as short as 10mm (16mm 35mm full frame equivalent) and as long as 60mm (96mm equivalent). Most subjects have been boats and ship models from less than 1 meter to over 25 meters in length.

The focal length relative to the size of the sensor is what matters for perspective. A 35mm lens on a "crop frame" DSLR (22.3mm x 14.9mm sensor) results in an image which will have same perspective as a 56mm lens on a "full frame" DSLR (36mm x 24mm sensor) and a 10mm lens on a compact camera with a 1/2.3 sensor (6.2mm x 4.5mm) if the images are taken from the same location.

It is very important to differentiate between true lens distortion which results in straight lines being curved in images, sometimes referred to as barrel or pincushion distortion, and geometric perspective "distortion" which results in parallel straight lines appearing to converge in an image but still being straight. Lenses of the same focal length can have very different amount of barrel/pincushion distortion. Shorter focal length lenses will have greater perspective "distortion" if the location the image is taken from is adjusted so that the subject will be the same size in the image.

PhotoScan like all photogrammetry, the same geometry which results in perspective "distortion", to determine 3D shape. When I tested very long focal lengths (160mm equivalent and longer) I found that PhotoScan sometimes had difficulty with aligning the photos which was probably due to insufficient "perspective".

PhotoScan has corrected the true lens distortion with all the lenses I have used as long as there are a sufficient number of images and there are at least two overlapping rows of images.   
Title: Re: 30mm for head scans
Post by: Infinite on February 25, 2014, 04:29:22 PM
My experience is very different than Infinite's. I have had excellent results in PhotoScan with images taken using lenses with focal lengths as short as 10mm (16mm 35mm full frame equivalent) and as long as 60mm (96mm equivalent). Most subjects have been boats and ship models from less than 1 meter to over 25 meters in length.

The focal length relative to the size of the sensor is what matters for perspective. A 35mm lens on a "crop frame" DSLR (22.3mm x 14.9mm sensor) results in an image which will have same perspective as a 56mm lens on a "full frame" DSLR (36mm x 24mm sensor) and a 10mm lens on a compact camera with a 1/2.3 sensor (6.2mm x 4.5mm) if the images are taken from the same location.

It is very important to differentiate between true lens distortion which results in straight lines being curved in images, sometimes referred to as barrel or pincushion distortion, and geometric perspective "distortion" which results in parallel straight lines appearing to converge in an image but still being straight. Lenses of the same focal length can have very different amount of barrel/pincushion distortion. Shorter focal length lenses will have greater perspective "distortion" if the location the image is taken from is adjusted so that the subject will be the same size in the image.

PhotoScan like all photogrammetry, the same geometry which results in perspective "distortion", to determine 3D shape. When I tested very long focal lengths (160mm equivalent and longer) I found that PhotoScan sometimes had difficulty with aligning the photos which was probably due to insufficient "perspective".

PhotoScan has corrected the true lens distortion with all the lenses I have used as long as there are a sufficient number of images and there are at least two overlapping rows of images.   

Do you have any results from face or body scanning using those lenses?

For faces it might be OK but you will loose detail. Body, it wont work at all.

Ariel shots of landscapes, buildings, boats etc are quite different to syncing multiple cameras to retain as much detail as possible on organic subjects.

I've also heard there can be a mismatch in accuracy of photogrammetry data when compared to the accuracy of a Faro3D laser scan, from using those types of lenses.
Title: Re: 30mm for head scans
Post by: David Cockey on February 25, 2014, 04:41:23 PM
A longer focal length can be advantageous for a highly curved object, such as a head, when photographs are taken at relatively large angle increments a longer focal length, such as might be used in a multi-camera rig. The reason is with the camera further from the subject the angle between the camera and parts of the surface curving away from the camera is reduced.
Title: Re: 35mm for head scans
Post by: Mfranquelo on February 25, 2014, 07:48:14 PM
Im very grateful for your suggestions,

Size is quite critical for me. Thats why i wanted to use 35mm.
Im really afraid of point cloud distortion and loosing quality, im working with 50mm lenses at the moment, but making my system almost 30% smaller is really important for me.

According to http://www.kenrockwell.com/tech/samyang/35mm-f14.htm the review seems to be pretty good, it is amazingly sharp.

Could you specify which 35mm lenses have produced bad quality in your scans Lee ?
Title: Re: 35mm for head scans
Post by: chadfx on February 25, 2014, 08:10:14 PM
Yes, lenses of the same focal length are definitely not equal.

Another 35mm to consider would be the Sigma 35mm, which seems to be regarded as far better than the Canon 35mm lenses.

http://www.dpreview.com/lensreviews/sigma-35mm-f1-4-dg-hsm/5

But I cannot say how they would fare in a body/head scan situation. (and they are probably 3x more expensive than the Samyang, although cheaper than Canon's 35mm L lens.)
Title: Re: 35mm for head scans
Post by: Mfranquelo on February 25, 2014, 08:13:53 PM
Thank you for your suggestion chadfx, however the price of the sigma 35mm is like you said, almost x3 times higher, for almost the same quality.

The reviews of the samyang are really positive, ill buy one and test it, i can post results next week :).

Like David said, 35mm on APS-C equals to 50mm more or less.
Title: Re: 35mm for head scans
Post by: David Cockey on February 25, 2014, 09:12:15 PM
Generally any lens used to take photos of three dimensional objects for PhotoScans should be used stopped down to at least f5.6 and frequently to f8 or f11 to obtain sufficient depth of field. Lens tests only look at sharpness in the plane the lens is focused to, and basic optics causes sharpness to be reduced away from that plane as the "circle of confusion" grows. The distance over which the image is acceptably sharp is referred to as depth of field, and it becomes greater as the aperture size decreases (higher f-stop number).

Sharpness and vignetting differences between different design lenses tend to be much greater at largest aperture (lowest f-stop number) than when stopped down. Lens distortion is generally independent of aperture. Chromatic aberration can vary with aperture and some lenses with large amounts of chromatic aberration at large aperture can improve at smaller aperture. Lens tests frequently concentrate on large aperture performance (lower f-stop numbers) because this is where the differences between lenses are greatest.

But for taking photos of 3D objects for PhotoScan performance at f1.4, f2.8 or even f4 is generally irrelevant because smaller apertures are used. When comparing results of objective lens tests for PhotoScan use the results between f5.6 and f11.   
Title: Re: 35mm for head scans
Post by: Mfranquelo on February 26, 2014, 02:34:46 AM
I've seen many tests of closing the aperture to f22 and carefully sharpening the "softened" image, the results are practically the same as the ones taken using the "sweet" spot at f9-f11
Title: Re: 35mm for head scans
Post by: David Cockey on February 26, 2014, 07:58:46 AM
I've seen many tests of closing the aperture to f22 and carefully sharpening the "softened" image, the results are practically the same as the ones taken using the "sweet" spot at f9-f11

Are you talking about the visual appearance of images, or results of using the images in PhotoScan? If it's for use with PhotoScan I'm interested in any information you have about the technique.

At f22 the sharpness of most lenses of a given focal length will be about the same.
Title: Re: 35mm for head scans
Post by: Marcel on February 26, 2014, 12:00:34 PM
If you are worried about diffraction I would do some tests with the lens you use. A lot of people like to bring up diffraction for some reason, but in reality it's really not such a big problem. I've never seen any problems when shooting up to F16.

And even if the sharpness is the tiniest bit lower due to diffraction, this is more than made by the fact that more parts of your image are sharp due to a bigger depth of field. I would rather have a 95% image that is in focus all over, than a 100% sharp image that has lots of blurred parts due to depth of field.

If you process the Dense Cloud at 'High' instead of 'Ultra' then you should not worry about diffraction at all (source images are downscaled to 50% on 'High', so any pixel level sharpness problems will be mostly gone).
Title: Re: 35mm for head scans
Post by: Mfranquelo on February 26, 2014, 01:32:26 PM
That is very usefull to know Marcel, thanks.

The samyang is coming tomorrow, i hope to run tests this weekend.
Title: Re: 35mm for head scans
Post by: Infinite on February 26, 2014, 02:56:39 PM
It can be hard to know what is truth and what is not in this field. The only way to find out, is to test yourself.

If your looking to get the best results out of your system, diffraction IS an issue. It's a real pain.

You can't just alter the images after the fact with sharpening, as you are in fact altering reality. It's not recommended to post process images at all, only for the colour usage. It can have a detrimental effect on the build quality if you alter the images. It's OK afterwards for texturing, just not before.

From my experience the ideal aperture setting is between 11-14. 16 if you have to.

Don't forget, if you go up over 16, you need a lot more light. Which can start to become uncomfortable for subjects. Think the Lightstage requiring their talent to wear dark contact lenses!

There is no rule book in this field. Many voices. Many methods. Your best bet is to find your way from experience.
Title: Re: 35mm for head scans
Post by: EMULAT3D on February 26, 2014, 05:02:35 PM
You can't just alter the images after the fact with sharpening, as you are in fact altering reality. It's not recommended to post process images at all, only for the colour usage. It can have a detrimental effect on the build quality if you alter the images. It's OK afterwards for texturing, just not before.

So should any post adjustments be made when converting from RAW to TIF? Programs like DXO have so many different color, sharpening and noise reductions settings built into their presets. Is it best to just convert the RAW to TIF directly?
Title: Re: 35mm for head scans
Post by: Infinite on February 26, 2014, 05:21:10 PM
You can't just alter the images after the fact with sharpening, as you are in fact altering reality. It's not recommended to post process images at all, only for the colour usage. It can have a detrimental effect on the build quality if you alter the images. It's OK afterwards for texturing, just not before.

So should any post adjustments be made when converting from RAW to TIF? Programs like DXO have so many different color, sharpening and noise reductions settings built into their presets. Is it best to just convert the RAW to TIF directly?

It would be best for Agisoft to comment on this. I tried the methods back in 2008 and 2009 with Dimensional Imaging and Scanner Killer, and since using Photoscan, with no benefits. It can make the scans worse in fact.

Personally I only shoot in JPG. RAW adds no benefit to the build quality, maybe some slight benefit to bit depth during texture phase.

Pipeline wise, it just quadruples all aspects of the work flow. If when shooting to RAW we saw a 50% or even 25% leap in quality it could justify it but we see maybe 1% if that.
Title: Re: 35mm for head scans
Post by: David Cockey on February 26, 2014, 06:02:57 PM
"Shooting in JPEG" just means the processing of the raw data from the sensor and conversion to the JPEG takes place inside the camera. The amount of sharpening, noise reduction, color temperature adjustment, compression, etc done inside the camera during the processing depends on the camera settings, and may or may not be controllable by the user.

RAW files contain the raw data from the sensor without any processing (with a few recent exceptions). The fundamental difference between "shooting in JPEG" and "shooting in RAW" is where the processing of sensor data to obtain the image occurs, inside the camera or on a separate computer.

When RAW files are saved and processed on a computer the user generally has more choices about the details of the processing including whether to create images in JPEG format (compressed with some amount of loss) or TIFF (not compressed with no loss). Also, if the resulting images are unsatisfactory it is possible to change the processing settings and create revised images starting with the raw sensor data.

The disadvantages of "shooting in RAW" are the files are larger and require more storage, and the processing on the computer is another step and requires time. The larger files are becoming less of an issue as larger memory cards and hard drives become less expensive.

Most recent DSLRs and more advanced compact cameras, and even a smartphone or two, have an option for having JPEGs created in the camera ("shooting in JPEG") as well as saving sensor data in a RAW file ("shooting in RAW") at the same time. This is what I do so that I immediately have JPEG images to use if needed, but can also have the RAW files for processing on a computer. The only disadvantage is fewer photos can be stored on a memory card. But with larger memory cards this may not be an issue. I'm currently using 32GB high speed SDHC memory cards (purchased for less than $40 each) and store over 1100 combined JPEG and RAW images per card.
Title: Re: 35mm for head scans
Post by: JMR on February 26, 2014, 06:25:34 PM
Photogrammetry theory tell us that short focal lenght strengthen solution in terms of photo orientation quality, so Lee is (in theory) wrong  when he states short lenses give less accurate results.
Let me explain why with an analogy: Imagine a pyramid whose base measures 50x50mm and has a height of 25mm standing on your table. Now imagine that you put under one of the vertices of the base a block of 1x1x1mm size.
You can understand that the whole body may oscillate between two extreme positions resulting in the position of the apex varying by about 1mm.
You probably understand that if this pyramid was 500mm in height, the travel of the apex would be much longer.

Let see that block as an error of one pixel in the picture. Well understood that, although the photo (pyramid) covers the same footprint in de object, being the error identical in photo-coordinates, a longer focal lenght (pyramid height) determines greater uncertainty in the orientation.

On the other side, considering photos pair-wise, it is also evident that for a certain fixed baseline/distance, ray intersections for wide angles are better than for teles.

So imho Lee's statement is not right. What it is doubtlessly right in his statement is that normal prime lenses gather richier texture than wide ones if the latter are not set closer to the object to capture similar footprints.
Title: Re: 35mm for head scans
Post by: EMULAT3D on February 26, 2014, 06:38:26 PM
Personally I only shoot in JPG. RAW adds no benefit to the build quality, maybe some slight benefit to bit depth during texture phase.

Thanks for the tip, I'll give straight-up JPG a go and compare the results to RAW. I agree, any time saving in the processing of data is good.  ;D
Title: Re: 35mm for head scans
Post by: Infinite on February 26, 2014, 06:58:28 PM
Photogrammetry theory tell us that short focal lenght strengthen solution in terms of photo orientation quality, so Lee is (in theory) wrong  when he states short lenses give less accurate results.
Let me explain why with an analogy: Imagine a pyramid whose base measures 50x50mm and has a height of 25mm standing on your table. Now imagine that you put under one of the vertices of the base a block of 1x1x1mm size.
You can understand that the whole body may oscillate between two extreme positions resulting in the position of the apex varying by about 1mm.
You probably understand that if this pyramid was 500mm in height, the travel of the apex would be much longer.

Let see that block as an error of one pixel in the picture. Well understood that, although the photo (pyramid) covers the same footprint in de object, being the error identical in photo-coordinates, a longer focal lenght (pyramid height) determines greater uncertainty in the orientation.

On the other side, considering photos pair-wise, it is also evident that for a certain fixed baseline/distance, ray intersections for wide angles are better than for teles.

So imho Lee's statement is not right. What it is doubtlessly right in his statement is that normal prime lenses gather richier texture than wide ones if the latter are not set closer to the object to capture similar footprints.

The thing is what works on paper or in ones mind, when put into practice, will produce very different results. What I say may seem wrong (in theory) but I've seen the evidence first hand. The fact is below 35mm, you get point cloud distortion a long with artefacts from the lens quality, even with primes. Try it on a set of 18-55mm lenses, let a lone 20mm or 28mm lenses. I bought 8x 20mm and 8x 28mm, I don't know of anyone else who has. I used them for 3 days, then returned them.

It also speaks volumes in other systems I've seen with people that rely on 35mm lenses. Sure they work, they produce mid level results but if you want superior, consistent, non distorted point clouds. 50mm primes are king, for face and body photogrammetry.

My system relies heavily on 50mm. I also use 8x 35mm for some things, 12x 85mm and 4x 100mm Primes which are incredible lenses. I've even used 12x 55mm-200mm lenses which work well but can produce soft images. No issues or distortion at 200mm. If you can, stay a way from 18-55mm. They're OK but not ideal.
Title: Re: 35mm for head scans
Post by: Infinite on February 26, 2014, 07:26:37 PM
Further to the discussion on lenses below 35mm. I had these replies from Alexey back in 2012 when we shared data and did some trouble shooting:

Quote
We have also checked the problems with 20mm lens, and it seems that they have even problems with matching between each other. So the geometry problems seems to be caused by alignment problems, and therefore we recommend not to use these lens (at least for geometry reconstruction and texturing).

Quote
In general wide angle lens can have large distortion which is not very well modeled analytically, so that may be a reason in this case.
Title: Re: 35mm for head scans
Post by: David Cockey on February 26, 2014, 08:04:56 PM
I've had excellent results using a Canon EF-S 10mm-22mm zoom at 10mm focal length (16mm equivalent) as well as longer focal lengths for photos of boats including interiors and construction. Alignment worked very well and PhotoScan had no problems correcting for the lens distortion. The point clouds were not distorted. I selected that particular lens because it has low distortion compared to other lenses of similar focal length. The short focal length was required because of space limitations.

I am not recommending focal lengths this short for general use but with the proper lens they do work and work well for most subjects.

Title: Re: 35mm for head scans
Post by: Infinite on February 26, 2014, 08:28:05 PM
I've had excellent results using a Canon EF-S 10mm-22mm zoom at 10mm focal length (16mm equivalent) as well as longer focal lengths for photos of boats including interiors and construction. Alignment worked very well and PhotoScan had no problems correcting for the lens distortion. The point clouds were not distorted. I selected that particular lens because it has low distortion compared to other lenses of similar focal length. The short focal length was required because of space limitations.

I am not recommending focal lengths this short for general use but with the proper lens they do work and work well for most subjects.

I don't doubt it for aerial photography. However it would be interesting to compare the data with laser scans to match the accuracy.

What cameras do you use?
Title: Re: 35mm for head scans
Post by: igor73 on February 26, 2014, 09:07:53 PM
I do photogrammetry under water as well as on land. UW you generally want to use wide angle to limit the amount of images needed because of time limits, especially during very deep diving. .  I have tested a nikon f2,8 16mm fish eye and it actually worked pretty well to my great surprise. And that is behind a plastic doom port with no camera calibration.   Obviously a fish eye lens is probably the worst lens you can use for this application but it worked and all images aligned with no problem.  On land i use mostly 50mm. 
Title: Re: 35mm for head scans
Post by: David Cockey on February 26, 2014, 11:43:30 PM
I've had excellent results using a Canon EF-S 10mm-22mm zoom at 10mm focal length (16mm equivalent) as well as longer focal lengths for photos of boats including interiors and construction. Alignment worked very well and PhotoScan had no problems correcting for the lens distortion. The point clouds were not distorted. I selected that particular lens because it has low distortion compared to other lenses of similar focal length. The short focal length was required because of space limitations.

I am not recommending focal lengths this short for general use but with the proper lens they do work and work well for most subjects.

I don't doubt it for aerial photography. However it would be interesting to compare the data with laser scans to match the accuracy.

What cameras do you use?
I have no experience with aerial photography. All my photogrammetry work has been with terrestrial photos of 3 dimensional objects. Reduced size examples of photos taken at 10mm focal length from three different projects are attached.

I use a Canon 500D/T1i with a 15.1 Mp sensor. What cameras do you use?
Title: Re: 35mm for head scans
Post by: David Cockey on February 26, 2014, 11:46:32 PM
Two more reduced size examples of photos taken at 10mm focal length and successfully used in PhotoScan projects are attached.
Title: Re: 35mm for head scans
Post by: JMR on February 27, 2014, 04:32:10 AM
Lee, I can accept that your experience has brought you to choose normal primes as best option for face photo-scanning. I agree with your very valuable opinion that it gives better results. I admire your work and always tell my studens that you are a reference for anyone working with body and face scanning, so please don't look for criticism in my post.

Why wide angles seem to work bad for face scanning?
While normal and tele fotos give nice portraits, wides give unpleasing and weird portraiture. the exagerated perspective makes them ugly even with the most perfect lens in the world. But this is not the actual issue but the fact that any move in the camera makes face shape change rapidly and that consequently makes harder to pair feature points as they match worse.
Wides usually suffer noticeable distortions. True. But sistematic errors caused by distortion can be sistematically corrected, so the question is not the existence of distortion but our ability to measure it exactly. This makes it necesary that the object "collaborated" filling the whole frame and provided lots of well paired feature points even near the corners. Just the opposite we'll likely find in a human face photo: empty corners and rays being increasingly tangent to the head towards the borders.
So the actual problem does not fall on that practice did not follow theory rules, but on how hard it is to calibrate a camera from shots taken to a sphere-like shape when distortion is far from negligible. If you had used a well calibrated set of wide angle primes, you wouldnt have found any abnormal distortion in the point cloud but just poorer texture rendition, and thus probably a noisier mesh model.
Again congrats for your work and thank you for your enormous contribution to this forum.
Title: Re: 35mm for head scans
Post by: Mfranquelo on February 27, 2014, 01:29:12 PM
Dear all,

Thank you for your input on this!

35mm samyang has just arrive, i've done the first tests of image quality. I'll post results as soon as possible. Focusing ring is amazing, i can really fine tune the focus. This lens doesnt provide EXIF data however, i will have to introduce it later on manually.

- Barrel distortion seems to be pretty OK.

See the images here : https://www.dropbox.com/sh/6ulo6kc67wtn107/GdKOQvXF2U

- The quality of the 35mm is practically the same as the 50mm, maybe a little bit worse on corners, but barely noticeable, its a little bit bettter on the center of the lens, in my opinion.
- I took a lot of time to fine tune focus both of them
- These are images are unprocessed RAW to TIFF

- I can photograph later on a square grid with both lens.