I am interested in generating DEM form Corona images for mountainous region.
I have mosaic the images and generated camera files. Now when I try to run initial stereo, it got stuck at 2%. And after waiting for 5 hours, it sometime improves to 40% progress.
I am not using any map projected images. I am just trying to generate initial stereo with mosaic raw images.
Please suggest how to overcome this.
# Run stereo with initial camera models
init_stereo_dir = os.path.join(outdir, "init_stereo")
os.makedirs(init_stereo_dir, exist_ok=True)
stereo_cmd = f"stereo {img1} {img2} {cam1} {cam2} --alignment-method affineepipolar --unalign-disparity {os.path.join(init_stereo_dir, 'run')}"
os.system(stereo_cmd)
[ 2024-Feb-14 14:46:43 ] : Stage 0 --> PREPROCESSING
--> Setting number of processing threads to: 8
Stereo file ./stereo.default could not be found. Will use default settings and command line options only.
Writing log info to: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-log-stereo_pprc-02-14-1446-13941.txt
Using session: opticalbar
Loading camera model: /home/das/Documents/corona_dem_asp/corona_post/for.tif /home/das/Documents/corona_dem_asp/corona_post/for.tsai
Loading camera model: /home/das/Documents/corona_dem_asp/corona_post/aft.tif /home/das/Documents/corona_dem_asp/corona_post/aft.tsai
Distance between camera centers in meters: 6684.81.
Using image files: /home/das/Documents/corona_dem_asp/corona_post/for.tif, /home/das/Documents/corona_dem_asp/corona_post/aft.tif
Using camera files: /home/das/Documents/corona_dem_asp/corona_post/for.tsai, /home/das/Documents/corona_dem_asp/corona_post/aft.tsai
Computing statistics for left
Using downsample scale: 28
stats: [**************************************************] Complete!
Writing stats file: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-for-stats.tif
left: [ lo: 6 hi: 255 mean: 123.066 std_dev: 59.5897 ]
Left image stats time: 4.25426
Computing statistics for right
Using downsample scale: 28
stats: [**************************************************] Complete!
Writing stats file: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-aft-stats.tif
right: [ lo: 3 hi: 255 mean: 165.02 std_dev: 65.6873 ]
Right image stats time: 3.82478
--> Applying alignment method: affineepipolar
--> Matching interest points in StereoSession.
Using epipolar threshold = 7151.04
IP uniqueness threshold = 0.8
Datum: Geodetic Datum --> Name: WGS_1984 Spheroid: WGS 84 Semi-major axis: 6378137 Semi-minor axis: 6356752.
3142451793 Meridian: Greenwich at 0 Proj4 Str: +proj=longlat +datum=WGS84 +no_defs
Using rough homography.
Rough homography--> [****************************************] Complete!
Projected 19507 rays for rough homography.
Rough homography inlier threshold: 10726.6
RANSAC iterations: 100
Estimating rough homography using RANSAC with 100 iterations.
Number of inliers: 19507.
RANSAC time: 10.5321 seconds.
Rough homography fit elapsed time: 11.8125 s.
Aligning right to left for IP capture using rough homography: Matrix3x3((0.967173,-0.0515867,0)(-0.00333539,0.980833,0)(-3.14486e-07,8.58098e-08,1))
Looking for IP in left image.
Using 50 interest points per tile (1024^2 px).
Detecting IP
Building descriptors
Found interest points: 37000
Recording interest points to file: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-for.vwip
Looking for IP in right image.
Using 50 interest points per tile (1024^2 px).
Detecting IP
Building descriptors
Found interest points: 38318
Elapsed time in ip detection: 117.154 s.
--> Matching interest points using the epipolar line.
Uniqueness threshold: 0.8
Epipolar threshold: 7151.04
Matching forward
---> Obtained 37000 matches.
Matching backward
---> Obtained 38318 matches.
Matched 620 points.
Unable to find inlier cluster, keeping best 70% of points.
Removed 23 points in stddev filtering.
Reduced matches to 411
Elapsed time in ip matching: 25.19 s.
Computing homography transform.
Homography rectification inlier threshold: 10726.6
RANSAC iterations: 100
Homography matrix:
Matrix3x3((1.11495,0.391284,-3813.5)(0.0313604,1.0823,-2645.09)(1.0867e-06,6.89247e-06,1))
Number of inliers: 391.
Elapsed time in homography computation: 0.173545 s.
* Writing match file: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-for__aft.match
Computing the epipolar rectification using RANSAC with 1000 iterations and inlier threshold 10.
RANSAC was unable to find a fit that matched the supplied data.
Attempting RANSAC with 136 inliers.
RANSAC was unable to find a fit that matched the supplied data.
Attempting RANSAC with 90 inliers.
RANSAC was unable to find a fit that matched the supplied data.
Attempting RANSAC with 60 inliers.
Found 99 / 411 inliers.
Maximum absolute difference of y components of aligned inlier interest points is 9.53316 pixels.
--> Aligning left and right images using affine matrices:
Matrix2x3((0.031938,-0.999737,5327)(0.999953,0.00969494,0))
Matrix2x3((0.0173951,-0.953017,6898.06)(0.997107,0.0414458,-529.051))
--> Normalizing globally to: [3.88657 296.394]
--> Writing pre-aligned images.
--> Writing: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-L.tif.
L: [******************************************************] Complete!
Time to write left image: 43.0865
--> Writing: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-R.tif.
R: [******************************************************] Complete!
Time to write right image: 44.232
--> Generating image masks.
Writing masks: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-lMask.tif /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-rMask.tif.
Mask L: [***************************************************] Complete!
Mask R: [***************************************************] Complete!
--> Creating previews. Subsampling by 0.0491556 by using a tile of size 128 and 8 threads.
Sub L: [*************************************************] Complete!
Sub R: [*************************************************] Complete!
Sub L Mask: [********************************************] Complete!
Sub R Mask: [********************************************] Complete!
Convergence angle percentiles (in degrees) based on interest point matches:
25% 1.5065, 50% 1.63485, 75% 1.74922.
[ 2024-Feb-14 14:55:29 ] : PREPROCESSING FINISHED
--> Setting number of processing threads to: 8
Stereo file ./stereo.default could not be found. Will use default settings and command line options only.
Writing log info to: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-log-stereo_corr-02-14-1455-17538.txt
Using session: opticalbar
Loading camera model: /home/das/Documents/corona_dem_asp/corona_post/for.tif /home/das/Documents/corona_dem_asp/corona_post/for.tsai
Loading camera model: /home/das/Documents/corona_dem_asp/corona_post/aft.tif /home/das/Documents/corona_dem_asp/corona_post/aft.tsai
Distance between camera centers in meters: 6684.81.
--> Using LOG pre-processing filter with 1.5 sigma blur.
[ 2024-Feb-14 14:55:30 ] : Stage 1 --> CORRELATION
[ 2024-Feb-14 14:55:30 ] : Stage 1 --> LOW-RESOLUTION CORRELATION
Cached IP match file found: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-for__aft.match
--> Using interest points to determine search window.
* Loading match file: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-for__aft.match
Removed 2 outliers based on percentiles of differences of interest points with --outlier-removal-params.
Refined search range using a histogram and --outlier-removal-params: (Origin: (-1612, -4098) width: 4946 height: 12843)
Search width of 4946 is greater than desired limit of 4000, retrying with more aggressive IP filter.
Refined search range using a histogram and --outlier-removal-params: (Origin: (-644, -758) width: 1670 height: 2163)
D_sub search range: (Origin: (-42.375, -51.5) width: 103.75 height: 135) px
Writing: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-D_sub.tif
--> Low-resolution disparity:[*******************************] Complete!
Filtering outliers in D_sub based on --outlier-removal-params.
Inlier range based on x coordinate of disparity: -175 210.
Inlier range based on y coordinate of disparity: -186 185.
Number (and fraction) of removed outliers by disparity values in x and y: 0 (0).
Height above datum inlier range: -280971 294245.
Number (and fraction) of removed outliers by the height check: 0 (0).
Triangulation error inlier range: -21256.4 25137.2.
Number (and fraction) of removed outliers by the triangulation error check: 0 (0).
Writing filtered D_sub: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-D_sub.tif
D_sub: [****************************************************] Complete!
Writing triangulated point cloud based on D_sub: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-PC_sub.tif
PC_sub: [***************************************************] Complete!
--> Full-res search range based on D_sub: (Origin: (-814, -1038) width: 2035 height: 2300)
[ 2024-Feb-14 14:58:00 ] : LOW-RESOLUTION CORRELATION FINISHED
[ 2024-Feb-14 14:58:00 ] : CORRELATION FINISHED
--> Setting number of processing threads to: 8
Stereo file ./stereo.default could not be found. Will use default settings and command line options only.
Writing log info to: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-log-stereo_corr-02-14-1458-17725.txt
Using session: opticalbar
Loading camera model: /home/das/Documents/corona_dem_asp/corona_post/for.tif /home/das/Documents/corona_dem_asp/corona_post/for.tsai
Loading camera model: /home/das/Documents/corona_dem_asp/corona_post/aft.tif /home/das/Documents/corona_dem_asp/corona_post/aft.tsai
Distance between camera centers in meters: 6684.81.
--> Using LOG pre-processing filter with 1.5 sigma blur.
[ 2024-Feb-14 14:58:02 ] : Stage 1 --> CORRELATION
--------------------------------------------------
Kernel size: Vector2(21,21)
Search range: (Origin: (-814, -1038) width: 2035 height: 2300)
Cost mode: 2
--------------------------------------------------
Writing: /home/das/Documents/corona_dem_asp/corona_post/corona_post/init_stereo/run-D.tif
--> Correlation :[*...............................................] 2%