六 參 SA6-031 劉 玲 1 27
行 類 立 易 狀 綠 狀 藍 狀 狀 數 狀 () R=0~255 綠 狀 () G=(0~255)*256 藍 狀 () B=(0~255)*256*256 狀 () A*256*256+A*256+A (R+G+B)/3*(256*256+256+1) 數 數 行 易 類 例 不 更 量 理 量 來 數 流 刺 識 復 兩 類 龍 數 了 切 陋 理 理 不 領 行 類 立 易 療 2 27
參 雷 數 見 料 理 料 來 見 了 綠 藍 來 綠 藍 不 更 雷 異 不 數 異 見 行 machine vision() 3D 量 量 151050 度 理 量 了 綠 藍 來 說 類 兩 狀 六 狀 來 說 兩 狀 連 狀 綠 藍 度 3 27
量 論 理 狀 狀 類 不 狀 狀 狀 狀 便 () () () 綠 () 藍 () () 2 類 識 400~656nm 識 discriminate threshhold 1~2nm 4 27
3 狀 綠 藍 4 5 力 料 5 27
若 來 來 不 不 了 量 來 度 來 綠 藍 綠 藍 數 便 綠 藍 利 列 令 六 例 參 錄 雷 力 料 兩 論 狀 狀 力 不 識 不 不 識 不 6 27
理 綠 藍 狀 力 劣 異 理 論 行 降 度 若 兩 欄 數 狀 力 例 識 行 綠 識 行 兩 兩 藍 來 行 兩 錄 7 8 狀 度 1~2nm 度 5~15 nm 度 8-1 8 料 類 狀 度 不 類 狀 不 說 12 療 行 行 8 8-1 7 27
1 Table1 見 力 不 藍 異 綠 Table2 Various Color Vision Deficies Based on Data in Hunt(1991) Type 2 Male(%) Female(%) Protanopia 1.0 0.02 Deuteranopia 1.1 0.01 Trianopia 0.002 0.001 Cone monochromatism ~ 0 ~ 0 Rod monochromatism 0.003 0.002 Protanomaly 1.0 0.02 Deuteranomaly 4.9 0.38 Trianomaly ~ 0 ~ 0 9 狀 綠 藍 度 狀 度 度 度 不 見 10 狀 異 若 不 8 27
識 11 12 雷 異 12 數 13 不 13 見 14 9 27
狀 狀 念 綠 藍 見 錄 了 什 龍 14 拉 綠 藍 例 了 滑 滑 欄 便 10 27
15 六 Color Matching Experiment 16: 見 錄 RGB RGB 行 RGB 力 讀 力 了 更 練 力 16 17 見 錄 易 立 雷 雷 不 利 理 令 讀 兩 若 不 易 若 不 來 類 雷 11 27
立 說 藍 綠 量 理 18 見 錄 雷 雷 不 度 不 不 識 不 類 理 量 17 說 藍 綠 類 12 27
18 理 量 19 見 錄 六 雷 率 數 理 便 理 數 行 數 量 臨 量 例 數 輪 廓 便 量 離 度 來 說 // 數 理 不 R=(Image1->Canvas->Pixels[X][Y]%256; G=(Image1->Canvas->Pixels[X][Y]%65536)/256; B=(Image1->Canvas->Pixels[X][Y]/65536); A=(R+G+B)/3; Image2->Canvas->Pixels[X][Y]=A*256*256+A*256+A; } A=(R+G+B)/3; 量 if ( A>gap ) { Image2->Canvas->Pixels[X][Y]=clRed; Memo1->Lines->Add("X"+IntToStr(X)+" Y"+IntToStr(Y)); break; } }} 19 13 27
陸 論 不 不 異 不 狀 狀 力 不 異 狀 狀 力 不 見 不 狀 力 不 識 不 不 識 不 狀 度 度 異 若 度 不 8-1 8 料 類 狀 度 不 不 狀 力 北 論 療 行 了 療 來 數 臨 行 更 了 不 易 利 練 力 烈 識 不 力 讀 率 識 令 論 數 更 若 不 列 列 來 14 27
量 理 量 不 更 更 兩 類 龍 數 流 刺 來 留 樂 料 來 什 1857 留 phonograph 2004 i Pod 來 什?i Vision? 來 21 數 類 20 復 若 異 數 流 刺 復 20 21 15 27
參 料 參 料 理 北 北 年 http://blog.lezplay.net/?p=1208 4.Despopoulos/Silbernagl(2003). Color Atlas of Physiology. Georg Thieme Verlag. 5. Chamelon Image, AquaPets, 45 6. Mostafa(2006). How I (color blind person) see the world?, http://spellcoder.com/blogs/mostafa/archive/2006/08/20/317.aspx 7. University of Utah The Organization of the Retina and Visual sys tem. Retrieved December 12, 2006, from http://webvision.med.utah.edu/ 8. 劉 9..Leeson & Leeson Histology Leeson & lesson A Brief Atlas of Histology 11.[Life]==? http://www.bio.ncue.edu.tw/general/ch45/eye.htm 識 16 27
錄 來 說 綠 藍 說 列 兩 說 例 例 度 度 度 17 27
度 18 27
19 27
20 27
21 27
錄 2 Chameleon 龍 C++ int X,Y,R,G,B,A; for (X=0;X<Image1->Width;X++) {for (Y=0;Y<Image1->Height;Y++) { R=Image1->Canvas->Pixels[X][Y]%256; G=(Image1->Canvas->Pixels[X][Y]%65536)/ 256; B=Image1->Canvas->Pixels[X][Y]/65536; A=(R+G+B)/3; //no Red Image1->Canvas->Pixels[X][Y]=Image1->Canvas->Pixels[X][Y]-R; //no Green //Image1->Canvas->Pixels[X][Y]=Image1->Canvas->Pixels[X][Y]-G*256; //noblue //Image1->Canvas->Pixels[X][Y]= Image1->Canvas->Pixels[X][Y]-B*256*256; //no GreenRed //Image1->Canvas->Pixels[X][Y]=Image1->Canvas->Pixels[X][Y]--G*256-R; //no BlueRed //Image1->Canvas->Pixels[X][Y]=Image1-> Canvas->Pixels[X][Y]-B*256*256-R; //nogreenblue //Image1->Canvas->Pixels[X][Y]=Image1->Canvas->Pixels[X][Y]-B* 256*256-G*256; //no R G B = Gray Scale //Image1->Canvas->Pixels[X][Y]=A*256*256+A*256+A; }} 錄 3 Color Matching ExperimentC++ #include <vcl.h> #pragma hdrstop #include "Unit1.h" #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {} void fastcall TForm1::Edit1Change(TObject *Sender) {Shape1->Brush->Color=StrToInt(Edit1->Text)+256*StrToInt(Edit2->Text)+256*256*StrToInt(Edit3->Text); Shape1->Pen->Color=StrToInt(Edit1->Text)+256*StrToInt(Edit2->Text)+256* 256*StrToInt(Edit3->Text);} void fastcall TForm1::Button1Click(TObject *Sender) {Edit1->Visible=true;Edit2->Visible=true; Edit3->Visible=true; } void fastcall TForm1::Button2Click(TObject *Sender) {Edit1->Visible=false;Edit2->Visible=false; Edit3->Visible=false;} void fastcall TForm1::Edit2Change(TObject *Sender) 22 27
{Shape1->Brush->Color=StrToInt(Edit1->Text)+256*StrToInt(Edit2->Text)+256*256*StrToInt(Edit3->Text); Shape1->Pen->Color=StrToInt(Edit1->Text)+256*StrToInt(Edit2->Text)+256*256*StrToInt(Edit3->Text);} void fastcall TForm1::Edit3Change(TObject *Sender) {Shape1->Brush->Color=StrToInt(Edit1->Text)+256*StrToInt(Edit2->Text)+256*256*StrToInt(Edit3->Text); Shape1->Pen->Color=StrToInt(Edit1->Text)+256*StrToInt(Edit2->Text)+256*256*StrToInt(Edit3->Text);} void fastcall TForm1::ScrollBar1Change(TObject *Sender) {Shape2->Brush->Color=StrToInt(ScrollBar1->Position)+256*StrToInt(ScrollBar2->Position)+256*256*StrToInt(Scro llbar3->position); Shape2->Pen->Color=StrToInt(ScrollBar1->Position)+256*StrToInt(ScrollBar2->Position)+256*256*StrToInt(ScrollB ar3->position); Edit4->Text=IntToStr(ScrollBar1->Position);} void fastcall TForm1::ScrollBar2Change(TObject *Sender) {Shape2->Brush->Color=StrToInt(ScrollBar1->Position)+256*StrToInt(ScrollBar2->Position)+256*256*StrToInt(Scro llbar3->position); Shape2->Pen->Color=StrToInt(ScrollBar1->Position)+256*StrToInt( ScrollBar2->Position)+256*256*StrToInt(ScrollB ar3->position); Edit5->Text=IntToStr(ScrollBar2->Position);} void fastcall TForm1::ScrollBar3Change(TObject *Sender) {Shape2->Brush->Color=StrToInt(ScrollBar1->Position)+256*StrToInt(ScrollBar2->Position)+256*256*StrToInt(Scro llbar3->position); Shape2->Pen->Color=StrToInt(ScrollBar1->Position)+256*StrToInt(ScrollBar2->Position)+256*256*StrToInt(ScrollB ar3->position); Edit6->Text=IntToStr(ScrollBar3->Position); } 錄 4 C++ } }}} 錄 5 量 C++ #include <vcl.h> #pragma hdrstop #include "Unit1.h" #pragma package(smart_init) #pragma resource "*.dfm" 23 27
TForm1 *Form1; fastcall TForm1::TForm1(TComponent* Owner) {} : TForm(Owner) void fastcall TForm1::BitBtn2Click(TObject *Sender) { Memo1->C lear(); Image1->Picture-> Assign(NULL); Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName); int X,Y,R,G,B,ax,ay=0,M=0; Edit4->Text=IntToStr(0); for (X=0;X<Image1->Width;X++) {for (Y=0;Y<Image1->Height;Y++) { R=Image1->Canvas->Pixels[X][Y]%256; G=(Image1->Canvas->Pixels[X][Y]%65536)/256; B=Image1->Canvas->Pixels[X][Y]/65536; if (R>StrToInt(Edit3->Text)) { Image1->Canvas->Pixels[X][Y-2]=clRed; } } Memo1->Lines->Add(FloatToStr(X)+" " +FloatToStr(Y)); ax=x; ay=y; break; if(m<y ) { M=Y; break; } Edit4->Text=IntToStr(M); if(strtoint(edit4->text)==154) {Label1->Caption="This is NT$50"; } if(strtoint(edit4->text)= =152) {Label1->Caption="This is NT$1";} if(strtoint(edit4->text)==151) {Label1->Caption="This is NT$5"; } if(strtoint(edit4->text)==153) {Label1->Caption="This is NT$10"; }}} void fastcall TForm1::BitBtn1Click(TObject *Sender) { OpenPictureDialog1->Execute(); Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName); 24 27
Edit4->Text=IntToStr(0); Label1->Caption=" ";} void fastcall TForm1::Image1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y) {Image1->Canvas->TextOutA(10,10,"R"+IntToStr(Image1->Canvas->Pixels[X][Y]%256)+"G"+IntToStr(Image1->Ca nvas->pixels[x][y]%65536/256)+"b"+inttostr(image1->canvas->pixels[x][y]/65536)+" ");} 錄 6 理 量 C++ # include <vcl.h> #pragma hdrstop #include "Unit1.h" #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {} int sx,sy; int R,G,B,A; void fastcall TForm1::BitBtn1Click(TObject *Sender) {BitBtn4->Enabled=False; OpenPictureDialog1->Execute(); Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName); //Image1->Canvas->TextOutA(10,10,Edit1->Text+Edit2->Text+Edit3->Text+Edit4->Text+Edit5->Text); Edit4->Text=IntToStr(Image1->Picture->Width); Edit5->Text=IntToStr(Image1->Picture->Height); Image1->Height=Image1->Picture->Height; Image1->Width=Image1->Picture->Width; Image2->Canvas->TextOutA(10,10," Celph for MaxilFacial Bones");} void fastcall TForm1::BitBtn2Click(TObject *Sender) {int A,X,Y,R,G,B,R1,B1,G1,A1; Memo1-> Clear(); Image1->Picture->Assign(NULL); Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName); int gap=strtoint(edit1->text); // Right to left scan for (int Y=0;Y<504;Y++) { for (int X=355;X>0;X--) 25 27
{ R=Image2->Canvas->Pixels[X][Y]%256; G=(Image2->Canvas->Pixels[X][Y]%65536)/256; B=(Image2->Canvas->Pixels[X][Y]/65536); A=(R+G+B)/3; if ( A>gap ) { Image2->Canvas->Pixels[X][Y]=clRed; Memo1->Lines->Add("X"+IntToStr(X)+" Y"+IntToStr(Y)); break; } }} Label4->Caption=" Total Points"+IntToStr(Memo1->Lines->Count);} void fastcall TForm1::BitBtn3Click(TObject *Sender) {int X,Y,R,G,B,A; for ( X=0;X<Image1->Width;X++) {for (Y=0;Y<Image1->Height;Y++) { R=Image1->Canvas->Pixels[X][Y]%256; G=(Image1->Canvas->Pixels[X][Y]%65536)/256; B=(Image1->Canvas->Pixels[X][Y]/65536); A=(R+G+B)/3; Image2->Canvas->Pixels[X][Y]=A*256*256+A*256+A; } Image2->Height=Image1->Height; Image2->Width=Image1->Width;}} void fastcall TForm1::Image2MouseMove(TObject *Sender, TShiftState Shift, int X, int Y) {Image2->Canvas->TextOutA(10,10,"X"+IntToStr(X)+" Y"+IntToStr(Y)+" R"+IntToStr(Image2->Canvas->Pixels[X][Y]%256)+" G"+IntToStr((Image2->Canvas->Pixels[X][Y]%65536)/256)+" B"+IntToStr(Image2->Canvas->Pixels[X][Y]/65536)+" RGB");} void fastcall TForm1::BitBtn4Click(TObject *Sender) {Image1->Picture->Assign(NULL); Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName); Image2->Canvas->Pen->Color=clYellow; int gap=strtoint(edit1->text); // Right to left scan for (int Y=0;Y<504;Y+=20) { for (int X=355;X>0;X--) { R=Image2->Canvas->Pixels[X][Y]%256; G=(Image2->Canvas->Pixels[X][Y]%65536)/256; B=(Image2->Canvas->Pixels[X][Y]/65536); A=(R+G+B)/3; if ( A>gap ) { Image2->Canvas->Pixels[X][Y]=clRed; Memo1->Lines->Add(IntToStr(X)); 26 27
Memo1->Lines->Add(IntToStr(Y)); Image2->Canvas->MoveTo(StrToInt(Label2->Caption),StrToInt(Label3->Caption)); }}} void fastcall TForm1::Image2MouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) {Image2->Canvas->Pen->Color=clRed; Image2->Canvas->LineTo(X,Y-3); Label2->Caption=IntToStr(X); Image2->Canvas->LineTo(X-2,Y); break; } Image2->Canvas->MoveTo(X+3,Y); Image2->Canvas->LineTo(X-3,Y); Image2->Canvas->MoveTo(X,Y+3); Label3->Caption=IntToStr(Y); sx=x; sy=y; Image2->Canvas->TextOutA(10,Y-20,"Sella center of hypophyseal fossa"); BitBtn4->Enabled=True;} 錄 B 27 27