Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
35a6408f
Commit
35a6408f
authored
May 28, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified examples by using load_image() instead of load_bmp()
parent
739c68ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
26 deletions
+14
-26
image_ex.cpp
examples/image_ex.cpp
+7
-13
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)
...
@@ -34,23 +34,16 @@ int main(int argc, char** argv)
return
1
;
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
// 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
// dlib there is no explicit image object, just a 2D array and
// various pixel types.
// various pixel types.
array2d
<
rgb_pixel
>::
kernel_1a
img
;
array2d
<
rgb_pixel
>::
kernel_1a
img
;
// now load the bmp file into our image. If the file isn't really a BMP
// Now load the image file into our image. If something is wrong then
// or is corrupted then load_bmp() will throw an exception.
// load_image() will throw an exception. Also, if you compiled with libpng
load_bmp
(
img
,
fin
);
// 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
// Now lets use some image functions. This example is going to perform
// simple edge detection on the image. First lets find the horizontal and
// simple edge detection on the image. First lets find the horizontal and
...
@@ -66,7 +59,8 @@ int main(int argc, char** argv)
...
@@ -66,7 +59,8 @@ int main(int argc, char** argv)
// window to display them on the screen.
// 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
);
image_window
my_window
(
edge_image
);
// also make a window to display the original 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)
...
@@ -40,28 +40,22 @@ int main(int argc, char** argv)
return
1
;
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
// 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
// dlib there is no explicit image object, just a 2D array and
// various pixel types.
// various pixel types.
array2d
<
rgb_pixel
>::
kernel_1a
img
;
array2d
<
rgb_pixel
>::
kernel_1a
img
;
// now load the bmp file into our image. If the file isn't really a BMP
// Now load the image file into our image. If something is wrong then
// or is corrupted then load_bmp() will throw an exception.
// load_image() will throw an exception. Also, if you compiled with libpng
load_bmp
(
img
,
fin
);
// 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
// get the 100 strongest SURF points from the image
std
::
vector
<
surf_point
>
sp
=
get_surf_points
(
img
,
100
);
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
);
image_window
my_window
(
img
);
// Now lets draw some rectangles on top of the image so we can see where
// 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