How can I transform this curved wall to a flat wall without any distortions in the image? Is there any code available for it?

11 views (last 30 days)
Hello. Mathwork community. I want to convert a curved wall in an image to a flat wall in x-y coordinates. How can I perform this. How can I make a code for it? or is there any code available which can help me out.

Answers (2)

Walter Roberson
Walter Roberson on 2 Nov 2022
Edited: Walter Roberson on 2 Nov 2022
To convert the curved wall to a flat wall without any distortions in the image then you will need to do a Deep Learning-style semantic segmentation to analyze the "idea" behind each small section of the wall, and then you would use the "idea" of each segment to build a new image that matched the semantics of the other image. So for example instead of matching the actual texture of the bricks, you might be able to find a number of samples of textured flat bricks online and choose one (or several) that were close matches for the original texture, and use in order texture samples to build a model of a new textured wall.
The output would not be a "transformation" of the image, it would be a rebuild of "the same idea" of a wall.
If you want to use the original image but unwarped to produce a flat wall, then there is no way to avoid distortion. The best you would be able to do is to place a limit on the amount of distortion you were willing to accept, and then to crop the transformed image at the boundaries where the distortion started to get more than you were willing to live with.
Those look like they might standard be 7 5/8" bricks. On my screen, the middle brick of the second layer (from the top) measures 48 mm wide, and as you follow that layer to the right, the furthest fully-visible brick is approximately 12 mm wide on my screen -- a 4:1 ratio after 5 bricks. In order to create a straight wall, those edges would have to be magnified by about 4:1, somehow recovering the texture in them that cannot really be seen from this angle (for example can you clearly count the number of dots on that far brick?) You cannot recover information that is not present in the original image.
  2 Comments
Mudassar
Mudassar on 3 Nov 2022
Thank you Sir @Walter Roberson for your kind suggestions.
Actually, I am planning to performing 2D Digital Image Correlation (DIC) on this brick wall to check the development of displacements and strains in it due to extreme weather conditions. Therefore, I have created a speckle pattern of white dots on this wall for DIC purpose, and I am taking same kind of images of this wall on daily basis from the same camera, same position, same angle and with same resolution, so that I can compare them later on in DIC. However, as per the principles of DIC, none of the images should be distorted, as any kind of distortion will lead to distortion of this white speckle pattern on the wall, which is the fundamental aspect of DIC. Therefore, any kind of distortion while converting this curved wall to flat wall will end up in giving us wrong results of displacements and strains in DIC. So, I cannot avoid any kind of distortions in the image. Moreover, I cannot create a rebuild "of the same idea" of the wall, as suggested by you bcoz in that the effects of natural changes in the extreme weather conditions cannot be inculcated.
So, isn't there any possible way, either any code or some other method, through which I can transform this curved wall to a flat wall without any distortions to perform 2D DIC on it?
Walter Roberson
Walter Roberson on 3 Nov 2022
So, isn't there any possible way, either any code or some other method, through which I can transform this curved wall to a flat wall without any distortions to perform 2D DIC on it?
If you had a flat wall, and you were looking straight at it from a particular point, and it had regular markings on it, then as you look further and further off-axes, the markings get closer and closer together. You can calculate the apparent distance in such a situation according to cos() of the angle relative to the viewing axis (0 being straight on, increasing angle meaning more and more left or right.) That is natural behaviour "without distortion" for a flat wall. You do not ask for the image to be projected as-if it were all straight on to you, you only ask that the image be projected as-if it were a flat wall -- so you expect the bricks at the edges to appear narrower than the bricks at the centre.
When you have a wall that is curved away from you, there would also be some reduction in apparent size according to angle, just because of viewing angle. But... you also get some shortening because of the curvature.
I will need to think about this more when I am more awake.

Sign in to comment.


Bjorn Gustavsson
Bjorn Gustavsson on 2 Nov 2022
Sure thing. First assume that all bricks are flat bricks of exactly the same size. Then identify the edges of each brick in the image. The horizontal length-variation is due to the combination of the rotation due to the curvature of the well-wall, and the effects of the camera-projection (which we don't know anything about from this single image). For a properly flat wall you have to undo this combined effect. One way to do this is to simply rescale the horizontal size of the bricks to your assumed unit-brick-size.
HTH
  6 Comments
Mudassar
Mudassar on 3 Nov 2022
Edited: Mudassar on 3 Nov 2022
Thank you Sir @Bjorn Gustavsson for your kind suggestions.
Actually, I am planning to performing 2D Digital Image Correlation (DIC) on this brick wall to check the development of displacements and strains in it due to extreme weather conditions. Therefore, I have created a speckle pattern of white dots on this wall for DIC purpose, and I am taking same kind of images of this wall on daily basis from the same camera, same position, same angle and with same resolution, so that I can compare them later on in DIC. However, as per the principles of DIC, none of the images should be distorted, as any kind of distortion will lead to distortion of this white speckle pattern on the wall, which is the fundamental aspect of DIC. Therefore, any kind of distortion while converting this curved wall to flat wall will end up in giving us wrong results of displacements and strains in DIC. So, I cannot avoid any kind of distortions in the image. Moreover, I cannot create a rebuild "of the same idea" of the wall, as suggested by Sir @Walter Roberson, bcoz in that the effects of natural changes in the extreme weather conditions cannot be inculcated.
So, isn't there any possible way, either any code or some other method, through which I can transform this curved wall to a flat wall without any distortions to perform 2D DIC on it?
Walter Roberson
Walter Roberson on 3 Nov 2022
The title of the question is
How can I transform this curved wall to a flat wall without any distortions in the image? Is there any code available for it?
so "without any distortions" is a direct quote from the poster.

Sign in to comment.

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!