Copy link to clipboard
Copied
Hi all.
There is a video about 20 seconds long. Somewhere around 7 seconds
at 2 seconds, the shooting scene is illuminated by a red light source.
You need to find the frame number when such lighting began.
The search strategy is to find the number of red pixels in the current frame
video, and comparing this value with the number of red pixels in the next frame.
Is there any filter that can give such a value?
Can anyone suggest another strategy for solving this problem, using AE?
Copy link to clipboard
Copied
can you post some screenshots for both frames, with and without the red light? so we can better idea about the difference
Copy link to clipboard
Copied
The stage is illuminated by a red laser
Copy link to clipboard
Copied
You could try to use an effect like Shift Channels and set it to Red only, then apply some sort of sampleImage() expression to detect and count the pixels. Either way, anything but trivial.
Mylenium
Copy link to clipboard
Copied
Hello Mylenium
Can you describe the proposed algorithm in more detail?
Where should sampleImage() be set??
Copy link to clipboard
Copied
You don't just "set" sampleImage(). In your case one would need to construct an algorithm that loops through all the pixel areas until it finds pixels with a pre-defined threshold, then accumulates them in some form. Again, this is not exactly trivial stuff and would take some time to develop and test. Given the low contrast in your image there may also be other factors to consider like additional processing with effects. For the basics of sampleImage() you can find enough tutorials online just by typing in the function name in a web search.
Mylenium
Copy link to clipboard
Copied
What is the purpose of the search? Are you hoping to remove the red pixels by using the frame next to it? If so, a difference matte might be the simplest option, or content aware fill will be a bit more time consuming but lead to a better result.
Given that it's a laser beam, a luma key is another possibility.
If you just need to identify the frames, you're only dealing with 2 seconds of footage to check. Pop a podcast one, and use the page down key to go frame by frame and hit the numpad * key whenever the light is on screen.
Copy link to clipboard
Copied
suggestion:
1) create a slider control
2) apply an expression to the slider control which does the following:
- sample image (preferably only of the region where the laser occurs, if you know that region) at current frame and at previous one.
- subtract color at previous frame from color at current frame, let's call that "color delta"
- you now have "color delta" values for all three channels r,g, and b and they tell you how much the intensity in these colors changed. Compute an additional "color delta average" as the average of the "color delta"s for r,g and b.
- subtract the "color delta average" from the red "color delta" and use this value as the end result of the expression.
3) bake the expression into keyframes and look at the keyframes values in the graph editor.
The keyframes should have a high peak at all the frame where the laser occurred.
By subtracting the average from the red channel, you make sure that you only have high peaks when the area becomes more red and not if the entire scene gets just brigher (i.e. red, but also green and blue increase).