ラプラシアンとか

OpenCV2.0でのラプラシアンの使い方

#include <cv.h>
#include <highgui.h>

int main(int argc, char **argv) {
  using namespace cv;

  VideoCapture cap(0);
  if(!cap.isOpened())
	  return -1;

  Mat frame;
  Mat img_in, img_bi, img_la, img_bi2;
  char code;

  for(;;) {
    cap >> frame;
	cvtColor(frame , img_in, CV_BGR2GRAY);
	threshold(img_in, img_bi, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
	Laplacian(img_bi, img_la, CV_32F, 3);
	convertScaleAbs(img_la, img_la, 1, 0);
	threshold(img_la, img_bi2, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);


	imshow("in", img_in);
	imshow("bi", img_bi);
	imshow("la", img_la);
	imshow("bi2", img_bi2);

    code = waitKey(100);
    if(code == 'q')
		break;

  }
  return 0;
}