Sunday, May 9, 2010

libdc1394 operation

dc1394_video_set_framerate

Saturday, May 8, 2010

Linux command line tricks

1. update gnome config from the command line. In that case turn on proxy usage in the system.

gconftool -s /system/http_proxy/use_proxy -t bool true

2. change file encoding from dos to unix and back:
fromdos, todos

3. detect and convert encoding of text files
enca

Thursday, May 6, 2010

QT creator tips and tricks

1. The problem comes when debugging:
Internal error: pc 0x4098b8 in read in psymtab, but not in symtab
Internal error: pc 0x4098b8 in read in psymtab, but not in symtab
Internal error: pc 0x4098b8 in read in psymtab, but not in symtab
Internal error: pc 0x4098b8 in read in psymtab, but not in symtab

To solve it go to Tool->Options->Debugger->gdb location and change the filename to point to the gdb binary stored in the qt sdk. In my case it is /home/user/qtsdk/bin/gdb

libraries maintenance

How to check the necessary g++ options:
1. pkg-config opencv --libs --cflags
2. ldconfig -v - shows the libraries stored in ld.so.conf
3. locate [libraryname] - searches for files
4. pkg-config opencv --modversion - shows the version of opencv library installed

Wednesday, May 5, 2010

basic irc operation

registering nick:
/msg nickserv register PASSWORD EMAIL
identifying after entering:
/msg nickserv identify PASSWORD

Friday, April 30, 2010

Mercurial: Create a new local repository and clone it to the remote repository.

Yes. Mercurial sucks.

If you were considering going
deeper into it. Forget it.
Does any high-end super glorious system give you a suggestion to delete
all your modifications silently? Yes. Mercurial.
After one day of hard work I want to commit.
hg commit -m 'Great job'
then great mercurial suggests:
abort: unresolved merge conflicts (see hg resolve)
Yes. It's telling you to run hg resolve. And if you do it with option -all you will loose all fucking changes since last update in a local directory.
Fuck this system.


If you really want to know how to clone to the remote repo - read below.

Say you have /home/joe/my_source direcory where you have your code and you want to make a new remote repository. You have to have ssh access to the remote repository.
cd /home/joe/my_source
hg init #create new local repo
hg add [files you want to add]
hg commit -m 'initial changeset' #commit initial changeset
hg push #push changes to repo
You migh want to use hg push ssh://repo@myrepo.com:22//home/repo/my_remote_source if you get "abort: repository default-push not found!" error. I don't know how to fix it yet.

Cloning:
cd /home/joe
hg clone my_source ssh://repo@myrepo.com:22//home/repo/my_remote_source
A note for cloning. Normally you clone from remote repo to local directory. My example is opposite. If you want to import repository to local directory then look elsewhere (it's easy).
The command above creates my_remote_source directory on the server and clones the local repository (from /home/joe/my_source) to myrepo.com.
'//' means absolute path. If you use '/' after port number it will be relative to home directory.

Now you have to:
ssh repo@myrepo.com
cd my_remote_source
hg update

That's done you should have your repo cloned. There is a way to make the last step automatic

Thursday, April 29, 2010

Setting up FireWire (1394b) machine vision camera

Currently udev on Ubuntu 9.10 has a problem that it does not create firewire video devices in /dev
For proper working of machine vision camera one has to have loaded:
  • ohci1394
  • ieee1394
  • video1394
  • raw1394
and rw rights set up for /dev/raw1394 and /dev/video1394/[0-3]

My fix for this was:
1. Add to /etc/modules (loading modules during boot)
  • raw1394
  • video1394
Setting the "rw" rights:
You can create /etc/udev/rules.d/51-raw1394.rules and add this line to that file:
KERNEL=="raw1394", GROUP=="video"
That way udev will change group belonging of /dev/raw1394 to "video" group.
Of course you have to have this group created (you can use groupadd for this).
Adding yourself to the group:
sudo usermod -a -G video joe
Checking if this was successful:
groups joe
You might want to restart udev to apply changes in udev rules.
sudo service udev restart
raw1394 is done. Now we have to fix /dev/video1394/[0-3]. I have to add startup script to make directory and nodes for my video1394 devices.

I created file /etc/init.d/1394:
touch 1394
changing rights:
sudo chmod +x ./1394
I have to put this text to 1394 file:

#!/bin/bash
mkdir /dev/video1394
mknod /dev/video1394/0 c 171 16
mknod /dev/video1394/1 c 171 17
mknod /dev/video1394/2 c 172 18
mknod /dev/video1394/3 c 173 19
chmod a+rw /dev/video1394/0
chmod a+rw /dev/video1394/1
chmod a+rw /dev/video1394/2
chmod a+rw /dev/video1394/3

This creates the nodes and sets proper rw rights.
I have to put this as startup script:
update-rc.d 1394 defaults

Finally coriander does not complain and my cameras seems to work.
Thanks to Point Grey for sharing the info