1 / 11

Computer Vision

Computer Vision. Kim Nam Woo. Console OpenCV. CvvImage cImage; cImage.Load("1.bmp"); IplImage* color_image=cImage.GetImage(); IplImage* gray_image=cvCreateImage(cvGetSize(color_image),IPL_DEPTH_8U,1); cvCvtColor(color_image, gray_image, CV_BGR2GRAY); cImage.CopyOf(gray_image,8);

vaughan
Download Presentation

Computer Vision

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Vision Kim Nam Woo

  2. Console OpenCV CvvImage cImage; cImage.Load("1.bmp"); IplImage* color_image=cImage.GetImage(); IplImage* gray_image=cvCreateImage(cvGetSize(color_image),IPL_DEPTH_8U,1); cvCvtColor(color_image, gray_image, CV_BGR2GRAY); cImage.CopyOf(gray_image,8); int height=cImage.Height(); int width=cImage.Width(); cImage.Show(pDC->GetSafeHdc(),0,0,width,height); cvReleaseImage(&gray_image); cImage.Destroy(); pDoc->SetTitle("CvvImage Class DefaultExam"); Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  3. Member Function in CvvImage Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  4. CvvImage in MFC • Select Multiple Documents • include in “StdAfx.h” #include <cv.h> • #include <cxcore.h> • #include <highgui.h> • #include <cvcam.h> • Add Member Variables • CvvImage m_cvvImage • char* m_szPathName Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  5. CvvImage in MFC • Add Virtual Function in Doc • Doc::OnOpenDocument(LPCTSTR lpszPathName) • { • if (!CDocument::OnOpenDocument(lpszPathName)) • return FALSE; • // TODO: Add your specialized creation code here • m_cvvImage.Load(lpszPathName); • m_szPathName=(char*)calloc(512,sizeof(char)); • strcpy(m_szPathName, (char*)lpszPathName); • return TRUE; • } Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  6. CvvImage in MFC • Add Virtual Function in Doc • Doc::DeleteContents() • { • // TODO: Add your specialized code here and/or call the base class • if(m_cvvImage.GetImage()!=NULL) • { • m_cvvImage.~CvvImage(); • } • CDocument::DeleteContents(); • } Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  7. CvvImage in MFC • Add Function in App • App::OnFileOpen() • { • // TODO: Add your command handler code here • char szFilter[]="JPEG file(*.jpeg, *.jpg, *,jpe) • | *.jpeg; *.jpg;, *.jpe|\ • Portable Network Graphics file(*.png)|*.png|\ • Windows bitmap files(*.bmp, *.dib)|*.bmp; *.dib|\ • Sun rasters(*.sr, *.ras)|*.sr; *.ras|\ • TIFF files(*.tiff, *.tif)|*.tiff; *.tif|\ • 지원하는 모든 영상 파일| • *.jpeg; *.jpg; *.jpe; *.png; *.bmp; *.dib; *.sr; *.ras;\ • *.tiff; *.tif||"; • CFileDialogfileDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT,szFilter); • intiReturn=fileDlg.DoModal(); • if(iReturn==IDOK) • { • POSITION pos=fileDlg.GetStartPosition(); • while(pos) • { • OpenDocumentFile • (fileDlg.GetNextPathName(pos)); • } • } • } Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  8. CvvImage in MFC • Add Virtual Function in View • View::OnInitialUpdate() • { • CTestDoc* pDoc = GetDocument(); • ASSERT_VALID(pDoc); • CScrollView::OnInitialUpdate(); • CSizesizeTotal; • // TODO: calculate the total size of this view • if(pDoc->m_cvvImage.GetImage()) • { • int height=pDoc->m_cvvImage.Height(); • int width=pDoc->m_cvvImage.Width(); • sizeTotal=CSize(width, height); • } • else • { • sizeTotal.cx = sizeTotal.cy = 100; • } • SetScrollSizes(MM_TEXT, sizeTotal); • ResizeParentToFit(TRUE); • } Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  9. CvvImage in MFC • Add Virtual Function in View • View::OnDraw(CDC* pDC) • { • CTestDoc* pDoc = GetDocument(); • ASSERT_VALID(pDoc); • // TODO: add draw code for native data here • if(pDoc->m_cvvImage.GetImage()) • { • int height=pDoc->m_cvvImage.Height(); • int width=pDoc->m_cvvImage.Width(); • CRect rect=CRect(0,0,width,height); • pDoc->m_cvvImage.DrawToHDC(pDC->GetSafeHdc(),&rect); • ResizeParentToFit(FALSE); • } • } Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  10. CvvImage in MFC • Add Virtual Function in View • View::OnDraw(CDC* pDC) • { • CTestDoc* pDoc = GetDocument(); • ASSERT_VALID(pDoc); • // TODO: add draw code for native data here • if(pDoc->m_cvvImage.GetImage()) • { • int height=pDoc->m_cvvImage.Height(); • int width=pDoc->m_cvvImage.Width(); • CRect rect=CRect(0,0,width,height); • pDoc->m_cvvImage.DrawToHDC(pDC->GetSafeHdc(),&rect); • ResizeParentToFit(TRUE); • } • } Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  11. CvvImage in MFC • Add Virtual Function in ViewApp • App::InitInstance() • { • : • : • if(cmdInfo.m_nShellCommand==CCommandLineInfo::FileNew) • { • cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing; • } • : • : • } Digital Image Processing, Kim Nam Woo, Dongseo Univ.

More Related