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
3ca31dcd
Commit
3ca31dcd
authored
Jun 17, 2011
by
Ana Huaman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New basic filter sample added
parent
6229af93
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
114 additions
and
5 deletions
+114
-5
AddingImages.cpp
samples/cpp/tutorial_code/Basic/AddingImages.cpp
+2
-2
AddingImagesTrackbar.cpp
samples/cpp/tutorial_code/Basic/AddingImagesTrackbar.cpp
+2
-2
LoadSaveImage.cpp
samples/cpp/tutorial_code/Basic/LoadSaveImage.cpp
+1
-1
FilterDemo1.cpp
samples/cpp/tutorial_code/Image_Processing/FilterDemo1.cpp
+109
-0
HappyFish.jpg
samples/cpp/tutorial_code/images/HappyFish.jpg
+0
-0
LinuxLogo.jpg
samples/cpp/tutorial_code/images/LinuxLogo.jpg
+0
-0
WindowsLogo.jpg
samples/cpp/tutorial_code/images/WindowsLogo.jpg
+0
-0
cat.jpg
samples/cpp/tutorial_code/images/cat.jpg
+0
-0
lena.png
samples/cpp/tutorial_code/images/lena.png
+0
-0
No files found.
samples/cpp/tutorial_code/Basic/AddingImages.cpp
View file @
3ca31dcd
...
@@ -32,8 +32,8 @@ int main( int argc, char** argv )
...
@@ -32,8 +32,8 @@ int main( int argc, char** argv )
{
alpha
=
input
;
}
{
alpha
=
input
;
}
/// Read image ( same size, same type )
/// Read image ( same size, same type )
src1
=
imread
(
"../
../
images/LinuxLogo.jpg"
);
src1
=
imread
(
"../images/LinuxLogo.jpg"
);
src2
=
imread
(
"../
../
images/WindowsLogo.jpg"
);
src2
=
imread
(
"../images/WindowsLogo.jpg"
);
if
(
!
src1
.
data
)
{
printf
(
"Error loading src1
\n
"
);
return
-
1
;
}
if
(
!
src1
.
data
)
{
printf
(
"Error loading src1
\n
"
);
return
-
1
;
}
if
(
!
src2
.
data
)
{
printf
(
"Error loading src2
\n
"
);
return
-
1
;
}
if
(
!
src2
.
data
)
{
printf
(
"Error loading src2
\n
"
);
return
-
1
;
}
...
...
samples/cpp/tutorial_code/Basic/AddingImagesTrackbar.cpp
View file @
3ca31dcd
...
@@ -43,8 +43,8 @@ void on_trackbar( int, void* )
...
@@ -43,8 +43,8 @@ void on_trackbar( int, void* )
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
/// Read image ( same size, same type )
/// Read image ( same size, same type )
src1
=
imread
(
"../
../
images/LinuxLogo.jpg"
);
src1
=
imread
(
"../images/LinuxLogo.jpg"
);
src2
=
imread
(
"../
../
images/WindowsLogo.jpg"
);
src2
=
imread
(
"../images/WindowsLogo.jpg"
);
if
(
!
src1
.
data
)
{
printf
(
"Error loading src1
\n
"
);
return
-
1
;
}
if
(
!
src1
.
data
)
{
printf
(
"Error loading src1
\n
"
);
return
-
1
;
}
if
(
!
src2
.
data
)
{
printf
(
"Error loading src2
\n
"
);
return
-
1
;
}
if
(
!
src2
.
data
)
{
printf
(
"Error loading src2
\n
"
);
return
-
1
;
}
...
...
samples/cpp/tutorial_code/Basic/LoadSaveImage.cpp
View file @
3ca31dcd
...
@@ -36,7 +36,7 @@ int main( int argc, char** argv )
...
@@ -36,7 +36,7 @@ int main( int argc, char** argv )
cvtColor
(
image
,
gray_image
,
CV_RGB2GRAY
);
cvtColor
(
image
,
gray_image
,
CV_RGB2GRAY
);
/// Save our gray image
/// Save our gray image
imwrite
(
"../
../
images/Gray_Image.png"
,
gray_image
);
imwrite
(
"../images/Gray_Image.png"
,
gray_image
);
/// Create a couple of windows and show our images
/// Create a couple of windows and show our images
namedWindow
(
imageName
,
CV_WINDOW_AUTOSIZE
);
namedWindow
(
imageName
,
CV_WINDOW_AUTOSIZE
);
...
...
samples/cpp/tutorial_code/Image_Processing/FilterDemo1.cpp
0 → 100644
View file @
3ca31dcd
/**
* file FilterDemo1.cpp
* brief Sample code for simple filters
* author OpenCV team
*/
#include <iostream>
#include <vector>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/features2d/features2d.hpp"
using
namespace
std
;
using
namespace
cv
;
/// Global Variables
int
DELAY_CAPTION
=
1500
;
int
DELAY_BLUR
=
100
;
int
MAX_KERNEL_LENGTH
=
31
;
Mat
src
;
Mat
dst
;
char
window_name
[]
=
"Filter Demo 1"
;
/// Function headers
int
display_caption
(
char
*
caption
);
int
display_dst
(
int
delay
);
/**
* function main
*/
int
main
(
int
argc
,
char
**
argv
)
{
namedWindow
(
window_name
,
CV_WINDOW_AUTOSIZE
);
/// Load the source image
src
=
imread
(
"../images/lena.png"
,
1
);
if
(
display_caption
(
"Original Image"
)
!=
0
)
{
return
0
;
}
dst
=
src
.
clone
();
if
(
display_dst
(
DELAY_CAPTION
)
!=
0
)
{
return
0
;
}
/// Applying Homogeneous blur
if
(
display_caption
(
"Homogeneous Blur"
)
!=
0
)
{
return
0
;
}
for
(
int
i
=
1
;
i
<
MAX_KERNEL_LENGTH
;
i
=
i
+
2
)
{
blur
(
src
,
dst
,
Size
(
i
,
i
),
Point
(
-
1
,
-
1
)
);
if
(
display_dst
(
DELAY_BLUR
)
!=
0
)
{
return
0
;
}
}
/// Applying Gaussian blur
if
(
display_caption
(
"Gaussian Blur"
)
!=
0
)
{
return
0
;
}
for
(
int
i
=
1
;
i
<
MAX_KERNEL_LENGTH
;
i
=
i
+
2
)
{
GaussianBlur
(
src
,
dst
,
Size
(
i
,
i
),
0
,
0
);
if
(
display_dst
(
DELAY_BLUR
)
!=
0
)
{
return
0
;
}
}
/// Applying Median blur
if
(
display_caption
(
"Median Blur"
)
!=
0
)
{
return
0
;
}
for
(
int
i
=
1
;
i
<
MAX_KERNEL_LENGTH
;
i
=
i
+
2
)
{
medianBlur
(
src
,
dst
,
i
);
if
(
display_dst
(
DELAY_BLUR
)
!=
0
)
{
return
0
;
}
}
/// Applying Bilateral Filter
if
(
display_caption
(
"Bilateral Blur"
)
!=
0
)
{
return
0
;
}
for
(
int
i
=
1
;
i
<
MAX_KERNEL_LENGTH
;
i
=
i
+
2
)
{
bilateralFilter
(
src
,
dst
,
i
,
i
*
2
,
i
/
2
);
if
(
display_dst
(
DELAY_BLUR
)
!=
0
)
{
return
0
;
}
}
/// Wait until user press a key
display_caption
(
"End: Press a key!"
);
waitKey
(
0
);
return
0
;
}
/**
* @function display_caption
*/
int
display_caption
(
char
*
caption
)
{
dst
=
Mat
::
zeros
(
src
.
size
(),
src
.
type
()
);
putText
(
dst
,
caption
,
Point
(
src
.
cols
/
4
,
src
.
rows
/
2
),
CV_FONT_HERSHEY_COMPLEX
,
1
,
Scalar
(
255
,
255
,
255
)
);
imshow
(
window_name
,
dst
);
int
c
=
waitKey
(
DELAY_CAPTION
);
if
(
c
>=
0
)
{
return
-
1
;
}
return
0
;
}
/**
* @function display_dst
*/
int
display_dst
(
int
delay
)
{
imshow
(
window_name
,
dst
);
int
c
=
waitKey
(
delay
);
if
(
c
>=
0
)
{
return
-
1
;
}
return
0
;
}
samples/cpp/tutorial_code/images/HappyFish.jpg
0 → 100755
View file @
3ca31dcd
8.09 KB
samples/cpp/tutorial_code/images/LinuxLogo.jpg
0 → 100755
View file @
3ca31dcd
6.8 KB
samples/cpp/tutorial_code/images/WindowsLogo.jpg
0 → 100755
View file @
3ca31dcd
11.1 KB
samples/cpp/tutorial_code/images/cat.jpg
0 → 100755
View file @
3ca31dcd
64 KB
samples/cpp/tutorial_code/images/lena.png
0 → 100644
View file @
3ca31dcd
463 KB
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