接續上一篇<輪廓搜尋 Finding contours using OpenCV2.4.6 with visual studio 2010>
這次將整合搜尋輪廓find contours範例至Image Viewer平台, 開啟上一篇的範例程式<find contour VS2010 OpenCV2.4.6>

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


/**
 * @function findContours_Demo.cpp
 * @brief Demo code to find contours in an image
 * @author OpenCV team
 */
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
Mat src; Mat src_gray;
int thresh = 100;                        // scollbar預設值(門檻值)   
int max_thresh = 255;                    // scrollbar上限(max value)
RNG rng(12345);                          // Random Number Generator, 參考core.hpp
/// Function header
void thresh_callback(int, void* );       // 門檻回呼函式
/**
 * @function main
 */
int main( int arg, char** argv )
{
  /// Load source image and convert it to gray
     const char* filename = arg == 2 ? argv[1] : "sample.jpg";      
    src = imread(filename, 1 );
  /// Convert image to gray and blur it
  cvtColor( src, src_gray, CV_BGR2GRAY );      // 轉灰階
  blur( src_gray, src_gray, Size(3,3) );             // 模糊化
  /// Create Window
  const char* source_window = "Source";
  namedWindow( source_window, CV_WINDOW_AUTOSIZE );  // CV_WINDOW_AUTOSIZE:使用者無法調整視窗大小
  imshow( source_window, src );
  createTrackbar( " Canny thresh:", "Source", &thresh, max_thresh, thresh_callback );/* createTrackbar(scrollbar名稱,
                                                                                                       視窗標題,
                                                                                                       scrollbar預設值,
                                                                                                       scrollbar上限值,
                                                                                                       回呼函式)
                                                                                     */
  thresh_callback( 0, 0 );
  waitKey(0);
  return(0);
}
/**
 * @function thresh_callback
 */
void thresh_callback(int, void* )
{
  Mat canny_output;
  vector<vector<Point> > contours;
  vector<Vec4i> hierarchy;
  /// Detect edges using canny
  Canny( src_gray, canny_output, thresh, thresh*2, 3 );
  namedWindow( "Canny", CV_WINDOW_AUTOSIZE );     // Canny output
  imshow( "Canny", canny_output );
  /// Find contours
  findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
  /// Draw contours
  //Mat drawing = Mat::zeros( canny_output.size(), CV_8UC3 );   // contour 輸出
  Mat drawing;
  src.copyTo(drawing);
 
  for( size_t i = 0; i< contours.size(); i++ )
     {
       Scalar color = Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) );
       drawContours( drawing, contours, (int)i, color, 3, 8, hierarchy, 0, Point() );
       /*
           void drawContours( InputOutputArray image,
                              InputArrayOfArrays contours,
                              int contourIdx,
                              const Scalar& color,
                              int thickness=1,
                              int lineType=8,
                              InputArray hierarchy=noArray(),
                              int maxLevel=INT_MAX,
                              Point offset=Point() );
       */
     }
  /// Show in a window
  namedWindow( "Contours", CV_WINDOW_AUTOSIZE );
  imshow( "Contours", drawing );
}

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


Qt Creator新增一個專案<Qt圖形介面應用程式>
專案名稱: DateTimeGUI
-----------------------------------------------------------------------------------------------------------
開始利用QDate和QTime來進行日期時間的操作吧!
首先mainwindow.h加入下列標頭檔
#include <QDate>
#include <QTime>
#pragmaexecution_character_set("utf-8")

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


Git-1.8.4-preview20130916.exe   14.9 MB
Git教學:初學者使用心得分享(Windows)
 

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


接續之前一篇<二值化灰階影像 Binarize a gray level image Using OpenCV 2.4.6 with Qt5 >
這次打算寫一個即時調整門檻值並顯示對應二值化後的小圖
1. 在tabwidget插入一個頁面<參數>

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


參考: Getting MouseMoveEvents in Qt
請加入下列至 mainwindow.h
bool eventFilter(QObject *obj,QEvent *event);//事件偵測(滑鼠)

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


接續上一篇<Basler 3.2 Pylon C API 筆記1>
Grabbing Using Stream Grabber Objects(電腦端非攝影機端)

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

pylon C and GenApi
The pylon C API builds upon GenApi, a software framework that provides a high-level API for generic access to all compliant digital cameras, hiding the peculiarities of the particular interface technology used. Accordingly, the application developer can focus on the functional aspects of the program to be developed. Due to the abstraction provided by GenApi, programs need not be adjusted to work with different types of camera interfaces.(例如使用area camera和linescan camera幾乎感覺一模一樣, 因為兩者的差異已經在GenAPI處理掉了, 使用者只需要專注在收到影像像素後的處理) Even applications can be addressed where different camera interfaces are used at the same time.The dependency of pylon C upon GenApi shows in some places, mostly where names of functions or other entities start with a GenApi prefix. Wherever this is the case, an element of the underlying GenApi layer is directly exposed to the pylon C user.

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


整合這篇<利用Qt5寫一個簡單的影像瀏覽器>至另一篇<分別取出RGB像素頻道Extract RGB channels from an image Using OpenCV2.4.6 with Qt5 >
將SplitRGBQt5OpenCV246目錄夾複製一份

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



Download:   FlyCapture v2.5.3.4 Viewer - Windows



Description:
The FlyCap2 Viewer download is a reduced installer with the minimum files required to be able to stream your camera and save images with our FlyCap2 GUI. For developers who require source code, other examples, libraries, and documentation, please download the complete FlyCapture2 SDK below. [read release notes]
FlyCapture 2.5.3.4 Viewer - Windows (64-bit Download) (exe) 25.39 MB
FlyCapture v2.5.3.4 Viewer - Windows (32-bit Download) (exe) 24.75 MB





Date:  2013/08/14

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


接續上一篇<二值化灰階影像 Binarize a gray level image Using OpenCV 2.4.6 with Qt5>
將BinarizeQt5OpenCV246目錄夾複製一份

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


接續上一篇<利用指標讀取像素值 Scanning an image with uchar* pointer>
將ScanlineQt5OpenCV246目錄夾複製一份

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

Blog Stats
⚠️

成人內容提醒

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

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