Skip to content
Snippets Groups Projects
Commit c314c52b authored by simon.fanetti's avatar simon.fanetti
Browse files

cleaning

parent 20213e24
No related branches found
No related tags found
No related merge requests found
...@@ -15,8 +15,6 @@ using namespace cv; ...@@ -15,8 +15,6 @@ using namespace cv;
Mat coloredFrame(Mat frameDepth); Mat coloredFrame(Mat frameDepth);
void showLevel(); void showLevel();
void showDiff(); void showDiff();
//vector<int> findCercleZ(Mat &rgb);
//void trackCircle();
...@@ -26,7 +24,7 @@ void (*apps[2])() = {showLevel, showDiff}; ...@@ -26,7 +24,7 @@ void (*apps[2])() = {showLevel, showDiff};
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(client.loadConfig()){ if(client.loadConfig()){
std::cout << "Error : Couldn't load the configuration" << std::endl; std::cout << "Failed to load the configuration" << std::endl;
return 1; return 1;
} }
...@@ -39,33 +37,34 @@ int main(int argc, char *argv[]) ...@@ -39,33 +37,34 @@ int main(int argc, char *argv[])
apps[n]();*/ apps[n]();*/
} }
void showLevel() void showLevel(){
{
char windowName[] = "Sandbox";
Mat frameData; Mat frameData;
Mat colored; Mat colored;
Mat proj_frame;
//client.initWindowsFullScreen(); //Mat proj_frame;
cv::namedWindow(windowName, CV_WINDOW_AUTOSIZE); //char windowName[] = "Sandbox";
//cv::namedWindow(windowName, CV_WINDOW_AUTOSIZE);
client.initWindowsFullScreen();
do{ do{
client.getDepthFrame().copyTo(frameData); client.getDepthFrame().copyTo(frameData);
colored = coloredFrame(frameData); colored = coloredFrame(frameData);
colored.copyTo(proj_frame); //colored.copyTo(proj_frame);
Mat* res = client.adjustProjection(&proj_frame); //Mat* res = client.adjustProjection(&proj_frame);
cv::imshow(windowName, *res); //cv::imshow(windowName, *res);
//client.showImage(&colored); client.showImage(&colored);
} while (waitKey(10) != ESCAPE_CHAR); } while (waitKey(10) != ESCAPE_CHAR);
cv::destroyAllWindows(); cv::destroyAllWindows();
} }
Mat coloredFrame(Mat frameDepth) Mat coloredFrame(Mat frameDepth){
{
Mat depthFrameColored(frameDepth.size(), CV_8U); Mat depthFrameColored(frameDepth.size(), CV_8U);
int width = frameDepth.cols, height = frameDepth.rows; int width = frameDepth.cols, height = frameDepth.rows;
static uint32_t histogram[0x10000]; static uint32_t histogram[0x10000];
...@@ -103,6 +102,7 @@ Mat coloredFrame(Mat frameDepth) ...@@ -103,6 +102,7 @@ Mat coloredFrame(Mat frameDepth)
return depthFrameColored; return depthFrameColored;
} }
void showDiff(){ void showDiff(){
/* /*
Mat frameData; Mat frameData;
...@@ -130,51 +130,3 @@ void showDiff(){ ...@@ -130,51 +130,3 @@ void showDiff(){
destroyAllWindows(); destroyAllWindows();
*/ */
} }
/*
vector<int> findCercleZ(Mat &rgb)
{
Mat src_gray;
cvtColor(rgb, src_gray, CV_BGR2GRAY);
/// Reduce the noise so we avoid false circle detection
GaussianBlur(src_gray, src_gray, Size(9, 9), 2, 2);
vector<Vec3f> circles;
circles.clear();
/// Apply the Hough Transform to find the circles
//source, output, method, inverse ratio of resolution, Minimum distance between detected centers, threeshold canny, threeshold center, min radius, max radius
HoughCircles(src_gray, circles, CV_HOUGH_GRADIENT, 1, src_gray.rows / 4, 75, 50, 0, 0);
//doit tester si le cercle est bon (rayon);
vector<int> result;
if (!circles.empty())
{
for (int i = 0; i < 3; i++)
{
result.push_back(round(circles[0][i]));
}
}
return result;
}
void trackCircle()
{
Mat frameRGB;
client.getRGBFrame(&frameRGB);
Mat frameColor(frameRGB.size(), CV_8UC3, Scalar(0, 0, 0));
do
{
client.getRGBFrame(&frameRGB);
vector<int> cercle = findCercleZ(frameRGB);
if (!cercle.empty())
{
Point circlePosition(cercle[0], cercle[1]);
cv::circle(frameColor, circlePosition, 3, Scalar(0, 255, 0), -1, 8, 0); // point without transformation
cout << circlePosition.x << "x" << circlePosition.y << endl;
}
client.showImage(frameColor);
frameColor.setTo(Scalar(0,0,0));
} while (waitKey(100) != ESCAPE_CHAR);
destroyAllWindows();
}*/
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment