1. New to Christmas lighting? Get started with the AusChristmasLighting 101 Manual:
    auschristmaslighting.com/wiki/AusChristmasLighting-101

Grid Pattern generation - vbscript version with pixel mapping

Discussion in 'Sequencers & Software Tools' started by AussiePhil, Oct 18, 2010.

  1. AussiePhil

    AussiePhil Dedicated Elf Administrator

    Joined:
    Jun 20, 2009
    Messages:
    1,391
    Likes Received:
    1
    Location:
    Canberra, ACT, Australia
    Find Me On:
    As some are already aware been playing with the a bit and have got it to a point it may be useful.

    Attached in the ZIP you will find two vbscript files, they have some internal documentation so people can see what they do.
    Also a sample pixelmap.csv is include. This is based on my own proposed mapping for the megatree.

    Requirements:
    This has been tested with the latest version of ImageMagick, the portable version.

    Getting started:
    Choose a location with plenty of space, though with todays HDD's this shouldn't matter.

    • Create a folder and name it something sensible to you, mine is called TigerVMS (Tiger Vixen Matrix Scripts)
    • Unzip the attached scripts into this this folder
    • Create a subfolder called IM6, download the portable version of imagemagick and unzip into this folder.
    • Create the vixenvir folder, this is not yet auto-created if missing
    • Create the imageinput folder, this is the default location for image sequences.

    ImageMagick download page
    http://www.imagemagick.org/download/www/binary-releases.html#windows

    Once you have down all that you need some image files to actually process.
    There are many options but for the Windows world VirtualDub is what i am using.
    http://www.virtualdub.org/
    Sorry can't run through a how to use but the goal is to open a mpg file and then export as Image Sequence into the imageinput folder above.

    Once you have a set of images in the folder, it's time then to get your hands dirty at the command line.
    Open a CMD window and change to the drive and folder you created in the beginning.
    Here is my full command line with all options
    cscript imageprocess.vbs /inputfolder:imageinput /width:40 /height:56 /imagetype:png /nogif:false

    Check the images folders and see if it worked
    if so, you can now run the ppmprocess.vbs file
    here's my command line
    cscript ppmprocess.vbs /outputfile:mymatrix.vir /mapfile:pixelmap.csv

    The pixelmap file was generated in excel and exported as a comma separated list, if no pixel map file is provided a 1:1 mapping is done.

    --------------------------------
    Here's the headers from both script files
    '.............................................
    'Script ppmprocess.vbs Version 1.1
    '
    'Purpose: Convert a selection of PPM files into a Vixen Routine file
    ' Primary use for RGB Matrix sequencing.
    '
    'Author: Aussiephil from forums.auschristmaslighting.com
    '
    'Requirements:
    ' Script must be located in a parent folder to the PPM files, the ppm folder must be called outputppm.
    ' output folder vixenvir MUST exist.
    '
    'Copywrite: Aussiephil 2010... with credit to mrpackethead for the original perl scripting (that made little sense to me)
    '
    'Aurguments accepted by script
    ' /outputfile:<name of file>
    ' /mapfile:<name of file>
    '
    'Version 1.0: Released 16 Oct 2010
    'Version 1.1: Released 18 Oct 2010
    '.............................................

    '.............................................
    'Script imageprocess.vbs Version 1.1
    '
    'Purpose: Convert a selection of image files into PPM files that can be processed
    ' Primary use for RGB Matrix sequencing.
    '
    'Author: Aussiephil from forums.auschristmaslighting.com
    '
    'Requirements:
    ' Script must be located in a parent folder to the image files, the image folder defaults to imageinput.
    ' Output folders are created if they are missing
    ' The ImageMagick convert.exe MUST be located in a subfolder called IM6
    '
    'Copywrite: Aussiephil 2010... with credit to mrpackethead for the original perl scripting (that made little sense to me)
    '
    'Aurguments accepted by script
    ' /inputfolder:<name of folder> no trailing slash and defaults to imageinput
    ' /width:<pixel width of matrix>
    ' /height:<pixel height of matrix>
    ' /imagetype:<file extension of images> defaults to png
    ' /nogif:<true/false> only true required, defaults to false and outputs gif files to assist.
    '
    'Version 1.0: Released 16 Oct 2010
    'Version 1.1: Released 18 Oct 2010
    '.............................................

    --------------------------
    Cheers
    Phil
    UPDATED File

    Version 1.2
    Pixel Map now used correctly.
    NOTE: after saving your csv file please open in notepad and remove the QUOTE marks around the text data especially the RGB entry.

    The default output file is a pastelog file open this file select all, copy to clipboard and then just paste in Vixen.
    NOTE: For larger matrix sizes this file can get quit large and have examples over a 100Mb. I would seriously recommend installing Notepad++ it's free and handles large files quite well.

    Another file is created that contains a Channel Order for vixen, this can be pasted into a sequence file or a profile file, i would suggest the profile be used.
     

    Attached Files:

  2. cBell

    cBell New Elf

    Joined:
    Jun 26, 2010
    Messages:
    4
    Likes Received:
    0
    Location:
    Brewster, OH, USA
    I know you guys have recommended Quartz Composer for actually making the videos, is there anything comparable for Windows?
     
  3. mrpackethead

    mrpackethead Full Time Elf

    Joined:
    Jun 12, 2010
    Messages:
    452
    Likes Received:
    0
    Location:
    Wellington
    Phil, you should release this under creative commons licence..
     
  4. joelrose

    joelrose NW Iowa

    Joined:
    Jul 3, 2010
    Messages:
    41
    Likes Received:
    0
    Location:
    NW Iowa
    Two issues I found with the files the script generates.

    The it inserts a blank line at the beginning of the .vir file.
    Nor a biggie, just delete it now that I know what it is.

    The second is that the pixel map is only applied to the first universe. Universes 2 & 3 are not rotated to fit my matrix.

    If anyone can confirm theses issues it would help trackinng the cause.

    I have checked, and rechecked my pixelmap.

    Pixelmap,RGB,24,21,1,,,,,,,,,,,,,,,,,,,
    61,64,187,190,313,316,439,442,565,568,691,694,817,820,943,946,1069,1072,1195,1198,1321,1324,1447,1450
    58,67,184,193,310,319,436,445,562,571,688,697,814,823,940,949,1066,1075,1192,1201,1318,1327,1444,1453
    55,70,181,196,307,322,433,448,559,574,685,700,811,826,937,952,1063,1078,1189,1204,1315,1330,1441,1456
    52,73,178,199,304,325,430,451,556,577,682,703,808,829,934,955,1060,1081,1186,1207,1312,1333,1438,1459
    49,76,175,202,301,328,427,454,553,580,679,706,805,832,931,958,1057,1084,1183,1210,1309,1336,1435,1462
    46,79,172,205,298,331,424,457,550,583,676,709,802,835,928,961,1054,1087,1180,1213,1306,1339,1432,1465
    43,82,169,208,295,334,421,460,547,586,673,712,799,838,925,964,1051,1090,1177,1216,1303,1342,1429,1468
    40,85,166,211,292,337,418,463,544,589,670,715,796,841,922,967,1048,1093,1174,1219,1300,1345,1426,1471
    37,88,163,214,289,340,415,466,541,592,667,718,793,844,919,970,1045,1096,1171,1222,1297,1348,1423,1474
    34,91,160,217,286,343,412,469,538,595,664,721,790,847,916,973,1042,1099,1168,1225,1294,1351,1420,1477
    31,94,157,220,283,346,409,472,535,598,661,724,787,850,913,976,1039,1102,1165,1228,1291,1354,1417,1480
    28,97,154,223,280,349,406,475,532,601,658,727,784,853,910,979,1036,1105,1162,1231,1288,1357,1414,1483
    25,100,151,226,277,352,403,478,529,604,655,730,781,856,907,982,1033,1108,1159,1234,1285,1360,1411,1486
    22,103,148,229,274,355,400,481,526,607,652,733,778,859,904,985,1030,1111,1156,1237,1282,1363,1408,1489
    19,106,145,232,271,358,397,484,523,610,649,736,775,862,901,988,1027,1114,1153,1240,1279,1366,1405,1492
    16,109,142,235,268,361,394,487,520,613,646,739,772,865,898,991,1024,1117,1150,1243,1276,1369,1402,1495
    13,112,139,238,265,364,391,490,517,616,643,742,769,868,895,994,1021,1120,1147,1246,1273,1372,1399,1498
    10,115,136,241,262,367,388,493,514,619,640,745,766,871,892,997,1018,1123,1144,1249,1270,1375,1396,1501
    7,118,133,244,259,370,385,496,511,622,637,748,763,874,889,1000,1015,1126,1141,1252,1267,1378,1393,1504
    4,121,130,247,256,373,382,499,508,625,634,751,760,877,886,1003,1012,1129,1138,1255,1264,1381,1390,1507
    1,124,127,250,253,376,379,502,505,628,631,754,757,880,883,1006,1009,1132,1135,1258,1261,1384,1387,1510


    Joel.
     
  5. OP
    OP
    AussiePhil

    AussiePhil Dedicated Elf Administrator

    Joined:
    Jun 20, 2009
    Messages:
    1,391
    Likes Received:
    1
    Location:
    Canberra, ACT, Australia
    Find Me On:
    Joel...

    Nothing looks wrong, i'll look at implementing a channel map log file just so we can see what happens

    Phil
     
  6. mrpackethead

    mrpackethead Full Time Elf

    Joined:
    Jun 12, 2010
    Messages:
    452
    Likes Received:
    0
    Location:
    Wellington
    well, gotta be paitent, and you'll get a .vir file eventually..

    Get this, i put in a 19MB video file, and the .VIR file is 33MB!
     
  7. neilric99

    neilric99 Full Time Elf

    Joined:
    May 20, 2010
    Messages:
    295
    Likes Received:
    0
    Location:
    Irvine, the OC, CA
    Find Me On:
    that is the same in LSP, as soon as you put in transitions the files get big
     
  8. joelrose

    joelrose NW Iowa

    Joined:
    Jul 3, 2010
    Messages:
    41
    Likes Received:
    0
    Location:
    NW Iowa
    Phil here is my profile,

    Matrix is 24 wide 21 high starts at channel 900
     

    Attached Files:

  9. joelrose

    joelrose NW Iowa

    Joined:
    Jul 3, 2010
    Messages:
    41
    Likes Received:
    0
    Location:
    NW Iowa
    Here is a sample putting Vixen and a 24 x 21 RGB matrix thru its paces.

    MatrixTest L vs V

    The first effect is color wave generated by LSP
    40 seconds 40 frames the ECG is set to 50ms refresh.
    I tried upping to 120 frames over 40 seconds with no change
    Then I seen the AVI is only 6 seconds long, so I changed to 6 seconds and 24 frames , and still no change.

    The second effect is also color wave produced by Vixen 50ms timing 8) 8) I like 8) 8)

    Next up is just random from Vixen with 30% saturation and 100ms duration 8) 8) thats cool 8) 8)

    Then the Vertigo spiral from Vixen, yes it it moving

    And the waving Flag also from Vixen

    If I needed to, I uses Any Video Converter to change the frame rate.
    Then used VirtualDub to split into Png or Jpeg
    Then ImageQuick and Phils FIRST scripts to convert to png and finally a vir(vixen routine)

    This produces a routine with channel 1 in the top left corner and channel 2 to the right of that.
    If your matrix is not set up this this way the channels need to be remapped to fit your actual layout.
    Phil attempted this in the second set of scripts, But I thought they only did the first universe, then stopped.

    I thought why not create a channel order that matches the input, so I went about rearranging all the channels to be in the order to routine was expecting them in, After I go two rows done I created the routing again and it was correct, this was going to work, but I was only on row 3 and there were 18 more rows to reorder.

    A quick glance at the profile showed that the channel order section was not encoded and it was only CSV data.
    Thank you KC :)

    So I should be able to get a spread sheet to come up with all these numbers for me.
    After I set up a little x & y data, once I came up with the formula for the first 6 cells, all I had to do was paste them into all the cells for the matrix.

    Save the results as CSV and paste int the Vixen channel order data.
    Set that channel order in Vixen and paste my routine and it is automagically mapped.

    I can post more details on the spreadsheet if any one is interested.

    I know what I am using this year 8)

    JOel
     
  10. joelrose

    joelrose NW Iowa

    Joined:
    Jul 3, 2010
    Messages:
    41
    Likes Received:
    0
    Location:
    NW Iowa
    Attached is my spread sheet that I used to create the channel map that I overlaid into the vixen channel order data.

    The only two formulas that count are in cell C1 and F1.
    A1, B1, are based on C1 and D1, E1 are based on F1.

    Once those 6 cells are correct you just past them to the size of your matrix.

    Row 25 and column CA have setup data that the formulas use.

    C27 is the vixen offset. I start at 0, and when everything looks right change it to your starting channel number -1(vixen is 0 based)

    Now that you have the correct formulas save the sheet as xls for future use.
    Then save as CSV to set the values.
    Close the file and reopen the CSV

    Delete the unneeded data in colum CA row 25 and cell CA.
    Export as CSV again .

    Open your vixen profile and create a new channel order, call it MATRIX
    Open both the profile and the CSV in notepad.
    Replace the CrLf with a comma and paste the modified CSV data into the MATRIX output order replacing the appropriate channels.

    If you did it right vixen will not crash when you select the MATRIX channel order.

    Joel
     

    Attached Files:

  11. TimW

    TimW Full Time Elf

    Joined:
    Jun 15, 2010
    Messages:
    168
    Likes Received:
    0
    Location:
    Melbourne
    I now have the code working directly with almost 2 universes (16x 20 grid) and Phil's original pixelmap format.

    The changes I needed to ppmprocess.vbs v1.1 :

    Line 80:
    Code:
    dictsize = sizearray(0) * sizearray(1)*3
    (had to add the x3 to get the channels instead of pixels)

    Line 122:
    Code:
    For rowcount = 1 to UBound(linesout)
    (for some reason the first row is blank... vixen hates that!....so start from line 1)

    Tim
     
  12. OP
    OP
    AussiePhil

    AussiePhil Dedicated Elf Administrator

    Joined:
    Jun 20, 2009
    Messages:
    1,391
    Likes Received:
    1
    Location:
    Canberra, ACT, Australia
    Find Me On:
    New zip file attached with an updated ppmprocess script.

    Couple of important points after using this in anger for about a week with a 42x56 Matrix size.

    1. Imagemagick will fail with no errors if the number of files it is processing is to large, I have limited mine to around 2,000 files per run. I have just been using subfolders.

    2. the ppmprocess script will get very slow around 5,000-6,000 files. I have used it to process 10,000 ppm files but left it overnight.

    3. for best results make the video frame rate equal to the proposed sequence timing. ie 25ms timing = 40fps etc

    4. a bug yet to be fixed... spreadsheets will save the CSV file with text delimiters, normally quotes, these MUST be removed from around the RGB text or the script will not build the map data correctly. open the file in notepad and remove quotes.
    Example:
    CORRECT: Pixelmap,RGB,42,56,1

    WRONG: "Pixelmap","RGB",42,56,1

    -----------------------

    Point 4 will fix the issue mentioned by Tim

    Cheers
    Phil
     

Share This Page