25 October 2007

OpenCV Problem with offset into video files.

OpenCV is unable to open into video files with offset. Guess we have to do it ourselves. The code which should take care of the offset is

/****************************************************************************/
#include
#include

int main()
{
CvCapture *video;
IplImage *im;
double wait;

cvNamedWindow("Video",1);
cvMoveWindow("Video",200,200);

video = cvCaptureFromFile("/home/sysad/Misc/Snatch.avi");
if(video==NULL)
{
abort();
}
cvSetCaptureProperty(video,CV_CAP_PROP_POS_AVI_RATIO,(double)0.75); // DOES NOT WORK CURRENTLY
im = cvQueryFrame(video);
wait = 1000.0/cvGetCaptureProperty(video,CV_CAP_PROP_FPS);

while(im!=NULL)
{
cvShowImage("Video",im);
cvWaitKey((int)wait);
im = cvQueryFrame(video);
}
cvReleaseCapture(&video);

return 0;
}

/************************************************************************/

Simplest workaround is to skip frames till one reaches the frame of interest!

21 October 2007

Pandal hopping in Mumbai

Yesterday night, 14 of us from the hostel went pandal hopping at major places in Mumbai. We started at 6:30 PM and returned at 2AM. We covered Vashi, Chembur, Shivaji Park(Dadar), Bandra, Santa Cruz and finally Lokhandwala. The crowds are certainly much lesser than in Calcutta but still impressive. The expat Bong population in Bombay is impressive and from all walks and classes of life. I have put up the photos here. All comments welcome! Note that I have not added the captions for the photos. One would notice that almost all of the goddess idols look the same. This is possibly due to the fact that at least at three of the places, the supplier of the idols was same person.

03 September 2007

Visit to Kanheri Caves

There were finally 11 of us who went to the Kanheri Caves, located within the Sanjay Gandhi National Park in Mumbai, starting from the 6. I can claim to have recruited 2 of them myself !! The more the merrier as they say. Well, the place was ok, bus ride took 1.5 hours. We had to wait for sometime inside for getting the internal transport. It takes approximately 20 minutes to reach the caves from the park gate and costs Rs.20/-. The caves are carved from rock. the photos are here. Apparently there is waterfall, but i found it less than good. We went over a short distance on extremely slippery surface, i myself plopped down while coming down an incline!!
Too tired to go for the Lion/Tiger Safari, two fellows who had taken the trip earlier assured us that it had a couple of mangy creatures.
The toilets are in a horrible condition, even for an Indian used to such things, its a shocker. Also, I am reliably told by people that in the off-season, couples have been robbed of belongings by squatters inside. There is nothing on a major scale and it is completely safe if one travels in the internal vehicle, but trekkers beware unless you are travelling in a big group.
Also, we found the usual set of smooching , grabbing,cooing frustrated couples who infest every possible public place cuddling each other in the latest romantic movie style. It is ironic that they seek "privacy", as they are wont to explain their frustrated antics, in the most public places. However, such is life.

31 July 2007

My .emacs file

I have been using emacs extensively for programming. While text editors are a matter of taste and getting used to the quirks, i find emacs very useful useful. For editing linux system files, I generally prefer vim for its speed.

Here is my .emacs file. The matlab.el file can be found easily by googling. Just copy paste below to enable, ruby mode, matlab mode, auto-indentation etc. If the font(bitstream vera sans mono) is not available on your system is not available, just change the font to "terminal", i find that tolerable for programming. Acknowledgments are due to the different people on the Internet for posting their .emacs file, unfortunately i never did remember the URLs from which i took the code snippets.

;;[C .emacs

;;; uncomment this line to disable loading of "default.el" at startup
(setq inhibit-default-init t)

;; turn on font-lock mode
(when (fboundp 'global-font-lock-mode)
(global-font-lock-mode t))

;; enable visual feedback on selections
;(setq transient-mark-mode t)

;; default to better frame titles
(setq frame-title-format
(concat "%b - emacs@" system-name))

;; default to unified diffs
(setq diff-switches "-u")
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(case-fold-search t)
'(current-language-environment "Latin-1")
'(default-input-method "latin-1-prefix")
'(global-font-lock-mode t nil (font-lock))
'(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
'(transient-mark-mode t)
'(visible-cursor t))
(set-default-font "-bitstream-bitstream vera sans mono-medium-r-normal-*-12-*-75-75-m-*-*-*")
;; Make text mode as default and turn on Auto Fill
(setq default-major-mode 'text-mode)
(setq text-mode-hook 'turn-on-auto-fill)
;; For ruby
(autoload 'ruby-mode "ruby-mode" "Mode for editing ruby source files")
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))
(autoload 'run-ruby "inf-ruby" "Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby" "Set local key defs for inf-ruby in ruby-mode")
(setq scroll-step 1)
(setq scroll-conservatively 1)
(global-set-key "\em" 'goto-line)
(global-set-key (read-kbd-macro "<delete>") 'delete-char)
;;(load "/usr/local/share/lush/etc/lush.el")
(add-to-list 'load-path "/nfs1/krishnan/.emacs.d/")
(autoload 'matlab-mode "/nfs1/krishnan/.emacs.d/matlab.el" "Matlab Editing Mode" t)
(add-to-list 'auto-mode-alist '("\\.m$" . matlab-mode))
(setq matlab-indent-function t)
(autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t)
(setq matlab-shell-command-switches '("-nojvm"))

(global-set-key [(f9)] 'compile)
(setq compilation-window-height 8 )
(setq compilation-finish-function
(lambda (buf str)
(if (string-match "exited abnormally" str)
;;there were errors
(message "compilation errors, press C-x ` to visit")
;;no errors, make the compilation window go away in 0.5 seconds
(run-at-time 0.5 nil 'delete-windows-on buf)
(message "NO COMPILATION ERRORS!"))))

(set-cursor-color "wheat")
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

(add-hook 'python-mode-hook
(lambda ()
(set (make-variable-buffer-local 'beginning-of-defun-function)
'py-beginning-of-def-or-class)
(setq outline-regexp "def\\|class ")))

(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:stipple nil :background "gray20" :foreground "wheat" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :family "bitstream-bitstream vera sans mono")))))

Blogged with Flock

First Post

Hello World.