Friday, May 25. 2007Dilated + rotated 2D Gaussian![]() I’ve finally improved my script that computes a dilated and rotated 2D Gaussian with respect to low memory consumption. It applies a dilation and rotation matrix to the 2D domain. I published it under the GNU GPLv2, so if you find any improvements, you are forced to share them. I still have the impression that it is rather slow, but I currently don’t know how to do it better. Of course, it has to be evaluated on function g=nsgauss(p,q,vdil,hdil,rot) % Computes a non-separable (dilated + rotated) 2D Gaussian % Usage: g = nsgauss(p, q, vdil, hdil, rot); % Input: p,q .... size of g % vdil ... vertical dilation factor (before rotation) % hdil ... horizontal dilation factor (before rotation) % rot .... rotation angle, e.g. pi/4 % Example: % norm(nsgauss(p,q,1,1,0) - gaussnk(p)’*gaussnk(q)) == eps % % Version 0.2-20070525 % by Stephan Paukner {stephan+math at paukner dot cc} % Licensed under the GNU General Public License v2 % $Id: nsgauss.m,v 1.2 2007/05/25 10:14:52 ps Exp ps $ D=[1/vdil 0; 0 1/hdil]; %dilation matrix R=[cos(rot) -sin(rot); sin(rot) cos(rot)]’; %’%rotation matrix sp=sqrt(p); sq=sqrt(q); g=zeros(1,p*q); for jp=-3:3 for jq=-3:3 [x y]=meshgrid( (0:p-1)/sp + jp*sp , (0:q-1)/sq + jq*sq ); v=D*R*[x(:)’; y(:)’]; g=g+exp(-pi*(v(1,:).^2 + v(2,:).^2)); end end g=reshape(g,q,p)’; %’ g=g/norm(g,’fro’);
CODE: > tic; g1=gaussnk(600)’ * gaussnk(800); toc
Elapsed time is 0.100037 seconds.
> tic; g2=nsgauss(600,800,1,1,0); toc
Elapsed time is 19.163170 seconds.
> compnorm(g1,g2);
quotient of norms: norm(x)/norm(y) = 1
difference of normalized versions = 1.344e-16
Storage capacity consideration![]() In my notebook, I have a 60GB disk, 27+14=41GB considered for the whole Linux system and 11.5GB left for various personal files. In my backup PC, I have a 112GB /home partition (LVM on RAID-5) and 12GB left, another 12GB are available on the /usr partition and 8.6GB in /opt, and as everything is on LVM, it might be resizable. So there’s currently no real need for additional disk space. The only drawback is that I can’t hold all music files on my notebook and that the available space is splitted into two partitions. But I can live with that, I just have to consider that some things will be in a mounted subdirectory. When space will get small, I’ll buy a 160GB notebook-disk. And my backup PC will be a new one with two 500GB SATA-disks on RAID-1. I won’t take a kind of commercial network storage array, as these aren’t capable of rsync or the like. I thought about taking RAID-5 again instead of RAID-1. Three 320GB disks are cheaper than two with 500GB, but data redundancy decreases from 2 to 1.5. Only one disk may fail in both cases, no matter if you’ve got two disks at RAID-1 or three disks at RAID-5. In addition, the probability that two disks fail is three(!) times higher when there are three disks as if there were only two. For me, RAID-5 is therefore just a strategy for expansion, not for starting freshly.
Posted by Stephan Paukner
in Information Technology
at
09:14
| Comments (0)
| Trackback (1)
Defined tags for this entry: hardware
(Page 1 of 1, totaling 2 entries)
|
AboutCalendarArchivesCategoriesShow tagged entriesandroid antenna anti-spam apache austria automobile ballooning bash bluetooth bug career cloud collecting cooking crypto cw debian diy dreams education electronics event fail fashion finance flickr fuerteventura fun gentoo geography german gnu-linux gnucash google google earth graphics guitar hardware history image processing internet kernel kids language lanzarote lhc lifestyle linkroll literature ltd machine learning making mallorca mathematics matlab migration munich music nautilus numismatics octave perl philately philosophy phone photo gear photography physics podcast politics postfix private programming public transport rant religion review salzburg samsung science security social web software statistics storage sustainability symbian tablet time lapse transceiver tv usenet venice video virtualization wordplay work www yahoo youtube
Syndicate This BlogFollow meBookmarks
Powered by |