Updates from March, 2008 Toggle Comment Threads | Keyboard Shortcuts

  • Akarsh Simha 4:11 am on March 30, 2008 Permalink
    Tags: camera, EOS 400D, gphoto2,   

    Canon EOS 400D and Linux – Expt1 

    I was all excited when my new Canon EOS 400D landed in my hands today. I think that it’s a great piece of equipment, although I haven’t yet played around with it enough.

    I thought I needed to buy a separate cable to computer-control it, and the USB cable was only a data transfer cable. I casually asked about software for EOS 400D on Linux on ##astronomy on freenode, and I was excited when ‘peerce’ told me that I should’ve got the USB cable for computer-control along with the camera! I ran down and brought the cable and connected the camera to my brother’s system, running Debian (testing).

    I didn’t find a good “HOWTO” for the Canon EOS 400D detailing the remote-controlled capture, although I expected that somebody would’ve written one. (I think I should write one when I fully explore it, if someone else hasn’t!)

    File transfer was trivially easy:

    sudo apt-get install gphoto2 gtkam

    gtkam

    Select the ‘Add Camera’ option from the ‘Camera’ menu and say ‘Detect’.  Then click ‘Ok’. If the camera doesn’t initialize, try restarting the camera :-D  (May not be the right way to do things). If gtkam doesn’t segfault or run into some trouble, you should see a list of thumbnails on the right half of the window, if you select the right thing (the only thing) in the tree on the left pane. Figure out, it’s quite intuitive, and it doesn’t work well :-P  Maybe there are better methods to do this – maybe the konqueror camera:/ kioslave (or whatever it’s called) works better – please let me know in that case.

    Now, I want to control my camera. So I look around for documentation. I understand that it is just

    gphoto –set-config capture=on

    gphoto2 -F <# of frames> -I <interval> –capture-image

    That didn’t seem to work. After much experimentation, I tend to think that the camera needs details of how you want to photograph – i.e. focusing, exposure settings etc. (or does it?). Besides, capture=on must be set in the same command as the –capture-image, or so it seems, probably because every gphoto2 command sends a whole bunch of other instructions to the camera as well (isn’t that inefficient???).

    So, that means that if I put the camera on Auto Mode using the Mode dial, then I can get away with:

    gphoto2 –set-config capture=on  -F 1 -I 1 –capture-image

    For some reason, the command doesn’t terminate (and consequently, F > 1 doesn’t work) – probably because it wants us to accept the image and save it as well. I still need to figure this out.

    One more thing that I see is that if I do a

    gphoto2 –list-config

    I get only three options:

     /main/settings/capturetarget
    /main/settings/capture
    /main/capturesettings/focuslock

    This is expected (after reading the documentation), because the remaining settings that pertain to capture mode are exposed only after we enable capture mode. So do a

    gphoto2 –set-config capture=on –list-config

    and you get a whole bunch of configurable parameters:

     /main/settings/eos-time
    /main/settings/capturetarget
    /main/settings/capture
    /main/imgsettings/eos-iso
    /main/imgsettings/eos-whitebalance
    /main/capturesettings/picturestyle
    /main/capturesettings/eos-aperture
    /main/capturesettings/eos-shutterspeed
    /main/capturesettings/eos-meteringmode
    /main/capturesettings/focuslock

    Ahh… so there we go. So, if I wanted a (semi-)successful manual exposure, I should do:

    gphoto2 –set-config capture=on –config -F <Nf> -I <Ti> –capture-image

    I still need to figure out how to retrieve the file or somehow get the command to complete.

    Earlier, my AF exposures would fail, because I was trying to shoot a blank wall, so AF would fail! It took me really really long to realize that!

    The following documentation will prove to be sparingly helpful:

     
    • Akarsh Simha 4:17 am on March 30, 2008 Permalink | Log in to Reply

      Expt 1.0.1
      I tried:

      ~/bin/gphoto2 –set-config capture=on -F 1 -I 1 –capture-image –new

      The command still doesn’t terminate.
      –new is supposed to get all pictures flagged as new.

    • Akarsh Simha 2:06 pm on March 31, 2008 Permalink | Log in to Reply

      The problem of not terminating correctly is apparently because of some change with the proprietary (and consequently undocumented) Canon PTP (Picture Transfer Protocol or something like that) in the new firmware.
      Marcus Meissner has already started working on it and has produced (and commited?) a patch today (an hour ago or so).
      Will check if it works later today evening.

    • akarshsimha 11:11 am on April 6, 2008 Permalink | Log in to Reply

      Ok… Marcus Meissner has fixed it and it works for other people. It’s been merged with the trunk. I now need to figure out how to compile gphoto2 from the trunk.

    • Nick Quinn 1:40 am on April 30, 2008 Permalink | Log in to Reply

      After messing around with gPhoto and my 40D for several months, your blog provided me with the ‘hint’ I needed to finally understand how to set the shutter speed! However, if I fire the shutter either from gPhoto or by the camera’s shutter button, no image is stored on the CF card. Did you manage to get any further with your 400D and actually capture an image?

    • Akarsh Simha 1:43 am on May 13, 2008 Permalink | Log in to Reply

      Glad that my blog proved useful. I haven’t got beyond this, because I haven’t found time to recompile gphoto2 from the trunk ever since :-D

      Regarding storing on CF card, you’ll have to set capturetarget to CF card. I don’t know what the exact value is, but you can look up the documentation for that.

      There’s also a neat ncurses based configuration screen, which you can use to set these parameteres.

    • Andrew Wyllie 4:36 pm on June 27, 2008 Permalink | Log in to Reply

      Thanks for all the information on this. I got the latest version from SVN and it compiled with no problem and works really well.

      If you want to capture an image an download it right away, you need to use a command like:
      gphoto2 –set-config capture=on -F1 -I 1 –capture-image-and-download

      Even cooler is to use a hook-script which allows you to manipulate and or display the image as soon as it’s downloaded.

      Here’s my hook-script script which uses ‘display’ from ImageMagick to display the image one it has been downloaded (you could put any command you want there).

      #! /bin/bash

      self=`basename $0`

      case “$ACTION” in
      init)
      echo “$self: INIT”
      # exit 1 # non-null exit to make gphoto2 call fail
      ;;
      start)
      echo “$self: START”
      ;;
      download)
      echo “$self: DOWNLOAD to $ARGUMENT”
      display ${ARGUMENT} &
      ;;
      stop)
      echo “$self: STOP”
      ;;
      *)
      echo “$self: Unknown action: $ACTION”
      ;;
      esac

      exit 0

    • fred 1:00 pm on August 2, 2008 Permalink | Log in to Reply

      Thanks for this useful info… you have put me on the right track. Maybe i can help you with a problem you have…

      Perhaps some of your commands haven’t been working because you weren’t typing the “–” correctly at the start?
      I cut and pasted some of the commands from this web page and they didn’t work for me. I changed the characters at the start of the arguments to “–” and then they worked.

      Eg gphoto2 –set-config capture=on -F 1 -I 1 –capture-image (from this page)
      didn’t work for me until i changed the -set to –set and -capture to –capture

      This may be of no use to you, perhaps the web page displays the double minus (–) as a single character for some reason

    • fred 1:03 pm on August 2, 2008 Permalink | Log in to Reply

      After publishing my last comment, i now see that it is just the web software that runs together the double minus if it is typed with no space. Be aware if you cut and paste commands from here that look like this
      –config
      you need to manually edit them to look like this

      • -config (but with no space between the minus)

      Sorry this info is no use to the owner of this page but any others might be caught by this trap

    • Akarsh Simha 9:18 pm on September 6, 2008 Permalink | Log in to Reply

      Yes, the – seems to be a problem with WordPress.

      I’ve still not been able to get gphoto2 from trunk to build and the latest release doesn’t seem to work for me.

    • jan 7:13 am on November 16, 2008 Permalink | Log in to Reply

      Thanks to your article and helpful comments I have managed to get gphoto control my Canon 400D. Everything works with gphoto 2.4.3 and libgphoto 2.4.3 (even capture-tethered).

    • Akarsh Simha 6:53 pm on February 1, 2009 Permalink | Log in to Reply

      I’m now doing astrophotography comfortably with my Canon EOS 400D and Debian laptop, thanks to Marcus Meissner and gphoto2.

      I’m using version 2.4.3 of both gphoto2 and libgphoto. This is what I do to get it working:

      gphoto2 –set-config capture=true -F -I –capture-image-and-download

      It still doesn’t seem to work with the mirror lock up / self timer. That’s something I need to figure out, because astrophotography really needs that!

    • Noah 12:37 pm on July 18, 2009 Permalink | Log in to Reply

      Maybe there are better methods to [transfer photos] – maybe the konqueror camera:/ kioslave (or whatever it’s called) works better – please let me know in that case.

      I like the following;
      $ mkdir ./photo && cd ./photo
      $ gphoto2 -P

      That will suck all the photos off the camera into dir photo. Thanks for the remote control info.

      Noah

    • Damien Keffyn 7:56 pm on August 1, 2009 Permalink | Log in to Reply

      I have tried with no real success to get my 400D to capture download and preview an image.

      is there a change that has relpaced the commands used above?

      Here is what I am trying
      gphoto2 –set-config capture=true -F -I –capture-image

      This returns –>

      value true, t 1
      New file is in location /capt0000.jpg on the camera

      this command fails –>
      gphoto2 –set-config capture=true -F -I –capture-image-and-download

      this command works –>

      gphoto2 –set-config capture=true -F -I –capture-image –get-all-files

      It returns the –>

      value true, t 1
      New file is in location /capt0000.jpg on the camera
      Saving file as capt0000.jpg

      The issue I have is I would like to be able to use the camera to take the image rather than instigate the capture from the command line.

      is this possible?

      Cheers,
      Damien K

    • Javier Pais 12:14 pm on December 20, 2009 Permalink | Log in to Reply

      gphoto2 –set-config capture=true –set-config eos-time=120 –capture-image-and-download

    • Javier Pais 12:29 pm on December 20, 2009 Permalink | Log in to Reply

      Sorry for my previous post…

      There is… if we do a:

      $ gphoto2 –set-config capture=on –list-config

      this is the result:

      /main/settings/eos-time
      /main/settings/eos-synctime
      /main/settings/capturetarget
      /main/settings/capture
      /main/imgsettings/eos-iso
      /main/imgsettings/eos-whitebalance
      /main/capturesettings/picturestyle
      /main/capturesettings/eos-aperture
      /main/capturesettings/eos-shutterspeed
      /main/capturesettings/focuslock

      then we can do a…

      $ gphoto2 –set-config capture=on –get-config=/main/capturesettings/eos-shutterspeed

      obtaining this:

      Current: 1/4000
      Choice: 0 30″
      Choice: 1 25″
      Choice: 2 20″
      Choice: 3 15″
      Choice: 4 13″
      Choice: 5 10″ (1/3)
      Choice: 6 8″
      Choice: 7 6″ (1/3)
      Choice: 8 5″
      Choice: 9 4″
      Choice: 10 3″2
      Choice: 11 2″5
      Choice: 12 2″
      Choice: 13 1″6
      Choice: 14 1″3
      Choice: 15 1″
      Choice: 16 0″8
      Choice: 17 0″6
      Choice: 18 0″5
      Choice: 19 0″4
      Choice: 20 0″3 (1/3)
      Choice: 21 1/4
      Choice: 22 1/5
      Choice: 23 1/6 (1/3)
      Choice: 24 1/8
      Choice: 25 1/10 (1/3)
      Choice: 26 1/13
      Choice: 27 1/15
      Choice: 28 1/20 (1/3)
      Choice: 29 1/25
      Choice: 30 1/30
      Choice: 31 1/40
      Choice: 32 1/50
      Choice: 33 1/60
      Choice: 34 1/80
      Choice: 35 1/100
      Choice: 36 1/125
      Choice: 37 1/160
      Choice: 38 1/200
      Choice: 39 1/250
      Choice: 40 1/320
      Choice: 41 1/400
      Choice: 42 1/500
      Choice: 43 1/640
      Choice: 44 1/800
      Choice: 45 1/1000
      Choice: 46 1/1250
      Choice: 47 1/1600
      Choice: 48 1/2000
      Choice: 49 1/2500
      Choice: 50 1/3200
      Choice: 51 1/4000

      and the pick the desired value…

      gphoto2 –set-config capture=true –set-config eos-time=26 –capture-image-and-download

      (remember that ‘–’ are two ‘-’)

    • Javier Pais 1:10 pm on December 20, 2009 Permalink | Log in to Reply

      Sorry another time…

      is not ‘eos-time’… it must be… ‘eos-shutterspeed’

      gphoto2 –set-config capture=true –set-config eos-suttherspeed=26 –capture-image-and-download

    • Luke 4:59 am on April 5, 2010 Permalink | Log in to Reply

      Akarsh you wrote:
      “I’m now doing astrophotography comfortably with my Canon EOS 400D and Debian laptop”
      I`m going to use my eos 400d with a small baloon to take photos from about 50m on archaeological site.
      Do you have any idea how to connect the camera with laptop? usb cabel is to short… via radio? How to fix it up with gphoto etc..?

    • Javier Pais 2:33 pm on April 5, 2010 Permalink | Log in to Reply

    • Luke 6:48 pm on April 5, 2010 Permalink | Log in to Reply

      Looks really good and may solve my problem, 150 fits may to be too short, but I may find sth. simillar if I know what am I looking for…
      Thanx a lot

  • Akarsh Simha 1:48 am on March 22, 2008 Permalink
    Tags: ioctl, , ,   

    Computer controlled tubelights! 

    A few months back, I implemented an interface using the Parallel Port to control my room’s tubelight and bulb. Such circuits that interface electrical devices to the computer through parallel port are extremely popular on the internet. My version uses one optocoupler (MCT2E), one transistor, a pair of resistors and a relay for every device I wish to control. So I’ve got some two implementations of this as of now.

    A simple C program can help control the bits on the parallel port (and thereby the devices). Again, there are examples all over the internet like this one, that help you do that. I wanted something more flexible and easy to use, so I wrote a rather long program (maybe it is an overkill). Forgive me for the unclean and dirty code. Here it is. You can kick me for writing dirty C++ – I hardly learnt any C++. (I learnt that it is dumb to use stdio.h, fprintf etc in C++ code, and that all C++ code must be encapsulated, but who cares! I wrote this for my own use, and am graciously releasing it, so take it if you must, and if you do write better and cleaner versions, please link them in the comments to this post! :-D). What this code does is to implement something that can toggle the state of a specified device.

    In this code, I read a configfile that defines the values of the bits that need to be switched on to control each of the devices. I implemented this so that it remains extensible – I’m planning to extend this to control my fan as well :-D. Once you’ve defined values in the configfile, you can then do things like:

    sudo lpdevctl bulb

    You can also specify a default device that’ll get toggled if you just say sudo lpdevctl (without an argument).

    Once you have such a program, you can do lots of interesting things. The simplest of them would be to switch on your tubelight after 10 seconds delay, say:

    sleep 10; sudo lpdevctl tubelight

    Something slightly more interesting:

    for i in `seq 1 5`; do sleep 0.5; sudo lpdevctl bulb; sleep 0.5; sudo lpdevctl bulb; done;

    That flashes the lamp 5 times. Even more interesting – switching on your tubelight every day automatically at 1830 hours is like setting up a cronjob at 1830 hours to execute sudo lpdevctl tubelight.

    I use a Jabber client called mcabber which has external action triggers, that can call an external action when something happens. So if somebody pings me on IM, I am notified of it through the flashing of my bulb (which I seldom use otherwise) instead of some ding sound that interrupts the beautiful music I’m playing. Besides, this alert is easy to switch off – because I can go and turn off the light bulb switch – and the relay is in series with that!

    Once you get a command on your Linux system to do something, the ways in which you can extend it are infinite and are only (un)bounded by your creativity!

    I like the idea of switching on my room light while sitting in my department computing facility using SSH :-D

     
    • Prasanna 10:10 pm on March 22, 2008 Permalink | Log in to Reply

      That was really a nice idea.

      @Other readers
      Try this out. Lots of fun. I tried it out too. Its very exciting :P

    • Vajahat Ali 7:51 pm on October 5, 2009 Permalink | Log in to Reply

      Please let me know how to make that Electric Circuit, can you provide some diagram :)

  • Akarsh Simha 8:53 pm on March 21, 2008 Permalink
    Tags: , QEMU, Virtual Machines   

    Running an emulator! 

    I found it really amazing that you could so conveniently run a virtual machine on your system! When I tried installing VMWare, it was such a pain. Finally, at the end, I got it working, but I didn’t use it.

    Today, I needed an emulator to test the Debian preseeded install that I’ve been working on. So I fired up the virtual machine that Varun showed me the other day:

    sudo apt-get install qemu

    qemu -cdrom bootable_cdrom.iso

    And voila! I get a GRUB prompt (that’s what I’d put on the ISO image) that awaits a few commands in no time. That’s as far as CD-ROM boot goes.

    Now, the virtual machine has no harddisk. Let’s say we wanted to give our virtual machine a harddisk – First we need to “create” the harddisk, that is if we’re not willing to dedicate a full partition to the virtual machine.  So, off we go:

    dd if=/dev/zero of=new_virtual_hdd.img count=10000000

    I think that produces a 5.12 GB file, if I amn’t wrong. So this time, we have a harddisk:

    qemu -cdrom bootable_cdrom.iso new_virtual_hdd.img

    So now you can go ahead and install any OS you want etc. But wait a minute, we want more than that – what about Network hardware?  QEMU automatically enables a kind of NAT between the virtual machines and the host macnine’s network. So internet access etc. should work as though we were behind a NAT router. As I write this, the Debian installer running on the VM tells me that my config file had a bug which I’ve to investigate, so I stop blogging here and do start working on fixing the flaw! :-D

    For more information:

    man qemu

    Has a lot of details about the hardware that it emulates etc.

     
  • Akarsh Simha 6:04 pm on March 21, 2008 Permalink
    Tags: , Debian Installer, Preseeding   

    Preseeding the Debian Installer 

    KMap happened to mention about preseeding when we were looking for some “automated” Linux installation (and configuration) for the IITM network, so that hostellers in the institute can easily install Linux and start using it straight away.There are a lot of hurdles in the campus network – the Proxy server, restricted NAT access, Proprietary NTLM Authentication for the proxy server, etc – which make Linux installations and configuration of simple utilities under Linux a pain

    So we wanted something that’ll autoconfigure these things. (If you see our Linux Users’ Group mailing list you’ll find many mails about NTLM authorization!) And after KMap explained what preseeding could do, I was hooked on to the idea. (I remember that this happened on the last day FossConf 2008, when we were thinking on these lines, inspired by Mr. Arun Khan whom we all spoke to the previous night.) And finally I caught onto the idea again a week and a half. Varun and I did some web-hunting and testing, and we should be able to shortly “release” the preseeded installer, both as CD ISO, netboot ISO (what a waste of a CD), and netboot installer ‘suites’.

    There are enough articles on preseeding the Debian Installer:

    I found the last two sites very useful. In addition this example-preseed.txt file proved very useful.

    I just took that example preseed configuration file and modified it to suit the IITM environment. The contents of the file with all the comments stripped of are here:

    debconf debconf/priority string critical
    unknown debconf/priority string critical
    d-i debconf/priority string critical
    d-i debian-installer/locale string en_US
    d-i console-tools/archs select at
    d-i console-keymaps-at/keymap select us
    d-i netcfg/choose_interface select auto
    d-i netcfg/dhcp_failed note
    d-i netcfg/dhcp_options select Configure network manually
    d-i netcfg/get_nameservers string 10.91.2.11 10.91.2.12
    d-i netcfg/get_netmask string 255.255.0.0
    d-i netcfg/get_gateway string 10.94.0.254
    d-i netcfg/confirm_static boolean true
    d-i netcfg/get_hostname string debian
    d-i netcfg/get_domain string iitm
    d-i netcfg/wireless_wep string
    d-i mirror/country string manual
    d-i mirror/http/hostname string 10.65.0.42
    d-i mirror/http/directory string /debian
    d-i mirror/http/proxy string
    d-i mirror/suite string testing
    d-i clock-setup/utc boolean false
    d-i time/zone string Asia/Calcutta
    d-i clock-setup/ntp boolean false
    d-i partman-auto/init_automatically_partition \
    select Guided – use the largest continuous free space
    d-i partman-auto/init_automatically_partition seen false
    d-i partman-auto/choose_recipe \
    select Separate /home partition
    d-i partman-auto/choose_recipe seen false
    d-i passwd/root-login boolean false
    d-i apt-setup/non-free boolean true
    d-i apt-setup/contrib boolean true
    d-i apt-setup/use_mirror boolean false
    d-i apt-setup/security_host string 10.65.0.42
    d-i apt-setup/local0/repository string \
    http://10.65.0.42/debian testing main
    d-i apt-setup/local0/comment string http://ftp.iitm.ac.in
    d-i apt-setup/local0/source boolean true
    d-i apt-setup/local0/key string http://10.65.0.42/key
    d-i debian-installer/allow_unauthenticated string true
    tasksel tasksel/first multiselect standard, web-server, desktop
    d-i pkgsel/include string openssh-server cntlm vlc pidgin xchat gimp linuxdcpp firefox
    popularity-contest popularity-contest/participate boolean false
    d-i grub-installer/only_debian boolean true
    d-i grub-installer/with_other_os boolean true
    d-i finish-install/reboot_in_progress note
    xserver-xorg xserver-xorg/config/device/driver select vesa
    xserver-xorg xserver-xorg/autodetect_monitor boolean true
    xserver-xorg xserver-xorg/config/monitor/selection-method \
    select medium
    xserver-xorg xserver-xorg/config/monitor/mode-list \
    select 1024×768 @ 60 Hz
    #d-i preseed/late_command string in-target wget -q \ #http://10.94.47.14/deb-preseed/post_install.tar.gz && tar -xzvf post_install.tar.gz && \ #rm post_install.tar.gz && pushd post_install && ./control.rc && popd

    The last three lines which I’ve commented out here are not actually commented in the version on my web server. I’ve commented them out here because they fetch some package from my web server which is not accessible from outside the institute. Also, those lines haven’t been tested (and are going to be tested as I write this blog post).

    Now… how do we get the netboot kernel to use this preseed file? You can’t use the preseed/file=<…> kernel parameter because it requires that the file be on the ramdisk. So one way of doing it is to put it on a web server / FTP server and then use preseed/url=<URL> kernel argument, as in (in the GRUB prompt):

    kernel /linux preseed/url=http://10.94.47.14/deb-preseed/preseed.cfg

    Where the http://&#8230;.cfg should be replaced with the appropriate URL where the installer can find the preseed config file.

    The other option is to open up initrd.gz and put it on the ramdisk. Any file named preseed.cfg put in the root of the ramdisk acts as the preseed configuration file, and the debian installer automatically loads it. If you would like to preseed “optionally” in that case, you can probably rename the file to something else, say optional_preseed.cfg and then pass preseed/file=optional_preseed.cfg to the kernel. This method is detailed in this article, in the context of burning the initrd permanently to an ISO. In that case, another option is to just put the ISO on the CDROM and then use preseed/file=<…>

     
  • Akarsh Simha 5:57 pm on March 21, 2008 Permalink  

    What is initrd? 

    I didn’t know what the purpose of the initrd file was. I had some vague idea that it had something to do with the ramdisk.

    Varun was looking at this Debian Wiki page and was trying to get a preseeded Debian Installer ISO. While hacking the initrd, we noticed that the initrd looked like a proper / filesystem – with a /bin, /etc et al. It is then that I learnt that initrd is like an “image” of the ramdisk to be used by the Linux kernel.

     
  • Akarsh Simha 5:11 pm on March 20, 2008 Permalink  

    How dumb can I get? 

    [ irc.freenode.org #linux-india , 16th March 2008 ]
    00:10 < kstar> Let’s say the base class is called Base and the inherits are Inh1 Inh2 etc
    00:11 < kstar> I want to have, elsewhere in my program, a variable declared as class Base a;
    00:11 < kstar> And I want to assign the contents of class Inh1 b; to it
    00:11 < kstar> Using something like a = b
    00:11 < kstar> Is that possible?
    00:12 < HereBeDragon> no
    00:12 < jsemmanue1> HereBeDragon: why not?
    00:12 < jsemmanue1> say a is of type car and b is of type maruti800
    00:12 < jsemmanue1> can’t we do that?
    00:13 < HereBeDragon> no, this cast from base to derived is undefined
    00:13 -!- sudhanwa [n=sudhanwa@61.17.74.127] has left ##linux-india ["Kopete 0.12.5 : http://kopete.kde.org"]
    00:13 < HereBeDragon> you can cast a maruti800 to a car. but not the other way rounf
    00:13 < devdas> not a type conflict
    00:13 < devdas> think shallow copy vs deep copy
    00:13 < HereBeDragon> kstar: what you should do is:
    00:13 < kstar> HereBeDragon: ?
    00:13 < HereBeDragon> base b = new Inh1();
    00:13 < devdas> oh wait, from child to parent? nope
    00:13 < kstar> HereBeDragon: Eh?
    00:13 < jsemmanue1> but he wants to cast from derived to parent right?
    00:14 < HereBeDragon> jsemmanue1: no, he wants to cast from base to derived
    00:14 < jsemmanue1> a is base and b is derived
    00:14 < kstar> Rather, I’ll explain my situation more clearly
    00:14 < HereBeDragon> look at it this way – when you declare a car, the size of your class is 5 bytes. When you inherit and create a
    00:15 < HereBeDragon> now, you see where the casting problem comes in
    00:15 < jsemmanue1> are we referring to the maruti800 or copying the entire contents?
    00:15 < HereBeDragon> we are assigning
    00:15 < jsemmanue1> because if we are just referring, base then doesn’t need to know that there are 3 more bytes, it just uses those that are needed
    00:15 < jsemmanue1> anyway, i am firing up my netbeans to check it out
    00:16 < HereBeDragon> kstar: so the solution is, give b the extra 3 bytes, so you can declare it as base b = new Inh1();
    00:16 < kstar> HereBeDragon: ok
    00:16 < kstar> you mean base *b
    00:16 < kstar> HereBeDragon: Eh????
    00:18 < kstar> HereBeDragon: Wait a minute… I’ll try to gather words to explain what exactly I want
    00:18 < HereBeDragon> kstar: if you can withstand some serious flames and gain in the process, go to ##c++
    00:18 < kstar> HereBeDragon: That’s the trouble. :-D
    00:18 < HereBeDragon> hee hee
    00:18 < HereBeDragon> c’mon, a little flame can’t hurt
    00:18 < kstar> HereBeDragon: I never learnt C++ but am coding in C++
    00:19 < HereBeDragon> I guessed :-D
    00:19 -!- devdas [n=a@dialup-mum-203.94.233.110.mtnl.net.in] has quit [Read error: 104 (Connection reset by peer)]
    00:20 < kstar> HereBeDragon: I have a class Base *a passed to my function, where a actually points to a class Inh1 *
    00:20 < HereBeDragon> that’s perfectly fine
    00:20 -!- TracerBullet [n=calvin@2001:470:1f06:46a:0:0:0:2] has joined ##linux-india
    00:21 < TracerBullet> yay!!!
    00:21 < kstar> HereBeDragon: I’m trying to look for a classdup like an strdup!
    00:21 * TracerBullet kicks jsemmanuel
    00:22 < kstar> HereBeDragon: But I want to make a copy of it and I don’t know which derived class it is – Inh1, Inh2 or what
    00:22 < grub> TracerBullet, tunnel?
    00:22 < TracerBullet> yeah
    00:22 < HereBeDragon> but woe be unto you if you refer to a base as a derived without the protection of dynamic_casr
    00:22 < grub> which one? i am too lazy to trace :p
    00:22 < TracerBullet> now to make my website ipv6 enabled :)
    00:22 < TracerBullet> he.net
    00:22 < grub> ah, he
    00:23 < HereBeDragon> kstar: you can use dynamic cast for that
    00:23 < grub> TracerBullet, pick up nice cool public domains from afraid.org setup ptrs, and sell vhosts for irc :p
    00:23 -!- TracerBullet [n=calvin@2001:470:1f06:46a:0:0:0:2] has quit ["wooo hooo .. back on ipv6 after ages!"]
    00:24 * Hobbes` goes to check afraid.org
    00:26 < HereBeDragon> nice
    00:26 < kstar> HereBeDragon: Thanks for being patient with me. :-S
    00:26 < jsemmanue1> kstar
    00:26 < jsemmanue1> is this what you want?
    00:26 < HereBeDragon> kstar: no probs. But just wanted to caution you that if you’re having to use dynamic_cast() still you should reexamine
    your design ;-)
    00:27 < jsemmanue1> http://pastebin.com/m371b3355
    00:27 < jsemmanue1> just check if this is the code you wanted? is that how you wanted the argument to be passed?
    00:27 < jsemmanue1> a is the base class and b is the inherited
    00:28 < jsemmanue1> tracerbullet what was that kick for?
    00:28 < jsemmanue1> kstar ??
    00:28 < jsemmanue1> :-D
    00:28 * kstar slaps himself hard
    00:28 -!- munichlinux [n=Prashant@121.243.205.67] has quit [Remote closed the connection]
    00:28 < jsemmanue1> no prob. happens often with me tool
    00:29 * jsemmanue1 kicks tracerbullet
    00:29 -!- tuxmaniac [n=aanjhan@unaffiliated/tuxmaniac] has joined ##linux-india
    00:29 < jsemmanue1> oh, he ran away
    00:29 < kstar> HereBeDragon: Look at that pastebin. That’s what I wanted to achieve. :-D
    00:30 < kstar> HereBeDragon: Anyway, thanks. I learnt something new/
    00:30 -!- pravins [n=psatpute@59.184.30.45] has joined ##linux-india
    00:32 < HereBeDragon> kstar: kewl! and read stroustroup so that you can (shakily at least) confront the masses in ##c++

    And this is what the pastebin was:
    //
    // File: newmain.c
    // Author: jsemmanuel
    //
    // Created on March 16, 2008, 12:10 AM
    //

    #include <stdlib.h>
    #include <iostream.h>

    //
    //
    //

    using namespace std;
    class a {
    public:
    int a;
    };
    class b: public a{
    public:
    int b;
    int c;
    };
    void test(a av) {
    cout<<av.a;
    };
    int main(int argc, char** argv) {
    b b1;
    b1.b=1;
    b1.c=2;
    b1.a=1;
    test(b1);
    return (EXIT_SUCCESS);
    };

     
  • Akarsh Simha 6:03 pm on March 19, 2008 Permalink  

    KMap 

    KMap

     
    • Prasanna 6:59 pm on March 19, 2008 Permalink | Log in to Reply

      :D

    • Srinidhi 10:43 pm on March 19, 2008 Permalink | Log in to Reply

      Sad da, I guess and also, we can peacefully say, some huge “Junta” in FOSS from India are packing.

    • Arjun N Bharadwaj 10:22 am on March 20, 2008 Permalink | Log in to Reply

      :D Why is Queen there? To step into the shoes of KMap….

    • Akarsh Simha 4:46 pm on March 20, 2008 Permalink | Log in to Reply

      @Srinidhi: Yeah!
      @Arjun: That’s why Slinky (not Queen) is there.

    • Aswin 10:58 am on March 23, 2008 Permalink | Log in to Reply

      There is palpable excitement in the Austin area too [:)] ..anticipating kmap’s arrival, the utexas debian mirror has been granted official status. We are preparing an approp welcome ..

    • Kumar Appaiah 11:02 am on March 23, 2008 Permalink | Log in to Reply

      I am very insignificant in Indian FOSS. But I’d really love it if you guys could become gawds.

    • Akarsh 12:03 pm on March 23, 2008 Permalink | Log in to Reply

      @Aswin: LOL.
      @KMap: You are definitely far less insignificant in comparison to other students in IIT Madras, if at all. Anyway, thanks for your encouragement.

  • Akarsh Simha 11:06 pm on March 11, 2008 Permalink
    Tags:   

    Some new, processed photos. 

    This was on Saturday when I went to a dark site called Shivanahalli for observing / photography.

    These are manually tracked photos on film (5 – 10 minute exposures).

    The trouble (and fun!) with manual tracking and film is that you hardly ever get things right. In the auto-tracked domain, there isn’t much effort involved other than pole alignment and setting up auto-guiding. And the major problem is the film – whereas if someone flashes a torchlight during an exposure with a digital camera, you lose one frame… at max. 6 minutes of exposure, because that is the maximum exposure you usually give in a digicam (you stack up several frames at high ISO, to produce an equivalent of a long exposure). If somebody flashes a torchlight during a manually tracked film exposure – you lose 15 minutes of hard work!!! And if one frame goes wrong, you can just drop it in digital exposures. In film exposures – it is monolithic – only one frame – so if that goes wrong, you’re whole exposure is gone!

    Needless to say, only 3 out of 5 photographs that I took came out well. And after processing, here they are:

    Constellation Corvus


    Although there is absolutely nothing interesting in Corvus, I like the shape of the constellation. So I took this photograph. It so happens that this turned out to be the best of all the photos I took, unfortunate as it may be.

    Constellation Crux

    Now, that was a really bad photo. I haven’t been able to give it my best processing as yet. I don’t think I will give any more time to this either. This photo was taken through heavy haze, so it is difficult to process. Omega Centauri is on the top left, Eta Carinae (and Theta Carinae??) at the bottom right.

    Southern Skies

    Of course, it is a little overprocessed. I like it that way, anyway. Notice the Coalsack. I didn’t expect that! Omega is the bright object to the 7 o’ clock of the center. I liked Eta Carinae as well. Running Chicken nebula (?) has appeared too.
    To date I haven’t got a good photo of Orion. :-(

    I was expecting one this time atleast, but it turns out that somehow I’ve got trails in the North-South direction! That’s ruined the exposure :-(

    Anyway, there’s a next time. And there’s still the fun of processing Shashank’s photos! :-D Shashank got a good shot of Orion at Shivanahalli, so here’s the processing. I hope I’ve done better than last time:

    Orion by H J Shashank - 2

    Getting a good photo on film is really a challenge, even with wide-field! It’s also exciting ;-)

     
  • Akarsh Simha 9:57 pm on March 11, 2008 Permalink
    Tags: IITMLUG, , LUG T-Shirt   

    The IITMLUG T-Shirt. 

    With inputs from many people, megabytes of discussions on the mailing list, and some GIMPing by Prasanna, Arun and me, the IITM Linux Users’ Group T-Shirt for this year is “ready”! It’s based on this star wars catchphrase “May the Force be with you”. A little googling gives you a Penguin that holds a Light Saber with text around it that reads “May the Source be with you”! I’m assuming that the above work is released by its author into public domain. Ich verstehe nur einbischen Deutsch, und Google Translate ist schlimm – but I think that’s what he meant in that page. If someone knows better German, please do help me! Of course, I hope that the logo is just as open source as what it depicts, and I guess it will be (because I’ve seen the same stuff in many other sites) So here’s the design:

    Front of the new IITMLUG T-Shirt

    That’s the front side of the T-Shirt. It carries in the circle a rather inconspicuous version of our IITMLUG “logo”. And this is the back side:

    Back of the IITMLUG T-Shirt

    As you can see, I’ve made quite a few modifications to the original logo. Again, I hope that it has been permitted by the author. Tell me ASAP if you find out that isn’t the case!

    I’d love to wear this T-Shirt for sure. Orders will be open very soon, so if anyone is interested in one, meet me.

     
  • Akarsh Simha 12:10 am on March 8, 2008 Permalink
    Tags: , Image Processing, Orion,   

    Processing Orion 

    Shashank took this wonderful wide-field photograph of constellation Orion sometime at Shivanahalli:

    Orion by H J Shashank (Unprocessed)

    I enjoyed processing this photo the most, so I thought I’ll reprocess the same and this time, write a blogpost on how I did it, so that the strange techniques I use may be available to others. I’m going to avoid explaining details on how to do small operations with The GIMP, which is what I’m going to use here to process this photograph.

    The GIMP is free and open source software and can be downloaded for both Linux and Windows. It is highly recommended that you encourage and use Free and Open Source software. The GIMP can do most of the things that a copy of Photoshop costing 30k Rupees for free, and much more!

    Step 1: Set your monitor contrast and brightness to a good amount. See Jerry Lodriguss’ page on how to do this professionally. I do it randomly to my satisfaction :-P. This is important, because the last time I processed this, the outcome was good looking at my low contrast (which I use to protect my eyes) but it looked really artificial and ugly at high contrast.Astro Proc Tutorial.

    Step 2: Open the photograph, investigate what Layers are. Layers are used extensively while processing. Familiarize yourself with the interface of The GIMP. The Layers dialog can be quickly fired by hitting Ctrl+L (atleast in my version of The GIMP)

    Astro Proc Tutorial.Step 3: We now set the black point. Go to Colors -> Levels (Layers -> Colors -> Levels in older versions) and click on the ‘pick black point’ button. Then, select a point on the image that corresponds to the skyglow in the image. Because of vignetting, the skyglow is not uniform, so I chose a point where it is somewhere inbetween, so that I don’t lose faint stars, but still cut out enough skyglow.

    Astro Proc Tutorial.Step 4: Adjust curves to improve the photo. The Curves tool is found at Colors -> Curves (Layers -> Colors -> Curves in older versions). Enhance the useful details and kill the noise. Of course, be careful to preserve the fainter stars as well. Don’t try to supress all the noise – you’ll lose the nebulosity.

    .

    Astro Proc Tutorial.Step 5: Decompose the image into Red, Green and Blue Channels. To do this go to Colors -> Components -> Decompose and choose RGB. The GIMP will open a new window with a grayscale image. If you fire up the layers dialog, you’ll notice that it has the R-G-B channels as separate layers. So we can work on each channel just as we would work on a layer. In this screenshot, the Red Layer is shown. Notice that the nebulosity is strong in the red channel because of the Hydrogen emissions.

    Astro Proc Tutorial.Astro Proc Tutorial.Step 6: Find the noise. It involves some thinking to decide how you will catch only the noisy skyglow and remove the sensible parts of the image. In the case of this example, the noise was mostly in the Red and Green channels, so I could use some combination of them to extract only theAstro Proc Tutorial.Astro Proc Tutorial. noise. I found that I could do that best by doing a “Grain Merge” between the Red and Green layers and subtracting that from the Green Layer. Then, merge the layers (Ctrl+M) and use the Curves tool and the Eraser / Paintbrush tools to eliminate all part not noise. You mayAstro Proc Tutorial.Astro Proc Tutorial. then copy the noise layer and paste its of the image that are into the original colour image. (Remember that we were working on the decomposed grayscale image till now). In the Layers dialog, that will appear as a ‘floating selection’. Click on the ‘Create new layer’ button to make it into a new layer.

    Astro Proc Tutorial.Step 7: Colorize the noise using the Channel Mixer (Colors -> Components -> Channel Mixer). Give the grayscale noise layer that we pasted in the previous step a hue of the colour of the noise in the original image. In the case of this photo it was yellowish-green. So I went to the Channel Mixer and raised the intensities of the contributions to red and green channels.

    Astro Proc Tutorial.Step 8: Set the layer mode to subtract, to subtract the noise from the image. It gives a real nice feeling to see that skyglow vanish! It was worth the effort, wasn’t it?

    .


    Astro Proc Tutorial.Astro Proc Tutorial.Step 9: You may want to enhance the nebulosity by adding that over again to the photo. Go back to the decomposed image and subtract the noise from the red channel. Then combine the layers, copy, paste into the main image. Again, convert the floating selection into a new layer, colorify the nebula with a red tint using the Channel Mixer. Change the mode of the nebula layer to value and the nebulosity will increase.

    Astro Proc Tutorial.Step 10: Now, merge the layers (Ctrl+M) and if required adjust curves to do some final adjustments. I had some more greenish skyfog, so I killed that by adjusting the curves for the Green channel. I also tampered with the curve for the value channel to improve contrast.

    Astro Proc Tutorial.Step 11: If you like, (I do!) you may want to give the diffuse stars effect by using Curves and Gaussian Blur (Filters -> Blur -> Gaussian Blur) repeatedly. To do this, first duplicate the image layer and blur it with a radius of about 20 px. Then use curves to kill all the fainter stars. Again, use blur to increase the diameter of the bright stars. Repeat till you are satisfied. If required (I had to do this) make colour adjustments by adjusting curves of individual channels as well. Once you get nice halos of bright stars, change the layer mode to screen. I also had to kill the blurred halo of Orion Nebula while doing this, to preserve detail.

    Ok… so this is what I got at the end:

    Orion by H J Shashank

    Shashank has really done a great job in taking this photo. This is a long exposure (> 10 minutes. I don’t know the details) manually tracked photo. Shashank does a very good job with manual tracking for the kind of equipment he has. You can also see the stars of Lepus highlighted by the diffuse stars effect. You can see the Flame Nebula,IC 434 emission nebula, Great Orion Nebula and Barnard’s Loop.

     
    • Akarsh Simha 12:12 am on March 8, 2008 Permalink | Log in to Reply

      Thanks to WordPress for screwing up so many things, such as the placement of the screenshot thumbnails and the cropping of the final image. Excuse me for my laziness to try and fix these errors! :-P

    • Ed 12:22 am on March 8, 2008 Permalink | Log in to Reply

      If you want to get even more out of it, you can create a sort of fake flat frame where you create an image with that vignette area as a white fuzzy snowball and then you can have a better black point to get rid of skyglow. I’ll bet there’d be even more detail in there that way. Good job, though.

    • Akarsh Simha 12:28 am on March 8, 2008 Permalink | Log in to Reply

      Ahh… yes. I think I understand what you mean. I’d tried that earlier sometime and it worked pretty well. I thought that the noise extraction from the decomposed image would remove that as well.
      I’ve never done astrophotograph proper or learnt processing by the book before, so I don’t understand terms like “flats” too well… but I get what you mean. Thanks for the suggestion. Will try that as well.,

    • Ed 2:58 am on March 8, 2008 Permalink | Log in to Reply

      just do some searching on Google on how to take a good flat frame – you can create one yourself (it’s not as good, but better than nothing) and the results will really surprise you – there’s even more data in there than you think!

    • Prasanna 6:39 am on March 8, 2008 Permalink | Log in to Reply

      Hope this comes in handy for many people :)

    • Dr Suresh 11:03 am on March 8, 2008 Permalink | Log in to Reply

      Hi,
      Flats are taken to remove the vignetting in a picture.Flats are taken at ISO 100 ,with t he focus and the position of the camera SAME as the subs. The histogram on the back of the camera should read between 1/3 to 1/2 ( adjust the timing).Pic is shot in the evening sky with scope pointing east .Normally 9 flats should suffice.
      Congratulations to Shashank on the briiliant manual tracking and Akarsh on the excelent processing.
      Dr.Suresh

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
Follow

Get every new post delivered to your Inbox.