Last active
March 1, 2016 12:42
-
-
Save PreSoichiSumi/174a560f3437e2952697 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*二値化 | |
Mat img2; | |
threshold(gray_img, img2, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU ); | |
*/ | |
/*輪郭抽出 | |
vector< vector<cv::Point> > contours; | |
cv::findContours(img2, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE); | |
// 抽出した輪郭を描画 | |
cv::Mat contourImage(img2.size(), CV_8U, cv::Scalar(255)); | |
const int drawAllContours = -1; | |
cv::drawContours(contourImage, contours, drawAllContours, cv::Scalar(0)); | |
// 画像の表示 | |
cv::imshow("Contour Image", contourImage);*/ | |
/* | |
Mat im_sobel, im_laplacian, im_canny, im_tmp; | |
Sobel(gray_img, im_tmp, CV_32F, 1, 1); | |
convertScaleAbs(im_tmp, im_sobel, 1, 0); | |
Laplacian(gray_img, im_tmp, CV_32F, 3); | |
convertScaleAbs(im_tmp, im_laplacian, 1, 0); | |
Canny(gray_img, im_canny, 50, 200); | |
imshow("Grayscale", gray_img); | |
imshow("Sobel", im_sobel); | |
imshow("Laplacian", im_laplacian); | |
imshow("Canny", im_canny);*/ | |
/* 拡大・縮小 | |
Mat er; | |
erode(adptImg, er, Mat(), Point(-1, -1), 1, BORDER_CONSTANT, morphologyDefaultBorderValue()); | |
imshow("eroded", er); | |
Mat dil; | |
dilate(adptImg, dil, Mat(), Point(-1, -1), 1, 0, morphologyDefaultBorderValue()); | |
imshow("dilated", dil);*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment