Gmbd, something about pixels

I looked at some of these videos where they put another head over a bit of film and I thought; “that seems to wobble about a bit, I wonder how they do that because I don’t know how”
Now I don’t have Premier because it is expensive for what I do.
Anyway I do know the principals of animation and I like to do things my way.
“I need some way of getting a list of locations on an image”
Now I think I was lucky but I am good at guesswork ( some things fit for no immediately obvious reason, well I think so ) I had previously been impressed with a bit of software called “geeqie
that I liked because it was so quick for viewing images, So I went on the mailing list and asked.
Something like; “Can I get a list of pixel locations outputted to a file please ?”
One of the maintainers came back

“I don’t think that is possible at the moment.
A guess would be that the easiest way is to make a new geeqie –remote command e.g.
“geeqie –remote –pixel-data” could output the contents of the pixel data section of the status line.
Then to make that useful to you, you would need to:
create a script file containing that command (and send the data
wherever)
create a plugin to call the script
set a hotkey to call the plugin
That’s maybe a bit convoluted, but at the moment I don’t see a better way.”

then the next day

“Attached is a quick .diff file to implement the command “geeqie –remote –pixel-data”.
Let me know if it is something like the functionality you are looking for.”

me: “this is nothing to do with the geeqie I’ll get from Debian repository ?
I’ll need to use git (don’t think I’ve used )and patch then build it from there ?”
—-
“Just to be safe, first uninstall the Geeqie you have installed from the repo.
To use the .diff file you must compile from sources. It is first necessary to install git.
Then, from an appropriate folder:

git clone git://www.geeqie.org/geeqie.git

cd geeqie

patch -p1 < pixel-data.diff ./autogen.sh make sudo make install [ Un-install is: sudo make uninstall; sudo make maintainer-clean; sudo make distclean ] Then, as I suggested, set up a hot key (maybe alt-C) to call a plugin/script which executes geeqie –remote –pixel-data >> your_file.txt ”

—–
then me;
“Hi,
sorry to have to ask but is not immediately obvious where to add a hotkey inside geeqie.

If plugin calls script file is that a bash file ? javascript ?

Is it possible to find the name of the currently open file in geeqie to add it to the text string via the plugin ?
Assume “>>” appends to your_file.txt”
—–
“You must first create a new plugin via Edit/Configure Plugins/New.

A template is opened; make sure you give the the Name parameter something sensible, and save as something other than the default, which is “new.desktop”.

The hotkey is set via Edit/Preferences/Keyboard.

The Action column should show the Name parameter; the Accel column will show the name of the desktop file you have created.

Click on the Key column entry, and type the hotkey you want to use.

The menu entry Help/Keyboard Map (which unfortunately opens with a default of very small dimensions) shows the current key allocations – that will help avoiding conflicts when selecting a new hotkey.

The Exec parameter of the desktop file can be anything you can call from the command line. Most times that will be a shell script.

The command:

geeqie –remote –tell

gives the currently displayed file.”
—-
then
“There is a new commit in the main Geeqie repository. You can see the list of changes at:

http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git

To install, cd to where you cloned the repo, then: ( me: see above )

sudo make uninstall, sudo make maintainer-clean; sudo make distclean

git checkout — .

git pull

./autogen.sh

make

sudo make install

N.B.

There is a fullstop at the end of the “git checkout” line

Your can speed up compilation with “make -j” where is the number of cpu cores you have.

The option is changed from pixel-data to pixel-info to conform with the status bar tooltip

If you have multiple Geeqie windows open, this will work only on the one with the focus – i.e. click on the window of interest”

———-

me:
“thanks very much
all working.
cleaned up output to a csv file now trying to remember how to get image and pixel locations into an array.

cheers”

So to recap: I asked if a thing was possible and 5 days later the maintainer has written the code, told me precisely how to get the program installed with the changes.

( don’t you love Open source ? )

——–
first thing though is to get some frames to play with, say it is iphone ( I dropped my handycam) get video on pc and edit with openshot then save as “Openshot_cut.mp4”
and to extract the frames run executable file

where it says “mod(n\,3)” you probably change that to “mod(n\,2)” or whatever

#!/bin/bash
#extract every 3rd frame ( works )
ffmpeg -i Openshot_cut.mp4 -vf “select=not(mod(n\,3))” -vsync vfr -q:v
2 img_%03d.jpg
# extract all frame ?
#ffmpeg -ss 00:00:00 -t 00:00:01.30 -i ./phone_test1.mov -r 25.0 test%4d.jpg

So now I have software that works, opens all the frames I just saved and has a plugin called pixel-info which writes to a file where the cursor is when I press a key (eg shift + z ) the plugin runs a script you point it to which is just.

#!/bin/bash
geeqie –remote –tell >> /some_directory/some_file.txt
geeqie –remote –pixel-info >> /some_directory/some_file.txt

then we have to clean it up to make a comma separated value file because I remember seeing how to get the info from a file like that.

#!/bin/bash
awk ‘ORS=NR%2?FS:RS’ some_file.txt >some_file.csv
sed -i ‘s/\[//g; s/\].*)//g; s/ //g; s/jpg/jpg,/g’ some_file.csv

that removes all the unwanted information from the file and just leaves the file name and the x,y pixel co-ordinates separated by commas. ( if they change the plugin you’ll have to change that )

now we have a load of frames and pixel location information where we would like something to be at each frame and a comma separated value file of the source images and x, y, co-ordinates.
also we have a transparent background image we want to put on top.
now to combine with PerlMagick

“apt-get install perlmagick”
need this module ( http://www.cpan.org/modules/INSTALL.html )
“cpan App::cpanminus”
“cpanm Text::CSV_XS\”

this is not the tidiest bit of code ( is cobbled together from stuff on the internet ) because I don’t know what I’m doing and made other variables to see if that was the problem causing it not to work. Going to tidy it up to get the value of the length of the records first instead of guessing a hundred and tidy up the unnecessary variables but anyway it works and combines one image over another sequence of pictures at the place specified when you went through the picture and pressed a key when happy with cursor position.

you type (whatever you call this file eg “make-combine”)

“make-combine your_csv_file”

#!/usr/bin/perl
use feature say;
use strict;
use Text::CSV_XS;
use Image::Magick;
use diagnostics;
my $file = $ARGV[0] or die “Need to get CSV file on the command line\n”; my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1, }); my $image=Image::Magick->new; my $image2=Image::Magick->new; $image2->Read(“images/arrow.png”);
#$image2->Write(“images/arrow3.png”);
my @value = (
[0…100],
[0…2]
);

my $z=0;
my $x=0;
my $y=0;
my $t=0;
my $c=0;
open(my $data, ‘<:encoding(utf8)’, $file) or die “Could not open ‘$file’ $!\n”; while (my $value = $csv->getline( $data )) { $value[$z][0]=$value->[0]; $value[$z][1]=$value->[1]; $value[$z][2]=$value->[2]; $z+=1; } close $data;

$c = $#value;
$z=0;
while ($z <= $c){ $t=$value[$z][0]; $x=$value[$z][1]; $y=$value[$z][2]; $image->Read($t);
$image->Composite(image=>$image2,
geometry=>”+$x+$y”,
compose=>”over”);
say $t;
$image->Write(“out”.($z).”.png”);
$image = undef();
$image = Image::Magick->new;
$z+=1;
}
———-

now we need to make it work with a sequence for the overlay and then make a gif of all the output pics.

but isn’t Open Source grand ?
 

© Gotham must be destroyed 2018