Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
06b0fa6f
Commit
06b0fa6f
authored
May 13, 2015
by
laurentBerger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BLOB_MSER avec opengl
parent
e7fcffee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
1 deletion
+99
-1
BLOB_MSER.cpp
samples/cpp/BLOB_MSER.cpp
+99
-1
No files found.
samples/cpp/BLOB_MSER.cpp
View file @
06b0fa6f
#include <opencv2/opencv.hpp>
#include "opencv2/core/opengl.hpp"
#include <vector>
#include <map>
#include <iostream>
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN 1
#define NOMINMAX 1
#include <windows.h>
#endif
#if defined(_WIN64)
#include <windows.h>
#endif
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
using
namespace
std
;
using
namespace
cv
;
void
Example_MSER
(
vector
<
String
>
&
fileName
);
static
void
help
()
...
...
@@ -96,10 +115,84 @@ String Legende(SimpleBlobDetector::Params &pAct)
}
const
int
win_width
=
800
;
const
int
win_height
=
640
;
struct
DrawData
{
ogl
::
Arrays
arr
;
ogl
::
Texture2D
tex
;
ogl
::
Buffer
indices
;
};
void
draw
(
void
*
userdata
);
void
draw
(
void
*
userdata
)
{
DrawData
*
data
=
static_cast
<
DrawData
*>
(
userdata
);
glRotated
(
0.6
,
0
,
1
,
0
);
ogl
::
render
(
data
->
arr
,
data
->
indices
,
ogl
::
TRIANGLES
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
Mat
imgcol
=
imread
(
"../data/lena.jpg"
);
namedWindow
(
"OpenGL"
,
WINDOW_OPENGL
);
//resizeWindow("OpenGL", win_width, win_height);
Mat_
<
Vec3f
>
vertex
(
1
,
4
);
vertex
<<
Vec3f
(
-
1
,
1
,
0
),
Vec3f
(
-
1
,
-
1
,
0
),
Vec3f
(
1
,
-
1
,
1
),
Vec3f
(
1
,
1
,
-
1
);
Mat_
<
Vec2f
>
texCoords
(
1
,
4
);
texCoords
<<
Vec2f
(
0
,
0
),
Vec2f
(
0
,
1
),
Vec2f
(
1
,
1
),
Vec2f
(
1
,
0
);
Mat_
<
int
>
indices
(
1
,
6
);
indices
<<
0
,
1
,
2
,
2
,
3
,
0
;
DrawData
*
data
=
new
DrawData
;
data
->
arr
.
setVertexArray
(
vertex
);
data
->
arr
.
setTexCoordArray
(
texCoords
);
data
->
indices
.
copyFrom
(
indices
);
data
->
tex
.
copyFrom
(
imgcol
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
gluPerspective
(
45.0
,
(
double
)
win_width
/
win_height
,
0.1
,
100.0
);
glMatrixMode
(
GL_MODELVIEW
);
glLoadIdentity
();
gluLookAt
(
0
,
0
,
3
,
0
,
0
,
0
,
0
,
1
,
0
);
glEnable
(
GL_TEXTURE_2D
);
data
->
tex
.
bind
();
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR
);
glTexEnvi
(
GL_TEXTURE_2D
,
GL_TEXTURE_ENV_MODE
,
GL_REPLACE
);
glDisable
(
GL_CULL_FACE
);
setOpenGlDrawCallback
(
"OpenGL"
,
draw
,
data
);
for
(;;)
{
updateWindow
(
"OpenGL"
);
int
key
=
waitKey
(
40
);
if
((
key
&
0xff
)
==
27
)
break
;
}
setOpenGlDrawCallback
(
"OpenGL"
,
0
,
0
);
destroyAllWindows
();
vector
<
String
>
fileName
;
Example_MSER
(
fileName
);
Mat
img
(
600
,
800
,
CV_8UC1
);
...
...
@@ -339,6 +432,11 @@ void Example_MSER(vector<String> &fileName)
}
int
channel
=
1
;
int
histSize
=
256
;
float
range
[]
=
{
0
,
256
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment