Wednesday, April 4. 2007Images to vectors: Quick index matrix
I found a quicker way to compute the index matrix I mentioned:
> tic; [jj kk]=meshgrid(1:p,1:q); toc
Elapsed time is 0.080879 seconds.
> size(jj), size(kk)
ans =
479 480
ans =
479 480
> tic; idx=mod(b*q*jj+a*p*kk,N)’; toc
Elapsed time is 0.129128 seconds.
> idx(p,q)=N; %valid index value
> imv=zeros(1,N);
> tic; for j=1:p; for k=1:q;
> imv(idx(j,k)) = im(j,k);
> end; end; toc
Elapsed time is 6.770042 seconds. So nothing with 58 seconds anymore. Tuesday, April 3. 2007Images to vectors and back
Regarding the previous questions I noticed that GA on LCA groups is too general for my concerns and that the study of GA on finite abelian groups is enough.
In a certain paper HGFei published a result that for p×q-images where p and q are relatively prime there is an isomorphism to a vector of length N=pq. The theory considers the groups
> im=img(2:480,:);
> size(im)
ans =
479 480
> gcd(479,480)
ans = 1
Just for a first test I set α=p and β=q and define a primitive mapping function. (I’ll have to find a quicker transform, as in my tests the switching takes too long. But this could be due to the actually large test image. In addition, I currently only manage to do the backward step by storing the indices in an index matrix.)
> function ii=ma2ve(j,k)
> p=479; q=480; a=p; b=q;
> ii = mod(b*q*j+a*p*k , p*q);
> if ii==0; ii=p*q; end
> endfunction
> ma2ve(1,1)
ans = 1
> ma2ve(1,2)
ans = 229442
> p*q
ans = 229920
I have to return N instead of 0 to have a correct index value. Although the mapping is actually an isomorphism I didn’t know how to go back to the tuple (j,k), so I store the indices in an index matrix while building the image vector:
> idx=zeros(p,q); imv=zeros(1,N);
> tic; for ii=1:p; for jj=1:q;
> idx(ii,jj) = ma2ve(ii,jj);
> imv(idx(ii,jj)) = im(ii,jj);
> end; end; toc
Elapsed time is 58.358711 seconds.
58 seconds!?
> plot(imv)
Continue reading "Images to vectors and back" Friday, March 30. 2007Haft, II
Die Köchin befindet sich in Schmackhaft. Thursday, March 29. 2007Oh no! The eighties are back!
Posted by Stephan Paukner
in Curiosities
at
15:13
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: fashion
Tuesday, March 27. 2007Raising questions, 70-73
I noticed that I’ll have to find a representation of images as vectors, and not as matrices as usual. Because otherwise I won’t be able to describe linear operations as matrices on vectors. To be able to do things like an SVD or a look at eigenvalues or eigenvectors, I’ll have to evaluate matrices on vectors. For building lattices or Gabor systems I’ll have to try to use the algorithms which have been developed for 1D-signals. This leads me to Gabor Analysis on locally compact abelian groups, but group theory is a little bit away from ordinary signal analysis. Reading first intros, I asked myself:
Posted by Stephan Paukner
in Master's Thesis
at
10:29
| Comments (0)
| Trackback (1)
Defined tags for this entry: mathematics
Sunday, March 18. 2007Schwarzfahren kann sich unmöglich auszahlen
Ich kenne jemanden, der/die darauf spekuliert, dass das regelmäßige Zahlen der Strafen fürs Schwarzfahren in Summe billiger kommt als die Jahreskarte der Wiener Linien. Diese kostet bei Teilzahlung €417/Jahr, und einmal beim Schwarzfahren erwischt werden kostet €60. Damit darf man höchstens sechs Mal im Jahr erwischt werden. Ich bin aber seit Jänner 2007 schon vier Mal kontrolliert worden. Wenn der Trend so weitergeht, bin ich bis Jahresende 16 Mal kontrolliert worden und hätte €960 hingeblättert. Die erstgenannte Spekulation kann also nur funktionieren wenn er/sie nur selten und/oder nur zu “exotischen” Uhrzeiten fährt.
Posted by Stephan Paukner
in Personal
at
13:28
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: german
Thursday, March 15. 2007Convolving a zebra with modulated Gaussians
I finally managed to scale the reconstructed images appropriately such that one can see at what locations certain 2D-frequencies occur. I FT’ed an image of a zebra and “windowed” the FT with a shifted Gaussian. Doing the inverse FT of that cutout yields a convolution of the input image with a modulated Gaussian, corresponding to
This is the zebra, a 480×480 pixel sample I clipped from an image I found in the Wikimedia Commons, and its FFT2:
Again, I rotated the image of the FT by 90° to match the orientation of the “jets” with the line patterns in the zebra. Clearly, the vertically oriented frequencies dominate the image. Now I window the FT-image by placing a Gaussian at the origin. This results in a low-pass filter. The IFT gives a reconstructed image which only contains the lowest frequencies:
The left half shows the (unmodulated) Gaussian with which the original image has been convolved. The right half shows the reconstructed image—the animal has lost all its zebra patterns! This effect is identical to a Gaussian blur. Continue reading "Convolving a zebra with modulated Gaussians"
Posted by Stephan Paukner
in Master's Thesis
at
18:13
| Comments (0)
| Trackback (1)
Defined tags for this entry: mathematics
Wednesday, March 14. 2007Time-frequency shifts of a 2D-Gaussian (Addendum)
I found out that the mentioned symmetry on the FFT2-picture occurs because the modulation in the input image only has a real part and no imaginary part. If one looks at fft2(real(Mg)) where Mg is a modulated Gaussian, one really gets two symmetrically shifted Gaussians as output. And the Gaussian in the center still comes up because the line patterns don’t span completely between -1 (black) and 1 (white). I also found a bump2d.m in the NuHAG toolbox which incorporates gaussnk.m, so I can trash my gauss2.m-attempt.
Posted by Stephan Paukner
in Master's Thesis
at
12:01
| Comments (0)
| Trackbacks (0)
Defined tags for this entry: mathematics
« previous page
(Page 18 of 52, totaling 413 entries)
» next page
|
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 meBookmarksPowered by |