This activity aims to correct geometric distortions which are a natural occurrence when taking pictures with a camera. The image below clearly shows a distorted image. We observe that the lines are not straight. What we aim here is to make the lines appear straight.
The instructions given can be summarized as follows:
1. Count the number of pixels down and across one box from the most undistorted grid of the image.
2. From the obtained data, we create an ideal and compute c1 to c8. We compute c1 to c8 by picking four points in the distorted image and then taking their respective coordinates in the ideal grid coordinate. Then using the equations below.
3. Per pixel in the ideal grid calculate the corresponding coordinate in the distorted grid. This can be done by using the equations below.
I measured the size of a box with the most undistorted part of the image. The size was 9 pixels by 11 pixels. Then I created the ideal grid using scilab. The calculation of c1 to c8 were supposed to be per rectangle but it would take an eternity to do that so I picked a fairly large rectangle from the distorted image and took the coordinates of vertices and their corresponding coordinates in the ideal grid. Below is the table of the data that was recorded.
I calculated c1 to c8 and used it to know the corresponding location of each pixel in the ideal grid in the distorted grid. Then since it is more likely that the answer would be a non-integer I used interpolation. I did not use the round command since it is better to use the int command which gives the greatest integer value. I used this because I need the 4 nearest neighbors. For example if the coordinate was (9.5,10.6) I know that its nearest neighbors would be (9,10), (10,10), (9,11) and (10,11). If I used the round command it would be more difficult since I would have two cases which are round up or down so I used the int command. Using the int command the nearest neighbors of (x,y) would just be (int(x),int(y)), (int(x)+1,int(y)), (int(x),int(y)+1) and (int(x)+1,int(y)+1). The corrected image is shown below.
The resulting image is much less distorted than the original. We could improve the correction if we section the image and then calculate the corresponding c1 to c8 of each section which was the original instruction. Nevertheless, the correction was still successful and the interpolation was also done.
It took me quite a while to blog this activity so I give myself a grade of 8. Even though I was successful in doing the correction as well as the interpolation, I was still late. Sorry for the late posting but I did this activity on the day it was given. In fact I did it even though I was sick at that time laying in my bed with my laptop.
Thanks for everyone who helped me in this activity. Thank you Ma'am Jing because you chatted with me while I was sick. Thanks to Cole, Jeric and Julie. Special thanks for SPP and Bio 11 for preventing me to post this blog on time.
1. Count the number of pixels down and across one box from the most undistorted grid of the image.
2. From the obtained data, we create an ideal and compute c1 to c8. We compute c1 to c8 by picking four points in the distorted image and then taking their respective coordinates in the ideal grid coordinate. Then using the equations below.
3. Per pixel in the ideal grid calculate the corresponding coordinate in the distorted grid. This can be done by using the equations below.
I measured the size of a box with the most undistorted part of the image. The size was 9 pixels by 11 pixels. Then I created the ideal grid using scilab. The calculation of c1 to c8 were supposed to be per rectangle but it would take an eternity to do that so I picked a fairly large rectangle from the distorted image and took the coordinates of vertices and their corresponding coordinates in the ideal grid. Below is the table of the data that was recorded.
Ideal Coordinates | Real Coordinates | ||
Xi | Yi | Xr | Yr |
54 | 33 | 48 | 30 |
54 | 187 | 52 | 183 |
99 | 33 | 95 | 31 |
99 | 187 | 97 | 183 |
The resulting image is much less distorted than the original. We could improve the correction if we section the image and then calculate the corresponding c1 to c8 of each section which was the original instruction. Nevertheless, the correction was still successful and the interpolation was also done.
It took me quite a while to blog this activity so I give myself a grade of 8. Even though I was successful in doing the correction as well as the interpolation, I was still late. Sorry for the late posting but I did this activity on the day it was given. In fact I did it even though I was sick at that time laying in my bed with my laptop.
Thanks for everyone who helped me in this activity. Thank you Ma'am Jing because you chatted with me while I was sick. Thanks to Cole, Jeric and Julie. Special thanks for SPP and Bio 11 for preventing me to post this blog on time.
1 comment:
I think the results are good enough for a grade of 9.0. Not 10 because the bottom left part of the capiz window still appears unstraightened. LOL on the acknowledgments to SPP and BIO 11.
Post a Comment