Migration vers OpenCV4
This commit is contained in:
parent
34c4234942
commit
5f99ea9f0e
2 changed files with 6 additions and 6 deletions
|
@ -52,9 +52,9 @@ bool Camera::Open() {
|
||||||
|
|
||||||
#ifdef __FOR_PC__
|
#ifdef __FOR_PC__
|
||||||
if (this->cap.open(0)) {
|
if (this->cap.open(0)) {
|
||||||
//this->cap.set(CV_CAP_PROP_FORMAT, CV_8UC3);
|
//this->cap.set(CAP_PROP_FORMAT, CV_8UC3);
|
||||||
this->cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
|
this->cap.set(CAP_PROP_FRAME_WIDTH, width);
|
||||||
this->cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
|
this->cap.set(CAP_PROP_FRAME_HEIGHT, height);
|
||||||
|
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,11 +239,11 @@ Arena Img::SearchArena() {
|
||||||
std::vector<cv::Vec4i> hierarchy;
|
std::vector<cv::Vec4i> hierarchy;
|
||||||
|
|
||||||
ImageMat imageTrt;
|
ImageMat imageTrt;
|
||||||
cv::cvtColor(this->img, imageTrt, CV_RGB2GRAY); // conversion en niveau de gris
|
cv::cvtColor(this->img, imageTrt, cv::COLOR_RGB2GRAY); // conversion en niveau de gris
|
||||||
cv::threshold(imageTrt, imageTrt, 128, 255, CV_THRESH_BINARY); // Threshold les éléments les plus clair
|
cv::threshold(imageTrt, imageTrt, 128, 255, cv::THRESH_BINARY); // Threshold les éléments les plus clair
|
||||||
cv::Canny(imageTrt, imageTrt, 100, 200, 3); // detection d'angle
|
cv::Canny(imageTrt, imageTrt, 100, 200, 3); // detection d'angle
|
||||||
|
|
||||||
findContours(imageTrt, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cv::Point(0, 0));
|
findContours(imageTrt, contours, hierarchy, cv::RETR_TREE, cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0));
|
||||||
for (unsigned int i = 0; i < contours.size(); i++) {
|
for (unsigned int i = 0; i < contours.size(); i++) {
|
||||||
approxPolyDP(ImageMat(contours[i]), approx, cv::arcLength(ImageMat(contours[i]), true) * 0.1, true);
|
approxPolyDP(ImageMat(contours[i]), approx, cv::arcLength(ImageMat(contours[i]), true) * 0.1, true);
|
||||||
if (approx.size() == 4 && fabs(cv::contourArea(contours[i])) > 100000) {
|
if (approx.size() == 4 && fabs(cv::contourArea(contours[i])) > 100000) {
|
||||||
|
|
Loading…
Reference in a new issue