Agisoft Metashape

Agisoft Metashape => General => Topic started by: 3D_Scan_Fan on March 21, 2015, 07:14:44 AM

Title: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on March 21, 2015, 07:14:44 AM
Hi guys, I dont know how else to explain this but I've been haivng some trouble with Photoscan recently.

After having taking photos of my subject by rotating around him three times resulting in 120 photos from all angles I load them up into Photoscan and in the beginning the alignment of the point cloud was terrible, it was almot like there was two face going on here, I really didnt know what to do.

Then I changed some settings on the Key Points and Tie Points which resulted me in a much more dense but sligtly more accurate result which gave me a point cloud with great alignment, very little overlap, I thought I got the right preferences correct in my settings. Then when I attempted to redo this again I once again got a horrible result which I am now stuck on and cant think of how I managed to get the better one.

The only time I managed to duplicate this result again is when I loaded a new batch of (the same) photos with different colour corrections applied. I saved it as soon as I saw a good result, but when I restarted everything again (without changing any of the settings) I got a bad alignment again.

This is really frustrating as the process of each stage is incredibly time consuming (literally leaving my computer on over many nights!) I dont understand what is going on here, I had it right early on and then it changed.

Can someone help me out here?
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: bigben on March 21, 2015, 09:32:53 AM
When you start an alignment from scratch there is no information about camera positions.  If you've already run the process once, then you are starting with the previously calculated camera positions. You can reset the cameras via a right click on the camera folder.

If you get what appear to be multiple copies of part of the model, then you have a couple of groups of cameras that have aligned amongst themselves, but there are no links between the groups.  Adding control points in those areas should help adjust the camera positions.
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: Alexey Pasumansky on March 22, 2015, 02:32:32 PM
Instable alignment results is usually caused by the input data problems, like lack of overlap, insufficient texture pattern on the object being scanned and/or quality of images.

If you can post some examples of the input images and correct/bad alignment results for the same project, it will be helpful.
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on March 23, 2015, 01:25:30 AM
When you start an alignment from scratch there is no information about camera positions.  If you've already run the process once, then you are starting with the previously calculated camera positions. You can reset the cameras via a right click on the camera folder.

If you get what appear to be multiple copies of part of the model, then you have a couple of groups of cameras that have aligned amongst themselves, but there are no links between the groups.  Adding control points in those areas should help adjust the camera positions.

Is there a tutorial on how to do this? I've even done this by start afresh, a new project and doing everything from scratch, closing the program and restarting it (including the PC). I just dont understand how one go it would go bad, and another go at doing the exact same thing with small tweaks resulted in something different (better) and from there nothing seemed to duplicate that result again.

Instable alignment results is usually caused by the input data problems, like lack of overlap, insufficient texture pattern on the object being scanned and/or quality of images.

If you can post some examples of the input images and correct/bad alignment results for the same project, it will be helpful.

