Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Thurdsak LEAUHATONG Dept. of electronics, Faculty of Engineering, KMITL

Similar presentations


Presentation on theme: "Dr. Thurdsak LEAUHATONG Dept. of electronics, Faculty of Engineering, KMITL"— Presentation transcript:

1 Dr. Thurdsak LEAUHATONG Dept. of electronics, Faculty of Engineering, KMITL klthurds@gmail.com thurdsak@hotmail.com klthurds@kmitl.ac.th

2 Schedule DateTimeSubject Nov. 1015:10 – 16:40Introduction and Digital Image Fundamental #1 Nov. 1715:10 – 16:40Digital Image Fundamental #2 Nov. 2415:10 – 16:40Image Transform Dec. 115:10 – 16:40Image Enhancement #1 Dec. 815:10 – 16:40Image Enhancement #2 & Assignment #1

3 Schedule (Continue) DateTimeSubject Dec. 1515:10 – 16:40Image Compression #1 Jan. 1215:10 – 16:40Image Compression #2 Jan. 1915:10 – 16:40Image Compression #3 & Assignment #2 Jan. 2615:10 – 16:40Image Segmentation #1 Feb. 215:10 – 16:40Image Segmentation #2

4 Old Schedule (Continue) DateTimeSubject Dec. 1515:10 – 16:40Image Compression #1 Jan. 1215:10 – 16:40Image Compression #2 Jan. 1915:10 – 16:40Image Compression #3 & Assignment #2 Jan. 2615:10 – 16:40Image Segmentation #1 Feb. 215:10 – 16:40Image Segmentation #2 Sep. 1015:10 – 16:40Image Recognition

5 Text Book Digital Image Processing using MATLAB by Rafael C. Gonzalez, Richard E. Woods, and Steven L. Eddins

6 Text Book Digital Image Processing by Rafael C. Gonzalez, Richard E. Woods

7  CxImage  www.codeproject.com

8

9 Structure of Human Eye Retina : Light Sensitive Tissue Cone Cell : Red cell, green cell, and blue cell. Detect Color. Locate at center of retina called fovea. Rod Cell : One type. Detect Illumination.

10 Structure of Human Eye

11 Camera Structure

12 Psychophysical

13

14 Gestalt Law  Similarity Human often perceive a group of similar objects as a single object or pattern

15 Gestalt Law  Anomally When similarity occurs, an object can be emphasised if it is dissimilar to the others. This is called anomally.

16 Getstalt Law  Continuation Continuation occurs when the eye is compelled to move through one object and continue to another object.

17 Getstalt Law  Closure Closure occurs when an object is incomplete or a space is not completely enclosed. If enough of the shape is indicated, people percieve the whole by filling in the missing infomation.

18 Getstalt Law  Proximity Proximity occurs when elements are placed close together. They tend to be perceived as a group.

19 Getstalt Law  Figure and Ground The eye differentiates an object from its surrounding area. A form, silhouette, or shape is naturally perceived as figure (object), while the surrounding area is perceived as ground (background). Balancing figure and ground can make the perceived image more clear. Using unusual figure/ground relationships can add interest and subtlety to an image.

20 Shape Detection

21 Gestalt Application  S. Kiranyaz, M. Ferreira, and M. Gabbouj, “A Generic Shape/ Texture Descriptor Over Multiscale Edge Field: 2-D Walking Ant Histogram,” IEEE Trans. Image Processing, vol. 17, no. 3, pp. 377-391, March, 2008.

22 Gray Image (x,y) = An image’s position or pixel f(x,y) = The intensity of the image at (x,y).

23 Color Image (x,y) = An image’s position or pixel f(x,y) = (r,g,b) The red, green, and blue components of the image at (x,y).

24 Gray Image Represented by Color Image (x,y) = An image’s position or pixel f(x,y) = (i,i,i) The intensity of white color of the image at (x,y).

25 Image Acquisition Continue Intensity Continue Spatial

26 Image Acquisition Continue Intensity Continue Spatial Continue Intensity Discrete Spatial

27 Image Acquisition Continue Intensity Discrete Spatial Discrete Intensity Discrete Spatial

