mltframework / mltframework/mlt
Discovered a bug regarding image size scaling and rotation
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.9k
- Forks
- 387
- Avg merge
- 17h 28m
- Merged PRs (30d)
- 8
Description
Hello everyone, there is a strange bug here. When I non proportionally scale the original image size, for example, using the 'affine' filter to set the image size to 640x640, using both the 'distort' and 'fill' parameters, and then I use 'fix_rotate_x' to rotate the image 90 degrees , and you will find that the image has distortion, the aspect ratio of the rotated image has also changed,which is completely different from before the rotation I found that this problem also occurs when rotating at other angles.
However, I found that if I scale the original image proportionally, such as using the 'affine' filter's rect parameter to set the image size to 960x540 for a 1920x1080 resolution original image, and then rotate it 90 degrees, I did not find any abnormalities, and the image looked fine.
May I ask how to solve this problem? I want to achieve non proportional scaling of the image and then rotate it.
Here are some examples and detailed information
This is the original image
I scaled the original image in a non proportional manner to obtain this image
I rotated the scaled image 90 degrees clockwise and the resulting image is as follows. I can see that the aspect ratio of the image has changed, which is different from before the rotation
Similarly, when I rotate the scaled image clockwise by 45 degrees, the resulting image is as follows. It can be observed that the aspect ratio of the image has changed, which is different from before rotation, and there may also be distortion
However, when I proportionally scaled the original image and then rotated it, these issues did not occur
This is the original image
I scaled the original image in a proportional manner to obtain this image
I rotated the scaled image 90 degrees clockwise and the resulting image is as follows,this doesn't seem like a problem, the aspect ratio of the image before and after rotation is consistent
Similarly, when I rotate it 45 degrees, the image looks fine
This is how I use code:
filter->set("transition.distort", 1);
filter->set("transition.fill", 1);
char tmp[128];
snprintf(tmp, 128, "%g/%g:%gx%g:1", geometry.left(), geometry.top(), geometry.width(), geometry.height());
filter->set("transition.rect", tmp);
filter->set("transition.valign", "middle");
filter->set("transition.halign", "center");
filter->set("transition.fix_rotate_x", geometry.rotate());
producer->attach(*filter);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example using the affine filter with distort and fill, then apply fix_rotate_x through the transition settings shown. Trace how transition.rect, non-proportional scaling, and rotation are handled, and compare the output at 90 and 45 degrees. Done means rotated output preserves the intended aspect ratio without distortion after non-proportional scaling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100