add preview video

This commit is contained in:
2023-05-12 17:09:03 +02:00
parent ab566b209a
commit 7ffa5e29ea
5 changed files with 21 additions and 10 deletions

BIN
MarkerMovie.MP4 Normal file

Binary file not shown.

View File

@@ -36,8 +36,8 @@ int main() {
const string contoursWindow = "Contours";
const string thresholdWindow = "Threshold";
namedWindow(contoursWindow, WINDOW_FREERATIO);
namedWindow(thresholdWindow, WINDOW_FREERATIO);
namedWindow(contoursWindow, WINDOW_AUTOSIZE);
namedWindow(thresholdWindow, WINDOW_AUTOSIZE);
const string UI = "Threshold";
int threshold = 65;
@@ -47,6 +47,11 @@ int main() {
Mat imgFiltered;
Detector detector;
//VIDEO
//VideoWriter threshOut("threshold.avi", VideoWriter::fourcc('M', 'J', 'P', 'G'), 24, Size(cap.get(3), cap.get(4)));
//VideoWriter imgOut("makerDetection.avi", VideoWriter::fourcc('M', 'J', 'P', 'G'), 24, Size(cap.get(3), cap.get(4)));
while (cap.read(frame)) {
// --- Process Frame ---
@@ -63,11 +68,21 @@ int main() {
imshow(contoursWindow, imgFiltered);
imshow(thresholdWindow, videoStreamFrameGray);
//VIDEO
//threshOut.write(videoStreamFrameGray);
//imgOut.write(imgFiltered);
if (waitKey(10) == 27) {
break;
}
}
cap.release();
//VIDEO
//threshOut.release();
//imgOut.release();
destroyAllWindows();
return (0);

BIN
preview/makerDetection.avi Normal file

Binary file not shown.

View File

@@ -78,7 +78,7 @@ void Detector::drawRectangle(Mat &output, contour_t contour){
correction.y += p.y;
circle(output, correction, 3, Scalar(255,0,0), -1);
circle(output, p, 1, CV_RGB(0, 0, 255), -1);
//circle(output, p, 3, CV_RGB(0, 0, 255));
}
sobelFilter.drawStrips(output);

View File

@@ -38,8 +38,6 @@ cv::Point2d SobelFilter::getSubPixelPoint(float dx, float dy, cv::Point edge, cv
subPixel.x += delimiter.x;
subPixel.y += delimiter.y;
//cv::circle(input, subPixel, 2, cv::Scalar(0,0,255), -1);
int pixel = samplePixel(input, subPixel);
int w = m + 1;
int h = n + (stripeLength >> 1);
@@ -48,9 +46,7 @@ cv::Point2d SobelFilter::getSubPixelPoint(float dx, float dy, cv::Point edge, cv
}
}
//std::cout << p1.x << "||" << std::fabs(p1.x) << std::endl;
cv::Sobel(iplStripe, iplStripe, CV_8U, 0, 1);
cv::Sobel(iplStripe, iplStripe, CV_8U, 1, 0);
return findSubPixelPoint(iplStripe, sample);
}
@@ -113,8 +109,8 @@ cv::Point2d SobelFilter::findSubPixelPoint(cv::Mat iplStripe, SampleStrip strip)
return edgeCenter;
}
edgeCenter.x = pos * (strip.vecX.x + strip.vecY.x);
edgeCenter.y = pos * (strip.vecX.y + strip.vecY.y);
edgeCenter.x = pos + (strip.vecX.x + strip.vecY.x);
edgeCenter.y = pos + (strip.vecX.y + strip.vecY.y);
return edgeCenter;
}