28 Image Acquisition k=the number of bits k=1; L=2 k=5; L=32 k=2; L=4 k=6; L=64 k=3; L=8 k=7; L=128 k=4; L=16 k=8; L=256

29 Sampling with Different Resolutions Lena 256x256Lena 128x128 Lena 64x64

30 Quantize with Different Levels L=2 L=16 L=64 L=8 L=128L=256

31 Size of Uncompressed Image  Size of Image = M x N x k bits = M x N x k/8 Bytes 64x64x8 =32768 bits =4kB 256x256x8 =524288 bits =64kB

32 Size of Uncompressed Image 128x128x1 =16384 bits =2kB 128x128x8 =131072 bits =16kB Higher Fidelity = Bigger Image Size

33 Image Representation a(0,0)a(1,0)a(2,0)a(3,0)a(4,0)a(5,0)a(6,0)a(7,0)a(8,0)a(9,0) a(0,1)a(1,1)a(2,1)a(3,1)a(4,1)a(5,1)a(6,1)a(7,1)a(8,1)a(9,1) a(0,2)a(1,2)a(2,2)a(3,2)a(4,2)a(5,2)a(6,2)a(7,2)a(8,2)a(9,2) a(0,3)a(1,3)a(2,3)a(3,3)a(4,3)a(5,3)a(6,3)a(7,3)a(8,3)a(9,3) a(0,4)a(1,4)a(2,4)a(3,4)a(4,4)a(5,4)a(6,4)a(7,4)a(8,4)a(9,4) a(0,5)a(1,5)a(2,5)a(3,5)a(4,5)a(5,5)a(6,5)a(7,5)a(8,5)a(9,5) a(0,6)a(1,6)a(2,6)a(3,6)a(4,6)a(5,6)a(6,6)a(7,6)a(8,6)a(9,6) a(0,7)a(1,7)a(2,7)a(3,7)a(4,7)a(5,7)a(6,7)a(7,7)a(8,7)a(9,7) a(0,8)a(1,8)a(2,8)a(3,8)a(4,8)a(5,8)a(6,8)a(7,8)a(8,8)a(9,8) An image with size MxN is an array of a(x,y) with x{0,M-1} and y{0,N-1}

34 Programming  VC++, Visual Studio 2008  CxImage

35 Build CxImgLib 1. Unzip CxImage600_full.zip into a folder, for example, at C:\CxImage 2. Open C:\CxImage\CxImgLib.dsw 3. Select Menu Build -> Batch Build 4. Click Select All 5. Rebuild 4 5

36 Run Demo Program 1. Go to Solution Explorer (at the left/right panel of VS2008) 2. Right click at demo and select “set as start up project” 3. Click green arrow at toolbar to run Demo program 3 2

37 Demo Program

38 Build a New Program 1. Select Menu File -> New -> Project 2. Select MFC -> MFC Application

39 Build a New Program (2) 1. Click Browse and select the CxImage folder, for example, “c:\CxImage” 2. Enter Project Name 1 2

40 Set Project Properties 1. Right Click at Project Name 2. Select Properties 3. Select Configuration Properties 4. Select General 5. Set Character Set to “Use Multi-Byte Character Set” 1 5

41 Set Project Properties 6. Select C/C++ -> General 7. Set Additional Include Directories to..\..\CxImage 7

42 Set Project Properties 8. Select C/C++ -> Preprocessor 9. Set Preprocessor Directories to WIN32;_DEBUG;_WINDOWS;VATI_EX TENSIONS;_CRT_SECURE_NO_DEPRE CATE 9

43 Set Project Properties 10. Select Linker -> Input 11. Set Additional Dependencies to../../png/Debug/png.lib../../jpeg/Debug/jpeg.lib../../zlib/Debug/zlib.lib../../tiff/Debug/tiff.lib../../jbig/Debug/jbig.lib../../jasper/Debug/jasper.lib../../mng/Debug/mng.lib../../cximage/Debug/cximage.lib../../raw/debug/libdcr.lib 9

