ImageProcessing-ElectronicPublications / photoquick

Light-weight image viewer with crop,resize,collage, photogrid and filters
GNU General Public License v3.0
4 stars 0 forks source link

Alpha in reFilter? #26

Closed zvezdochiot closed 3 years ago

zvezdochiot commented 3 years ago

https://github.com/ImageProcessing-ElectronicPublications/photoquick/blob/cf0b658f73069a8e6436b64b2946490509faebd4/src/main.cpp#L546

I used RGB in this function, https://github.com/ImageProcessing-ElectronicPublications/photoquick/blob/cf0b658f73069a8e6436b64b2946490509faebd4/src/main.cpp#L557-L558 thinking that the Alpha channel, if present, will remain untouched. But this is not the case.

Default resize (x4):
x4
Enable RIS (x4):
x4-RIS

Can you get around this so as not to run into a segfault?

PS: If successful, I intend to use reFilter in Smooth/Blur as an option for unSharp/reBlur.

ksharindam commented 3 years ago

The code seems ok. When it is causing segfault.

On Sun, 14 Mar, 2021, 2:08 AM звездочёт, @.***> wrote:

https://github.com/ImageProcessing-ElectronicPublications/photoquick/blob/cf0b658f73069a8e6436b64b2946490509faebd4/src/main.cpp#L546

I used RGB in this function,

https://github.com/ImageProcessing-ElectronicPublications/photoquick/blob/cf0b658f73069a8e6436b64b2946490509faebd4/src/main.cpp#L557-L558 thinking that the Alpha channel, if present, will remain untouched. But this is not the case.

Default resize (x4): [image: x4] https://camo.githubusercontent.com/651edfd627793bebcfb4e17526a190017ab98bf9ddf37640d21fdf897bbafbee/68747470733a2f2f693131342e666173747069632e72752f6269672f323032312f303331332f62622f37653338643364303032366339626364313163663461643961623762386162622e706e67 Enable RIS (x4): [image: x4-RIS] https://camo.githubusercontent.com/778fed79276f0eaf5e91a5e509b8d7f52e8501783a06fbcefe476e31c2adee7c/68747470733a2f2f693131342e666173747069632e72752f6269672f323032312f303331332f66332f37333537316238343830373362343962383037643632316266383836373766332e706e67

Can you get around this so as not to run into a segfault?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ImageProcessing-ElectronicPublications/photoquick/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKWXPSLVKHQNSIAT6SRHWLTDPEKVANCNFSM4ZEF2MFQ .

zvezdochiot commented 3 years ago

@ksharindam say:

When it is causing segfault.

I'm just not used to QImage yet. I don't understand him well. In c, such a mismatch would inevitably lead to a segfault. Did some experiments on copying qAlpha from source images, but something strange is happening on the test image:

RGBA
(https://github.com/ImageProcessing-ElectronicPublications/photoquick-examples/blob/main/orig/wallwatter.png)

I'm clearly missing something. But the result I get is bad. Perhaps a fresh eyes (yours) will solve this problem.

                //rowre[x] = qRgb(r, g, b);
                rowre[x] = qRgba(r, g, b, qAlpha(clrre));

Default resize (x2, crop center):
x2
Enable RIS (x2, crop center):
x2-RIS

PS: In my opinion, Alpha will climb to the red channel.