08 Crop 剪裁

screen-shot-2016-11-14-at-3-22-37-pm

/*
 柯博文老師
 www.powenko.com
 */
#include <iostream>
#include <opencv2/core/core.hpp> 
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>

using namespace cv ;
using namespace std ;
int main() {
     Mat image = cv::imread("/Users/powenko/Desktop/1.png");
    
    
    
   // Mat image=imread("/Users/powenko/Desktop/1.png",1);
    
    int startX=200,startY=200,width=200,height=200;
    
    Mat ROI(image, Rect(startX,startY,width,height));
    Mat croppedImage;
    ROI.copyTo(croppedImage);
    
    cv::namedWindow("Image") ;
    cv::imshow("Image", image) ;
    cv::imshow("PowenKo.com Result", croppedImage) ;
    cv::waitKey() ;

    return 0;
}

OpenCV
CH01 簡介CH02 OpenCV APICH03 繪圖CH04 應用範例CH06 haarcascadesCH06 surf和siftCH07 OCRCH09 FaceCH5 輪廓(findContours、drawContours)