Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
b967f1f4
Commit
b967f1f4
authored
Jul 13, 2011
by
Davis King
Browse files
Made code a little easier to read.
parent
a5ecb1fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
dlib/image_transforms/image_pyramid.h
dlib/image_transforms/image_pyramid.h
+18
-12
No files found.
dlib/image_transforms/image_pyramid.h
View file @
b967f1f4
...
...
@@ -441,18 +441,21 @@ namespace dlib
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
in_image_type
::
type
>::
has_alpha
==
false
);
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
out_image_type
::
type
>::
has_alpha
==
false
);
const
long
size_in
=
3
;
const
long
size_out
=
2
;
typedef
typename
pixel_traits
<
typename
in_image_type
::
type
>::
basic_pixel_type
bp_type
;
typedef
typename
promote
<
bp_type
>::
type
ptype
;
down
.
set_size
(
2
*
((
original
.
nr
()
-
2
)
/
3
),
2
*
((
original
.
nc
()
-
2
)
/
3
));
down
.
set_size
(
size_out
*
((
original
.
nr
()
-
2
)
/
size_in
),
size_out
*
((
original
.
nc
()
-
2
)
/
size_in
));
long
rr
=
1
;
for
(
long
r
=
0
;
r
<
down
.
nr
();
r
+=
2
)
for
(
long
r
=
0
;
r
<
down
.
nr
();
r
+=
size_out
)
{
long
cc
=
1
;
for
(
long
c
=
0
;
c
<
down
.
nc
();
c
+=
2
)
for
(
long
c
=
0
;
c
<
down
.
nc
();
c
+=
size_out
)
{
ptype
block
[
3
][
3
];
ptype
block
[
size_in
][
size_in
];
separable_3x3_filter_block_grayscale
(
block
,
original
,
rr
,
cc
,
3
,
10
,
3
);
// bi-linearly interpolate block
...
...
@@ -461,9 +464,9 @@ namespace dlib
assign_pixel
(
down
[
r
+
1
][
c
]
,
(
block
[
2
][
0
]
*
9
+
block
[
1
][
0
]
*
3
+
block
[
2
][
1
]
*
3
+
block
[
1
][
1
])
/
(
16
));
assign_pixel
(
down
[
r
+
1
][
c
+
1
]
,
(
block
[
2
][
2
]
*
9
+
block
[
1
][
2
]
*
3
+
block
[
2
][
1
]
*
3
+
block
[
1
][
1
])
/
(
16
));
cc
+=
3
;
cc
+=
size_in
;
}
rr
+=
3
;
rr
+=
size_in
;
}
}
...
...
@@ -502,16 +505,19 @@ namespace dlib
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
in_image_type
::
type
>::
has_alpha
==
false
);
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
out_image_type
::
type
>::
has_alpha
==
false
);
down
.
set_size
(
2
*
((
original
.
nr
()
-
2
)
/
3
),
2
*
((
original
.
nc
()
-
2
)
/
3
));
const
long
size_in
=
3
;
const
long
size_out
=
2
;
down
.
set_size
(
size_out
*
((
original
.
nr
()
-
2
)
/
size_in
),
size_out
*
((
original
.
nc
()
-
2
)
/
size_in
));
long
rr
=
1
;
for
(
long
r
=
0
;
r
<
down
.
nr
();
r
+=
2
)
for
(
long
r
=
0
;
r
<
down
.
nr
();
r
+=
size_out
)
{
long
cc
=
1
;
for
(
long
c
=
0
;
c
<
down
.
nc
();
c
+=
2
)
for
(
long
c
=
0
;
c
<
down
.
nc
();
c
+=
size_out
)
{
rgbptype
block
[
3
][
3
];
rgbptype
block
[
size_in
][
size_in
];
separable_3x3_filter_block_rgb
(
block
,
original
,
rr
,
cc
,
3
,
10
,
3
);
// bi-linearly interpolate block
...
...
@@ -531,9 +537,9 @@ namespace dlib
down
[
r
+
1
][
c
+
1
].
green
=
(
block
[
2
][
2
].
green
*
9
+
block
[
1
][
2
].
green
*
3
+
block
[
2
][
1
].
green
*
3
+
block
[
1
][
1
].
green
)
/
(
16
*
256
);
down
[
r
+
1
][
c
+
1
].
blue
=
(
block
[
2
][
2
].
blue
*
9
+
block
[
1
][
2
].
blue
*
3
+
block
[
2
][
1
].
blue
*
3
+
block
[
1
][
1
].
blue
)
/
(
16
*
256
);
cc
+=
3
;
cc
+=
size_in
;
}
rr
+=
3
;
rr
+=
size_in
;
}
}
...
...
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