Shotdetect logic

Shotdetect logic:
Shotdetect is a nice useful tool, for video processing area of work. In essence, it tells you at which shots there was/is a scene/shot change. It takes a threshold value and compares two consecutive frames.(I’d like an option to compare more ,but the compare algo gets complicated).

Even for the two images, he’s doing summary statistics of the frames/images. But, there are problems with that approach, (i.e: high intensity object in a small corner of an image, like a car headlight, ) can be counted as shot, it can be valid in cases where 25% of the image/frame is a car light, but on a long shot of the road, it’s probably a bad idea.

So he splits the image into segments and summarizes the segments and compare segment by segment.
Here’s the logic/code:
(in film.cc cscope/grep for CompareFrame function )

for (y = 0; y < height; y++) {
for (x = 0; x data[0] + y * pFrame->linesize[0] + x * 3);
c2 = *(pFrame->data[0] + y * pFrame->linesize[0] + x * 3 + 1);
c3 = *(pFrame->data[0] + y * pFrame->linesize[0] + x * 3 + 2);

c1prev = *(pFramePrev->data[0] + y * pFramePrev->linesize[0] + x * 3);
c2prev = *(pFramePrev->data[0] + y * pFramePrev->linesize[0] + x * 3 + 1);
c3prev = *(pFramePrev->data[0] + y * pFramePrev->linesize[0] + x * 3 + 2);

c1tot += int ((char) c1 + 127);
c2tot += int ((char) c2 + 127);
c3tot += int ((char) c3 + 127);

score += abs (c1 - c1prev);
score += abs (c2 - c2prev);
score += abs (c3 - c3prev);
}

He splits the image into 3 parts and then multiplies the x and y values and calculates differences.

One immediate improvement I can think of is to split the image into 9 parts(3×3 square matrix) and weight each of the subsections differently. For example: I would weight the centermost(2,2) section higher (atleast in some type of movies/videos).
However, on second thoughts ,it’s better to make it a user choice. I think, I’ll tary to work on it and send a pull request, when I find free time to revive my long-dead C skills. Here’s an initial untested attempt.

UPDATE: Jun. 27-2015 Initial test run says it takes longer to run and prints fewer shots. but the code is still buggy giving I/O error while saving the data.

expertise vs generalists

I used to hate the idea of becoming an expert and rebel at all those who suggested i focus and become an expert.
I used to hate and rebel it so much so that i have let it dictate the course of my career so far.
At this point i find that, it has it’s uses.
1.Claiming/accumulating credentials/certifications/work experience for expertise in one area,
creates an easy,packageable brand of your skill sets.
In fact that is what most modern educational institutions are about. As for whether it’s good or bad, i don’t know.

2.A clear, surer, certain path can be created unless of course you are claiming expertise in a completely new area.
(think Mandelbrot* and fractals or script-based thinking(EY) or narrative based decisions(VGRao) with a preset narrative or script)

3. It can create anti-fragile careers, as long as the branch is established and you manage to convince a majority to acknowledge your accreditations.

* — Am aware of that it’s disputable(only among mathematicians?) to say Mandelbrot created the area,
but i don’t know the history, and just need a reasonably well-known example/analogy here.

On the Other hand, generalist requires a hell of a lot of effort and most importantly,
the skillsets and/or accomplishments that come with it are not scalable across multiple humans and their belief/trust/faith**.

** — whatever that convinces them to part with their money for using your help/advice/service.