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
2819438f
Commit
2819438f
authored
Jun 21, 2011
by
Ana Huaman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganized code and added Morphology 2 cpp code
parent
ae55138a
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
80 additions
and
80 deletions
+80
-80
DisplayImage.cpp
samples/cpp/tutorial_code/Basic/DisplayImage.cpp
+0
-28
LoadSaveImage.cpp
samples/cpp/tutorial_code/Basic/LoadSaveImage.cpp
+0
-52
Drawing_1.cpp
samples/cpp/tutorial_code/CxCore/Matrix/Drawing_1.cpp
+0
-0
Drawing_2.cpp
samples/cpp/tutorial_code/CxCore/Matrix/Drawing_2.cpp
+0
-0
AddingImagesTrackbar.cpp
samples/cpp/tutorial_code/HighGUI/AddingImagesTrackbar.cpp
+0
-0
BasicLinearTransformsTrackbar.cpp
...p/tutorial_code/HighGUI/BasicLinearTransformsTrackbar.cpp
+0
-0
AddingImages.cpp
samples/cpp/tutorial_code/ImgProc/AddingImages.cpp
+0
-0
BasicLinearTransforms.cpp
samples/cpp/tutorial_code/ImgProc/BasicLinearTransforms.cpp
+0
-0
Morphology_1.cpp
samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp
+0
-0
Morphology_2.cpp
samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp
+80
-0
Smoothing.cpp
samples/cpp/tutorial_code/ImgProc/Smoothing.cpp
+0
-0
No files found.
samples/cpp/tutorial_code/Basic/DisplayImage.cpp
deleted
100644 → 0
View file @
ae55138a
/**
* @file DisplayImage.cpp
* @brief Sample code that show how to read and display an image in a OpenCV window
* @author OpenCV team
*/
#include <cv.h>
#include <highgui.h>
using
namespace
cv
;
int
main
(
int
argc
,
char
**
argv
)
{
Mat
image
;
image
=
imread
(
argv
[
1
],
1
);
if
(
argc
!=
2
||
!
image
.
data
)
{
printf
(
"No image data
\n
"
);
return
-
1
;
}
namedWindow
(
"Display Image"
,
CV_WINDOW_AUTOSIZE
);
imshow
(
"Display Image"
,
image
);
waitKey
(
0
);
return
0
;
}
samples/cpp/tutorial_code/Basic/LoadSaveImage.cpp
deleted
100644 → 0
View file @
ae55138a
/**
* @file LoadSaveImage.cpp
* @brief Sample code that load an image, modify it and save the new image.
* @author OpenCV team
*/
#include <cv.h>
#include <highgui.h>
using
namespace
cv
;
/**
* @function main
* @brief Self-explanatory
*/
int
main
(
int
argc
,
char
**
argv
)
{
/// Get the name of the file to be loaded
char
*
imageName
=
argv
[
1
];
/// Create a Mat object
Mat
image
;
/// Load the image using imread
image
=
imread
(
imageName
,
1
);
/// Verify that the image was loaded
if
(
argc
!=
2
||
!
image
.
data
)
{
printf
(
" No image data
\n
"
);
return
-
1
;
}
/// Change the image to Grayscale
Mat
gray_image
;
cvtColor
(
image
,
gray_image
,
CV_RGB2GRAY
);
/// Save our gray image
imwrite
(
"../images/Gray_Image.png"
,
gray_image
);
/// Create a couple of windows and show our images
namedWindow
(
imageName
,
CV_WINDOW_AUTOSIZE
);
namedWindow
(
"Gray image"
,
CV_WINDOW_AUTOSIZE
);
imshow
(
imageName
,
image
);
imshow
(
"Gray image"
,
gray_image
);
/// Wait until user finish the application
waitKey
(
0
);
return
0
;
}
samples/cpp/tutorial_code/
Basic
/Drawing_1.cpp
→
samples/cpp/tutorial_code/
CxCore/Matrix
/Drawing_1.cpp
View file @
2819438f
File moved
samples/cpp/tutorial_code/
Basic
/Drawing_2.cpp
→
samples/cpp/tutorial_code/
CxCore/Matrix
/Drawing_2.cpp
View file @
2819438f
File moved
samples/cpp/tutorial_code/
Basic
/AddingImagesTrackbar.cpp
→
samples/cpp/tutorial_code/
HighGUI
/AddingImagesTrackbar.cpp
View file @
2819438f
File moved
samples/cpp/tutorial_code/
Basic
/BasicLinearTransformsTrackbar.cpp
→
samples/cpp/tutorial_code/
HighGUI
/BasicLinearTransformsTrackbar.cpp
View file @
2819438f
File moved
samples/cpp/tutorial_code/
Basi
c/AddingImages.cpp
→
samples/cpp/tutorial_code/
ImgPro
c/AddingImages.cpp
View file @
2819438f
File moved
samples/cpp/tutorial_code/
Basi
c/BasicLinearTransforms.cpp
→
samples/cpp/tutorial_code/
ImgPro
c/BasicLinearTransforms.cpp
View file @
2819438f
File moved
samples/cpp/tutorial_code/Im
age_Processing
/Morphology_1.cpp
→
samples/cpp/tutorial_code/Im
gProc
/Morphology_1.cpp
View file @
2819438f
File moved
samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp
0 → 100644
View file @
2819438f
/**
* @file Morphology_2.cpp
* @brief Advanced morphology Transformations sample code
* @author OpenCV team
*/
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <stdio.h>
using
namespace
cv
;
/// Global variables
Mat
src
,
dst
;
int
morph_elem
=
0
;
int
morph_size
=
0
;
int
morph_operator
=
0
;
int
const
max_operator
=
4
;
int
const
max_elem
=
2
;
int
const
max_kernel_size
=
21
;
char
*
window_name
=
"Morphology Transformations Demo"
;
/** Function Headers */
void
Morphology_Operations
(
int
,
void
*
);
/**
* @function main
*/
int
main
(
int
argc
,
char
**
argv
)
{
/// Load an image
src
=
imread
(
argv
[
1
]
);
if
(
!
src
.
data
)
{
return
-
1
;
}
/// Create window
namedWindow
(
window_name
,
CV_WINDOW_AUTOSIZE
);
/// Create Trackbar to select Morphology operation
createTrackbar
(
"Operator:
\n
0: Opening - 1: Closing
\n
2: Gradient - 3: Top Hat
\n
4: Black Hat"
,
window_name
,
&
morph_operator
,
max_operator
,
Morphology_Operations
);
/// Create Trackbar to select kernel type
createTrackbar
(
"Element:
\n
0: Rect - 1: Cross - 2: Ellipse"
,
window_name
,
&
morph_elem
,
max_elem
,
Morphology_Operations
);
/// Create Trackbar to choose kernel size
createTrackbar
(
"Kernel size:
\n
2n +1"
,
window_name
,
&
morph_size
,
max_kernel_size
,
Morphology_Operations
);
/// Default start
Morphology_Operations
(
0
,
0
);
waitKey
(
0
);
return
0
;
}
/**
* @function Morphology_Operations
*/
void
Morphology_Operations
(
int
,
void
*
)
{
// Since MORPH_X : 2,3,4,5 and 6
int
operation
=
morph_operator
+
2
;
Mat
element
=
getStructuringElement
(
morph_elem
,
Size
(
2
*
morph_size
+
1
,
2
*
morph_size
+
1
),
Point
(
morph_size
,
morph_size
)
);
/// Apply the specified morphology operation
morphologyEx
(
src
,
dst
,
operation
,
element
);
imshow
(
window_name
,
dst
);
}
samples/cpp/tutorial_code/Im
age_Processing
/Smoothing.cpp
→
samples/cpp/tutorial_code/Im
gProc
/Smoothing.cpp
View file @
2819438f
File moved
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