#include <opencv2 / improc.hpp>
#include <opencv2 / highgui.hpp>
#include <opencv2 / imgproc /imgproc.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main()
{
	Mat src, dst, cdst;
    src = imread("KN_building.jpg", IMREAD_GRAYSCALE);
    
    Canny(src, dst, 35, 255);
    cvtColor(dst, cdst, COLOR_GRAY2BGR);
    vector <Vec4i> lines;
    HoughLinesP(dst, lines, 1, CV_PI / 180, 50, 100, 20);
    for(size_t i = 0; i< lines.size(); i++){
    	Vec4i l = lines[i];
        line(cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 0, 255), 2);
    }
    
    imshow("허프변환",cdst);
    
    waitkey(0);
}

+ Recent posts