Computer Vision II
Computer Vision (II) 2002Spring
Professor Chiou-Shann Fuh
|(Chap 19)||(Chap 20)||(Chap no)||(Chap no)|
528 U1200 一.內容: 講授電腦視覺之基本觀念及立論基礎。介紹各種電腦視覺可 能之應用,並配合各項相關專題課程的需求研發適當之演算法及 計算架構並完成軟體模擬。 將涵蓋: 照明 (Illumination), 透視投射幾何學 (Perspective Projective Geometry), 分析式照相測量術 (Analytic Photogrammetry), 序列照片中找出運動與表面結構 (Motion and Surface Structure from Time Varying Image Sequences), 影像比對 (Image Matching), 物件模型與比對 (Object Models and Matching), 知識為基礎的視覺 (Knowledge-Based Vision), 準確度 (Accuracy)。 二.教科書: R. M. Haralick and L. G. Shapiro, Computer and Robot Vision, Vol. II, Addison-Wesley, Reading, MA, 1993. 主要參考書: R. C. Gonzalez and R. E. Woods, Digital Image Processing, Addison-Wesley, Reading, MA, 1992. 三.成績評量方式: 平時作業, term project, 期中考, 期末考 四.預修課程: 電腦視覺 (一) 或數位影像處理 備註: 選修, 大三以上可修, 每週演講: 3 小時Course Number: 526 U1200
TA has some suggestions, since TA had tested and verified
something on somemachine, and believe they are ok.
if you have any problem and want to email to ask TA,
you should DESCRIBE THE PROBLEM MORE CLEARLY, then TA can
reproduce the error and understand what the problem you met.
(ex. which machine, what is your id and name, what command you
are executing, and the full error messages, etc)
then TA can provide his help as soon as possible if TA know what
exectly problem happened.
anyway, TA will go to classroom in course every tuesday afternoon.
so you can ask TA further questions if you can't solve them.
WARNING! Please exit the process normally after you wrote your homework!
Q:(1/24/2002) Dear TA, I have a question about get the value of a specific pixel. If a image has pixels of OneByte, I can use B_PIX to get its value. If a image has pixels of REALPIX, I can use hvGetPixel to get its value. How can I get its value if the image has pixels of INTPIX(4Bytes)? If there is no procedure can be used, can I use four times of B_PIX to get a INT PIX? If I can do so, the first pixel of INTPIX (0,0) can be got by computing B_PIX(0,0)*2^24 + B_PIX(0,1)*2^16 + B_PIX(0,1)*2^8 + B_PIX(0,3) or B_PIX(0,0)*2^24 + B_PIX(1,0)*2^16 + B_PIX(1,0)*2^8 + B_PIX(3,0) or another way? Thanks. P A: Dear P, by `man hvision`, you can see B_PIX(I,i,j) pixel i,j of byte image I US_PIX(I,i,j) pixel i,j of unsigned two byte image I SS_PIX(I,i,j) pixel i,j of signed two byte image I INT_PIX(I,i,j) pixel i,j of integer image I R_PIX(I,i,j) pixel i,j of real image I sincerely, VisionTA Q:(1/1/2002) Dear TA: I has a problem about HW10. What does it mean that "choose proper thresholds" on the four types of images. (Laplacian,minimum-variance Laplacian,Laplacian of Gaussian, and Difference of Gaussian) Thanks!! A: Dear oo, i am not sure what does professor fuh means when he assigned hw10. and after i saw my homework write 3 years ago, i think maybe it means, "There are 4 methods in p.349 (all are zero-crossing)." "Please implement 4 methods of zero-corssing to detect edge of image." "And different method maybe needs different threshold, " "just choose different." maybe typo of that page, i had modified it. and about DOG, if you want to understand what is it, you can see the reference listed on course lecture page. if you still don't know what is it, don't worry, hvision library had implement it. it is allowed to use DOG by tk directly or hvDog hvision function call. sorry for my late reply! i am busy those days ^^;; sincerely, VisionTA Q:(12/2/2001) 請問助教Gaussian noise 加到圖裡的意思是說,每一個pixel都有雜訊, 而雜訊是分佈在-255到255之間嗎??? 我忘了老師那時後到底是怎麼說的,而且salt and pepper又是怎樣呢,如果 每一個pixel都有noise的話, 那整張圖一定變成黑白的了,.. 我實在是不太懂題意, 所以有點不知如何下手,希望助教可以將兩個題目都解釋請楚~謝謝! A:(1/2/2002) (sorry for so late reply ^^;;) Dear Y, "gaussian noise" means, there will be some noise on image, and the noise amplitude of noise is like gaussian distribution. (the noise "value" added to each pixel is like gaussian random variable) the problem becomes, "what is the value added to each pixel?" or "what is gaussian random number generater?" if you want to see the definition of gaussian random variable, you can see http://mathworld.wolfram.com/ (mathworld is the most famous math forum and diction on web!!) if you still have problem, just go to R505 in CSIE building. i will teach it if you need. you should choose the mean (zero), st.dev. (標準差), and the amplitude applied on the noise. you can write a program to do this. the key point of sub-problem 2 (salt and pepper) is you should choose the signal-to-noise ratio, not all pixel have noise value, if noise ratio is 1/10, one of ten pixel will have such salt-or-pepper noise, and other nine are remaining the same. sincerely, jsyeh@cmlab, VisionTa ps. below is the program header comment of my hw8 implementation 3 years ago. hope that will help you. i had implemented my own gaussian random variable in c. you can find a better code of it in Knuth's famous book, "the art of computer science" volume II. (but it is not easy to understnat the code ^^;;) or you can find some code on internet. (it is better to implement it ^^;;) /************************************************************************\ hw8_1.c This Program generate I(nim,i,j) = I(im,i,j)+amplitude * N(0,1) N(0,1): Gaussian random variable with zero mean and st.dev. 1 amplitude: determines signal-to-noise ratio, try 10,30 \************************************************************************/ Q:(1/4/2002) 助教抱歉,我想我用中文說明可能比較清楚,上一封我寫得不太清楚, 我不懂的是我不知道"choose proper thresholds"是什麼意思, 如何用fig.7.33 fig.7.36 fig.7.37等對影像做運算且還要選擇 適當的門檻值,還是說(我猜)課本上這三個masks並不optimal, 選擇適當的 門檻值是要我們自己製造新的masks, 再去做weighting sum的運算就好了,謝謝!! A: Dear r, about "choose proper threshold", your question looks like, "choose what threshold? change the mask? or what?" homework#9 and homework#10 are almost the same. in homework#9, you need to "choose proper threshold" to decide how many pixels are edge. let me take an example: in hw9_1, you should "apply" roberts operator to an testing gray-level image. so what? lena.im --(apply_roberts_opertor)---> lena.robert but, major issue is, how many pixels are like "edge"! that's why we "choose proper threshold" to let lena.robert to an 0-or-1 image. lena.robert --(choose_proper_threshold)--> lena_robert.bin then we can said, 1 is like edge, 0 is not like edge. *************************************************************** let's take a look of hw10_1: we APPLY "laplacian zero-crossing mask" to an testing gray-level image. so what? lena.im --(apply_laplacian_mask)---> lena.lap but, major issue is, we want to find out "edge"! so we need to "choose proper threshold" again to convert lena.lap to a 0-or-1 image . lena.lap --(choose_proper_threshold)--> lena_lap.bin then in that binary image we can said, 1 is like edge, 0 is not like edge. so we need to "choose proper threshold" again to convert lena.lap to a 0-or-1 image . lena.lap --(choose_proper_threshold)--> lena_lap.bin then in that binary image we can said, 1 is like edge, 0 is not like edge. *************************************************************** so you didn't need to "choose proper mask", those masks all work fine! sincerely, jsyeh@cmlab, VisionTA Q:(11/5/2001) in Homework#3, how to do Hit-and-Miss operation with only one octagon structuring element? A: you can prepare more structuring elements for this homework. don't be constrained in only one structuring element(liek octagon). it is encouraged to let your program accept different kernels (structuring elements) for user to choose. Q:(11/3/2001) what kind of structuring element should we use in homework#4? A: in TA's own opinion, you can prepare some structuring elements and then there will be a lot of fun. but somebody said that Professor fuh had assigned octagon *** ***** ***** ***** *** as the one for the first 4 binary morphological operations. anyway, TA will not care, just go ahead. TA will appreciate who do more experiments for different kernels. Q:(10/13/2001) i had emailed homework to TA, but TA didn't reply to me for a long time. is there anything wrong? A: Dear p, i really have received your homework#1, but i didn't reply email to you because i had not checked the correctness of your program. because there are a lot of homework deliver to here. so, don't worry about it. i promise that i will verify all homework in 1 week. if you have any problem, you can find me at TA time (every tuesday afternoon) sincerely, jsyeh@cmlab, VisionTA Q:(10/11/2001) what does segmentation fault mean? A: the message means, "you mis-use pointer (*ptr) or array (ary)" maybe you should check your pointers and arrays. Q:(10/11/2001) is there any debugger in unix environment? A: yes, there is a very very powerful debugger in unix environment. gdb you can read the gdb_howto written by TA 2 years ago. gdb_howto if you still have problem using gdb, you are welcome to ask TA. it is TA's honor to introduce gdb to you. Q:(10/13/2001) dear TA: 關於作業二我有點問題要請問你， 1.lena的bmp檔要去哪裡找?我手邊有的lena的圖檔是432X432 不過標準的好像是512X512，是否有標準的可以下載呢? 還有作業的話我能否不考慮general case， 因為我想把二維陣列的維度設成lena的長和寬(態陣列太複雜了)， 這樣比較方便，可以嗎? 2.binarize的threshold值能否隨便設? 因為我想讓黑色部分多一點，這樣會比較簡單. 3.bounding box是指包圍相同label的最小四邊形嗎? 那是不是有可能會有重疊的情況呢? H 10.12 A: Dear h, about your question, 1) i am sorry that i could not provide lena 512x512 bmp file. there is a 512x512 hvision format lena image at /usr/local/vision/images/lena.im if you login our unix machines. and it is ok if you only accept 512x512 image size. 2) i am sorry that binarize threshold should be 128, because it is harder and if your program have error, it will show the error. 3) it is possible to overlay each bounding box. but that is ok. just draw it. and if the region is too small to draw a rectangle, you can set a threshold of size (width and/or height) to ommit some small region. sincerely, jsyeh@cmlab, VisionTA Q:(10/7/2001) in homework#2, the lena image has a lot of small connected-components. and it is very hard to show bounding box in such image. should we really use lena as the image? A: yes. professor fuh assigned homework#2 with lena image. you can use a threshold to omit small connected-components. Q:(9/28/2001) 助教可以不要用英文寫網頁嗎? 又很多, 看得很痛苦~ 回 email 可不可以用中文? A: i am sorry that i am trying to use english to establish this page. sometimes the chinese big5 will have trouble in some email. and i am trying to put as much information as i can. anyway, i will translate this english page to chinese big5 latter. Q:(9/28/2001) How is the workstations(solaris and linux) in R217 now? i cannot use any command after i login linux machines! A: (From 9/12/2001 R217TA email) please type the following command in your home directory /bin/cp ~sk/.cshrc* . to reset your configuration for linux environment, then exit and login again (1) This may occur to users whose accounts are created before 1999. please see the command above to reset your configuration files. (2) Too keep your original configuration files, please rename .cahrc* or move them somewhere else in advance. machines available now: Linux linux1.csie.ntu.edu.tw linux2.csie.ntu.edu.tw linux3.csie.ntu.edu.tw linux4.csie.ntu.edu.tw linux5.csie.ntu.edu.tw linux6.csie.ntu.edu.tw linux7.csie.ntu.edu.tw linux8.csie.ntu.edu.tw FreeBSD bsd1.csie.ntu.edu.tw bsd2.csie.ntu.edu.tw Q:(9/27/2001) Dear TA, After typing the command "cc -o pseudo pseudo.c -lhvision -lm ",I received error message: pseudo.c:7: hvision.h: No such file or directory my .profile is : PATH=$PATH:/usr/bin /bin /usr/X11R6/bin /opt/kde/bin /usr/local/vision/linux /$ MANPATH=$MANPATH:/usr/local/vision/man LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/vision/linux export MANPATH LD_LIBRARY_PATH run on :linux2 A: Dear Lee, about the error message, "hvision.h: No such file or directory" there is no such file which is included in your pseudo.h (because linux2 didn't have hvision.h in /usr/local/include) (but linux5 has such file. it is not your fault,) you can (A) change to use linux5 or you can add some compile parameter: (B) "gcc -o pseudo -I/usr/local/vision/include pseudo.c -lhvision -lm" then you can compile your program everywhere~ or (C) copy the /usr/local/vision/include/hvision.h to be together with your pseudo.c directory and about your setting of PATH, maybe your setup is not correct! please give me your account name (id used in R217 workstations) then i can go to your directory to verify your setup .profile there. sincerely, TA Q:(10/2/2001) Dear TA, AFter typing the command, "cc -o pseudo pseudo.c -lhvision -lm ", at home, i received error message: /usr/bin/ld: cannot find -lhvision collect2: ld returned 1 exit status how do i solve this program? A: Dear c, the error message "/usr/bin/ld: cannot find -lhvision" means, the linker (/usr/bin/ld) cannot find the library file (libhvision.a) you can add -L/usr/local/vision/linux to specify the library directory so, my suggestion is: 1) cc -o pseudo pseudo.c -L/usr/local/vision/linux -lhvision -lm or 2) use linux5 as the machine you compile your program (because on linux5, libhvision.a is in /usr/local/lib/, the default search directory ) hope those information are enough for you. sincerely, jsyeh@cmlab, VisionTA Q:(10/5/2001) i cannot find hvision.h in the course website, where is it? A: Dear t, it is useless for you to find hvision.h. hvision.h is for the people who need to use hvision library. but since you will not use hvision library in our workstations, it is really useless for you. so i have 2 suggestions: 1) if you want to use hvision.h with Harvard hvision library, you should use our workstation. of course you can find hvision.h in our R217 workstation lab /usr/local/vision/include/hvision.h 2) if you didn't not want to use the linux or unix machine provided by us, you should write your own utility to read the images (like lena.im) if so, the course website provide the image file format for you. you can find it in http://www.cmlab.csie.ntu.edu.tw/~jsyeh/visionta#format or you use other image files and image format (like jpg, bmp, gif, etc) and write your own utility to read them. (of course, it is ok to use any image library to read image) (but when you deliver your homework, you should specify and provide it) (for my grading and testing) sincerely, jsyeh@cmlab, VisionTA Q:(10/6/2001) 很抱歉又打擾你了,還是有點不明白為何hvision.h檔對我來說沒用, 因為很久沒用C寫程式了,一直都是用Matlab,所以現在還正在熟悉中。 以下是我原先的想法,不知對不對,我看了一下 pseudo.c裡有include hvision.h檔,所以不是找到hvision.h檔後放到include的資料匣中 就可以run這個程式了嗎( 我用Borland C++), 或許助教信中有提到, 只是我太久沒用C了,看不太懂,可否請助教再講清楚點讓我明白, 謝謝。 ps:hvision library是什麼???? A: Dear t, it is really useless because you are using borland c++. it is almost impossible if you have hvision.h to compile the pseudo.c!! it is the FACT!! about the reason why, let me introduce it. 1) what is hvision library? A: hvision library is a library constructed by Harvard University. and it is used in unix and X-window environment. as i know, nobody had ported it to ms-dos or ms-windows environment. 2) why i can't compile the program with hvision.h and pseodu.c? A: the question is like: "why i can't run ms-dos assembly language in sun-sparc workstation?" they are different hardware architecture and operation system. if nobody ports it to different environment, it is almost impossible. so i will tell you, if you want to write your homework, please see my personal suggestions in the last email. since you are familiar with matlab, maybe you can use my suggestion#2, "use your familiar programming enviroment (matlab) to write your program" "and you will use diffferent function calls " or 認命一點, suggestion#1, learn how to write program in unix environment, and find a classmate to learn it together. if you don't have classmate or no classmate want to help you, you can find me next theusday afternoon. i will demo how to write it again. (why next theusday? because i had demoed how to write it for two weeks in classroom TA time. and i also put all materials on our course web-site. it will not be my fault.) sincerely, jsyeh@cmlab, VisionTA Q:(10/5/2001) 助教您好: 一直無法熟悉linux的環境所以想自己用C寫,再寄給助教,記得老師第 一次上課時有show出程式的source code還有lena的照片,是否能麻煩 助教寄給我,還有是否有這二樣東西就能自己寫作業了,謝謝! A: Dear t, professor fuh had put the source code and lena image in his homepage (and of course, some LaTex lecture notes) http://www.csie.ntu.edu.tw/~fuh/vcourse it is your responsibility to take those things yourself. and the course website is at: http://www.cmlab.csie.ntu.edu.tw/~jsyeh/visionta hope those information is helpful for you. sincerely, jsyeh@cmlab, VisionTA Q:(9/27/2001) How to deliver homework#1? A: by email, send the source code to TA. it is better to write down some README for your homework. a format here is suggested, but not restricted: "Title: B7506006 Vision Homework #1" "ID: B7506006, Name: Yeh,Jeng-sheng" Below is my homework#1, you can compile it with "gcc -lhvision h1.c" and the commands i used in tk is : tk> read image: ooxx.im ..... ........ ---------h1.c--------------- #include "hvision.h" ...... it is better for you to write down some experiment and problems what you had met and how you solved them. it can prove you really write the homework yourself, not copycat. Q:(9/27/2001) Why VNC is so slow when i am using it at home? A: Yes, you got the point! VNC is slow when the bandwidth is not enough. if you are at home with slow network connection to school, then i suggest you can write homework at school. if you are strongly want to write at home and want faster condition, i had tried two methods, and the result is not bad, 1) use real X server(8-bit colormap) at home, not to use VNC solution. ex. homelinux:~> startx --bpp 8 (which will be homelinux:0.0) homelinux:~> xhost +linux8 (which allow display on your monitor) linux8:~> setenv DISPLAY homelinux:0.0 linux8:~> tk (or hview, xview, etc) 2) build another programming environment at home, run everything locally. ex. Installed hvision library at home. or, you are the one who likes to do everything yourself. 3) rebuild the wheel, ex. your own programming environment. every function are builded by yourself, including read the image, etc. (then you need the format of files in /usr/local/vision/images) (you can man hvision on the workstations in school) (or see the file format here) Q:(9/26/2001) Why i can't login linux8.csie.ntu.edu.tw? It shows the error message: YPBINDPROC_DOMAIN: Domain not bound what should i do? A: Don't worry. it shows "Our R217 Workstation Lab have some problems". Please wait some moment. maybe TA in R217 will solve that problem. those days the workstation lab is not stable. if this problem still exists, VisionTA will construct another environment for you. to be continue... Q:(9/26/2001) somebody email to me that my process (gterm) use too much cpu time, what should i do? USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND bxxxxxxx 3810 99.7 0.1 2620 1424 ? R Sep25 1475:35 gterm version2 linux8:3.0 /home/student/8x/bxxxxxxx/.gterm.lockfile A: it seens that you didn't exit your gterm (of hvision) and vnc successfully. now you can use vnc -kill :number to kill vnc and kill -9 pid_number(3810 here, for example) Anyway, the correctly way is not use "kill -9" to kill process, you should click the [Exit Gterm] in the window if you want to exit. and also "vnc -kill :Xnumber" to close vncserver. Q:(9/26/2001) Dear VisionTA, i got a problem. i failed in set the MANPATH, PATH ... global parameters. can you teach me how to do it? thank you. sincerely, b67050xx A: Dear b67050xx, About your environment variable, you can add the setting in your ~b67050xx/.cshrc or your .login file set path=( ooxxooxx /usr/local/vision/linux ) or setenv MANPATH /usr/local/vision/man or if you are using other shell, PATH=OOXX; export PATH; and, please remember! don't discard the old path setting, (ex. setenv PATH /usr/local/vision/linux that will discard all your old PATH setting ^^;; ) But!!!! [Important!] you seens not CSIE student, so maybe you didn't have R217 account. if so, then you will not use our hvision successfully. (Harvard hvision is not available everywhere!) sincerely, jsyeh@cmlab VisionTA Q:(9/20/2001) How to use tk in hvision library? A: In our workstation lab (R217), all the workstations, including linux and solaris operation systems, had already installed the hvision library and have `tk` to be use. You can read our Course Lecture Notes Chapter 1. In the end of that chapter, there are some simple tutorials of tk. Here TA lists some useful "Quick Guides": (please login our workstation) linux5:~> tk tk> list command (and you can see some useful commands) tk> read image: src.im dest.im (src.im is in disk, and dest.im in memory) (if you are not sure how many parameter should be given, just type the command name, then you can interactively input all parameters) tk> view image: dest.im tk> help some_command_here (see the help pages of commands) tk> quit ("quit" to leave tk and back to your unix shell) linux5:~> Q:(9/26/2001) Dear TA, After i added the Path described in Professor fuh's lecture notes, i still not run the `tk` and there are error messages like below: "exec format error. binary file not executable" what should i do? sincerely, A A: Dear A, about exec format error, binary file not executable, yes, it is binary format not compatable~ for example, you can't run SPARC binary in Intelx86 architecture, vice versa. so you should make sure the "path" point to the correct place. sincerely, TA Q:(9/28/2001) When i use `xview lena.im`, it shows, unknow format! what happened? A: ^^;; very interesting! the xview introduced in our lecture notes are a single utility together with Harvard hvision library. But, there is also a program xview in some linux. the latter one is a generic program for viewing images, but it didn't understand the lena.im image format. so you can (1) change the name of our hvision xview to another name. or (2) use the full path name to indicate which one you want to use. Q:(9/20/2001) When I type `tk` in unix shell, there are error messages like below, linux5:~> tk Xlib: connection to "jan.csie.ntu.edu.tw:0.0" refused by server Xlib: Client is not authorized to connect to Server ERROR:
Last updated: 10th Mar. 2002
Created: 15th Aug. 2001 by Jeng-sheng Yeh
FastCounter by bCentral