從Pythoner賴勇浩的blog看到一篇文章關于利用python來進行圖像處理的,很是覺得好玩,于是試驗了下。
          Python Imaging Library--PIL
          import Image
          img 
          = Image.open('test.bmp')
          print img.format, img.size, img.mode
          new_img 
          = img.convert('L')
          new_img.show();
          new_img = img.convert('L')是把圖像轉換為灰度。
          打開PIL的handbook研究一番

          截取圖像中的一塊box大小
              box = (100, 100, 400, 400)
              region = im.crop(box)

          圖片逆時針旋轉90度
          im.transpose(Image.ROTATE_90)
          圖片逆時針旋轉270度
          im.transpose(Image.ROTATE_270)
          圖片倒置(逆時針旋轉180度)
          im.transpose(Image.ROTATE_180)

          out = im.transpose(Image.FLIP_LEFT_RIGHT)     左右互置
          out = im.transpose(Image.FLIP_TOP_BOTTOM)  上下互置

          用ImageFilter模塊來進行圖像增強:
          Point Operations:
          # multiply each pixel by 1.2
          out = im.point(lambda i: i * 1.2)

          (未完待續)
          http://www.pythonware.com/library/pil/handbook/index.htm

          附:賴老師的文章:用python做圖像處理 http://blog.csdn.net/lanphaday/archive/2007/10/28/1852726.aspx

          posted @ 2008-11-06 15:38 Robert Su 閱讀(670) | 評論 (0)編輯 收藏

          今天新系統裝完IIS測試之后,又裝了一個office 2007(daob)、跟D-tool,然后IIS直接無法啟動。
          重新安裝也不行。
          到微軟官方網站找解決辦法,恢復MMC還是無濟于事

          最終解決辦法很簡單,先把os安裝盤裝入光驅,卸載IIS,然后重新安裝,ok了

          posted @ 2008-11-06 13:44 Robert Su 閱讀(159) | 評論 (0)編輯 收藏

          #include "stdafx.h"
          #include 
          <iostream>
          #include 
          <vector>   
          using   namespace std;   


          void   vect(vector<int>   &ve)   
          {   
                    ve.push_back(
          100);   
          }
             
              
          void   main()   
          {   
                    vector
          <int>   v;   
                    vect(v);
                    
          for (vector<int>::iterator it = v.begin();it != v.end();++it)
                    cout
          <<*it<<endl;}

                    cin.
          get();
          }

          posted @ 2008-10-10 11:10 Robert Su 閱讀(4708) | 評論 (0)編輯 收藏

           

          #include <iostream> 
          #include 
          <vector> 

          using namespace std; 
          int main()
          int ia[] = {1,2,3,4,5,6,7,8,9}
          vector
          <int> ivec(ia,ia+9); 
          vector
          <int> tvec(ia,ia+9); 
          for (vector<int>::iterator it = ivec.begin();it != ivec.end();++it)
          for (vector<int>::iterator iv = tvec.begin();iv != tvec.end();++iv)
          cout
          <<*it<<"*"<<*iv<<"="<<*it * *iv<<" "
          if(*iv == 9
          cout
          <<endl; 
          }
           
          }
           
          }
           

          posted @ 2008-10-08 15:34 Robert Su 閱讀(1505) | 評論 (0)編輯 收藏

          111
          import sys
          def readfile(filename):
                  
          '''Print a file the standard output.'''
                  f 
          = file(filename)
                  
          while True:
                          line 
          = f.readline()
                          
          if len(line) == 0:
                                  
          break
                          
          print line, #notice comma
                  f.close()

          if len(sys.argv) < 2:
                  
          print 'No action specified.'
                  sys.exit()

          if sys.argv[1].startswith('--'):
                  option 
          = sys.argv[1][2:]
                  
          if option == 'verison':
                          
          print 'Version 1.2'
                  
          elif option == 'help':
                          
          print '''\
          This program prints files to the standard output.
          Any number of files can be specified.
          Options include:
                  --version : Print the version number
                  --help    : Display this help
          '''
                          
          else:
                          
          print 'Unknown option.'
                          sys.exit()
          else:
                  
          for filename in sys.argv[1:]:
                          readfile(filename)
          運行提示:
          D:\python>python cat.py
            File "cat.py", line 27
              else:
                 ^
          SyntaxError: invalid syntax

          誰知道這個哪里出錯了啊

          posted @ 2008-08-15 17:41 Robert Su 閱讀(1304) | 評論 (2)編輯 收藏

           

          #include <stdio.h> 
          void ShowMe() 

            printf(
          "showme\n"); 

          int add(int value,int value1) 

            
          int * pAdd=&value; 
            
          int* value2=pAdd-1
            
          *value2=*value2-0x0e
            
          return (value+value1); 

          /* 
          */ 
          int add3v(int v,int v1,int v2) 

            
          return (v+v1+v2); 

          int main(int argc, char* argv[]) 
          {    ShowMe(); 
                
          int temp=add(10,12); 
                
          int te=add3v(3,4,5); 
                  printf(
          "%d,%d",temp,te); 

                  
          return 0
          }

          這個程序輸入在VC下是一直是showMe,死循環
          結果是:不停的調用showme()。
          showme
          showme
          showme
          showme
          showme
          showme
          showme
          。。。


          請教了同學,找出了答案
          這個是自動變量存儲棧,傳給函數的參數是以棧這種結構來開辟暫時存貯空間的。現在的C++編譯器處理函數參數后按照參數表的順序往臨時開辟的棧空間中壓入數據,以這段程序來說~先壓進value,再壓進value1,而函數內部語句的執行代碼也是以棧的形式存貯的
           ShowMe();這段程序的執行代碼是最先被壓入函數的執行棧中的,int temp=add(10,12); 地址要高于ShowMe();這個函數的地址
          ,int temp=add(10,12); 把地址又改回里低地址。
          局部函數的參數
          函數內代碼的執行,都是按照棧這種方法進行的

          這道題目不能說沒有意思,主要考察了基礎的匯編以及堆棧知識。
          int* value2=pAdd-1;
          *value2=*value2-0x0e;

          這里明顯修改了add函數返回地址,剛恰好showme()的入口地址,所以就
          add->showme->add->showme ...
          不停的調用下去。


          posted @ 2008-08-08 18:14 Robert Su 閱讀(1554) | 評論 (0)編輯 收藏

          去年的一道面試題,想起來了,順遍把代碼貼到這里
          兩個數組合并到一起,然后排序;用set確實比較方面了

          #include<iostream>
          #include
          <set>  
          #include
          <iterator>
          #include
          <algorithm>  
          using namespace std;

          int _tmain(int argc, _TCHAR* argv[])
          {

              
          int a[5]={2,5,1,2,3    };
              
          int b[10]={8,9,5,9,7,1,3,4,4,6};

              
          set<int>ist(a,a+sizeof(a)/sizeof(a[0])); 
              
          set<int>::iterator  itor; 
              
          set<int>it(b,b+sizeof(b)/sizeof(b[0]));
              
          set<int>::iterator p;
              
          for( itor = ist.begin();itor !=ist.end();++itor)   
              { 
                  cout
          <<*itor<<endl;
              }
              
          for(p=it.begin();p!=it.end();++p)
              { 
                  cout
          <<*p<<endl;

              }
              cout
          <<"合并后:"<<endl;  

              
          set<int>su;
              
          set<int>::iterator q;
              set_union(ist.begin(),ist.end(),it.begin(),it.end(),inserter(su,su.begin()));

              
          for(q=su.begin();q!=su.end();++q)
              {
                  cout
          <<*q<<endl;
              }
              
          return 0;
          }

          }

          posted @ 2008-08-08 15:26 Robert Su 閱讀(1355) | 評論 (0)編輯 收藏

          今天qu推薦了一個軟件給我——Cardio Calipers
          一款刻度尺軟件,可以測量屏幕上某個東西的長度,挺好玩的,很有想法:)

          下載地址:
          http://www.iconico.com/cardioCaliper/

          附截圖




          這個尺子通過鼠標可以旋轉,拉長縮短

          posted @ 2008-08-07 15:50 Robert Su 閱讀(2708) | 評論 (5)編輯 收藏

          操作的系統的多進程實現了___________
          多線程的根本是________________
          JVM線程調度方式是______________

          posted @ 2008-07-24 10:37 Robert Su 閱讀(1147) | 評論 (0)編輯 收藏

          今天晚上真的非常郁悶.本來心情高漲的要繼續寫程序.但是老鄉給我傳了一個抓包程序要我幫他測試下,一裝直接藍屏.
          一開機就藍屏,可以進安全模式,刪了該刪的還是繼續藍.
          這哥們居然下線睡覺去了.

          裝進去系統盤,提示找不到OS
          可是我把Ubuntu的盤放進去,居然就出現提示,問我要不要安裝.....

          奇怪...
          哪位這方面的行家給指點一下啊

          posted @ 2008-06-25 02:48 Robert Su 閱讀(452) | 評論 (0)編輯 收藏

          僅列出標題
          共11頁: First 上一頁 3 4 5 6 7 8 9 10 11 下一頁 

          posts - 103, comments - 104, trackbacks - 0, articles - 5

          Copyright © Robert Su

          主站蜘蛛池模板: 阳朔县| 西充县| 溆浦县| 景泰县| 庆安县| 铜鼓县| 临湘市| 钦州市| 讷河市| 南宫市| 启东市| 吉首市| 南通市| 乌鲁木齐县| 集贤县| 湾仔区| 中西区| 腾冲县| 封丘县| 河北省| 葵青区| 陆丰市| 平乡县| 西峡县| 乌兰县| 莆田市| 华阴市| 连云港市| 观塘区| 宝山区| 巫山县| 南通市| 芦溪县| 陆良县| 泽库县| 西盟| 南安市| 宁德市| 巢湖市| 翼城县| 阳原县|