Wednesday, August 28, 2013

ImageMagick: batch resize and DPI change

mogrify -resize 59.06% -density 150x150 *.tif
mogrify -resize 1024x1234 -density 150x150 *.tif
If the images are in grayscale than the above will convert them to RGB. Thus one can use the following: mogrify -resize 59.06% -density 150x150 -colorspace gray -layers flatten *.tif
mogrify -resize 1024x1234 -density 150x150 -colorspace gray -layers flatten *.tif

Wednesday, August 14, 2013

Matlab: split vector into number of parts of roughly the same size

%split into 3 parts
chunckCell=splitvect(1:10, 3);
chunckCell{:}
ans = 1 2 3 ans = 4 5 6 7 ans = 8 9 10

Wednesday, July 24, 2013

Ubuntu: Install java 7 source (openjdk-7-source)

sudo apt-get install openjdk-7-source

The src.zip that is going to be installed by this command can be found: /usr/lib/jvm/java-7-openjdk-i386 or
/usr/lib/jvm/java-7-openjdk-common

Saturday, July 20, 2013

Arch Linux: xfce 4.10 panel freezes

From time to time the xfce 4.10 panel freezes. Instead of restarting or logging out, one can just kill it and it should restartkillall -9 xfce4-panel

ImageJ: Import source code into Eclipse and git version control

ImageJ is a public domain Java image processing program inspired by NIH Image for the Macintosh. It runs, either as an online applet or as a downloadable application, on any computer with a Java 1.4 or later virtual machine. Downloadable distributions are available for Windows, Mac OS, Mac OS X and Linux.
Since it is open sourced it can be modified and extended. It normally comes with ant build.xml but I usually work with Eclipse and Git, thus I wanted to work with the source files in this environment.

I will show how to add ImageJ source code into Eclipse and with Git support. The steps below where executed in Xubuntu 13.04.

1. Download the source code and unpack

The ImageJ source code is here. At the moment of writing, the latest version is ij147v-src.zip I usually download to ~/Downloads folder. To unpack it use the following:cd ~/Downloads/
unzip ij147v-src.zip
This will create a folder named source in ~/Downloads.

2. Create new Java Project in Eclipse

Create new Java Project in your default workspace. Usually the folder is set by Eclipse as ~/workspace. Its important to select "Use project folder as root for sources and class files" because in a moment we will import the ImageJ source into it.





Wednesday, July 17, 2013

Arch Linux: Error about msvcr100.dll.wctomb_s in wine 1.6-rc5 when starting Path of Exile.

Sorry, just writing from memory. I had wine 1.6-rc5 on a Arch Linux x64, though wine was set as 32-bit wine environment, i.e. withWINEARCH=win32 winecfgI had problem running Path of Exile client (Client.exe). It was something about unimplemented function msvcr100.dll.wctomb_s. The fix for me was to install Microsoft Visual C++ 2010 winetricks vcrun2010However, this may require you to first install msxml3.

Thursday, July 11, 2013

avcon: change frame, resize ogv obtained from RecordMyDesktop

avconv -i test.ogv -r 10 -s 1280x720 -q 1 output.ogvr is frames per second, s is the new size and q is quality, from 1(worse) to 32(best).

Tuesday, July 02, 2013

Matlab: deal - assign values in vector into variables

Mex files in Matlab for linux: failed to map segment from shared object: Operation not permitted

This happens when you have no permissions to execute given file or library. In my case it was happening because I was trying to run mex files using Matlab for linux that were located in NTFS partition. Often the partition is mounted in linux without exec arguments. To fix it, I edited my /etc/fstab file and aded exec argument to the line responsible for mounting NTFS partition:

UUID=F4B664646C02A51D /mnt/c ntfs users,defaults,exec 0 0

Monday, July 01, 2013

Problems with libstdc++.so.6 when compiling mex files in Matlab 2013a x64 on Xubuntu 13.04 x64

Problem compiling mex files in Matlab 2013a x64 on Linux (Xubuntu 13.04 x64):/usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus: /usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl_c.so.4) /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus: /usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl.so.12)

The problem was that Matlab was linking libstdc++.so.6 (located in /usr/local/MATLAB/R2013a/sys/os/glnxa64) to the file it provides, i.e. libstdc++.so.6.0.13 (located in /usr/local/MATLAB/R2013a/sys/os/glnxa64).

This is the old version of libstdc++, and xubuntu has newer version, i.e. libstdc++.so.6.0.17 (located in /usr/lib/x86_64-linux-gnu).

Thus, I solved this problem by changing the symbolic link in Matlab to point to the new version:cd /usr/local/MATLAB/R2013a/sys/os/glnxa64
sudo mv libstdc++.so.6 libstdc++.so.6_org
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17 libstdc++.so.6