Folks,

I was playing with the chromakey pluging and found that the threshold
parameter was behaving strangely when changing modes (RGB-float or RGB8
for example).

Digging into the code, the threshold is used to compare the difference
(RMS) of the components with the key color. But the threshold should be
a percentage (varying between 0 and 100%), so it makes sense to  divide
the difference by something of the same nature (difference is a value, a
percentage is a ratio between two values).

The following patch does that. I found that it's much easier to get a
cleaner key mask with this applied.
With this, the threshold means a percentage of "color difference"  with
the key color.

Now I've played a bit with elimitating spill light, but I don't have
anything really good yet. Does anybody have pointers to techniques to do
so ?

Let me know,
    Jerome

-----


diff -uNr hvirtual.orig/plugins/chromakey/chromakey.C
hvirtual/plugins/chromakey/chromakey.C
--- hvirtual.orig/plugins/chromakey/chromakey.C 2006-01-31
12:23:58.000000000 -0500
+++ hvirtual/plugins/chromakey/chromakey.C      2006-02-12
14:48:28.753754863 -0500
@@ -420,9 +420,9 @@
                                        YUV::yuv_to_rgb_f(r, g, b, y, u
- 0.5, v - 0.5); \
                                } \
  \
-                               float difference = sqrt(SQR(r - red) +  \
+                               float difference = (sqrt(SQR(r - red) +  \
                                        SQR(g - green) + \
-                                       SQR(b - blue)); \
+                                       SQR(b - blue)))/(red+green+blue); \
  \
                                if(difference < threshold) \
                                { \


_______________________________________________
Cinelerra mailing list
[email protected]
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra

Reply via email to