film3:
#!/usr/bin/perl
use Image::Magick;
use Device::SerialPort;
my $port = Device::SerialPort->new("/dev/ttyACM0");
$port->databits(8);
$port->baudrate(9600);
$port->parity("none");
$port->stopbits(1);
$count = 0;
$zaehler = 2;
$spalte = 0;
$zeile = 0;
$e = 1;
$rot = 0;
$gruen = 0;
for ($i = 0; $i <= 1920; $i++)
{
my $image = Image::Magick->new;
$image->Set(size=>'1920x1080');
$image->ReadImage('xc:white');
for ($sp = 0; $sp <= 1920*1080; $sp++)
{
if ($spalte == 1080)
{
$spalte = 0; # AN DEN ANFANG ZURUECK
$zeile = $zeile + 1; # EINE ZEILE RUNTER
}
#my $rot=$port->read(3);
#$port->read_const_time(30);
#my $gruen=$port->read(3);
#$port->read_const_time(30);
my $blau=$port->read(3);
$port->read_const_time(10);
if ( $blau != '' ) {
#$rot =~ s/\R//g;
#$gruen =~ s/\R//g;
$blau =~ s/\R//g;
#print $byte;
#$farbe = "#".$byte."0"."0";
$farbe = "hsl(".$rot.",".$gruen.",".$blau.")";
#print "$farbe\n";
#print "$count\n";
$image->Draw(primitive=>'point', fill=>"$farbe", points=>"$zeile,$spalte");
$spalte = $spalte + 1;
$zaehler = $zaehler + 1;
$count = $count + 1;
} else { $sp = $sp - 1; }
}
$zeile = 0;
$spalte = 0;
$image->Write("xyz_$i.jpg");
print "xyz_$i.jpg\n";
}
readanddraw:
code reads a 8bit number
and draws a brightness pixel in the hsl room in a hd frame.
rgb and hsl full code is commented out