Skip to content
Snippets Groups Projects
Commit 8efbe93f authored by am0ebe's avatar am0ebe
Browse files

.

parent b35d87f9
Branches
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
], ],
"settings": "settings":
{ {
"tab_size": 8, "tab_size": 3,
// "cmake": // "cmake":
// { // {
// "build_folder": "$folder/build", // "build_folder": "$folder/build",
......
...@@ -32,6 +32,8 @@ using namespace bgslibrary::algorithms; ...@@ -32,6 +32,8 @@ using namespace bgslibrary::algorithms;
using namespace cv; using namespace cv;
using namespace std; using namespace std;
Scalar color_red( 0,0,255,255 );
int g_badSignalFlagAbort = 0; int g_badSignalFlagAbort = 0;
void my_handler(int signum); void my_handler(int signum);
...@@ -50,7 +52,7 @@ int main(int argc, char * argv[]) ...@@ -50,7 +52,7 @@ int main(int argc, char * argv[])
signal(SIGUSR1, my_handler); signal(SIGUSR1, my_handler);
cout << "Using OpenCV " << CV_MAJOR_VERSION << "." << CV_MINOR_VERSION << "." << CV_SUBMINOR_VERSION << endl; cout << "Using OpenCV " << CV_MAJOR_VERSION << "." << CV_MINOR_VERSION << "." << CV_SUBMINOR_VERSION << endl;
cout << "Using processcenter " << PROCESS_CENTER_VERSION_MAJOR << "." << PROCESS_CENTER_VERSION_MINOR<< "." <<PROCESS_CENTER_VERSION_MINOR_FIXES<< endl << endl; cout << "Using processcenter " << PROCESS_CENTER_VERSION_MAJOR << "." << PROCESS_CENTER_VERSION_MINOR << "." << PROCESS_CENTER_VERSION_MINOR_FIXES << endl << endl;
//!** parse programm input****************/ //!** parse programm input****************/
...@@ -116,7 +118,7 @@ int main(int argc, char * argv[]) ...@@ -116,7 +118,7 @@ int main(int argc, char * argv[])
} }
cout << "args: -i " <<inputFile<< " -a " <<amountFiles << " -c" << centerFileString<< " -o " << outputDir << " -p " << cameraParameterFile << endl; cout << "args: -i " << inputFile << " -a " << amountFiles << " -c" << centerFileString << " -o " << outputDir << " -p " << cameraParameterFile << endl;
//!**** end parse input***********/ //!**** end parse input***********/
//libarchive things //libarchive things
...@@ -141,7 +143,7 @@ int main(int argc, char * argv[]) ...@@ -141,7 +143,7 @@ int main(int argc, char * argv[])
//and open the handler //and open the handler
if ((r = archive_read_open_filename(archive, filename, 10240))) if ((r = archive_read_open_filename(archive, filename, 10240)))
{ {
cerr<< "archive_read_open_filename: error: " << archive_error_string(archive) << " will abort" << endl; cerr << "archive_read_open_filename: error: " << archive_error_string(archive) << " will abort" << endl;
exit(1); exit(1);
} }
...@@ -185,6 +187,7 @@ int main(int argc, char * argv[]) ...@@ -185,6 +187,7 @@ int main(int argc, char * argv[])
cv::String configFileNameCenter(centerFileString); cv::String configFileNameCenter(centerFileString);
//read the config //read the config
cout << "parameter of centerConfigFile.xml" << endl; cout << "parameter of centerConfigFile.xml" << endl;
FileStorage fsCen; FileStorage fsCen;
fsCen.open(configFileNameCenter, FileStorage::READ); fsCen.open(configFileNameCenter, FileStorage::READ);
if (!fsCen.isOpened()) if (!fsCen.isOpened())
...@@ -204,6 +207,10 @@ int main(int argc, char * argv[]) ...@@ -204,6 +207,10 @@ int main(int argc, char * argv[])
fsCen.release(); fsCen.release();
cout << "here" << endl;
system("pause");
//open camera config file //open camera config file
cv::String camParam (cameraParameterFile); cv::String camParam (cameraParameterFile);
Mat intrinsicsCameraMatrix, distortionCoeff; Mat intrinsicsCameraMatrix, distortionCoeff;
...@@ -229,8 +236,6 @@ int main(int argc, char * argv[]) ...@@ -229,8 +236,6 @@ int main(int argc, char * argv[])
cout << "distortion_coefficients = " << distortionCoeff << endl; cout << "distortion_coefficients = " << distortionCoeff << endl;
} }
cout.flush();
cout << "a) we process all frames " << endl; cout << "a) we process all frames " << endl;
int everyPic= 60*5; int everyPic= 60*5;
...@@ -242,13 +247,13 @@ int main(int argc, char * argv[]) ...@@ -242,13 +247,13 @@ int main(int argc, char * argv[])
vector<string> myFileListNoContour; //list for no contours found; vector<string> myFileListNoContour; //list for no contours found;
vector<string> myFileListAfterContourSelection; //list for no contours found after selection; vector<string> myFileListAfterContourSelection; //list for no contours found after selection;
cout << "here" << endl; //loop over _all_ picture of the tar archive
system("pause");
//loop over all picture of the tar archive, independing how many this are
for (;;) for (;;)
{ {
//measure time consumption //measure time consumption
//sa opencv tick timer:
// https://docs.opencv.org/4.x/d9/d6f/classcv_1_1TickMeter.html#details
clock_t begin = clock(); //for every single file clock_t begin = clock(); //for every single file
vector<char> vec; vector<char> vec;
...@@ -266,7 +271,7 @@ int main(int argc, char * argv[]) ...@@ -266,7 +271,7 @@ int main(int argc, char * argv[])
// get filename // get filename
const char *fileNamePtr = archive_entry_pathname(entry); const char *fileNamePtr = archive_entry_pathname(entry);
string filename(fileNamePtr,strlen(fileNamePtr) ); string filename(fileNamePtr,strlen(fileNamePtr) );
//cout << "fileName: " << filename <<endl; //cout << "fileName: " << filename << endl;
// convert it to a framenumber // convert it to a framenumber
frameCounter = toFrameNumber(filename); frameCounter = toFrameNumber(filename);
...@@ -281,7 +286,7 @@ int main(int argc, char * argv[]) ...@@ -281,7 +286,7 @@ int main(int argc, char * argv[])
r = archive_write_header(ext, entry); r = archive_write_header(ext, entry);
if (r != ARCHIVE_OK) if (r != ARCHIVE_OK)
{ {
cerr<< "archive_write_header() error: " << archive_error_string(ext)<<endl; cerr << "archive_write_header() error: " << archive_error_string(ext)<< endl;
myFileTarWriterHeaderCounter++; myFileTarWriterHeaderCounter++;
continue; //we overjump all in our for loop continue; //we overjump all in our for loop
} }
...@@ -293,7 +298,7 @@ int main(int argc, char * argv[]) ...@@ -293,7 +298,7 @@ int main(int argc, char * argv[])
r = archive_write_finish_entry(ext); r = archive_write_finish_entry(ext);
if (r != ARCHIVE_OK) if (r != ARCHIVE_OK)
{ {
cerr<< "archive_write_finish_entry: error: " << archive_error_string(ext) << " will abort" << endl; cerr << "archive_write_finish_entry: error: " << archive_error_string(ext) << " will abort" << endl;
exit(1); exit(1);
} }
...@@ -376,13 +381,13 @@ int main(int argc, char * argv[]) ...@@ -376,13 +381,13 @@ int main(int argc, char * argv[])
//over stepp all small areas //over stepp all small areas
if(area0<areaMinThreshold||area0>areaMaxThreshold) if(area0<areaMinThreshold||area0>areaMaxThreshold)
{ {
//cout<<i<< ":area0:" <<area0<< " dismissed " <<endl; //cout << i << ":area0:" << area0 << " dismissed " << endl;
//skipe if the area is too small //skipe if the area is too small
continue; continue;
} }
else else
{ {
//cout<<i<< ":area0:" <<area0<< " choose " <<endl; //cout << i << ":area0:" << area0 << " choose " << endl;
//get the center of this rectangle //get the center of this rectangle
Point2f center = minRect[i].center; Point2f center = minRect[i].center;
...@@ -438,18 +443,18 @@ int main(int argc, char * argv[]) ...@@ -438,18 +443,18 @@ int main(int argc, char * argv[])
if(!conHull.empty()) if(!conHull.empty())
{ {
muConvexHull = moments(conHull, true ); muConvexHull = moments(conHull, true );
muConvexHullMassCenter= Point2f( muConvexHull.m10/muConvexHull.m00 , muConvexHull.m01/muConvexHull.m00 ); muConvexHullMassCenter = Point2f( muConvexHull.m10/muConvexHull.m00 , muConvexHull.m01/muConvexHull.m00 );
} }
} }
else //end after selection is empty else //end after selection is empty
{ {
cerr<< "error, no contour found after selection in file: " << filename<<endl; cerr << "error, no contour found after selection in file: " << filename << endl;
myFileListAfterContourSelection.push_back(filename); myFileListAfterContourSelection.push_back(filename);
} }
}//end if contours are empty, to canny edge found nothing }//end if contours are empty, to canny edge found nothing
else else
{ {
cerr<< "error, no contour found at all in file: " << filename<<endl; cerr << "error, no contour found at all in file: " << filename << endl;
myFileListNoContour.push_back(filename); myFileListNoContour.push_back(filename);
} }
...@@ -458,26 +463,25 @@ int main(int argc, char * argv[]) ...@@ -458,26 +463,25 @@ int main(int argc, char * argv[])
if(!conHull.empty())//if we any elements, we process further if(!conHull.empty())//if we any elements, we process further
{ {
Mat imgConvexHull = Mat::zeros( img_input.size(), CV_8UC3 ); Mat imgConvexHull = Mat::zeros( img_input.size(), CV_8UC3 );
imgConvexHull = Scalar(255,255,255); //fille the picture imgConvexHull = Scalar(255,255,255); //fill the picture
Scalar colorB( 0,0,255,255 );//red polylines(imgConvexHull, hullComplete, true, color_red, 1, 8);
polylines(imgConvexHull, hullComplete, true, colorB, 1, 8);
//draw circle around //draw circle around
//circle( imgConvexHull, roiCenter, (int) roiRadius, colorB, 2, 8, 0 ); //circle( imgConvexHull, roiCenter, (int) roiRadius, color_red, 2, 8, 0 );
//we draw it //we draw it
cv::String outpath2= outputDir; cv::String outpath2 = outputDir;
ostringstream convert2; ostringstream convert2;
convert2 << outpath2 << TToolBox::mNzero(frameCounter) << "_convex_hull.jpg"; convert2 << outpath2 << TToolBox::mNzero(frameCounter) << "_convex_hull.jpg";
cv::imwrite(convert2.str().c_str(), imgConvexHull); cv::imwrite(convert2.str().c_str(), imgConvexHull);
} }
else else
cout<< "convex hull has no points will skip file: " << i<< endl; cout << "convex hull has no points will skip file: " << i << endl;
#endif #endif
//cout << " found center at : " << massCenters.at(0).x<< ";" << massCenters.at(0).y<< endl; //cout << " found center at : " << massCenters.at(0).x << ";" << massCenters.at(0).y << endl;
//! step 8: we write down all our results in yml file //! step 8: we write down all our results in yml file
string nameOutPutFileData = outputDir + TToolBox::mNzero(frameCounter) + ".yml"; string nameOutPutFileData = outputDir + TToolBox::mNzero(frameCounter) + ".yml";
...@@ -493,12 +497,11 @@ int main(int argc, char * argv[]) ...@@ -493,12 +497,11 @@ int main(int argc, char * argv[])
//! occasionaly write a dbg picture //! occasionaly write a dbg picture
if(frameCounter%everyPic==0) if(frameCounter%everyPic==0)
{ {
Scalar colorRed( 0,0,255,255 );//red
RNG rng(4344234); RNG rng(4344234);
Mat imgDebugPaint2 = Mat::zeros( img_input.size(), CV_8UC3 ); Mat imgDebugPaint2 = Mat::zeros( img_input.size(), CV_8UC3 );
imgDebugPaint2 = Scalar(255,255,255); //fill the picture white imgDebugPaint2 = Scalar(255,255,255); //fill the picture white
//we write all polyies of the selection and the mass centers with a random color // write all polyies of the selection and the mass centers with a random color
for( size_t i = 0; i< contourSelection.size(); i++ ) for( size_t i = 0; i< contourSelection.size(); i++ )
{ {
//random color //random color
...@@ -513,9 +516,9 @@ int main(int argc, char * argv[]) ...@@ -513,9 +516,9 @@ int main(int argc, char * argv[])
if(!conHull.empty()) if(!conHull.empty())
{ {
//the poly //the poly
polylines(imgDebugPaint2, conHull, true, colorRed, 1, 8); polylines(imgDebugPaint2, conHull, true, color_red, 1, 8);
//the center //the center
circle( imgDebugPaint2,muConvexHullMassCenter, 4, colorRed, -1, 8, 0 ); circle( imgDebugPaint2,muConvexHullMassCenter, 4, color_red, -1, 8, 0 );
} }
// copy // copy
...@@ -533,7 +536,7 @@ int main(int argc, char * argv[]) ...@@ -533,7 +536,7 @@ int main(int argc, char * argv[])
}//end if the loaded picture has data }//end if the loaded picture has data
else else
{ {
cerr<< "error loading file: " << filename<< ", will skip this file" << endl; cerr << "error loading file: " << filename << ", will skip this file" << endl;
myFileErrorList.push_back(filename); myFileErrorList.push_back(filename);
} }
...@@ -545,10 +548,10 @@ int main(int argc, char * argv[]) ...@@ -545,10 +548,10 @@ int main(int argc, char * argv[])
//calc the time which was used for all pictures //calc the time which was used for all pictures
clock_t endAll = clock(); clock_t endAll = clock();
double elapsedSecTotal = double(endAll - beginAll) / CLOCKS_PER_SEC; double elapsedSecTotal = double(endAll - beginAll) / CLOCKS_PER_SEC;
cout << "process single pic:\t" << elapsedSecs<< " s - \t\t" << (int)(elapsedSecTotal/60)<< " min -\t" << (int)(elapsedSecTotal/60/60)<< " h" << endl; cout << "process single pic:\t" << elapsedSecs << " s - \t\t" << (int)(elapsedSecTotal/60)<< " min -\t" << (int)(elapsedSecTotal/60/60)<< " h" << endl;
if(g_badSignalFlagAbort) if(g_badSignalFlagAbort)
frameCounter = amountFiles; //we abort frameCounter = amountFiles; // abort
//if(frameCounter>10)exit(0); //the test abort function //if(frameCounter>10)exit(0); //the test abort function
...@@ -557,7 +560,7 @@ int main(int argc, char * argv[]) ...@@ -557,7 +560,7 @@ int main(int argc, char * argv[])
//finishing time //finishing time
clock_t endAll = clock(); clock_t endAll = clock();
double elapsed = double(endAll - beginAll) / CLOCKS_PER_SEC; double elapsed = double(endAll - beginAll) / CLOCKS_PER_SEC;
cout << "process : " << amountFiles<< " files took:\t" << (int)(elapsed/60)<< " min -\t" << (int)(elapsed/60/60)<< " h \n in total" << endl; cout << "process : " << amountFiles << " files took:\t" << (int)(elapsed/60)<< " min -\t" << (int)(elapsed/60/60)<< " h \n in total" << endl;
// //we write the random file list to a file // //we write the random file list to a file
// string nameOutRandomFile = outputDir + "randlist.yml"; // string nameOutRandomFile = outputDir + "randlist.yml";
...@@ -567,7 +570,7 @@ int main(int argc, char * argv[]) ...@@ -567,7 +570,7 @@ int main(int argc, char * argv[])
//TODO we should merge the file //TODO we should merge the file
cout<< "amount of libarchive read header errors :" << myFileTarWriterHeaderCounter; cout << "amount of libarchive read header errors :" << myFileTarWriterHeaderCounter;
// write the random file list to a file // write the random file list to a file
string nameOutErrorList = outputDir + "fileErrorList.yml"; string nameOutErrorList = outputDir + "fileErrorList.yml";
......
This diff is collapsed.
point2f(y,x) # inverted! point2f(y,x) # inverted!
BGR #not rgb ...
Scalar = 4 element vector
CV_RGB(r, g, b) #from bgs
Types: Types:
#depth #depth
...@@ -10,27 +14,67 @@ Types: ...@@ -10,27 +14,67 @@ Types:
CV_32F float CV_32F float
CV_64F double CV_64F double
# + channels C1..4 eg RGBA: # + channels C1..4 eg RGBA:
# eg Mat M(2,2, CV_8UC3, Scalar(0,0,255));
0 to 255 for CV_8U images
0 to 65535 for CV_16U images
0 to 1 for CV_32F images
Camera Calibration: Camera Calibration:
distortion_coefficients - 5 values distortion_coefficients - 5 values
camera_matrix - 3x3 matrix - eg focal length etc. camera_matrix - 3x3 matrix - eg focal length etc.
might need to calibrate using chess board, to get values different methods:
sa https://docs.opencv.org/4.x/d7/d21/tutorial_interactive_calibration.html
https://github.com/abidrahmank/OpenCV2-Python-Tutorials/blob/master/source/py_tutorials/py_calib3d/py_calibration/py_calibration.rst https://docs.opencv.org/4.x/d6/d55/tutorial_table_of_content_calib3d.html
# using chess board, to get values
https://github.com/abidrahmank/OpenCV2-Python-Tutorials/blob/master/source/py_tutorials/py_calib3d/py_calibration/py_calibration.rs
roi - region of interest
x, y, w, h
// roi as subset of full data image
Mat D (A, Rect(10, 10, 100, 100) ); // using a rectangle
Mat E = A(Range::all(), Range(1,3)); // using row and column boundaries
Matrix
Fill matrix with random values
Mat R = Mat(3, 2, CV_8UC3);
randu(R, Scalar::all(0), Scalar::all(255));
Formatted output
cout << "R (csv) = " << endl << format(R, Formatter::FMT_CSV ) << endl << endl;
#sa FMT_C/PYTHON/NUMPY/CSV
MISC
glob( dir, file )
CommandLineParser
randu() # https://docs.opencv.org/4.x/d2/de8/group__core__array.html#ga1ba1026dca0807b27057ba6a49d258c0
cvtColor(img, img, COLOR_BGR2Luv); #convert color
roi - region of interest - x, y, w, h
BS: BS:
https://docs.opencv.org/4.x/da/d5c/tutorial_canny_detector.html
https://docs.opencv.org/4.x/d1/dc5/tutorial_background_subtraction.html https://docs.opencv.org/4.x/d1/dc5/tutorial_background_subtraction.html
https://web.archive.org/web/20140418093037/http://bmc.univ-bpclermont.fr/ https://web.archive.org/web/20140418093037/http://bmc.univ-bpclermont.fr/
https://web.archive.org/web/20140221195750/http://docs.opencv.org/trunk/doc/tutorials/video/background_subtraction/background_subtraction.html https://web.archive.org/web/20140221195750/http://docs.opencv.org/trunk/doc/tutorials/video/background_subtraction/background_subtraction.html
https://www.pyimagesearch.com/2020/07/27/opencv-grabcut-foreground-segmentation-and-extraction/ https://www.pyimagesearch.com/2020/07/27/opencv-grabcut-foreground-segmentation-and-extraction/
https://learnopencv.com/applications-of-foreground-background-separation-with-semantic-segmentation/ https://learnopencv.com/applications-of-foreground-background-separation-with-semantic-segmentation/
https://docs.opencv.org/4.x/d2/d55/group__bgsegm.html https://docs.opencv.org/4.x/d2/d55/group__bgsegm.html
https://docs.opencv.org/4.x/d5/de8/samples_2cpp_2segment_objects_8cpp-example.html#_a15
tuts:)) tuts:))
https://docs.opencv.org/4.x/d6/d00/tutorial_py_root.html https://docs.opencv.org/4.x/d6/d00/tutorial_py_root.html
https://datahacker.rs/opencv-thresholding/
# median frame as bg + frame difference
https://learnopencv.com/simple-background-estimation-in-videos-using-opencv-c-python/
https://learnopencv.com/contour-detection-using-opencv-python-c/
https://learnopencv.com/deep-learning-with-opencvs-dnn-module-a-definitive-guide/
moments
https://docs.opencv.org/4.x/d0/d49/tutorial_moments.html
#include "ttoolbox.h" #include "ttoolbox.h"
/*
http://docs.opencv.org/2.4/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.html
https://learnopencv.com/edge-detection-using-opencv/
https://learnopencv.com/contour-detection-using-opencv-python-c/
*/
std::string TToolBox::mNzero(int i) std::string TToolBox::mNzero(int i)
{ {
std::ostringstream convert; std::ostringstream convert;
...@@ -10,37 +14,36 @@ std::string TToolBox::mNzero(int i) ...@@ -10,37 +14,36 @@ std::string TToolBox::mNzero(int i)
} }
std::string TToolBox::getFileName(int i) std::string TToolBox::getFileName(int i)
{ {
std::string fileName =std::string ( std::string ("/data/")+ mNzero(i) + std::string (".jpg")); std::string fileName = std::string ( std::string ("/data/") + mNzero(i) + std::string (".jpg"));
return fileName; return fileName;
} }
std::vector<std::vector<cv::Point>> TToolBox::applyCannyEdgeAndCalcCountours(cv::Mat imgSource, double threshholdMin, double threshholdMax, int apertureSize) std::vector<std::vector<cv::Point>> TToolBox::applyCannyEdgeAndCalcCountours(cv::Mat imgSource, double threshholdMin, double threshholdMax, int apertureSize)
{ {
cv::Mat imgCannyEdge; //TODO: check if clone is necessary or if it wastes ressources by doing unneccessary copies of frames
std::vector<std::vector<cv::Point> > contours;
std::vector<cv::Vec4i> hierarchy;
//! 2 make a copy //! make a copy
cv::Mat imgBinary = imgSource.clone(); cv::Mat imgBinary = imgSource.clone();
//imgMarkBinary = Scalar(255,255,255); //fill white
//! 3 apply binary filter not reduce noise //! apply binary filter not reduce noise
//method to threshold important changes // > method to threshold important changes
int binaryThreshold = 80; //TODO as parameter int binaryThreshold = 80; //TODO as parameter
imgBinary = imgSource > binaryThreshold; imgBinary = imgSource > binaryThreshold;
//! smooth with gaussian filter to suppress no connected lines
//! 4 smooth with gaussian filter to suppress no connected lines //add a gaussian filter
//add a gaussian filter //see http://docs.opencv.org/2.4/doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.html
cv::Mat imgSmoothed = imgBinary.clone(); cv::Mat imgSmoothed = imgBinary.clone();
int exclusPara3 = 3; //TODO as parameter int exclusPara3 = 3; //TODO as parameter
cv::GaussianBlur(imgBinary,imgSmoothed,cv::Size(exclusPara3,exclusPara3),0); //0 = BORDER_CONSTANT cv::GaussianBlur(imgBinary,imgSmoothed,cv::Size(exclusPara3,exclusPara3),0); //0 = BORDER_CONSTANT
//! 5 we make the canny edge detect //! detect edges using canny
// Detect edges using canny cv::Mat imgCannyEdge;
cv::Canny( imgSmoothed, imgCannyEdge, threshholdMin, threshholdMax, apertureSize ); cv::Canny( imgSmoothed, imgCannyEdge, threshholdMin, threshholdMax, apertureSize );
// Find contours, use RETR_EXTERNAL ignore inner child structures, TREE more usefull ? //! find contours
// use RETR_EXTERNAL ignore inner child structures, TREE more useful ?
std::vector<std::vector<cv::Point> > contours;
std::vector<cv::Vec4i> hierarchy;
cv::findContours( imgCannyEdge, contours, hierarchy, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0) ); cv::findContours( imgCannyEdge, contours, hierarchy, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0) );
#define MC_SHOW_STEP_ANALYSE #define MC_SHOW_STEP_ANALYSE
...@@ -65,7 +68,6 @@ std::vector<std::vector<cv::Point>> TToolBox::applyCannyEdgeAndCalcCountours(cv: ...@@ -65,7 +68,6 @@ std::vector<std::vector<cv::Point>> TToolBox::applyCannyEdgeAndCalcCountours(cv:
#endif #endif
// return minRect;
return contours; return contours;
} }
...@@ -73,7 +75,7 @@ std::vector<std::vector<cv::Point>> TToolBox::applyCannyEdgeAndCalcCountours(cv: ...@@ -73,7 +75,7 @@ std::vector<std::vector<cv::Point>> TToolBox::applyCannyEdgeAndCalcCountours(cv:
cv::Mat TToolBox::cropImageCircle(cv::Mat image, int x, int y, int r) cv::Mat TToolBox::cropImageCircle(cv::Mat image, int x, int y, int r)
{ {
// Your Hough circle // Hough circle
cv::Vec3f circ(x,y,r); cv::Vec3f circ(x,y,r);
// Draw the mask: white circle on black background // Draw the mask: white circle on black background
...@@ -87,7 +89,7 @@ cv::Mat TToolBox::cropImageCircle(cv::Mat image, int x, int y, int r) ...@@ -87,7 +89,7 @@ cv::Mat TToolBox::cropImageCircle(cv::Mat image, int x, int y, int r)
// Create a black image // Create a black image
cv::Mat res = cv::Mat::zeros( image.size(), CV_8UC3 ); cv::Mat res = cv::Mat::zeros( image.size(), CV_8UC3 );
res = cv::Scalar(0,0,0); //fill with black color res = cv::Scalar(0,0,0); //fill with black color //needed? isnt it initd with zeros above?
// Copy only the image under the white circle to black image // Copy only the image under the white circle to black image
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment