srun and matlab
ok Mr. Cluster, here I come, I have unlocked the power to issue commands to your nodes for my maltab function ha ha ha ha!
so if you are in slurm
srun -n1 -o t.txt matlab -nodesktop -nosplash -nodisplay -r “temp4(29)” &
t.txt <— will get all the output
after -r you can give all the commands as the form of script i.e. ” “
in above case temp4 was matlab file function, and 29 was input
& so that it can run in background
-n1 only one measly node
But then you can run multiple of such commands and each one gets node
Don’t forget to open the matlabpool in the file you are running if you are using the parallel commands.
getPatch; matlab function to get a patch from a matrix
function mat = getPatch(srcMat, rect) %function getPatch(srcMat, rect) %rect is [x y width height] stX = max(rect(1),1);stY = max(rect(2),1); endX = min(rect(1)+rect(3)-1, size(srcMat,1));endY = min(rect(2)+rect(4)-1, size(srcMat,2)); mat = srcMat(stY:endY, stX:endX);
cygwin/x cannot establish any listening sockets
Running cygwin/x I was facing following error
Cannot establish any listening sockets Make sure an X server isn’t already running
poked around to find what’s happening, firewall was fine and I was on the administrator account, but it appears one has to set the application it-self as “run as administrator”
i.e. go to the XWin file, right click, get the properties, go to advanced and check ”Run as administrator”.
fixing MSVCR100.DLL not found
Just download Microsoft Visual C++ Redistributable Package. It will install the MSVCR100.DLL in folder windows\system32.
However I was not able to get MSVCR100D.DLL for the debugging
Dynamic Multi-dimensional memory allocation C/C++
An excellent library for the multi dimensional memory allocation.
http://www8.cs.umu.se/~isak/snippets/mdalloc.c
some other code snippets are http://www8.cs.umu.se/~isak/snippets/
VLFeat; library for SIFT and MSER
While searching some code for Maximally Stable Extermal Regions, I came to this libraray.
calculating distance matrix; Matlab
A simple code to calculate the L2 distance matrix between any features.
function D = calculateDistMatrix( points1, points2, f) %D = calculateDistMatrix( points1, points2) %points1: is m by n matrix, where n is number of points if nargin <3 f = 0; end totalPoints1 = size(points1,2); totalPoints2 = size(points2,2); if f == 0 D= zeros(totalPoints1, totalPoints2); else D = sparse(totalPoints1, totalPoints2); end for i=1:totalPoints1 D(i,:) = sqrt(sum((points2-repmat(points1(:,i), 1,totalPoints2)).^2)); end
Recovering 2D motion between the frames of video
Motion2D is C/C++ library by Irsia/INRIA to estimate 2D parametric motion in between the frames of video. Works very good. Have a good example code.
Only headache is I am having problem in compiling with the VC. They don’t have any dsp file for compilation of code in Windows, so don’t know which libaries to create. Have to use cygwin.
Block commenting in Visual Studio
Having worked in the Matlab, you get habit of selecting multiple lines and commenting them just using short keys. So nowadays when I have to work in Visual Studio, I tried finding short keys for this.
Comment: Ctrl+K+C
Un-Comment: Ctrl+K+U
IPP, new version of OpenCV, cmake and all the mess
After some long time, had to work on OpenCV and for the first time had to use the IPP. IPP is Intel’s high performance routines. They many of them, but I had to work on OpenCV one. http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-open-source-computer-vision-library-opencv-faq/
Download it, run it.
Follow these two links for installation help
- Deploying applications with Intel® IPP DLLs
- IPP with OpenCV highGUI + VS 2008 express ; as the name shows is more about making OpenCV and IPP work together. It even has the test code in it.
Before we move ahead, let’s look at the new version of OpenCV. It’s install guide is here. They were recommending CMake, so tried it. Because we are using the IPP here also so carefully have to give the bin address.
The IPP it appears, by searching online, not to work properly with OpenCV’s new version. Had actually some problem, but it was I think because IPP libraries access the OpenCv libraries and these libraries have their names changed. So copy pasted them and changed new names to old names. Compiled and viola it’s linking.
Well while putting it here, it looks everything is working fine but it took some time before i was able to solve that.
Some lessons actually commonsense things which one forgets the moment you need it most.
1) Every time you add the Environment variable, restart Visual Studio
2) Bad idea to copy paste your dll’s, set their location path in the Environment Variable path.