Hello,
I'm trying to write a script that will let me create an array of Pixel Analyzer analysis areas that will encompass whatever size video clip I'm working on. That is, to create enough analysis areas to cover the entire video in both x and y directions. I should mention I am a total newbie to coding.
Since the PixelAnalyzer node can be made to create ,say, 2 analysis areas just by using
CODE
PixelAnalyzer(0, "1", 1, "area1", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, width/2, height/2, 30, 30, 1,0, "1", 1, "area2", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, width/2, height/2, 30, 30, 1)
I figured I should use a for-loop to create a sufficient number of analysis areas, and insert whatever string I get into the PixelAnalyzer.
This is what I have so far, only trying to create an array of 2 analysis areas for the moment:
CODE
image arraytest(image img=0)
{
string Numbers0 = "0, 0, \"1\"";
string Numbers1 = "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15";
string String = "";
for(i=0;i<2;++i)
{if(i==0)
{String = stringf("\"area%d\",%s,%d,30,30,1", i, Numbers1, 30*(i+1))}
else
{String = stringf("%s,\"area%d\",%s,%d,30,30,1", String, i, Numbers1, 30*(i+1))}
};
return PixelAnalyzer(Numbers0, String);
}
Now, everything about the script works except for actually creating the PixelAnalyzer node. That causes Shake to crash with a segmentation fault. I tested the output of my strings by outputting them to the filein field of a filein node, and the string created is fine and works if I paste that as an input for the PixelAnalyzer(). So, I deduce the PixelAnalyzer function doesn't accept a string as an input. This just leaves me with one question: what do I do now? I worry that I'll have to somehow parse my string to separate the number arrays and the character strings, and then find a way to feed those to the PixelAnalyzer function. Worry because I have no idea where to begin with that.
If anyone can offer advice, I would be most appreciative.