final
This commit is contained in:
30
ora7/proj1/main.cpp
Normal file
30
ora7/proj1/main.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "histo.h"
|
||||
#include "opencv2/core/types.hpp"
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using namespace cv;
|
||||
|
||||
int main(){
|
||||
Mat img = imread("../sajt.png", IMREAD_COLOR);
|
||||
Mat gray, mask;
|
||||
cvtColor(img, gray, COLOR_BGR2GRAY);
|
||||
threshold(gray, mask, 250, 255, THRESH_BINARY_INV);
|
||||
medianBlur(mask, mask, 3);
|
||||
|
||||
std::vector<std::vector<Point>> contours;
|
||||
findContours(mask, contours, RETR_EXTERNAL, CHAIN_APPROX_NONE);
|
||||
|
||||
for(int i = 0; i < contours.size(); i++){
|
||||
drawContours(img, contours, i, Scalar(0,0,255), 2);
|
||||
imshow("img", img);
|
||||
waitKey();
|
||||
}
|
||||
|
||||
imshow("mask", mask);
|
||||
|
||||
while(waitKey(3) != 'q');
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user