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
35a6408f
Commit
35a6408f
authored
May 28, 2011
by
Davis King
Browse files
Simplified examples by using load_image() instead of load_bmp()
parent
739c68ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
26 deletions
+14
-26
examples/image_ex.cpp
examples/image_ex.cpp
+7
-13
examples/surf_ex.cpp
examples/surf_ex.cpp
+7
-13
No files found.
examples/image_ex.cpp
View file @
35a6408f
...
...
@@ -34,23 +34,16 @@ int main(int argc, char** argv)
return
1
;
}
// Here we open the image file. Note that when you open a binary file with
// the C++ ifstream you must supply the ios::binary flag.
ifstream
fin
(
argv
[
1
],
ios
::
binary
);
if
(
!
fin
)
{
cout
<<
"error, can't find "
<<
argv
[
1
]
<<
endl
;
return
1
;
}
// Here we declare an image object that can store rgb_pixels. Note that in
// dlib there is no explicit image object, just a 2D array and
// various pixel types.
array2d
<
rgb_pixel
>::
kernel_1a
img
;
// now load the bmp file into our image. If the file isn't really a BMP
// or is corrupted then load_bmp() will throw an exception.
load_bmp
(
img
,
fin
);
// Now load the image file into our image. If something is wrong then
// load_image() will throw an exception. Also, if you compiled with libpng
// and libjpeg then load_image() can also load PNG and JPEG files in addition
// to BMP files.
load_image
(
img
,
argv
[
1
]);
// Now lets use some image functions. This example is going to perform
// simple edge detection on the image. First lets find the horizontal and
...
...
@@ -66,7 +59,8 @@ int main(int argc, char** argv)
// window to display them on the screen.
// create a window to display the edge image
// create a window to display the edge image. (Note that you can zoom into
// the window by holding CTRL and scrolling the mouse wheel)
image_window
my_window
(
edge_image
);
// also make a window to display the original image
...
...
examples/surf_ex.cpp
View file @
35a6408f
...
...
@@ -40,28 +40,22 @@ int main(int argc, char** argv)
return
1
;
}
// Here we open the image file. Note that when you open a binary file with
// the C++ ifstream you must supply the ios::binary flag.
ifstream
fin
(
argv
[
1
],
ios
::
binary
);
if
(
!
fin
)
{
cout
<<
"error, can't find "
<<
argv
[
1
]
<<
endl
;
return
1
;
}
// Here we declare an image object that can store rgb_pixels. Note that in
// dlib there is no explicit image object, just a 2D array and
// various pixel types.
array2d
<
rgb_pixel
>::
kernel_1a
img
;
// now load the bmp file into our image. If the file isn't really a BMP
// or is corrupted then load_bmp() will throw an exception.
load_bmp
(
img
,
fin
);
// Now load the image file into our image. If something is wrong then
// load_image() will throw an exception. Also, if you compiled with libpng
// and libjpeg then load_image() can also load PNG and JPEG files in addition
// to BMP files.
load_image
(
img
,
argv
[
1
]);
// get the 100 strongest SURF points from the image
std
::
vector
<
surf_point
>
sp
=
get_surf_points
(
img
,
100
);
// create a window to display the input image and the SURF boxes
// create a window to display the input image and the SURF boxes. (Note that
// you can zoom into the window by holding CTRL and scrolling the mouse wheel)
image_window
my_window
(
img
);
// Now lets draw some rectangles on top of the image so we can see where
...
...
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