Yeah sure, I did as quick printscreen of all the thumbnails of the photos I used (c&p them in photoshop as it's 120 altogether), hope this gives you a better idea.

(http://i.imgur.com/FfPenV3.jpg)

the one on the left is the better (upon closer inspection there is definitely some overlapping but is very minor, so much that it aligned pretty damn well. The one on the right is obviously what I am having trouble with, especially when using the same settings/preferences and no way to get the same result without somesort of luck.

(http://i.imgur.com/yB67VhS.jpg)
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: Wishgranter on March 23, 2015, 02:27:59 AM
try mask out all except the head..... and report back....
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on March 23, 2015, 03:26:44 AM
I have to mask all 120 photos???

Also when I do the Align Photos process which gives me the sparse point cloud, it gives me detail of the backgrounds and etc. all of which I delete all of them points before I go ahead creating the Dense Point Cloud. Would this be the same or perhaps not?
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: bigben on March 23, 2015, 03:43:06 AM
Yes, all 120 photos.  Deleting points in the sparse cloud is not the same.

Tried a similar thing once. Shooting close to the back of the head can be problematic as well. Better to include more shoulder to help with the alignment. I'm guessing that's what caused your "double object"
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on March 23, 2015, 04:19:09 AM
Hmmm, then should I try aligning the photos again but removing the ones that contain a large portion of the back of the head?
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: bigben on March 23, 2015, 09:11:49 AM
You could try disabling them rather than removing them ... or possibly move them to a new chunk and see if they align to each other, then align and merge the two chunks. 
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: James on March 23, 2015, 01:02:58 PM
try mask out all except the head..... and report back....
I have to mask all 120 photos???

To mask quickly, create a quick mesh of the head only on low settings, and then Tools->Imprt Mask -> from model. Then try aligning the photos again with 'constrain features by mask'.

This might give you a better alignment so you can create a better mesh and then import even better masks from that model.
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: Alexey Pasumansky on March 23, 2015, 02:38:40 PM
Hello 3D_Scan_Fan,

I think that the following video would be useful for you:

http://www.zbrushworkshops.com/content/jeffrey-wilsons-photogrammetry-webinar-replay
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on March 26, 2015, 07:09:07 AM
You could try disabling them rather than removing them ... or possibly move them to a new chunk and see if they align to each other, then align and merge the two chunks.

Well I always start a new project and only add the ones I need (all projects have a different filename). Anywa I did this by excluding the back of the head as much as I can from the different angles I took (Eye-Level, Low-angle & High-angle), and despite a big mess point cloud behind my subject, the results already look very impressive!

How do I go about aligning the different chunks and at what stage?

try mask out all except the head..... and report back....
I have to mask all 120 photos???

To mask quickly, create a quick mesh of the head only on low settings, and then Tools->Imprt Mask -> from model. Then try aligning the photos again with 'constrain features by mask'.

This might give you a better alignment so you can create a better mesh and then import even better masks from that model.

I will give the masking a go soon, I just dont have the time to ask all 120 photos with such precision, I want the contours, edge of the head as close as possible and I feel doing a hand masking process would interfere with that, but nver saying never!

Hello 3D_Scan_Fan,

I think that the following video would be useful for you:

http://www.zbrushworkshops.com/content/jeffrey-wilsons-photogrammetry-webinar-replay

That was really good stuff there, thanks for sharing that! The first 55mins explained and taught me alot of things already and was getting better results with it, however I am still ending up with a slightly noisy mesh, maybe because I am processing everything at High/UltraHigh quality?

What I have been doing as well beforehand was only doing one side at a time, thus half a head, generate a point cloud and mesh for each side and then merge/align them later in Geomagic Studio, is this a good idea perhaps guys? :D
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on March 27, 2015, 07:24:45 AM
Guys? Anyone??
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: James on March 27, 2015, 12:50:59 PM
I will give the masking a go soon, I just dont have the time to ask all 120 photos with such precision, I want the contours, edge of the head as close as possible and I feel doing a hand masking process would interfere with that, but nver saying never!

It only takes a minute or two to import masks from model, no precision needed, and then 95% of your background will be gone and you will have a better idea of where your problem is.

Because you took the shots with a single camera (i assume) the subject would have moved considerably during that time whereas (hopefully) the buildings in the background remained static. The buildings in the background fill more of the frame than the subject does so photoscan maybe makes more effort to align those properly and lets the actual subject alignment slip.

Even if you just create a basic single mask that only masks the right and left 33% of each image then you will probably get rid of enough background to improve your alignment, like the attached.

(Just create the mask manually in one photo, then export it and finally import it for all cameras)
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on March 28, 2015, 07:21:25 AM
Well what I did was I went ahead and made a very very rough mask by using all the shots combined together and making them transparent so I could see through each one roughly in Photoshop. I then would Lasso around the subject thus creating a mask which I then saved as a PNG with an Alpha channel. In some places it would cut out or into the subject but this was only a rough to see what will happen.

I did this for each angle (three altogether) and ran Align Photos, the results were outstanding! Everything seemed to have aligned almost perfectly, and nomore weird overlapping or seeing double :D The same goes for when generating the Dense Point Cloud (after doing some gradual selection of point and removing them).

Because of this, I have now taken the liberty to mask each of 120 photos and creating a mask png file. The mask itself is just a very loose constraint and outline but much more accurate than the previous since this doesn't cut off any part of the subject, My hand is very sore from this, it took me over 2 hours to do this! Very very tedious and repetitive, loosing my mind abit too. I hope this will be worth it since I just finished doing this.

However what I did notice, even though achieving a much superior result is that my generated model is still quite noisy, my photos are well exposed and shot at the lowest ISO (160) and even the noise within the photos was cleaned up, I don't know what could be causing a bumpy mesh :(
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: Marcel on March 28, 2015, 11:00:17 AM
However what I did notice, even though achieving a much superior result is that my generated model is still quite noisy, my photos are well exposed and shot at the lowest ISO (160) and even the noise within the photos was cleaned up, I don't know what could be causing a bumpy mesh :(

A bumpy / noisy mesh could be because of blurry photos. Go through your photos and see if they are in focus at the pixel level. Remove photos that are completely out of focus or show camera shake, and re-align the whole set or use Tools->Optimize Cameras. Be very strict about photo quality.

Another issue can be when the shape of the object changes in photos (ie. your subject moved their head or changed expression). It's hard to keep perfectly still during the whole shoot.

If you use too much noise reduction you might remove the pixel detail that Photoscan uses for reconstruction, so be careful not to crank the noise reduction too high.

Even the super 100+ camera rigs can show some noise in harder to scan areas, so don't expect perfect output.


Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on May 10, 2015, 04:15:08 AM
Hey guys, so sorry for the late reply, but I have been playing around with many different things and have been getting pretty decent results.

I dont think anything can change the fact that the mesh is noisy, my still are all generally in focus and after carefully inspecting the photos with the noised cleaned up there was little-to-no detail loss (incase I could see abit more due to no noise interfering). I have instead taken the mesh into Geomagic studio where I decimated a 60-70million polymesh down to 12.5% which (as I've discovered the hard way) makes things alot more manageable.

With that mesh I applied a Free-form noise reduction with the smoothness set at the highest and I resulted in something that's pretty good but that needs alittle more work on.

My problem now is, how do I get the textures that was originally created in Photoscan to faithfully be mapped back onto the cleaned mesh? I have been watching that webinar over and over and over again during the part where he does applies the texture back onto his cleaned mesh but not in great detail, I'm just worried that the UVs of the original mesh might not match up exactly to the cleaned up mesh, nor do I know the workflow to this exactly because he mentions "Keep UVs (what does it do???)" but doesn't demonstrate it properly.

Can anyone help me here?
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: bigben on May 10, 2015, 07:57:42 AM
Import the mesh back into Photoscan and create a texture.  As long as you haven't scaled/transformed the mesh it should be fine.  The UVs are created at the time of mesh generation, although you could also UV map before importing and retain that mapping in Photoscan.
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: James on May 11, 2015, 01:26:01 PM
My problem now is, how do I get the textures that was originally created in Photoscan to faithfully be mapped back onto the cleaned mesh? I have been watching that webinar over and over and over again during the part where he does applies the texture back onto his cleaned mesh but not in great detail, I'm just worried that the UVs of the original mesh might not match up exactly to the cleaned up mesh, nor do I know the workflow to this exactly because he mentions "Keep UVs (what does it do???)" but doesn't demonstrate it properly.

You only have to worry about 'keep uv' if you have a UV layout that you particularly like. In the webinar i think he generated his own UV layout based on the retopologised mesh, which it makes sense to 'keep' as it has a much more logical layout than that auto generated by photoscan.

If you have no particular attachment to your uv layout, or don't have one at all then just stick with generic mapping and let photoscan generate a new one when you generate the texture again for the retopologised and reimported model. So long as you didn't translate, rotate or scale the model it should all be fine.

* edit - just noticed that's almost exactly what bigben said... and more concisely!
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on May 12, 2015, 12:45:52 AM
Hmmm, that simple huh? :D

So all I do is just import mesh (which replaces the current one in the chunk, then just 'Build Texture' and that's it?

Also, how would I take it into Zbrush? It says that my (decimated and denoised) mesh contains no UVs and that I would need to apply UV mapping or polypaint. How do I get the texture that was generated in Photoscan onto the mesh in Zbrush?? :(
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on May 12, 2015, 02:16:57 PM
Anyone?

Anyone at all may I ask?
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: James on May 12, 2015, 03:11:52 PM
I haven't used zbrush, so only guessing!

If you have 'decimated and denoised' in zbrush then presumably you will have lost the uv mapping that was originally generated when you first textured the mesh in photoscan.

To generate a new uv map, you will have to either:

1. import the 'decimated and denoised' mesh into photoscan and generate texture using generic mapping (this will generate a new generic uv map for your 'decimated and denoised' mesh
2. do some uv unwrapping of the 'decimated and denoised' mesh in zbrush
3. uv unwrap in some other software

If you do #2 or #3 then you still need to do #1 but using 'keep uv' instead of 'generic' mapping.
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on May 12, 2015, 07:49:44 PM
Well what I've been doing was importing yhe decimated-denoised mesh into Photoscan, building a texture map for it and exporting an FBX file from Photoscan including a texture being made through it. Then i would take it into 3ds max which actually opens up the mesh with the texture in place correctly, then I would export that into an OBJ keeping yhe texture coordinates during the export, finally that exported OBJ containing UVs is imported into Zbrush and when i start applying a texture map it works, but not as it should be, it looks completely patchy and messy, reading it all wrong :(

And it's really strange, the mesh isnt that heavy but everytime i try adding a UVW Unwrap modifier to the mesh in 3ds max is seriously has a very hard time doing so, keep freezing, unresponsive and somewhat slow. I just thought i could redo the seams there and export a new texture based on that before doing any changes to it in Zbrush.

So I suppose what you're saying is, import the decimated-denoised mesh into Photoscan and build a texture using 'Keep UVs'? But wouldn't the outcome be different from 'Generic' or if one was to use any other option?

Also how would this differ? The mesh would still be the same and tbe exported texture map looks the same too (from my recollection).
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: mrb on May 12, 2015, 09:15:57 PM
You need to use the "flip-v" button on the texture in ZBrush.  Textures come into ZBrush upside down by default.  Same when you export a texture FROM zbrush - you need to flip-v it.
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on May 14, 2015, 01:29:30 PM
Okay wow, that was all what was needed to be done, feel abit stupid now :(

But in anycase, how would i go about doing it for 3ds max then??
Title: Re: Photoscan giving me (two) different alignment point clouds (Bug?)
Post by: 3D_Scan_Fan on May 17, 2015, 09:34:07 PM
No? Anyone at all?

I haven't used zbrush, so only guessing!

If you have 'decimated and denoised' in zbrush then presumably you will have lost the uv mapping that was originally generated when you first textured the mesh in photoscan.

To generate a new uv map, you will have to either:

1. import the 'decimated and denoised' mesh into photoscan and generate texture using generic mapping (this will generate a new generic uv map for your 'decimated and denoised' mesh
2. do some uv unwrapping of the 'decimated and denoised' mesh in zbrush
3. uv unwrap in some other software

If you do #2 or #3 then you still need to do #1 but using 'keep uv' instead of 'generic' mapping.

Well I've taken that as one of my steps, I Dynamesh'ed the mesh in Zbrush quite low and exported it as an OBJ and imported it back to Photoscan however the placement of the model is completely off, the transform and rotation does not match the original/dense cloud at all.

Either way with that I proceeded with Building a Texture for it as you normally do and not surprisingly everything came out looking wrong, complete garbage :(

How would I go abouts doing this? Bringing a modified mesh in Zbrush into Photoscan to work with??