Extracting the position of game board & recognition of game board pieces

me1237guy 發表在 痞客邦 留言(0) 人氣()


setup version: 320.49-desktop-win8-win7-winvista-64bit-international-whql.exe

me1237guy 發表在 痞客邦 留言(0) 人氣()

1. NVIDIA Performance Primitives (NPP) library

me1237guy 發表在 痞客邦 留言(0) 人氣()



    private: System::Void 開啟ToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                 tabControl1->SelectedIndex = 0;
             }
private: System::Void 開啟ToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
             tabControl1->SelectedIndex = 1;
         }

me1237guy 發表在 痞客邦 留言(0) 人氣()


OpenCV: version 2.4.5
Visual Studio: version 2010
                 IsStop = false;
                 using namespace cv;
                 VideoCapture capture(0);
                 if (!capture.isOpened())  // check if we succeeded
                     return;
                 Mat src, src_gray, src_edge;
                 CvRect Rect;
                 long cnt = 0;
                 for (;;)
                 {
                     capture >> src;
                     System::Drawing::Graphics^ graphics = pictureBox1->CreateGraphics();
                     System::IntPtr ptr(src.ptr());   
                     System::Drawing::Bitmap^ b  = gcnew System::Drawing::Bitmap(src.cols,src.rows,src.step,System::Drawing::Imaging::PixelFormat::Format24bppRgb,ptr);
                     System::Drawing::RectangleF rect(0,0,pictureBox1->Width,pictureBox1->Height);
                     graphics->DrawImage(b,rect);
                     //----------------------------------------------------------------------------------------------------------------------
                     cvtColor( src, src_gray, CV_BGR2GRAY );
                     System::Drawing::Graphics^ graphics2 = pictureBox2->CreateGraphics();
                     System::IntPtr ptr2(src_gray.ptr());  
                     System::Drawing::Bitmap^ b2  = gcnew System::Drawing::Bitmap(src_gray.cols/3,src_gray.rows,src_gray.step,System::Drawing::Imaging::PixelFormat::Format24bppRgb ,ptr2);
                     System::Drawing::RectangleF rect2(0,0,pictureBox2->Width,pictureBox2->Height);
                     graphics2->DrawImage(b2,rect2);
                     //----------------------------------------------------------------------------------------------------------------------
                     Canny( src_gray, src_edge, 50, 25, 3);
                     System::Drawing::Graphics^ graphics3 = pictureBox3->CreateGraphics();
                     System::IntPtr ptr3(src_edge.ptr());   
                     System::Drawing::Bitmap^ b3  = gcnew System::Drawing::Bitmap(src_edge.cols,src_edge.rows,src_edge.step,System::Drawing::Imaging::PixelFormat::Format8bppIndexed ,ptr3);
                     System::Drawing::RectangleF rect3(0,0,pictureBox3->Width,pictureBox3->Height);
                     graphics3->DrawImage(b3,rect3);
                     cnt++;
                     label1->Text = Convert::ToString(cnt);
                     Application::DoEvents();
                     if(IsStop) break;
                 }  

me1237guy 發表在 痞客邦 留言(0) 人氣()


using namespace cv;
Mat src, src_gray;
CvRect Rect;
// 開啟檔案對話框                

me1237guy 發表在 痞客邦 留言(0) 人氣()

Mean Shift Clustering/ Segmentation in Matlab

me1237guy 發表在 痞客邦 留言(0) 人氣()

資料來源: display cv::Mat (opencv 2.4.3) in pictureBox (Visual C++ 2010)
Mat img;
openFileDialog1->Filter = "JPEG files (*.jpg)|*.jpg|Bitmap files (*.bmp)|*.bmp";
if(openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{

me1237guy 發表在 痞客邦 留言(0) 人氣()


google後才知道2010的 C++/CLI 不支援IntelliSense了,
所以改用Visual AssistX 10.6.1827,可以在64位元的
VS2010執行。
安裝 VA_X_Setup1940

me1237guy 發表在 痞客邦 留言(0) 人氣()


#include "stdafx.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
int _tmain(int argc, _TCHAR* argv[])
{
    
    using namespace cv;
    Mat src, src_gray;
  /// Read the image
  src = imread( "cd.jpg", 1 );
  if( !src.data )
    { return -1; }
  /// Convert it to gray
  cvtColor( src, src_gray, CV_BGR2GRAY );
  /// Reduce the noise so we avoid false circle detection
  GaussianBlur( src_gray, src_gray, Size(9, 9), 2, 2 );
  vector<Vec3f> circles;
  /// Apply the Hough Transform to find the circles
  HoughCircles( src_gray, circles, CV_HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 );
  /// Draw the circles detected
  for( size_t i = 0; i < circles.size(); i++ )
  {
      Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
      int radius = cvRound(circles[i][2]);
      // circle center
      circle( src, center, 3, Scalar(0,255,0), -1, 8, 0 );
      // circle outline
      circle( src, center, radius, Scalar(0,0,255), 3, 8, 0 );
   }
  /// Show your results
  namedWindow( "Hough Circle Transform Demo", CV_WINDOW_AUTOSIZE );
  imshow( "Hough Circle Transform Demo", src );
  waitKey(0);
    return 0;
}

me1237guy 發表在 痞客邦 留言(0) 人氣()


解壓縮至C:\OpenCV-2.4.5
新增一個資料夾vs2010, 即C:\OpenCV-2.4.5\opencv\vs2010

me1237guy 發表在 痞客邦 留言(0) 人氣()

安裝檔案: OpenCV-2.3.1-win-superpack
安裝步驟: 2013 06 24 安裝OpenCV2 3 1

me1237guy 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。