44 Example of Load an Image File  void CDIP1Dlg::OnBnClickedOpen()  {  CFileDialog fOpenDlg(TRUE, "jpg", NULL, OFN_HIDEREADONLY|OFN_FILEMUSTEXIST,  "JPEG (*.jpg)|*.jpg|BITMAP (*.bmp)|*.bmp||", this);  fOpenDlg.m_pOFN->lpstrTitle="Select an Image File";  fOpenDlg.m_pOFN->lpstrInitialDir="c:";  if(fOpenDlg.DoModal()==IDOK)  {  CString FN = fOpenDlg.GetPathName();  int Type = CxImage::GetTypeIdFromName(FN.Mid(FN.ReverseFind('.')+1));  m_ViewImage.Load(FN,Type);  RedrawWindow();  }

45 Example of Save an Image File  void CDIP1Dlg::OnBnClickedSave()  {  CFileDialog fOpenDlg(FALSE, "jpg", NULL, OFN_HIDEREADONLY|OFN_FILEMUSTEXIST,  "JPEG (*.jpg)|*.jpg|BITMAP (*.bmp)|*.bmp||", this);  fOpenDlg.m_pOFN->lpstrTitle="Select an Image File";  fOpenDlg.m_pOFN->lpstrInitialDir="c:";  if(fOpenDlg.DoModal()==IDOK)  {  CString FN = fOpenDlg.GetPathName();  int Type = CxImage::GetTypeIdFromName(FN.Mid(FN.ReverseFind('.')+1));  m_ViewImage.Save(FN,Type);  }

46 Example of Changing from a Color Image to a Gray Image  void CDIP1Dlg::OnBnClickedGrayImage()  {  DWORD Width = m_ViewImage.GetWidth();  DWORD Height = m_ViewImage.GetHeight();  DWORD x,y;  RGBQUAD rgb;  BYTE Gray;   for(y=0;y<Height;y++)  for(x=0;x<Width;x++)  {  rgb = m_ViewImage.GetPixelColor(x,y);  Gray = (BYTE) ((((float) rgb.rgbRed) + ((float) rgb.rgbGreen) + ((float) rgb.rgbBlue))/3.0);  rgb.rgbRed = Gray;  rgb.rgbGreen = Gray;  rgb.rgbBlue = Gray;  m_ViewImage.SetPixelColor(x,y,rgb);  }  RedrawWindow();  }

47 Example of Displaying an Image  void CDIP1Dlg::OnPaint()  {  if (IsIconic())  { :  }  else  {  CPaintDC dc(this); // device context for painting  CRect rect;  CWnd *pWnd;  pWnd = GetDlgItem(IDC_IMAGE_VIEW);  pWnd->GetWindowRect( &rect );  ScreenToClient( &rect );  if(m_ViewImage.IsValid())  m_ViewImage.Stretch(dc.GetSafeHdc(), rect);  CDialog::OnPaint();  }

48 How Computer Store an Image a(0,0)a(1,0)a(2,0)a(3,0)a(4,0)a(5,0)a(6,0)a(7,0)a(8,0)a(9,0) a(0,1)a(1,1)a(2,1)a(3,1)a(4,1)a(5,1)a(6,1)a(7,1)a(8,1)a(9,1) a(0,2)a(1,2)a(2,2)a(3,2)a(4,2)a(5,2)a(6,2)a(7,2)a(8,2)a(9,2) a(0,3)a(1,3)a(2,3)a(3,3)a(4,3)a(5,3)a(6,3)a(7,3)a(8,3)a(9,3) a(0,4)a(1,4)a(2,4)a(3,4)a(4,4)a(5,4)a(6,4)a(7,4)a(8,4)a(9,4) a(0,5)a(1,5)a(2,5)a(3,5)a(4,5)a(5,5)a(6,5)a(7,5)a(8,5)a(9,5) a(0,6)a(1,6)a(2,6)a(3,6)a(4,6)a(5,6)a(6,6)a(7,6)a(8,6)a(9,6) a(0,7)a(1,7)a(2,7)a(3,7)a(4,7)a(5,7)a(6,7)a(7,7)a(8,7)a(9,7) a(0,8)a(1,8)a(2,8)a(3,8)a(4,8)a(5,8)a(6,8)a(7,8)a(8,8)a(9,8)


Download ppt "Dr. Thurdsak LEAUHATONG Dept. of electronics, Faculty of Engineering, KMITL"

Similar presentations


Ads by Google