N
N
Neiro House2020-11-05 12:02:03
Python
Neiro House, 2020-11-05 12:02:03

How to make an elastic (not discontinuous) deformation of the picture such as in my cases?

A question arose that puzzled me.
There is a picture (which is indicated below). This is valid for any image that needs to be deformed.
5fa3bef22e869734914250.png
With it, you need to do the following, this is to reduce it along the Y axis (in height) by 15-20%. Further, after this procedure, you need to take,
as I understand it, divide the image into 2 parts and already deform the second part so that there is this kind of barreling.
5fa3bf01cd82d755496831.png
I have been thinking about how to make this program for a week, I read a bunch of articles and QnA on similar topics, but nothing came up.
As I understand it, in order to do this correctly, you need to divide the picture into a grid, then make an elastic deformation. But feltings of the mind, felts of experience does not allow me to realize this topic.
I will not leave my code (because it is no different at this stage (except for the inversion of the sine wave) from the code in the 1st article), instead I will send just a link to the stackoverflow from which I tried to deny:
1) https://stackoverflow.com/ questions/52460962/conve...
2) https://stackoverflow.com/questions/32462548/plot-...
And the most important and, as I understand it, the most necessary information for me is here (but here I didn’t understand how to move and where are the points that the answerer sets and how will I make a kind of elliptical barreling in the code):
3) https://stackoverflow.com/questions/53907633/how-t
... that with a large radius, the picture is cut out and does not look like a single whole.
If you have a suggestion or at least from what else you can build on, then I very much ask you to help in this matter.
If you answer with a code, I will be very happy if you explain to me what you did, because most likely I will need to do some more fraud with pictures, and such a hero will most likely not be on my questions for the second time!
Thanks in advance to all those who read this question!
All peace.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
maaGames, 2020-11-05
@maaGames

1. Make a textured polygonal 2D mesh (the smaller, the more accurate the result will be)
2. Deform the mesh in any way in any direction, even barrel-shaped, even a wave, whatever you want
3. visualize the polygonal mesh
4. PROFIT.
How specifically to do this in opencv and python I will not say. But I'm sure it's possible.

A
Armenian Radio, 2020-11-05
@gbg

The usual solution to the problem of body deformation, partial differential equations used in structural mechanics will help you.
The image will need to be covered with a grid of dots.
You will need an iterative algorithm that will alternately calculate the magnitude of the stresses at the nodes of the points, and then move these points to new places.
Any engineering student who has studied numerical methods can handle this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question