# find correspondences using simple weighted sum of squared differences src = [] dst = [] for coord in coords_orig_subpix: src.append(coord) dst.append(match_corner(coord)) src = np.array(src) dst = np.array(dst)
model_robust, inliers = ransac((src, dst), AffineTransform, min_samples=3, residual_threshold=2, max_trials=100)
--
You received this message because you are subscribed to the Google Groups "Ames Stereo Pipeline Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ames-stereo-pipeline...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ames-stereo-pipeline-support/92d2ff8a-15ee-46fa-bb8c-cc46740b0a5f%40googlegroups.com.
Andrew,
The pc_align tool with the --initial-transform-from-hillshading option already uses ipfind and ipmatch under the hood. One can pass options to those two tools in pc_align. (Or maybe I misunderstand what you say.)
> 1. could it be used to align normal visible rasters, ie instead of using arcgis/qgis to georegister/co-register map projected images (I tried and although the matching worked great I didn’t see a way to apply to transformations).
Yeah, we have no option to apply a transform to a georeferenced image. A non-smart way of doing it is to use pc_align with two georeferenced images with an --initial-transform that you want to apply. Then those images will be interpreted as DEMs with the image value as a height. It will move that image as a cloud, and can save that aligned cloud to disk as a PC file. Then point2dem can be used to rasterize it to get back a (transformed) image. Ideally we should have the ability to apply a 2D transform to a 2D image to get back a 2D image using interpolation. Maybe one day. Should be easy to do in python with the relevant gis packages I guess, like gdal, or something.
Oleg
From: ames-stereo-pi...@googlegroups.com <ames-stereo-pi...@googlegroups.com> on behalf of Andrew Annex <andre...@gmail.com>
Sent: Wednesday, April 29, 2020 4:08 PM
To: Ames Stereo Pipeline Support <ames-stereo-pi...@googlegroups.com>
Subject: [EXTERNAL] idea/feature request: use ipfind/ipmatch georeferencing (aliging map projected images) and for improved pc_align instead of using hillshades
--Hey all,
I was playing around with ipfind/ipmatch and I was wondering two things:
1. could it be used to align normal visible rasters, ie instead of using arcgis/qgis to georegister/co-register map projected images (I tried and although the matching worked great I didn’t see a way to apply to transformations).
2 as an option instead of using the hill shades to align in pc_align. I used ipfind/match on a hirise and ctx pair which worked great, but I couldn’t use the transformation because I guess there is no associated Z information, but maybe there could be an advanced mode that uses the pixel positions of the matched points to get Z values from corresponding DEMs. Often when attempting to use the hill shade align I will end up with low numbers of ip matches (less than 30), which is totally adequate, but once I was left with 4 matches that somehow caused a 180 degree rotation of the hirise DEM.
You received this message because you are subscribed to the Google Groups "Ames Stereo Pipeline Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ames-stereo-pipeline-support+unsub...@googlegroups.com.
Oleg did suggest a workaround to align mapprojected images using pc_align transform: https://github.com/NeoGeographyToolkit/StereoPipeline/issues/265Perhaps one can use the formula here: https://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.AffineTransform and here: https://stackabuse.com/affine-image-transformations-in-python-with-numpy-pillow-and-opencv/ to apply the transformation matrix output by pc_align to the image geo-transform using python.The transformation matrix can also be found in python once you have the coordinates of the match points in the 2 images using ipfind/ipmatch. See this simple implementation here: https://scikit-image.org/docs/dev/auto_examples/transform/plot_matching.html#sphx-glr-auto-examples-transform-plot-matching-py. Specifically these 2 blocks:"""# find correspondences using simple weighted sum of squared differences src = [] dst = [] for coord in coords_orig_subpix: src.append(coord) dst.append(match_corner(coord)) src = np.array(src) dst = np.array(dst)"""The source and dst array will contain the match point coordinates in the 2 images.and"""# robustly estimate affine transform model with RANSACmodel_robust, inliers = ransac((src, dst), AffineTransform, min_samples=3, residual_threshold=2, max_trials=100)"""The model_robust variable will contain the transformation parameters.I will try to check what I wrote here makes any sense by running it in sometime. I tried these with sample image data in skimage, and it worked well there, but have not tried on satellite images yet, so these are suggestions, not answers :) .
On Wed, Apr 29, 2020 at 4:14 PM Andrew Annex <andre...@gmail.com> wrote:
--Hey all,I was playing around with ipfind/ipmatch and I was wondering two things:1. could it be used to align normal visible rasters, ie instead of using arcgis/qgis to georegister/co-register map projected images (I tried and although the matching worked great I didn’t see a way to apply to transformations).2 as an option instead of using the hill shades to align in pc_align. I used ipfind/match on a hirise and ctx pair which worked great, but I couldn’t use the transformation because I guess there is no associated Z information, but maybe there could be an advanced mode that uses the pixel positions of the matched points to get Z values from corresponding DEMs. Often when attempting to use the hill shade align I will end up with low numbers of ip matches (less than 30), which is totally adequate, but once I was left with 4 matches that somehow caused a 180 degree rotation of the hirise DEM.
You received this message because you are subscribed to the Google Groups "Ames Stereo Pipeline Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ames-stereo-pipeline-support+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ames-stereo-pipeline-support/92d2ff8a-15ee-46fa-bb8c-cc46740b0a5f%40googlegroups.com.
I see. What you propose would be easy enough. It would assume that images are overlayed accurately on top of the DEMs. Then matches would be found among the images, and those would be transferred on top of the DEMs.
In fact, if each of your DEMs has precisely the same resolution as the image mapprojected on top of it, the current approach can be used with very small changes. First, ipfind and ipmatch is used to find the matches, among the images, then pc_align is invoked with the two DEMs and the value of the option --match-file being obtained from the images. Here it is implicitly assumed that the DEMs and images have one-to-one correspondence among the pixels. Then pc_align will extract the height info for each of those pixels and find the best-fitting 3D transform.
In short, it is easy to write a little script that would do calls to ipfind, ipmatch, then pc_align with that match file option.
To view this discussion on the web visit https://groups.google.com/d/msgid/ames-stereo-pipeline-support/148d4132-f7c7-42f9-8863-953c39b91de9%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ames-stereo-pipeline...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ames-stereo-pipeline-support/92d2ff8a-15ee-46fa-bb8c-cc46740b0a5f%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Ames Stereo Pipeline Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ames-stereo-pipeline...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ames-stereo-pipeline-support/148d4132-f7c7-42f9-8863-953c39b91de9%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Ames Stereo Pipeline Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ames-stereo-pipeline...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ames-stereo-pipeline-support/126d6e0e-8912-44f5-88cb-564f9361578e%40googlegroups.com.
On Oct 21, 2020, at 10:48 PM, Shashank Bhushan <sbag...@uw.edu> wrote:
<read_match.py>