Heroine Virtual Ltd. wrote:
> By the way, your equations for "av" and "avm" still use "s".
> Finally, you're still using 1/2 everywhere. At least in gcc, this
> evaluates to 0 which works.
> Actually using 0.5 breaks it.
and there's a couple of other typos as well... like an as=as and so forth
I've attached a patch against CVS that should fix it for good (I hope)
This version looks OK on the footage I use, which is a bad test, but I
didn't get around to do a synthetic test bench that could make sure of
the correctness.
> In 7 years of designing chromakey effects, hue keying has always
> produced the coarsest results.
> The reason is hue only has 1/3 the information of the color cube.
> Chromakeying with 8 bit consumer
> cameras doesn't work. You can spend a lot of time desigining
> chromakey algorithms and learn about
> software engineering that way, but you're not going to get very far.
The reason why I personally like hue keying is that it's less precise :-)
The other reason I like it is that it's a bit more intuitive to tweak
(purely a personal opinion).
Consumer-grade video uses 4:2:0 or 4:1:1 chroma subsampling, so you end
up pulling keys with a color information that's 4 times less dense
(spatially) than luma anyway.
How about doing a bilinear/bicubic interpolation of the chroma
information (UV) when importing 4:2:0 footage ? That might dramatically
improve the quality of keying/color processing in general (even for
4:2:2) ...
Would that be a good idea or there is something else I'm not getting ?
> You need really good lighting, perfectly consistent mattes, and a 10
> bit camera to get TV
> weather forecast quality. To get cinematic quality, you need a lot of
> manual artifact removal
> in Cinepaint. At least you only have to airbrush 25fps. If you were
> American you'd have to
> airbrush 30fps.
For professional work I agree 100%; for toying around, this does a good
enough job for me...
Hey, Cinelerra is the only decent free editor/compositor out there, so
the kids making Star Wars fan films might want to do chroma keying with
it :-) don't you think it's worth giving them the tools ?
BTW, my only complain with the existing chromakey is that I can't use it
for some reason. Is there a documentation/tutorial that explains how to
set it ?
Cheers, and thanks again for taking the trouble of pointing out my mistakes,
Jerome
--- chromakey.C.orig 2006-04-10 09:39:12.970449639 -0400
+++ chromakey.C 2006-04-10 15:29:08.024599732 -0400
@@ -622,7 +622,7 @@
else if ((out_slope != 0) && (ABS (h - hk) < tolerance * 180))
ah = ABS (h - hk) / tolerance / 360; /* we scale alpha
between 0 and 1/2 */
else if (ABS (h - hk) < tolerance_out * 180)
- ah = 1 / 2 + ABS (h - hk) / tolerance_out / 360; /* we scale
alpha between 1/2 and 1 */
+ ah = 0.5 + ABS (h - hk) / tolerance_out / 360; /* we scale
alpha between 1/2 and 1 */
else
has_match = false;
@@ -634,9 +634,9 @@
else if (s - sat >= min_s_in)
as = 0;
else if ((out_slope != 0) && (s - sat > min_s))
- as = (s - sat - min_s / min_s) / 2;
+ as = (s - sat - min_s) / (min_s * 2);
else if (s - sat > min_s_out)
- as = 1 / 2 + (s - sat - min_s_out) / (min_s_out * 2);
+ as = 0.5 + (s - sat - min_s_out) / (min_s_out * 2);
else
has_match = false;
}
@@ -649,9 +649,9 @@
else if (v >= min_v_in)
av = 0;
else if ((out_slope != 0) && (v > min_v))
- av = (s - min_v / min_v) / 2;
+ av = (v - min_v ) / (min_v * 2) ;
else if (v > min_v_out)
- av = 1 / 2 + (v - min_v_out) / (min_v_out * 2);
+ av = 0.5 + (v - min_v_out) / (min_v_out * 2);
else
has_match = false;
}
@@ -664,9 +664,9 @@
else if (v <= max_v_in)
avm = 0;
else if ((out_slope != 0) && (v < max_v))
- avm = (s - max_v / max_v) / 2;
+ avm = (v - max_v) / ( max_v * 2);
else if (v < max_v_out)
- avm = 1 / 2 + (v - max_v_out / max_v_out) / 2;
+ avm = 0.5 + (v - max_v_out ) / (max_v_out *2);
else
has_match = false;
}