Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
panoramic
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Luis Penaranda
panoramic
Commits
8e1fbd14
Commit
8e1fbd14
authored
Aug 12, 2013
by
Luis Penaranda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the Zorin-Barr transformation
parent
a5318a15
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
5 deletions
+71
-5
openglcanvas.cpp
openglcanvas.cpp
+39
-0
openglcanvas.h
openglcanvas.h
+1
-0
pano_interface_1.pro
pano_interface_1.pro
+4
-0
panowindow1.ui
panowindow1.ui
+5
-0
shaders/test_vertex_shader.vert
shaders/test_vertex_shader.vert
+22
-5
No files found.
openglcanvas.cpp
View file @
8e1fbd14
...
...
@@ -40,6 +40,8 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
fov_scale_relation
=
"Naive"
;
visualization
=
"Moebius"
;
auto_fov_max
=
false
;
zblambda
=
.1
f
;
// Zorin-Barr transformation lambda
zbR
=
1.
f
;
// Zorin-Barr transformation R
time_frames
=
0
;
time_timer
.
setInterval
(
0
);
...
...
@@ -248,6 +250,19 @@ void OpenGLCanvas::read_config_file(){
auto_fov_max
=
atof
(
read_line
);
fprintf
(
stderr
,
"auto_max_fov=%d
\n
"
,
auto_fov_max
);
}
// check for the Zorin-Barr transformation parameters, lambda and R
if
(
!
strncmp
(
line
,
"zblambda="
,
9
)){
strcpy
(
read_line
,
line
+
9
);
read_line
[
strlen
(
line
)
-
10
]
=
'\0'
;
zblambda
=
atof
(
read_line
);
fprintf
(
stderr
,
"zblambda=%f
\n
"
,
zblambda
);
}
if
(
!
strncmp
(
line
,
"zbR="
,
4
)){
strcpy
(
read_line
,
line
+
4
);
read_line
[
strlen
(
line
)
-
5
]
=
'\0'
;
zbR
=
atof
(
read_line
);
fprintf
(
stderr
,
"zbR=%f
\n
"
,
zbR
);
}
}
fclose
(
rcfile
);
}
...
...
@@ -475,6 +490,24 @@ void OpenGLCanvas::vertex_transformation(float *positions, int m, int n, float c
positions
[
3
*
(
j
+
i
*
n
)
+
2
]
=
z
;
}
// perspective
if
(
visualization
==
"Zorin-Barr"
){
// perspective
u
=
x
/
(
-
z
);
v
=
y
/
(
-
z
);
// apply Z-B transformation to (u,v)
float
lambda
=
.1
f
;
float
R
=
1.
f
;
float
alpha
=
atanf
(
v
/
u
);
float
r
=
hypotf
(
u
,
v
);
float
rhoprime
=
(
lambda
*
r
/
R
)
+
(
1.
f
-
lambda
)
*
(
R
*
(
sqrtf
(
r
*
r
+
1.
f
)
-
1.
f
))
/
(
r
*
(
sqrtf
(
R
*
R
+
1.
f
)
-
1.
f
));
u
=
rhoprime
*
cosf
(
alpha
);
v
=
rhoprime
*
sinf
(
alpha
);
//
positions
[
3
*
(
j
+
i
*
n
)]
=
u
/
extent
;
positions
[
3
*
(
j
+
i
*
n
)
+
1
]
=
v
/
extent
;
positions
[
3
*
(
j
+
i
*
n
)
+
2
]
=
z
;
}
}
}
...
...
@@ -546,6 +579,11 @@ float OpenGLCanvas::calculate_extent(float fov_rads){
// Write now it's olny showing the entire panorama intead of
// the corresponging FOV.
}
if
(
visualization
==
"Zorin-Barr"
){
// TODO: check whether this is correct
u
=
x
/
(
-
z
);
v
=
y
/
(
-
z
);
}
return
u
;
}
...
...
@@ -724,6 +762,7 @@ void OpenGLCanvas::paintGL(){
else
if
(
visualization
==
"Equi-Rectangular"
)
vis_mode
=
3.0
;
else
if
(
visualization
==
"Stereographic"
)
vis_mode
=
4.0
;
else
if
(
visualization
==
"Mercator"
)
vis_mode
=
5.0
;
else
if
(
visualization
==
"Zorin-Barr"
)
vis_mode
=
6.0
;
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glOrtho
(
0.0
,
2.0
/
extent
,
0.0
,
2.0
/
scale
,
0.0
,
-
2.0
/
vis_mode
);
...
...
openglcanvas.h
View file @
8e1fbd14
...
...
@@ -71,6 +71,7 @@ private:
QString
fov_scale_relation
;
QString
visualization
;
bool
auto_fov_max
;
float
zblambda
,
zbR
;
// parameters of the Zorin-Barr transformation
Chronos
time_time
;
QTimer
time_timer
;
...
...
pano_interface_1.pro
View file @
8e1fbd14
...
...
@@ -76,3 +76,7 @@ HEADERS += panowindow1.h \
files
.
h
FORMS
+=
panowindow1
.
ui
OTHER_FILES
+=
\
shaders
/
fragment_shader
.
frag
\
shaders
/
test_vertex_shader
.
vert
panowindow1.ui
View file @
8e1fbd14
...
...
@@ -202,6 +202,11 @@
<string>
Mercator
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Zorin-Barr
</string>
</property>
</item>
</widget>
</item>
<item
row=
"12"
column=
"1"
>
...
...
shaders/test_vertex_shader.vert
View file @
8e1fbd14
...
...
@@ -4,6 +4,7 @@ float u, v, x, y, z;
varying
float
r
,
theta
,
s
;
float
lambda
,
phi
;
float
extent
,
scale
,
vis_mode
,
center_lambda
,
center_phi
;
varying
float
zbu
,
zbv
,
zblambda
,
zbr
,
zbR
,
zbalpha
,
zbrho
;
void
main
(
void
){
...
...
@@ -58,23 +59,39 @@ void main(void){
phi
=
asin
(
y
)
/
1
.
5708
;
// Visualize using specified visualization (remove for timings in the paper! Use only "Perspective" in the paper!)
if
(
vis_mode
==
1
.
0
)
{
if
(
vis_mode
==
1
.
0
)
{
// Moebius
u
=
x
/
(
-
z
);
v
=
y
/
(
-
z
);
gl_Position
=
vec4
(
u
/
extent
,
v
/
extent
,
z
,
1
.
0
);
}
else
if
(
vis_mode
==
2
.
0
)
gl_Position
=
vec4
(
0
.
9
*
x
,
0
.
9
*
y
,
z
,
1
.
0
);
else
if
(
vis_mode
==
3
.
0
)
gl_Position
=
vec4
(
lambda
,
phi
,
z
,
1
.
0
);
else
if
(
vis_mode
==
4
.
0
)
{
else
if
(
vis_mode
==
2
.
0
)
// 3D Sphere
gl_Position
=
vec4
(
0
.
9
*
x
,
0
.
9
*
y
,
z
,
1
.
0
);
else
if
(
vis_mode
==
3
.
0
)
// Equi-Rectangular
gl_Position
=
vec4
(
lambda
,
phi
,
z
,
1
.
0
);
else
if
(
vis_mode
==
4
.
0
)
{
// Stereographic
u
=
2
.
f
*
x
/
(
-
z
+
1
);
v
=
2
.
f
*
y
/
(
-
z
+
1
);
gl_Position
=
vec4
(
u
/
extent
,
v
/
extent
,
z
,
1
.
0
);
}
else
if
(
vis_mode
==
5
.
0
)
{
else
if
(
vis_mode
==
5
.
0
)
{
// Mercator
u
=
lambda
;
v
=
log
((
1
.
0
/
cos
(
phi
))
+
tan
(
phi
));
gl_Position
=
vec4
(
u
,
v
,
z
,
1
.
0
);
}
else
if
(
vis_mode
==
6
.
0
)
{
// Zorin-Barr
// perspective projection
zbu
=
x
/
(
-
z
);
zbv
=
y
/
(
-
z
);
// Z-B transformation
zblambda
=
0
.
1
;
zbR
=
1
.
0
;
zbalpha
=
atan
(
zbv
,
zbu
);
zbr
=
sqrt
(
zbu
*
zbu
+
zbv
*
zbv
);
zbrho
=
(
zblambda
*
zbr
/
zbR
)
+
(
1
.
0
-
zblambda
)
*
(
zbR
*
(
sqrt
(
zbr
*
zbr
+
1
.
0
)
-
1
.
0
))
/
(
zbr
*
(
sqrt
(
zbR
*
zbR
+
1
.
0
)
-
1
.
0
));
u
=
zbrho
*
cos
(
zbalpha
);
v
=
zbrho
*
sin
(
zbalpha
);
gl_Position
=
vec4
(
u
/
extent
,
v
/
extent
,
z
,
1
.
0
);
}
// gl_Position = vec4(u/2.0,v/2.0,z,1.0);
...
...
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