Open Edu371 opened 3 weeks ago
warpAffine applies interpolation to all channels, including alpha. It means, that alpha value on rectangle border is not strictly 0 or 255.
yes, but the problem is that when the background color is (255, 0, 0, 0) it is interpolating to red even though alpha is 0.
when image background is RGBA (0, 0, 0, 0)
when image background is RGBA (255, 0, 0, 0)
when image background is RGBA (0, 255, 0, 0)
background is fully transparent so it be (0, 0, 0, 0) or (255, 0, 0, 0) or (0, 255, 0, 0) should produce same results, the RGB channels should be ignored when alpha is 0
this wikipedia articles describes this problem
https://en.wikipedia.org/wiki/Alpha_compositing#Comparison
The most significant advantage of premultiplied alpha is that it allows for correct blending, interpolation, and filtering. Ordinary interpolation without premultiplied alpha leads to RGB information leaking out of fully transparent (A=0) regions, even though this RGB information is ideally invisible. When interpolating or filtering images with abrupt borders between transparent and opaque regions, this can result in borders of colors that were not visible in the original image. Errors also occur in areas of semitransparency because the RGB components are not correctly weighted, giving incorrectly high weighting to the color of the more transparent (lower alpha) pixels.
@asmorkalov i provided more info about this ussue please reconcider
System Information
OpenCV python version: 4.9.0.80 Operating System / Platform: Windows 10 Python version: 3.11.2
Detailed description
when using any type of interpolation the border matches background color, which is expected, the problem is that even when the background alpha is 0, it is still blending the others RGB channels
Steps to reproduce
zoom in the images to see
Issue submission checklist