Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
관리 메뉴

어제보다 나은 내가 되자

이진화, threshold 본문

영상처리

이진화, threshold

rudruddl 2020. 5. 13. 16:55
#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;

void on_threshold(int pos, void* userdata) {
	Mat src = *(Mat*)userdata;

	Mat dst;
	threshold(src, dst, pos, 255, THRESH_BINARY);

	imshow("dst", dst);
}

int main(int argc, char* argv[]) {
	Mat src;

	src = imread("neutrophils.png", IMREAD_GRAYSCALE);

	imshow("src", src);

	namedWindow("dst");
	createTrackbar("Threshold", "dst", 0, 255, on_threshold, (void*)&src);
	
	waitKey();
	return 0;
}

 

Comments