weixin's profile听潮轩PhotosBlogListsMore Tools Help

Blog


    12/6/2006

    初试OpenCV

    以后的工作就得和OpenCV打交道了,试用了一下,确实非常方便。今晚试了一下试用CvvImage类来载入图片,比以前一直在用的那个自己用CDIB和IPicture拼凑出来的新CDIB容易多了。前几天还重新看了一下那个两年前写的CDIB,确实比较垃圾,居然用了那么长时间。


      在VC的View中利用OpenCV显示图片:
            // code start
            CRect rect;
            CvvImage image;
            image.Load("test.jpg");
            GetClientRect(&rect);
            image.Show(GetDC()->GetSafeHdc(),   
                            rect.TopLeft().x,
                            rect.TopLeft().y, 
                            rect.Width(), 
                            rect.Height());
            // code end



      在VC的Dialog中利用OpenCV显示图片:
            // 在对话框中放着一个Picture框(IDC_PIC)
            // code start
            CvvImage image;
            image.Load(path);
           
            CRect rect;
            rect.top = 0;
            rect.left = 0;
            rect.bottom = image.Height();
            rect.right = image.Width();

            CWnd *pWnd = GetDlgItem(IDC_PIC);
            HDC m_HDC = pWnd->GetDC()->GetSafeHdc();
            pWnd->Invalidate();
            pWnd->UpdateWindow();

            image.DrawToHDC(m_HDC, &rect);
            // code end

    11/27/2005

    终于完成boss的任务了!

      今天从起床就开始调程序,昨天已经把boss布置的程序全写出来了,可是运行结果却很有问题,对照着文档检查了一个晚上之后也没什么结果。今天继续奋斗,设了n个断点,一步一步看,好不容易在下午四点左右发现了一个非常弱智的错误(T_T天啊,怎么开这种玩笑,就快被玩死了),居然是在定义函数参数表的时候随手写了个i当参数,然后写函数体的时候忘了这事,把i又给for了一遍......无语了,这种错误,太随意了,以后变量名字不能这样搞了,不然迟早得被搞死-_-

       在调得晕头转向的中间还去SX帮师妹看了一下他们参加数学建模的程序,运行出错,out memory!一看没什么错误,想想可能他们用TC2.0的问题,于是装一个VC,果然搞定。

    10/18/2005

    在solaris下挂载FAT32分区

      刚安装了一个solaris系统打算学习学习UNIX,很幸运,solaris 10可以识别出我使用的GeForce2 MX/MX 400的显卡。因为以前曾经用过一点Linux,知道可以挂载Windows下的分区,所以首先就是把FAT32分区挂上,因为好多UNIX资料都在那边。
      #mkdir /win_c
      #mkdir /win_d
      #mount -F pcfs /dev/dsk/c0d0p0:c /win_c
      #mount -F pcfs /dev/dsk/c0d0p0:d /win_d
      执行完之后发现已经挂载成功了,可重启机器后却发现之前的工作白做了,又得重新挂载。查了一下资料,原来要自动挂载必须修改/etc/vfstab这个文件。在/etc/vfstab中加入一下两行:
      /dev/dsk/c0d0p0:c /dev/rdsk/c0d0p0:c /win_c pcfs 2 yes -
      /dev/dsk/c0d0p0:d /dev/rdsk/c0d0p0:d /win_d pcfs 3 yes -
      保存后reboo,发现成功自动挂载上分区了。可惜现在还存在一个问题,挂载后的分区中,所有的中文名字的文件与目录都看不到,在网上查了一下也没找到解决方法。

    Computer history of the world

    *This is a intresting story which Shu send to me. After I read it, I decided to study Unix.*

     

    In the beginning, God created the Bit and the Byte. And from those he created the Word. And there were two Bytes in the Word; and nothing else existed. And God separated the One from the Zero; and he saw it was good. And God said Let the Data be; And so it happened. And God said - Let the Data go to their proper places. And he created floppy disks and hard disks and compact disks. And God said Let the computers be, so there would be a place to put floppy disks and hard disks and compact disks. Thus God created computers and called them hardware. And there was no Software yet. But God created programs; small and big... And told them - Go and multiply yourselves and fill all the Memory. And God said I will create the Programmer; And the Programmer will make new programs and govern over the computers and programs and Data. And God created the Programmer; and put him at Data Center; And God showed the Programmer the Catalog Tree and said You can use all the volumes and subvolumes but do not use Windows. And God said It is not good for the programmer to be alone. He took a bone from the Programmer's body and created a creature that would look up at the Programmer; and admire the Programmer; and love the things the Programmer does; And God called the creature: the User. And the Programmer and the User were left under the naked DOS and it was Good. But Bill was smarter than all the other creatures of God. And Bill said to the User - Did God really tell you not to run any programs? And the User answered God told us that we can use every program and every piece of Data but told us not to run Windows or we will die. And Bill said to the User - How can you talk about something you did not even try. The moment you run Windows you will become equal to God. You will be able to create anything you like by a simple click of your mouse. And the User saw that the fruits of the Windows were nicer and easier to use. And the User saw that any knowledge was useless since Windows could replace it. So the User installed the Windows on his computer; and said to the Programmer that it was good. And the Programmer immediately started to look for new drivers. And God asked him--What are you looking for? And the Programmer answered I am looking for new drivers because I can not find them in the DOS. And God said - Who told you need drivers? Did you run Windows? And the Programmer said - It was Bill who told us to! And God said to Bill Because of what you did, you will be hated by all the creatures. And the User will always be unhappy with you. And you will always sell Windows. And God said to the User Because of what you did, the Windows will disappoint you and eat up all your Resources; and you will have to use lousy programs; and you will always rely on the Programmers help. And God said to the Programmer - Because you listened to the User, you will never be happy. All your programs will have errors and you will have to fix them and fix them to the end of time. And God threw them out of the Data Center and locked the door and secured it with a password.