add preview video
This commit is contained in:
BIN
MarkerMovie.MP4
Normal file
BIN
MarkerMovie.MP4
Normal file
Binary file not shown.
@@ -36,8 +36,8 @@ int main() {
|
|||||||
const string contoursWindow = "Contours";
|
const string contoursWindow = "Contours";
|
||||||
const string thresholdWindow = "Threshold";
|
const string thresholdWindow = "Threshold";
|
||||||
|
|
||||||
namedWindow(contoursWindow, WINDOW_FREERATIO);
|
namedWindow(contoursWindow, WINDOW_AUTOSIZE);
|
||||||
namedWindow(thresholdWindow, WINDOW_FREERATIO);
|
namedWindow(thresholdWindow, WINDOW_AUTOSIZE);
|
||||||
|
|
||||||
const string UI = "Threshold";
|
const string UI = "Threshold";
|
||||||
int threshold = 65;
|
int threshold = 65;
|
||||||
@@ -47,6 +47,11 @@ int main() {
|
|||||||
Mat imgFiltered;
|
Mat imgFiltered;
|
||||||
Detector detector;
|
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)) {
|
while (cap.read(frame)) {
|
||||||
|
|
||||||
// --- Process Frame ---
|
// --- Process Frame ---
|
||||||
@@ -63,11 +68,21 @@ int main() {
|
|||||||
imshow(contoursWindow, imgFiltered);
|
imshow(contoursWindow, imgFiltered);
|
||||||
imshow(thresholdWindow, videoStreamFrameGray);
|
imshow(thresholdWindow, videoStreamFrameGray);
|
||||||
|
|
||||||
|
//VIDEO
|
||||||
|
//threshOut.write(videoStreamFrameGray);
|
||||||
|
//imgOut.write(imgFiltered);
|
||||||
|
|
||||||
if (waitKey(10) == 27) {
|
if (waitKey(10) == 27) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cap.release();
|
||||||
|
|
||||||
|
//VIDEO
|
||||||
|
//threshOut.release();
|
||||||
|
//imgOut.release();
|
||||||
|
|
||||||
destroyAllWindows();
|
destroyAllWindows();
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|||||||
BIN
preview/makerDetection.avi
Normal file
BIN
preview/makerDetection.avi
Normal file
Binary file not shown.
@@ -78,7 +78,7 @@ void Detector::drawRectangle(Mat &output, contour_t contour){
|
|||||||
correction.y += p.y;
|
correction.y += p.y;
|
||||||
|
|
||||||
circle(output, correction, 3, Scalar(255,0,0), -1);
|
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);
|
sobelFilter.drawStrips(output);
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ cv::Point2d SobelFilter::getSubPixelPoint(float dx, float dy, cv::Point edge, cv
|
|||||||
subPixel.x += delimiter.x;
|
subPixel.x += delimiter.x;
|
||||||
subPixel.y += delimiter.y;
|
subPixel.y += delimiter.y;
|
||||||
|
|
||||||
|
|
||||||
//cv::circle(input, subPixel, 2, cv::Scalar(0,0,255), -1);
|
|
||||||
int pixel = samplePixel(input, subPixel);
|
int pixel = samplePixel(input, subPixel);
|
||||||
int w = m + 1;
|
int w = m + 1;
|
||||||
int h = n + (stripeLength >> 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, 1, 0);
|
||||||
|
|
||||||
cv::Sobel(iplStripe, iplStripe, CV_8U, 0, 1);
|
|
||||||
|
|
||||||
return findSubPixelPoint(iplStripe, sample);
|
return findSubPixelPoint(iplStripe, sample);
|
||||||
}
|
}
|
||||||
@@ -113,8 +109,8 @@ cv::Point2d SobelFilter::findSubPixelPoint(cv::Mat iplStripe, SampleStrip strip)
|
|||||||
return edgeCenter;
|
return edgeCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
edgeCenter.x = pos * (strip.vecX.x + strip.vecY.x);
|
edgeCenter.x = pos + (strip.vecX.x + strip.vecY.x);
|
||||||
edgeCenter.y = pos * (strip.vecX.y + strip.vecY.y);
|
edgeCenter.y = pos + (strip.vecX.y + strip.vecY.y);
|
||||||
|
|
||||||
return edgeCenter;
|
return edgeCenter;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user