evo-biomech / scAnt

open-source 3D scanning and processing pipeline
MIT License
173 stars 39 forks source link

Reconstruction failed #9

Closed pbrennan10 closed 2 years ago

pbrennan10 commented 2 years ago

I was able to successfully run the stacking and masking and fix the metadata after acquiring the images, but I am having two problems: First several of the masked images show just a black box, so the masking is not being successful. I am using CLAHE 9.5 but maybe I should do something else? The second problem is that when I reconstruct the model in Zephyr (lite), it does not work because all the cameras collapsed to a single perspective (it does not go 360 degrees around the object), this is even though I am using the masked images that I got, which we thought was the problem before. This may be a problem with the Zephyr settings? Or could it be the metadata are not really fixed? Would love some suggestions. Attached are two pictures 0

0

FabianPlum commented 2 years ago

Hi Patty! Glad to hear, you are making progress! I suspect the issue lies on the side of masking here. Could you upload a few of your stacked images and post a link to them here so I can try to find more suitable values?

The ideal settings depend on your dataset's appearance but once you have those dialed in, they should work with most specimens you place in the scanner, given you keep lighting and magnification similar.

All the best Fabi

FabianPlum commented 2 years ago

Oh, could you also post your Zephyr settings here?

pbrennan10 commented 2 years ago

Hi Fabi, Here is the link to the images. I uploaded both the stacked and the masked.

https://drive.google.com/drive/folders/1T9kk3qmEmdthzK1Qwr9grPR21RVaWy7A?usp=sharing

The calibration for the camera in Zephyr says: Autocalibrated (unknown 5472X3648 px / 0 x 0 px) The camera orientation presets: General, presets: default. Dense point cloud creation presets: Category general, Presets: default, same for surface reconstruction presets and texturing presets (default multi texture) (use multiband method: yes, maximum number of vertices: 2000000, maximum cameras per triangle 1.

FabianPlum commented 2 years ago

Hi Patty!

I just had a look at your images and the reason you are not getting a 3D reconstruction seems to be that the Y axis is actually not rotating for some reason. If you look at the images, you'll see that all images for one X position are mostly identical in their visual content. Have another look at your setup, maybe a cable got disconnected, or the pin was not secured.

Once the Y axis is spinning again as expected, here's what I'd advise to do:

Looking at your image masks (the ones in the folder you uploaded), the majority looks great! For the ones that appear entirely black or have strange cutouts, try lowering the CLAHE option to be less aggressive. This way the random forest-based outline detection has a better chance of picking up coherent contours. Also, check the min and max threshold values. Looking at the images you have uploaded, I'd recommend using

--mask_thresh_min 175 --mask_thresh_max 195

You also need to add the metadata to the stacked images. The config file should contain all the metadata you need, namely camera and lens model, resolution, sensor size, and focal length. If you use a different camera and lens setup than in the original paper, simply open the config file and replace whatever is in there with your own details. When running stacking and masking through the scAnt user interface while scanning, metadata will be written from the config file to your final stacked images automatically. When you stack and mask after the capturing process, you will need to run the following:

(from within the scAnt folder on your computer)

conda activate scAnt cd scripts python .\batch_fix_meta_data.py --images "...\Masked and stacked images MAGO001F\stacked" --config "...\Masked and stacked images MAGO001F\MAGO001F_config.yaml"

Replace the --images path to your "stacked" folder and the --config path to your config file. If there are spaces in your folder paths you will have to write the path in quotation marks. Otherwise, you can just copy it directly.

Then, in Zephyr, the following settings work well for your specimens:

Texturing

Hope this helps!

All the best Fabi

pbrennan10 commented 2 years ago

Hi Fabi! Success with the reconstruction... We are having a small issue with some holes on the edges of the model, and I think it may be the masking? We went from CLAHE 9.5. to CLAHE 8.0... Should we try further down? Getting closer! Patty

Screenshot 2022-06-14 120345

pbrennan10 commented 2 years ago

We played with many CLAHE values, and this one was still the best, so we are trying different values for each model.