Aligned the two images


(اية طارق) #1

السلام عليكم ورحمه الله وبركاته

الاخ الفاضل لدي استفسار في الماتلاب
كيفيه اجراء alignment the two images حيث هناك صورتان بينهما اختلاف بسيط ( صورتان متشابهتان مع اختلاف بسيط في الثانيه بسبب الحركه ) واريد ان اجعل الثانيه مشابهه للاولى تماما بواسطه aligned the second image لجعلها تشابه الاولى

ولك جزيل الشكر

اختك ايه


(mr.volt) #2

[CENTER][SIZE=3]اختي الكريمه ما تريدين يندرج تحت ما يسمى في علم معالجه الصور الرقميه ب Image Registration واترك لك التفاصيل لتبحري في اعماق الموضوع

[/size][/center]
Overview

[CENTER]Image registration is the process of aligning two or more images of the same scene. Typically, one image, called the base image or reference image, is considered the reference to which the other images, called input images, are compared. The object of image registration is to bring the input image into alignment with the base image by applying a spatial transformation to the input image. The differences between the input image and the output image might have occurred as a result of terrain relief and other changes in perspective when imaging the same scene from different viewpoints. Lens and other internal sensor distortions, or differences between sensors and sensor types, can also cause distortion.






The following figure provides a graphic illustration of this process. This process is best understood by looking at an example. See Example: Registering to a Digital Orthophoto for an extended example.




[SIZE=3]

[/size][/center]
Example: Registering to a Digital Orthophoto

[CENTER]This example illustrates the steps involved in performing image registration using point mapping. These steps include:

[ul]
[li]Step 1: Read the Images[/li][li]Step 2: Choose Control Points in the Images[/li][li]Step 3: Save the Control Point Pairs to the MATLAB Workspace[/li][li]Step 4: Fine-Tune the Control Point Pair Placement (Optional)[/li][li]Step 5: Specify the Type of Transformation and Infer Its Parameters[/li][li]Step 6: Transform the Unregistered Image[/li][/ul]

[/center]
Step 1: Read the Images

[CENTER]In this example, the base image is westconcordorthophoto.png, the MassGIS georegistered orthophoto. It is a panchromatic (grayscale) image, supplied by the Massachusetts Geographic Information System (MassGIS), that has been orthorectified to remove camera, perspective, and relief distortions (via a specialized image transformation process). The orthophoto is also georegistered (and geocoded) — the columns and rows of the digital orthophoto image are aligned to the axes of the Massachusetts State Plane coordinate system. In the orthophoto, each pixel center corresponds to a definite geographic location, and every pixel is 1 meter square in map units.
The image to be registered is westconcordaerial.png, a digital aerial photograph supplied by mPower3/Emerge, and is a visible-color RGB image. The aerial image is geometrically uncorrected: it includes camera perspective, terrain and building relief, internal (lens) distortions, and it does not have any particular alignment or registration with respect to the earth.
The following example reads both images into the MATLAB workspace and displays them using
[SIZE=3]orthophoto = imread(‘westconcordorthophoto.png’);
figure, imshow(orthophoto)
unregistered = imread(‘westconcordaerial.png’);

figure, imshow(unregistered)[/size]
You do not have to read the images into the MATLAB workspace. The cpselect function accepts file specifications for grayscale images. However, if you want to use cross-correlation to tune your control point positioning, the images must be in the workspace.
[SIZE=3]

[/size][/center]
Step 2: Choose Control Points in the Images

[CENTER]
The toolbox provides an interactive tool, called the Control Point Selection Tool, that you can use to pick pairs of corresponding control points in both images. Control points are landmarks that you can find in both images, like a road intersection, or a natural feature.
To start this tool, enter cpselect at the MATLAB prompt, specifying as arguments the input and base images.
cpselect(unregistered, orthophoto)
The Control Point Selection Tool displays two views of both the input image and the base image in which you can pick control points by pointing and clicking. For more information, see Selecting Control Points. This figure shows the Control Point Selection Tool with four pairs of control points selected. The number of control point pairs you pick is at least partially determined by the type of transformation you want to perform (specified in Step 5). See Transformation Types for information about the minimum number of points required by each transformation.






[SIZE=3]

[/size][/center]
Step 3: Save the Control Point Pairs to the MATLAB Workspace

[CENTER]In the Control Point Selection Tool, click the File menu and choose the Export Points to Workspace option. See Exporting Control Points to the Workspace for more information.
For example, the following set of control points in the input image represent spatial coordinates; the left column lists x-coordinates, the right column lists y-coordinates.
[SIZE=3]input_points =

118.0000 96.0000
304.0000 87.0000
358.0000 281.0000

127.0000 292.0000[/size][/center]
Step 4: Fine-Tune the Control Point Pair Placement (Optional)

This is an optional step that uses cross-correlation to adjust the position of the control points you selected with cpselect. To use cross-correlation, features in the two images must be at the same scale and have the same orientation. They cannot be rotated relative to each other. Because the Concord image is rotated in relation to the base image, cpcorr cannot tune the control points. See Using Correlation to Improve Control Points for more information.

Step 5: Specify the Type of Transformation and Infer Its Parameters

In this step, you pass the control points to the cp2tform function that determines the parameters of the transformation needed to bring the image into alignment. cp2tform is a data-fitting function that determines the transformation based on the geometric relationship of the control points. cp2tform returns the parameters in a geometric transformation structure, called a TFORM structure.
When you use cp2tform, you must specify the type of transformation you want to perform. The cp2tform function can infer the parameters for five types of transformations. You must choose which transformation will correct the type of distortion present in the input image. See Transformation Types for more information. Images can contain more than one type of distortion.
The predominant distortion in the aerial image of West Concord (the input image) results from the camera perspective. Ignoring terrain relief, which is minor in this area, image registration can correct for camera perspective distortion by using a projective transformation. The projective transformation also rotates the image into alignment with the map coordinate system underlying the base digital orthophoto image. (Given sufficient information about the terrain and camera, you could correct these other distortions at the same time by creating a composite transformation with maketform. See Performing General 2-D Spatial Transformations for more information.)
mytform = cp2tform(input_points, base_points, ‘projective’);

Step 6: Transform the Unregistered Image

[CENTER]As the final step in image registration, transform the input image to bring it into alignment with the base image. You use imtransform to perform the transformation, passing it the input image and the TFORM structure, which defines the transformation. imtransform returns the transformed image. For more information about using imtransform, see Spatial Transformations
registered = imtransform(unregistered, mytform);
The following figure shows the transformed image transparently overlaid on the base image to show the results of the registration. (To see how this is done, see Example: Performing Image Registration.
[SIZE=3]

وبامكانك الاستفاده من الملف في المرفقات لطرق اخرى تحت نفس المفاهيم

[/size][/center]


(mr.volt) #3

اليك ايضا هاتين الصفحتين المتخصصتين في الموضوع من احد المراجع المهمه وهو digital image processing using Matlab والتي تحوي معظم ال approaches لتحقيق الربط


(اية طارق) #4

جزاك الله كل الخير لكن انا اريد ان اعمل alignment بدون اختيار control points يعني ان تقارن صوره مع اخرئ مخزونه كمصدر refrence واغير الثانيه بحيث اجعلها تشابه الاولئ بدون اختيار النقاط الرئيسيه وجزاك الله كل الخير

اختك ايه