Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ar_sandbox_app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AR_Sandbox
ar_sandbox_app
Commits
c314c52b
Commit
c314c52b
authored
5 years ago
by
simon.fanetti
Browse files
Options
Downloads
Patches
Plain Diff
cleaning
parent
20213e24
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app.cpp
+16
-64
16 additions, 64 deletions
app.cpp
with
16 additions
and
64 deletions
app.cpp
+
16
−
64
View file @
c314c52b
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment