Grid Pattern Generation on the cheap.

mrpackethead

Full time elf
Joined
Jun 12, 2010
Messages
452
Location
Wellington
Starting point..


(1) Create Quicktime move in Quartz composer..

(2) Export as a quicktime movie..

Dimensisons 16 x 10
Duration pick the appropriate time

(3) Open in Quicktime Player...

File ---> Export
Movie to Image Sequence
---> Options Format PNG
---> Frames per second 10
---> No space beofre Number

(4) Use imagemagik to convert the entire directory to a 10x16! ppm file.

run from within the folder that contains the .pngs

mkdir ppm && for i in *.png; do echo $i ; /opt/local/bin/convert $i -resize 10x16! -compress none -rotate -90 ppm/$i.ppm; done




====================================
(5) Run this perl script (split_files_out.pl)


Copy this file to local

../../../0.perl/split_files_out.pl

edit for number of files.


This script converts the files into a set of channel data.

To convert to vixen file;



for i in *.dmx; do cat $i | perl ../../../0.perl/dec-to-bin.pl | perl ../../../0.perl/bin-to-base64.pl; done > bells_mime64.txt

..
(6)


../../../0.perl/strip_newlines.pl bells.txt > bellsbase64.txt




#!/usr/bin/perl

use Convert::BaseN;
# by name
my $cb_64 = Convert::BaseN->new('base64');
my $cb_2 = Convert::BaseN->new('base2');

$data = <>;
$onechannelofdata = $cb_64->encode($cb_2->decode($data));
chop ($onechannelofdata);
print $onechannelofdata;



#!/usr/bin/perl

while (<>) {

print dec2bin($_);

}

sub dec2bin {
my $str = unpack("B32", pack("N", shift));
# $str =~ s/^0+(?=\d)//; # otherwise you'll get leading zeros
$str = (substr $str , 24);
return $str;
}
 

Attachments

  • 0.perl.zip
    3.5 KB · Views: 11

mrpackethead

Full time elf
Joined
Jun 12, 2010
Messages
452
Location
Wellington
IF there is a perl guru in the audience, then perhaps we can tidy this up and make it much more user freindly.. I can't program perl to save myself..
 

Wombat

Full time elf
Joined
May 12, 2010
Messages
138
Location
Sydney
Here is Mph's Instructions from the Chat yesterday for doing it

1. Create a movie that will represent your "grid"
i used Apples Quartz composer
but theres any number of thigns that could do this
2. export your movie in quicktime format
you need to set your movie up here to have the dimensions of your grid
so, if your grid was 20 x 10, you'd export your movie as a 20x10 pixel movie
then you open up your movie in quicktime player ( you need the pro version )
3. export your movie as a set of of images, setting the frame rate to equal what your desired frame rate will be
if you are running 25mS steps, then pick 40
if you are running 50ms, then pick 20
etc etc
you'll end up with a folder fill of tiny PNG's
each numbered
4. using imagemagik, convert all the images to PPM files
i've included a script to do this
5. Then run a couple of perl scripts
this creates a bunch fo channel data
then theres another script that pulls the entire file together
and creates the raw vixen data
6. theres another little script you need to run that kills some newlines that break things
7. then what you have is a file that contains a set of vixen data
but its missing the XML at the top and bottom of the file
so
8. you open vixen
create a new file that has the write number of channels, time slots and length ( exactly )
open it up in text editor
remove all the empty data
and paste in your newly created data
simple
there is a little bash script for doing the image conversion
that would need to be changed to run under windows
if you could find a perl guru
this could be majorly tidyed up
to a single step
ie point perl program at a diretory of images, and convert it to a .vix file in one easy step
 

AussiePhil

Dedicated elf
Administrator
Joined
Jun 20, 2009
Messages
1,606
Location
Canberra, ACT, Australia
Had to have a play with something different to clear head, so have been playing with making this work under Windows.

Progress so far is.
Make video file with effects etc based on bright colour photos and export WMV file.
Use Video converter to change WMV to MPG file... plenty of options
Use VirtualDub to split video into PNG images at 20 frames per seond to match a 50ms time in Vixen.
Use ImageMagick to create the PPM files resizing to the nominated matrix size on the fly.

Next: write vbscript to do the pixel mapping and vixen file generation.

Cheers
Phil
 

mrpackethead

Full time elf
Joined
Jun 12, 2010
Messages
452
Location
Wellington
A compiled VB Script would be really useful i guess, it woudl make it "easy" for the conversion.

As Phils described, the process to get your set of PPM images is largely not important.. You can do what ever you like there. I see phils using WMV and MPG's, I'd used Quicktime and export to pngs, and then converted..

My scripts did'nt build the header/footer data into the .vix file.. That was too hard for me.. I created my .vix file in vixen, then opened it in a text editor, and cut and paste the data i'd created.

Heres hoping that this process might make large scale Pixel maps not only affordable, but also reliable..
 

AussiePhil

Dedicated elf
Administrator
Joined
Jun 20, 2009
Messages
1,606
Location
Canberra, ACT, Australia
OK for the brave that have following instructions so far from the chat, here's the 0.0.0.1 script versions

expand the zip file into your imagemagick folder.

open a DOS prompt and go to that folder and enter something like the following command line

imageprocess.vbs /inputfolder:CD3D /width:40 /height:56 /imagetype:pNG

/inputfolder: <the folder the images are in>
/width: this is the matrix width
/height: matrix height
/imagetype: what you saved the files as

When the script completes you should have and "output" folder with a bunch of PPM files

then you can run the ppmprocess.vbs script

This will create a matrix.vir in the imagemagick directory when it is completed

have a try

Phil
 

Attachments

  • process.zip
    4 KB · Views: 17
Top