├── .gitattributes
├── .gitignore
├── 01_display_picture
├── display_picture.vcxproj
├── display_picture.vcxproj.filters
└── main.cpp
├── 02_display_video
├── display_video.vcxproj
├── display_video.vcxproj.filters
└── main.cpp
├── 02a_display_feed_twice
├── 02b_display_feed_twice.vcxproj
├── 02b_display_feed_twice.vcxproj.filters
└── main.cpp
├── 02b_display_multiple_feeds
├── 02b_display_multiple_feeds.vcxproj
├── 02b_display_multiple_feeds.vcxproj.filters
└── main.cpp
├── 03_ceemple_canny_(default_program)
├── Ceemple_start_canny.vcxproj
├── Ceemple_start_canny.vcxproj.filters
├── Ceemple_start_canny.vcxproj.user
└── main.cpp
├── 04_threshold
├── 4_threshold.vcxproj
├── 4_threshold.vcxproj.filters
└── main.cpp
├── 05_thresholds
├── 5_thresholds.vcxproj
├── 5_thresholds.vcxproj.filters
└── main.cpp
├── 06_in_range
├── 6_in_range.vcxproj
├── 6_in_range.vcxproj.filters
└── main.cpp
├── 07_thresholding_using_trackbars
├── 7_thresholding_using_trackbars.vcxproj
├── 7_thresholding_using_trackbars.vcxproj.filters
└── main.cpp
├── 07b_hsv_conversion
├── 07b_hsv_conversion.vcxproj
├── 07b_hsv_conversion.vcxproj.filters
└── main.cpp
├── 08_erode_and_dilate_using_a_still_image
├── 08_erode_and_dilate_using_a_still_image.vcxproj
├── 08_erode_and_dilate_using_a_still_image.vcxproj.filters
└── main.cpp
├── 08a_erode_using_slider
├── 08a_erode_using_slider.vcxproj
├── 08a_erode_using_slider.vcxproj.filters
└── main.cpp
├── 08b_dilate_using_slider
├── 08b_dilate_using_slider.vcxproj
├── 08b_dilate_using_slider.vcxproj.filters
└── main.cpp
├── 09_fancy_erode_and_dilate_using_video
├── 8_erode_and_dilate.vcxproj
├── 8_erode_and_dilate.vcxproj.filters
└── main.cpp
├── 10_draw
├── 9_draw.vcxproj
├── 9_draw.vcxproj.filters
└── main.cpp
├── 10a_more_drawing
├── 10a_more_drawing.vcxproj
├── 10a_more_drawing.vcxproj.filters
└── main.cpp
├── 11_color_tracking
├── 11_color_tracking.vcxproj
├── 11_color_tracking.vcxproj.filters
└── main.cpp
├── 12_track_color_display_coordinates
├── 12_track_color_display_coordinates.vcxproj
├── 12_track_color_display_coordinates.vcxproj.filters
└── main.cpp
├── 13_contours
├── 13_contours.vcxproj
├── 13_contours.vcxproj.filters
└── main.cpp
├── 14_motion_tracking
├── 10_track_motion.vcxproj
├── 10_track_motion.vcxproj.filters
└── main.cpp
├── 15_write_file_to_disk
├── 15_write_file_to_disk.vcxproj
├── 15_write_file_to_disk.vcxproj.filters
└── main.cpp
├── 15a_shrink_crop_save
├── 15a_shrink_crop_save.vcxproj
├── 15a_shrink_crop_save.vcxproj.filters
└── main.cpp
├── 16_hough_lines
├── hough_lines.vcxproj
├── hough_lines.vcxproj.filters
└── main.cpp
├── 16a_hough_lines_with_video
├── 16a_hough_lines_with_video.vcxproj
├── 16a_hough_lines_with_video.vcxproj.filters
└── main.cpp
├── 17_sobel_transform
├── 17_sobel_transform.vcxproj
├── 17_sobel_transform.vcxproj.filters
└── main.cpp
├── 18_scharr_transform
├── 18_scharr_transform.vcxproj
├── 18_scharr_transform.vcxproj.filters
└── main.cpp
├── 19_track_red_and_paint
├── 19_track_red_and_paint.vcxproj
├── 19_track_red_and_paint.vcxproj.filters
└── main.cpp
├── 20_warp_affine_video
├── 20_warp_affine_video.vcxproj
├── 20_warp_affine_video.vcxproj.filters
└── main.cpp
├── 21_contours_with_canny
├── 21_contours_with_canny.vcxproj
├── 21_contours_with_canny.vcxproj.filters
└── main.cpp
├── 22_color_maps
├── 22_color_maps.vcxproj
├── 22_color_maps.vcxproj.filters
└── main.cpp
├── 23_skeletonization
├── 23_skeletonization.vcxproj
├── 23_skeletonization.vcxproj.filters
└── main.cpp
├── 24_shape_detection
├── 24_shape_detection.vcxproj
├── 24_shape_detection.vcxproj.filters
└── main.cpp
├── 25_corner_detection
├── 25_corner_detection.vcxproj
├── 25_corner_detection.vcxproj.filters
└── main.cpp
├── 26_morph_selector
├── 26_morph_selector.vcxproj
├── 26_morph_selector.vcxproj.filters
└── main.cpp
├── 27_face_detection
├── 27_face_detection.vcxproj
├── 27_face_detection.vcxproj.filters
└── main.cpp
├── 28_face_detect_superimpose_mask
├── 28_face_detect_superimpose_mask.vcxproj
├── 28_face_detect_superimpose_mask.vcxproj.filters
└── main.cpp
├── LICENSE
├── README.md
├── cascades
├── haarcascade_eye.xml
├── haarcascade_eye_tree_eyeglasses.xml
├── haarcascade_frontalface_alt.xml
├── haarcascade_frontalface_alt2.xml
├── haarcascade_frontalface_alt_tree.xml
├── haarcascade_frontalface_default.xml
├── haarcascade_fullbody.xml
├── haarcascade_lefteye_2splits.xml
├── haarcascade_licence_plate_rus_16stages.xml
├── haarcascade_lowerbody.xml
├── haarcascade_profileface.xml
├── haarcascade_righteye_2splits.xml
├── haarcascade_russian_plate_number.xml
├── haarcascade_smile.xml
├── haarcascade_upperbody.xml
├── hogcascade_pedestrians.xml
├── lbpcascade_frontalface.xml
├── lbpcascade_profileface.xml
└── lbpcascade_silverware.xml
├── images
├── 1.png
├── 5.jpg
├── 768x576.avi
├── CMakeLists.txt
├── DetectingContours.jpg
├── HappyFish.jpg
├── LinuxLogo.jpg
├── WindowsLogo.jpg
├── aero1.jpg
├── aero3.jpg
├── aloeL.jpg
├── aloeR.jpg
├── baboon.jpg
├── baby_blanket.png
├── basketball1.png
├── basketball2.png
├── board.jpg
├── box.png
├── box_in_scene.png
├── building.jpg
├── cat.jpg
├── chess.JPG
├── chicky_512.png
├── data01.xml
├── digits.png
├── fruits.jpg
├── glasses.jpg
├── graf1.png
├── graf3.png
├── hand1.png
├── hand2.png
├── hand3.png
├── horse.jpg
├── image.jpg
├── imageTextN.png
├── imageTextR.png
├── intrinsics.yml
├── left01.jpg
├── left02.jpg
├── left03.jpg
├── left04.jpg
├── left05.jpg
├── left06.jpg
├── left07.jpg
├── left08.jpg
├── left09.jpg
├── left11.jpg
├── left12.jpg
├── left13.jpg
├── left14.jpg
├── lena.jpg
├── letter-recognition.data
├── licenseplate_motion.jpg
├── masks
│ ├── 1.jpg
│ ├── 10.jpg
│ ├── 11.jpg
│ ├── 2.jpg
│ ├── 3.jpg
│ ├── 4.jpg
│ ├── 5.jpg
│ ├── 6.jpg
│ ├── 7.jpg
│ ├── 8.png
│ └── 9.jpg
├── maui.jpg
├── moon.jpg
├── my_capture.jpg
├── o.png
├── opencv-logo.png
├── opencv_cheatsheet.pdf
├── person.jpg
├── pic1.jpg
├── pic1.png
├── pic2.png
├── pic3.png
├── pic4.png
├── pic5.png
├── pic6.png
├── readme.txt
├── right01.jpg
├── right02.jpg
├── right03.jpg
├── right04.jpg
├── right05.jpg
├── right06.jpg
├── right07.jpg
├── right08.jpg
├── right09.jpg
├── right11.jpg
├── right12.jpg
├── right13.jpg
├── right14.jpg
├── robot.png
├── rubberwhale1.png
├── rubberwhale2.png
├── scratchcard-ocr-sample-image.png
├── shape_sample
│ ├── 1.png
│ ├── 10.png
│ ├── 11.png
│ ├── 12.png
│ ├── 13.png
│ ├── 14.png
│ ├── 15.png
│ ├── 16.png
│ ├── 17.png
│ ├── 18.png
│ ├── 19.png
│ ├── 2.png
│ ├── 20.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ ├── 6.png
│ ├── 7.png
│ ├── 8.png
│ └── 9.png
├── shapes.png
├── source1.png
├── starry_night.jpg
├── stereo_calib.xml
├── stuff.jpg
├── templ.png
├── text_defocus.jpg
├── text_motion.jpg
├── tony.mpg
├── tony.png
├── tree.avi
├── vec_files
│ └── trainingfaces_24-24.vec
├── water_coins.jpg
└── xyed.jpg
└── project_solution.sln
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 |
19 | # External tool builders
20 | .externalToolBuilders/
21 |
22 | # Locally stored "Eclipse launch configurations"
23 | *.launch
24 |
25 | # CDT-specific
26 | .cproject
27 |
28 | # PDT-specific
29 | .buildpath
30 |
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | ## Ignore Visual Studio temporary files, build results, and
37 | ## files generated by popular Visual Studio add-ons.
38 |
39 | # User-specific files
40 | *.suo
41 | *.user
42 | *.sln.docstates
43 |
44 | # Build results
45 |
46 | [Dd]ebug/
47 | [Rr]elease/
48 | x64/
49 | build/
50 | [Bb]in/
51 | [Oo]bj/
52 |
53 | # MSTest test Results
54 | [Tt]est[Rr]esult*/
55 | [Bb]uild[Ll]og.*
56 |
57 | *_i.c
58 | *_p.c
59 | *.ilk
60 | *.meta
61 | *.obj
62 | *.pch
63 | *.pdb
64 | *.pgc
65 | *.pgd
66 | *.rsp
67 | *.sbr
68 | *.tlb
69 | *.tli
70 | *.tlh
71 | *.tmp
72 | *.tmp_proj
73 | *.log
74 | *.vspscc
75 | *.vssscc
76 | .builds
77 | *.pidb
78 | *.log
79 | *.scc
80 |
81 | # Visual C++ cache files
82 | ipch/
83 | *.aps
84 | *.ncb
85 | *.opensdf
86 | *.sdf
87 | *.cachefile
88 |
89 | # Visual Studio profiler
90 | *.psess
91 | *.vsp
92 | *.vspx
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 |
101 | # TeamCity is a build add-in
102 | _TeamCity*
103 |
104 | # DotCover is a Code Coverage Tool
105 | *.dotCover
106 |
107 | # NCrunch
108 | *.ncrunch*
109 | .*crunch*.local.xml
110 |
111 | # Installshield output folder
112 | [Ee]xpress/
113 |
114 | # DocProject is a documentation generator add-in
115 | DocProject/buildhelp/
116 | DocProject/Help/*.HxT
117 | DocProject/Help/*.HxC
118 | DocProject/Help/*.hhc
119 | DocProject/Help/*.hhk
120 | DocProject/Help/*.hhp
121 | DocProject/Help/Html2
122 | DocProject/Help/html
123 |
124 | # Click-Once directory
125 | publish/
126 |
127 | # Publish Web Output
128 | *.Publish.xml
129 | *.pubxml
130 | *.publishproj
131 |
132 | # NuGet Packages Directory
133 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
134 | #packages/
135 |
136 | # Windows Azure Build Output
137 | csx
138 | *.build.csdef
139 |
140 | # Windows Store app package directory
141 | AppPackages/
142 |
143 | # Others
144 | sql/
145 | *.Cache
146 | ClientBin/
147 | [Ss]tyle[Cc]op.*
148 | ~$*
149 | *~
150 | *.dbmdl
151 | *.[Pp]ublish.xml
152 | *.pfx
153 | *.publishsettings
154 |
155 | # RIA/Silverlight projects
156 | Generated_Code/
157 |
158 | # Backup & report files from converting an old project file to a newer
159 | # Visual Studio version. Backup files are not needed, because we have git ;-)
160 | _UpgradeReport_Files/
161 | Backup*/
162 | UpgradeLog*.XML
163 | UpgradeLog*.htm
164 |
165 | # SQL Server files
166 | App_Data/*.mdf
167 | App_Data/*.ldf
168 |
169 | #############
170 | ## Windows detritus
171 | #############
172 |
173 | # Windows image file caches
174 | Thumbs.db
175 | ehthumbs.db
176 |
177 | # Folder config file
178 | Desktop.ini
179 |
180 | # Recycle Bin used on file shares
181 | $RECYCLE.BIN/
182 |
183 | # Mac crap
184 | .DS_Store
185 |
186 |
187 | #############
188 | ## Python
189 | #############
190 |
191 | *.py[cod]
192 |
193 | # Packages
194 | *.egg
195 | *.egg-info
196 | dist/
197 | build/
198 | eggs/
199 | parts/
200 | var/
201 | sdist/
202 | develop-eggs/
203 | .installed.cfg
204 |
205 | # Installer logs
206 | pip-log.txt
207 |
208 | # Unit test / coverage reports
209 | .coverage
210 | .tox
211 |
212 | #Translations
213 | *.mo
214 |
215 | #Mr Developer
216 | .mr.developer.cfg
217 |
--------------------------------------------------------------------------------
/01_display_picture/display_picture.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/01_display_picture/main.cpp:
--------------------------------------------------------------------------------
1 | //Link to video tutorials: https://www.youtube.com/watch?v=Q6NkiY9fylw&list=PLpV2_Uaul7v_i88gZRwIwPgNGpakZnOhs
2 | //Link to ceemple plugin that installs opencv dependencies: https://visualstudiogallery.msdn.microsoft.com/00ebd33e-c7c6-4a02-9466-b619b5eddfb5
3 | //github repo: https://github.com/muilenta/
4 | //note: many sections of the code in these tutorials come from ceemple, opencv, or other sites. Please help reference original authors if you know who they are.
5 |
6 | //highgui functions: http://www.ai.rug.nl/vakinformatie/pas/content/Highgui/opencvref_highgui.htm
7 |
8 | //This program displays a picture. You can pass in an image path to work with a differnet image if desired.
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | using namespace cv;
15 | using namespace std;
16 |
17 | int main(int argc, char** argv)
18 | {
19 | const char* filename = argc >= 2 ? argv[1] : "../images/baboon.jpg"; //if no image is passed in, use the baboon.png image
20 | //string filename = "../images/tony.png"; //another way to specify the image
21 |
22 | //load the image
23 | Mat image;
24 | image = imread(filename, CV_LOAD_IMAGE_COLOR);
25 | //check if the image loaded properly
26 | if (!image.data){
27 | cout << "Image could not be loaded\n";
28 | return -1;
29 | }
30 | //show the image
31 | imshow("My Image", image);
32 | waitKey(0);
33 | return 0;
34 | }
--------------------------------------------------------------------------------
/02_display_video/display_video.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/02_display_video/main.cpp:
--------------------------------------------------------------------------------
1 |
2 | //This program displays video from device 0
3 |
4 | #include "opencv2\opencv.hpp"
5 | using namespace cv;
6 | int main()
7 | {
8 | VideoCapture cap(0); // open the default camera
9 | if (!cap.isOpened()) // check if we succeeded
10 | return -1;
11 | Mat edges;
12 |
13 | for (;;)
14 | {
15 | Mat frame;
16 | cap >> frame; // get a new frame from camera
17 | imshow("Feed", frame);
18 | if (waitKey(30) >= 0)
19 | break;
20 | }
21 | // the camera will be deinitialized automatically in VideoCapture destructor
22 | return 0;
23 | }
--------------------------------------------------------------------------------
/02a_display_feed_twice/02b_display_feed_twice.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/02a_display_feed_twice/main.cpp:
--------------------------------------------------------------------------------
1 | //same as the previous program, but it displays the feed in two different windows
2 |
3 | #include "opencv2/opencv.hpp"
4 |
5 | #include
6 | #include
7 |
8 | using namespace cv;
9 |
10 | void main()
11 | {
12 | Mat image1;
13 | Mat image2;
14 |
15 | //cv capture pointer
16 | VideoCapture my_capture;
17 |
18 | //open the img device
19 | my_capture.open(0);
20 |
21 | while (1)
22 | {
23 | //show the image from the webcam
24 | my_capture >> image1;
25 | imshow("window_1", image1);
26 | waitKey(10);
27 |
28 | my_capture >> image2;
29 | imshow("window_2", image2);
30 | waitKey(10);
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/02b_display_multiple_feeds/02b_display_multiple_feeds.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/02b_display_multiple_feeds/main.cpp:
--------------------------------------------------------------------------------
1 | //This program displays multiple video feeds, each in a different window.
2 | //Two camera devices are required for this (or emulated feeds).
3 |
4 |
5 | #include "opencv2/highgui/highgui.hpp"
6 | #include "opencv2/imgproc/imgproc.hpp"
7 | #include
8 | #include
9 |
10 | using namespace cv;
11 |
12 | void main()
13 | {
14 | Mat image1;
15 | Mat image2;
16 | Mat image3;
17 |
18 | //cv capture pointer
19 | VideoCapture capture1;
20 | VideoCapture capture2;
21 | //VideoCapture capture3; //uncomment this to display a third feed
22 |
23 | //open the img device
24 | capture1.open(0);
25 | capture2.open(1);
26 | //capture3.open(2);
27 |
28 | while (1)
29 | {
30 | //show the image from the webcam
31 | capture1 >> image1;
32 | imshow("window_1", image1);
33 | waitKey(10);
34 |
35 | capture2 >> image2;
36 | imshow("window_2", image2);
37 | waitKey(10);
38 |
39 | //capture3>>image3;
40 | //imshow("window_3",image3);
41 | //waitKey(10);
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/03_ceemple_canny_(default_program)/Ceemple_start_canny.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/03_ceemple_canny_(default_program)/Ceemple_start_canny.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/03_ceemple_canny_(default_program)/main.cpp:
--------------------------------------------------------------------------------
1 |
2 | //This is the default code the ceemple plugin creates when starting a visual studio ceemple project
3 | //requirements include visual studio 2013, and installation of the ceemple plugin (links are in the description section)
4 |
5 | #include "opencv2/opencv.hpp"
6 |
7 | using namespace cv;
8 |
9 | int main(int, char)
10 | {
11 | VideoCapture cap(0); // open the default camera
12 | if (!cap.isOpened()) // check if we succeeded
13 | return -1;
14 | Mat edges;
15 | namedWindow("edges", 1);
16 |
17 | for (;;)
18 | {
19 | Mat frame;
20 | cap >> frame; // get a new frame from camera
21 | cvtColor(frame, edges, CV_BGR2GRAY);
22 | GaussianBlur(edges, edges, Size(7, 7), 1.5, 1.5);
23 | Canny(edges, edges, 0, 30, 3);
24 | imshow("edges", edges);
25 | if (waitKey(30) >= 0)
26 | break;
27 | }
28 | // the camera will be deinitialized automatically in VideoCapture destructor
29 | return 0;
30 | }
--------------------------------------------------------------------------------
/04_threshold/4_threshold.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/04_threshold/main.cpp:
--------------------------------------------------------------------------------
1 | //this program runs a simple threshold
2 | //threshold tutorial: http://docs.opencv.org/trunk/doc/py_tutorials/py_imgproc/py_thresholding/py_thresholding.html
3 |
4 | #include "opencv2/highgui/highgui.hpp"
5 | #include "opencv2/imgproc/imgproc.hpp"
6 | #include
7 | #include
8 | #include
9 |
10 | using namespace cv;
11 | using namespace std;
12 |
13 |
14 | /** @function main */
15 | int main()
16 | {
17 | Mat src; Mat srcGray;
18 | Mat threshColor, threshGray;
19 | int thresh = 100;
20 | int max_thresh = 255;
21 | VideoCapture myCapture;
22 | myCapture.open(0);
23 |
24 |
25 | while (1)
26 | {
27 | myCapture >> src;
28 | threshold(src, threshColor, 100, 200, THRESH_BINARY);
29 | cvtColor(src, srcGray, CV_BGR2GRAY);
30 | threshold(srcGray, threshGray, 100, 200, THRESH_BINARY);
31 | imshow("src", src);
32 | imshow("src gray", srcGray);
33 | imshow("thresh color", threshColor);
34 | imshow("thresh gray", threshGray);
35 | waitKey(10);
36 | }
37 | }
--------------------------------------------------------------------------------
/05_thresholds/5_thresholds.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/05_thresholds/main.cpp:
--------------------------------------------------------------------------------
1 | //this program demonstrates multiple threshold options. Uncomment a few to try them out
2 | //threshold tutorial: http://docs.opencv.org/trunk/doc/py_tutorials/py_imgproc/py_thresholding/py_thresholding.html
3 |
4 | #include "opencv2/highgui/highgui.hpp"
5 | #include "opencv2/imgproc/imgproc.hpp"
6 | #include
7 | #include
8 | #include
9 |
10 | using namespace cv;
11 | using namespace std;
12 |
13 | int main()
14 | {
15 | Mat src; Mat srcGray;
16 | Mat threshColor, threshGray;
17 | int thresh = 100;
18 | int max_thresh = 255;
19 | VideoCapture myCapture;
20 | myCapture.open(0);
21 |
22 | while (1)
23 | {
24 | myCapture >> src;
25 | //threshold(src, threshColor, 100, 200, THRESH_BINARY);
26 | //threshold(src, threshColor, 100, 200, THRESH_BINARY_INV);
27 | //threshold(src, threshColor, 100, 200, THRESH_TRUNC);
28 | threshold(src, threshColor, 100, 200, THRESH_TOZERO);
29 | //threshold(src, threshColor, 100, 200, THRESH_TOZERO_INV);
30 | cvtColor(src, srcGray, CV_BGR2GRAY);
31 | threshold(srcGray, threshGray, 100, 200, THRESH_BINARY);
32 | imshow("src", src);
33 | //imshow("src gray", srcGray);
34 | imshow("thresh color", threshColor);
35 | //imshow("thresh gray", threshGray);
36 | waitKey(10);
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/06_in_range/6_in_range.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/06_in_range/main.cpp:
--------------------------------------------------------------------------------
1 | //This program converts the video feed to HSV, then filters out pixels based on high and low filter settings specified
2 | #include "opencv2/opencv.hpp"
3 |
4 | #include
5 | #include
6 |
7 | using namespace cv;
8 |
9 | void main()
10 | {
11 | Mat image1;
12 | Mat hsv_image;
13 | Mat threshold_image;
14 |
15 | //cv capture pointer
16 | VideoCapture my_capture;
17 |
18 | //open the img device
19 | my_capture.open(0);
20 |
21 | while (1)
22 | {
23 | //show the image from the webcam
24 | my_capture >> image1;
25 | imshow("window_1", image1);
26 | waitKey(10);
27 |
28 | my_capture >> hsv_image;
29 | cvtColor(hsv_image, hsv_image, COLOR_BGR2HSV);
30 | imshow("window_2", hsv_image);
31 | waitKey(10);
32 |
33 | my_capture >> threshold_image;
34 | inRange(hsv_image, Scalar(30, 10, 45), Scalar(250, 256, 200), threshold_image); //values are 0 to 256
35 | imshow("window_3", threshold_image);
36 | waitKey(10);
37 | }
38 |
39 | }
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/07_thresholding_using_trackbars/7_thresholding_using_trackbars.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/07_thresholding_using_trackbars/main.cpp:
--------------------------------------------------------------------------------
1 | //This program allows the user to move sliders to change threshold values
2 |
3 | #include "opencv2/opencv.hpp"
4 |
5 |
6 | using namespace cv;
7 |
8 | void my_trackbar(int, void*) { } //called when trackbar is moved
9 |
10 | void main()
11 | {
12 | Mat image1;
13 | Mat hsv_image;
14 | Mat threshold_image;
15 |
16 | int H_MIN = 0; //0 to 256
17 | int H_MAX = 256;
18 | int S_MIN = 0;
19 | int S_MAX = 256;
20 | int V_MIN = 0;
21 | int V_MAX = 256;
22 |
23 | namedWindow("select colors", 0);
24 | //create memory to store trackbar name on window
25 | char TrackbarName[50];
26 | sprintf(TrackbarName, "H_MIN", H_MIN);
27 | sprintf(TrackbarName, "H_MAX", H_MAX);
28 | sprintf(TrackbarName, "S_MIN", S_MIN);
29 | sprintf(TrackbarName, "S_MAX", S_MAX);
30 | sprintf(TrackbarName, "V_MIN", V_MIN);
31 | sprintf(TrackbarName, "V_MAX", V_MAX);
32 |
33 | createTrackbar("H_MIN", "select colors", &H_MIN, H_MAX, my_trackbar);
34 | createTrackbar("H_MAX", "select colors", &H_MAX, H_MAX, my_trackbar);
35 | createTrackbar("S_MIN", "select colors", &S_MIN, S_MAX, my_trackbar);
36 | createTrackbar("S_MAX", "select colors", &S_MAX, S_MAX, my_trackbar);
37 | createTrackbar("V_MIN", "select colors", &V_MIN, V_MAX, my_trackbar);
38 | createTrackbar("V_MAX", "select colors", &V_MAX, V_MAX, my_trackbar);
39 |
40 | //cv capture pointer
41 | VideoCapture my_capture;
42 |
43 | //open the img device
44 | my_capture.open(0);
45 |
46 | while (1)
47 | {
48 | //show the image from the webcam
49 | my_capture >> image1;
50 | imshow("window_1", image1);
51 | waitKey(10);
52 |
53 | my_capture >> hsv_image;
54 | cvtColor(hsv_image, hsv_image, COLOR_BGR2HSV);
55 | imshow("window_2", hsv_image);
56 | waitKey(10);
57 |
58 | my_capture >> threshold_image;
59 | inRange(hsv_image, Scalar(H_MIN, S_MIN, V_MIN), Scalar(H_MAX, S_MAX, V_MAX), threshold_image); //values are 0 to 256
60 | imshow("select_colors", threshold_image);
61 | waitKey(10);
62 | }
63 |
64 | }
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/07b_hsv_conversion/07b_hsv_conversion.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/07b_hsv_conversion/main.cpp:
--------------------------------------------------------------------------------
1 | //display HSV
2 | //https://en.wikipedia.org/wiki/HSL_and_HSV
3 |
4 | #include "opencv2/highgui/highgui.hpp"
5 | #include "opencv2/imgproc/imgproc.hpp"
6 |
7 | #include
8 | #include
9 |
10 | using namespace cv;
11 |
12 | void main()
13 | {
14 | Mat image1;
15 | Mat hsv_image;
16 |
17 | //cv capture pointer
18 | VideoCapture my_capture;
19 |
20 | //open the img device
21 | my_capture.open(0);
22 |
23 | while (1)
24 | {
25 | //show the image from the webcam
26 | my_capture >> image1;
27 | imshow("window_1", image1);
28 | waitKey(10);
29 |
30 | my_capture >> hsv_image;
31 | cvtColor(hsv_image, hsv_image, COLOR_BGR2HSV);
32 | imshow("window_2", hsv_image);
33 | waitKey(10);
34 | }
35 |
36 | }
--------------------------------------------------------------------------------
/08_erode_and_dilate_using_a_still_image/08_erode_and_dilate_using_a_still_image.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/08_erode_and_dilate_using_a_still_image/main.cpp:
--------------------------------------------------------------------------------
1 | //this code demonstrates erosion and dilation to clean up noise in an image
2 |
3 | #include "opencv2/imgproc/imgproc.hpp"
4 | #include "opencv2/highgui/highgui.hpp"#include
5 |
6 | #include
7 | #include
8 |
9 | using namespace cv;
10 |
11 | void on_trackbar2(int, void*) { } //called when trackbar is moved
12 |
13 | void main()
14 | {
15 | Mat image1;
16 | Mat hsv_image;
17 | Mat threshold_image;
18 | Mat dialated_image;
19 | Mat eroded_image;
20 |
21 | int H_MIN = 20; //0 to 256
22 | int H_MAX = 240;
23 | int S_MIN = 10;
24 | int S_MAX = 236;
25 | int V_MIN = 0;
26 | int V_MAX = 256;
27 |
28 | namedWindow("select colors", 0);
29 | //create memory to store trackbar name on window
30 | char TrackbarName[50];
31 | sprintf(TrackbarName, "H_MIN", H_MIN);
32 | sprintf(TrackbarName, "H_MAX", H_MAX);
33 | sprintf(TrackbarName, "S_MIN", S_MIN);
34 | sprintf(TrackbarName, "S_MAX", S_MAX);
35 | sprintf(TrackbarName, "V_MIN", V_MIN);
36 | sprintf(TrackbarName, "V_MAX", V_MAX);
37 |
38 | createTrackbar("H_MIN", "select colors", &H_MIN, H_MAX, on_trackbar2);
39 | createTrackbar("H_MAX", "select colors", &H_MAX, H_MAX, on_trackbar2);
40 | createTrackbar("S_MIN", "select colors", &S_MIN, S_MAX, on_trackbar2);
41 | createTrackbar("S_MAX", "select colors", &S_MAX, S_MAX, on_trackbar2);
42 | createTrackbar("V_MIN", "select colors", &V_MIN, V_MAX, on_trackbar2);
43 | createTrackbar("V_MAX", "select colors", &V_MAX, V_MAX, on_trackbar2);
44 |
45 | //cv capture pointer
46 | VideoCapture tony_capture;
47 |
48 | //open the img device
49 | tony_capture.open(0);
50 |
51 | while (1)
52 | {
53 | //show the image from the webcam
54 | tony_capture >> hsv_image;
55 |
56 |
57 | (hsv_image, hsv_image, COLOR_BGR2HSV);
58 |
59 | tony_capture >> threshold_image;
60 | inRange(hsv_image, Scalar(H_MIN, S_MIN, V_MIN), Scalar(H_MAX, S_MAX, V_MAX), threshold_image); //values are 0 to 256
61 | imshow("select_colors", threshold_image);
62 | waitKey(30);
63 |
64 | Mat erodeElement = getStructuringElement(MORPH_RECT, Size(3, 3));
65 | Mat dilateElement = getStructuringElement(MORPH_RECT, Size(3, 3));
66 |
67 | //erode and dialate twice each
68 | cv::erode(threshold_image, threshold_image, erodeElement);
69 | cv::erode(threshold_image, threshold_image, erodeElement);
70 |
71 | imshow("eroded image", threshold_image);
72 |
73 | cv::dilate(threshold_image, threshold_image, erodeElement);
74 | cv::dilate(threshold_image, threshold_image, erodeElement);
75 |
76 | imshow("dilated image", threshold_image);
77 |
78 | }
79 |
80 | }
81 |
82 |
--------------------------------------------------------------------------------
/08a_erode_using_slider/08a_erode_using_slider.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {A9FF2675-9A37-4ADD-9CA6-6FD21F977962}
18 | _08a_erode_using_slider
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/08a_erode_using_slider/08a_erode_using_slider.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/08a_erode_using_slider/main.cpp:
--------------------------------------------------------------------------------
1 | //Erosion example. Use the slider to increase the impact
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | using namespace std;
9 | using namespace cv;
10 |
11 | int ksize = 1;
12 | void on_trackbar(int, void*);
13 | void createTrackbars();
14 |
15 | int main(void)
16 | {
17 | createTrackbars();
18 | on_trackbar(0, 0);
19 | Mat frame, erodeimg;
20 | frame = imread("../images/baboon.jpg", CV_LOAD_IMAGE_UNCHANGED);
21 | //frame = imread("../images/chess.jpg", CV_LOAD_IMAGE_UNCHANGED); //another good example image for erosion
22 |
23 | cvtColor(frame, frame, CV_BGR2GRAY);
24 | while (waitKey(30) != 27)
25 | {
26 | erode(frame, erodeimg, getStructuringElement(MORPH_RECT, Size(ksize, ksize)));
27 | imshow("Image", erodeimg);
28 | }
29 | }
30 |
31 | void createTrackbars()
32 | {
33 | namedWindow("Image", WINDOW_NORMAL);//create window trackbarwindow
34 | createTrackbar("erode me", "Image", &ksize, 255, on_trackbar);
35 | }
36 |
37 |
38 | void on_trackbar(int, void*)
39 | {//This function gets called whenever a
40 | // trackbar position is changed
41 | if (ksize == 0)
42 | {
43 | ksize = 1;
44 | }
45 | cout << ksize << endl;
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | }
--------------------------------------------------------------------------------
/08b_dilate_using_slider/08b_dilate_using_slider.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {C669BE0C-F907-4981-96AF-1C81B64DBB73}
18 | _08b_dilate_using_slider
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/08b_dilate_using_slider/08b_dilate_using_slider.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/08b_dilate_using_slider/main.cpp:
--------------------------------------------------------------------------------
1 | //Dilation example. Use the slider to increase the impact
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | using namespace std;
9 | using namespace cv;
10 |
11 | int ksize = 1;
12 | void on_trackbar(int, void*);
13 | void createTrackbars();
14 |
15 | int main(void)
16 | {
17 | createTrackbars();
18 | on_trackbar(0, 0);
19 | Mat frame, dilateimg;
20 | frame = imread("../images/baboon.jpg", CV_LOAD_IMAGE_UNCHANGED);
21 | //chess.JPG"
22 | cvtColor(frame, frame, CV_BGR2GRAY);
23 | while (waitKey(30) != 27)
24 | {
25 | dilate(frame, dilateimg, getStructuringElement(MORPH_RECT, Size(ksize, ksize)));
26 | imshow("Image", dilateimg);
27 | }
28 | }
29 |
30 | void createTrackbars()
31 | {
32 | namedWindow("Image", WINDOW_NORMAL);//create window trackbarwindow
33 | createTrackbar("dilate me", "Image", &ksize, 255, on_trackbar);
34 | }
35 |
36 |
37 | void on_trackbar(int, void*)
38 | {//This function gets called whenever a
39 | // trackbar position is changed
40 | if (ksize == 0)
41 | {
42 | ksize = 1;
43 | }
44 | cout << ksize << endl;
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | }
--------------------------------------------------------------------------------
/09_fancy_erode_and_dilate_using_video/8_erode_and_dilate.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/09_fancy_erode_and_dilate_using_video/main.cpp:
--------------------------------------------------------------------------------
1 | //erostion and dilation demonstrated using a video camera
2 |
3 | #include "opencv2/imgproc/imgproc.hpp"
4 | #include "opencv2/highgui/highgui.hpp"
5 | #include
6 | #include
7 |
8 | using namespace cv;
9 |
10 | /// Global variables
11 | Mat src_img, erosion_dest, dilation_dest;
12 |
13 | int erosion_ele = 0;
14 | int eros_size = 0;
15 | int dilation_ele = 0;
16 | int dilation_size_ = 0;
17 | int const max_elements = 2;
18 | int const max_kernel_size_ = 21;
19 |
20 | /** Function Headers */
21 | void Erosion3(int, void*);
22 | void Dilation3(int, void*);
23 |
24 | /** @function main */
25 | int main(int argc, char** argv)
26 | {
27 |
28 |
29 | //cv capture pointer
30 | VideoCapture my_capture;
31 |
32 | //open the img device
33 | my_capture.open(0);
34 |
35 | //src_img = imread("..\\baboon.jpg");
36 |
37 |
38 |
39 | while (1)
40 | {
41 | my_capture >> src_img;
42 | /// Create windows
43 | namedWindow("Erosion Demo", CV_WINDOW_AUTOSIZE);
44 | namedWindow("Dilation Demo", CV_WINDOW_AUTOSIZE);
45 | cvMoveWindow("Dilation Demo", src_img.cols, 0);
46 |
47 | /// Create Erosion Trackbar
48 | createTrackbar("Element:\n 0: Rect \n 1: Cross \n 2: Ellipse", "Erosion Demo",
49 | &erosion_ele, max_elements,
50 | Erosion3);
51 |
52 | createTrackbar("Kernel size:\n 2n +1", "Erosion Demo",
53 | &eros_size, max_kernel_size_,
54 | Erosion3);
55 |
56 | /// Create Dilation Trackbar
57 | createTrackbar("Element:\n 0: Rect \n 1: Cross \n 2: Ellipse", "Dilation Demo",
58 | &dilation_ele, max_elements,
59 | Dilation3);
60 |
61 | createTrackbar("Kernel size:\n 2n +1", "Dilation Demo",
62 | &dilation_size_, max_kernel_size_,
63 | Dilation3);
64 |
65 | /// Default start
66 | Erosion3(0, 0);
67 | Dilation3(0, 0);
68 | waitKey(30);
69 | }
70 | //waitKey(500);
71 | my_capture.release();
72 | //return 0;
73 | }
74 |
75 | /** @function Erosion */
76 | void Erosion3(int, void*)
77 | {
78 | int erosion_type;
79 | if (erosion_ele == 0){ erosion_type = MORPH_RECT; }
80 | else if (erosion_ele == 1){ erosion_type = MORPH_CROSS; }
81 | else if (erosion_ele == 2) { erosion_type = MORPH_ELLIPSE; }
82 |
83 | Mat element = getStructuringElement(erosion_type,
84 | Size(2 * eros_size + 1, 2 * eros_size + 1),
85 | Point(eros_size, eros_size));
86 |
87 | /// Apply the erosion operation
88 | erode(src_img, erosion_dest, element);
89 | imshow("Erosion Demo", erosion_dest);
90 | }
91 |
92 | /** @function Dilation */
93 | void Dilation3(int, void*)
94 | {
95 | int dilation_type;
96 | if (dilation_ele == 0){ dilation_type = MORPH_RECT; }
97 | else if (dilation_ele == 1){ dilation_type = MORPH_CROSS; }
98 | else if (dilation_ele == 2) { dilation_type = MORPH_ELLIPSE; }
99 |
100 | Mat element = getStructuringElement(dilation_type,
101 | Size(2 * dilation_size_ + 1, 2 * dilation_size_ + 1),
102 | Point(dilation_size_, dilation_size_));
103 | /// Apply the dilation operation
104 | dilate(src_img, dilation_dest, element);
105 | imshow("Dilation Demo", dilation_dest);
106 | }
--------------------------------------------------------------------------------
/10_draw/9_draw.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/10_draw/main.cpp:
--------------------------------------------------------------------------------
1 | //Draw a crosshair, some text, and a chess piece over the video feed
2 |
3 | #include "opencv2/imgproc/imgproc.hpp"
4 | #include "opencv2/highgui/highgui.hpp"
5 |
6 | #include
7 | #include
8 |
9 | using namespace cv;
10 |
11 | void MyPolygon(Mat);
12 |
13 | void main()
14 | {
15 | Mat image1;
16 | Mat hsv_image;
17 | Mat threshold_image;
18 |
19 | //cv capture pointer
20 | VideoCapture my_capture;
21 |
22 | //open the img device
23 | my_capture.open(0);
24 |
25 | while (1)
26 | {
27 | //show the image from the webcam
28 | my_capture >> image1;
29 |
30 | //////////////// draw target, circle, text
31 | int x = 100;
32 | int y = 100;
33 | const int FRAME_WIDTH = 640;
34 | const int FRAME_HEIGHT = 480;
35 | putText(image1, "Crosshair", Point(0, 50), 2, 1, Scalar(0, 255, 0), 2);
36 |
37 | circle(image1, Point(x, y), 20, Scalar(0, 255, 0), 2);
38 | line(image1, Point(x, y), Point(x, y - 25), Scalar(0, 255, 0), 2);
39 | line(image1, Point(x, y), Point(x, y + 25), Scalar(0, 255, 0), 2);
40 | line(image1, Point(x, y), Point(x - 25, y), Scalar(0, 255, 0), 2);
41 | line(image1, Point(x, y), Point(x + 25, y), Scalar(0, 255, 0), 2);
42 |
43 |
44 | imshow("window_1", image1);
45 |
46 | MyPolygon(image1);
47 |
48 | waitKey(30);
49 | imshow("window 2", image1);
50 | waitKey(30);
51 | }
52 |
53 | }
54 |
55 |
56 | void MyPolygon(Mat img)
57 | {
58 | int lineType = 8;
59 | int w = 100;
60 |
61 | // Create some points
62 | Point rook_points[1][20];
63 | rook_points[0][0] = Point(w / 4.0, 7 * w / 8.0);
64 | rook_points[0][1] = Point(3 * w / 4.0, 7 * w / 8.0);
65 | rook_points[0][2] = Point(3 * w / 4.0, 13 * w / 16.0);
66 | rook_points[0][3] = Point(11 * w / 16.0, 13 * w / 16.0);
67 | rook_points[0][4] = Point(19 * w / 32.0, 3 * w / 8.0);
68 | rook_points[0][5] = Point(3 * w / 4.0, 3 * w / 8.0);
69 | rook_points[0][6] = Point(3 * w / 4.0, w / 8.0);
70 | rook_points[0][7] = Point(26 * w / 40.0, w / 8.0);
71 | rook_points[0][8] = Point(26 * w / 40.0, w / 4.0);
72 | rook_points[0][9] = Point(22 * w / 40.0, w / 4.0);
73 | rook_points[0][10] = Point(22 * w / 40.0, w / 8.0);
74 | rook_points[0][11] = Point(18 * w / 40.0, w / 8.0);
75 | rook_points[0][12] = Point(18 * w / 40.0, w / 4.0);
76 | rook_points[0][13] = Point(14 * w / 40.0, w / 4.0);
77 | rook_points[0][14] = Point(14 * w / 40.0, w / 8.0);
78 | rook_points[0][15] = Point(w / 4.0, w / 8.0);
79 | rook_points[0][16] = Point(w / 4.0, 3 * w / 8.0);
80 | rook_points[0][17] = Point(13 * w / 32.0, 3 * w / 8.0);
81 | rook_points[0][18] = Point(5 * w / 16.0, 13 * w / 16.0);
82 | rook_points[0][19] = Point(w / 4.0, 13 * w / 16.0);
83 |
84 | const Point* ppt[1] = { rook_points[0] };
85 | int npt[] = { 20 };
86 |
87 | fillPoly(img,
88 | ppt,
89 | npt,
90 | 1,
91 | Scalar(255, 255, 255),
92 | lineType);
93 | }
94 |
95 |
--------------------------------------------------------------------------------
/10a_more_drawing/10a_more_drawing.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/10a_more_drawing/main.cpp:
--------------------------------------------------------------------------------
1 | //More drawing
2 |
3 | #include "opencv2/highgui/highgui.hpp"
4 | #include "opencv2/imgproc/imgproc.hpp"
5 |
6 | #include
7 | #include
8 |
9 | using namespace cv;
10 |
11 | void main()
12 | {
13 | Mat image1;
14 | Mat hsv_image;
15 | Mat threshold_image;
16 |
17 | //cv capture pointer
18 | VideoCapture my_capture;
19 |
20 | //open the img device
21 | my_capture.open(0);
22 |
23 | for (int i = 0; i< 100; i++) // 100 loops take around 10 seconds
24 | {
25 | //show the image from the webcam
26 | my_capture >> image1;
27 |
28 | //////////////// draw target, circle, text
29 | int x[10000];
30 | int y[10000];
31 |
32 | x[0] = i;
33 | y[0] = i;
34 |
35 | const int FRAME_WIDTH = 640;
36 | const int FRAME_HEIGHT = 480;
37 | putText(image1, "Hello World", Point(0, 200), 2, 1, Scalar(0, 0, 255), 2);
38 | //draw all points that have been found up to this point
39 | for (int k = 0; k < 100; k++)
40 | {
41 | circle(image1, Point(k, k), 20, Scalar(255, 0, 0), 2);
42 | //line(image1,Point(k,k),Point(k+10,k+10),Scalar(0,255,0),2);
43 | }
44 | for (int k = 0; k < 50; k++)
45 | {
46 | //circle(image1,Point(400-k,400-k),20,Scalar(0,255,0),2);
47 | line(image1, Point(200, 200 + k), Point(400, 400), Scalar(0, 255, 0), 2);
48 | }
49 |
50 | rectangle(image1, Point(330, 20), Point(280, 80), Scalar(255, 255, 0), 2, 8, 0);
51 | //waitKey(50);
52 | imshow("window_1", image1);
53 | waitKey(50);
54 | }
55 |
56 |
57 | getchar();
58 |
59 | }
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/11_color_tracking/11_color_tracking.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/11_color_tracking/main.cpp:
--------------------------------------------------------------------------------
1 | //Tracking blue, or another color if the threshold sliders are changed after running
2 |
3 | #include
4 | #include
5 |
6 | using namespace std;
7 | using namespace cv;
8 |
9 |
10 |
11 | //https://www.youtube.com/watch?v=bSeFrPrqZ2A
12 |
13 | #include
14 | #include
15 |
16 |
17 | using namespace cv;
18 | using std::vector;
19 | //trackbars
20 | int H_MIN13_2 = 74;
21 | int H_MAX13_2 = 158;
22 | int S_MIN13_2 = 100;
23 | int S_MAX13_2 = 256;
24 | int V_MIN13_2 = 95;
25 | int V_MAX13_2 = 203;
26 |
27 | void my_trackbars(int, void*) {// called when trackbars are instantiated
28 | }
29 |
30 | void createTrackbars(){
31 | //create window for trackbars
32 | namedWindow("trackbars", 0);
33 | //create memory to store trackbar name on window
34 | char TrackbarName[50];
35 | sprintf(TrackbarName, "H_MIN", H_MIN13_2);
36 | sprintf(TrackbarName, "H_MAX", H_MAX13_2);
37 | sprintf(TrackbarName, "S_MIN", S_MIN13_2);
38 | sprintf(TrackbarName, "S_MAX", S_MAX13_2);
39 | sprintf(TrackbarName, "V_MIN", V_MIN13_2);
40 | sprintf(TrackbarName, "V_MAX", V_MAX13_2);
41 | //create trackbars and insert them into window
42 | createTrackbar("H_MIN", "trackbars", &H_MIN13_2, H_MAX13_2, my_trackbars);
43 | createTrackbar("H_MAX", "trackbars", &H_MAX13_2, H_MAX13_2, my_trackbars);
44 | createTrackbar("S_MIN", "trackbars", &S_MIN13_2, S_MAX13_2, my_trackbars);
45 | createTrackbar("S_MAX", "trackbars", &S_MAX13_2, S_MAX13_2, my_trackbars);
46 | createTrackbar("V_MIN", "trackbars", &V_MIN13_2, V_MAX13_2, my_trackbars);
47 | createTrackbar("V_MAX", "trackbars", &V_MAX13_2, V_MAX13_2, my_trackbars);
48 | }
49 |
50 | void track_object(int &color, int &x, int &y, Mat threshold, Mat &cameraFeed){
51 | Mat temp;
52 | threshold.copyTo(temp);
53 | //these two vectors needed for output of findContours
54 | vector< vector > contours;
55 | vector hierarchy;
56 | //find contours of filtered image using openCV findContours function
57 | findContours(temp, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);
58 | //use moments method to find our filtered object
59 | double refArea = 0;
60 | bool objectFound = false;
61 | if (hierarchy.size() > 0) {
62 | int numObjects = hierarchy.size(); //if this is big, we have a noisy image
63 | for (int index = 0; index >= 0; index = hierarchy[index][0]) {
64 | Moments moment = moments((cv::Mat)contours[index]);
65 | double area = moment.m00; //area
66 | x = moment.m10 / area;
67 | y = moment.m01 / area;
68 | objectFound = true;
69 | refArea = area;
70 | }
71 | //let user know you found an object
72 | if (objectFound == true){
73 | putText(cameraFeed, "Tracking Object", Point(0, 50), 2, 1, Scalar(0, 255, 0), 2);
74 | //draw object location on screen
75 | circle(cameraFeed, Point(x, y), 10, Scalar(0, 255, 0), 2);
76 | }
77 | }
78 | }
79 |
80 | int main()
81 | {
82 | Mat cameraFeed;
83 | Mat HSV;
84 | Mat threshold;
85 | Mat green_threshold;
86 | //x and y values for the location of the object
87 | int bx = 0, by = 0; //blue x and y
88 | int gx = 0, gy = 0; //green x and y
89 | int color = 0;
90 | createTrackbars();
91 | VideoCapture capture;
92 | capture.open(0);
93 |
94 | int i;
95 | while (1){ //100 iterations should take round 10 seconds
96 | capture.read(cameraFeed);
97 | //convert frame from BGR to HSV colorspace
98 | cvtColor(cameraFeed, HSV, COLOR_BGR2HSV);
99 | //filter and store in threshold matrix
100 | //blue
101 | inRange(HSV, Scalar(H_MIN13_2, S_MIN13_2, V_MIN13_2), Scalar(H_MAX13_2, S_MAX13_2, V_MAX13_2), threshold);
102 | //erode and dilate to clean up the image
103 | Mat erodeElement = getStructuringElement(MORPH_RECT, Size(3, 3));
104 | Mat dilateElement = getStructuringElement(MORPH_RECT, Size(8, 8));
105 | erode(threshold, threshold, erodeElement);
106 | dilate(threshold, threshold, dilateElement);
107 | //track the object
108 | color = 1;
109 | track_object(color, bx, by, threshold, cameraFeed);
110 | //printf("blue position x = %d, y = %d, \n", x ,y);
111 |
112 | imshow("blue_threshold", threshold);
113 | imshow("camera_feed", cameraFeed);
114 |
115 | waitKey(30);
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/12_track_color_display_coordinates/12_track_color_display_coordinates.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/12_track_color_display_coordinates/main.cpp:
--------------------------------------------------------------------------------
1 | //Tracking blue, or another color if the threshold sliders are changed after running
2 |
3 | #include
4 | #include
5 |
6 | using namespace std;
7 | using namespace cv;
8 |
9 |
10 |
11 | //https://www.youtube.com/watch?v=bSeFrPrqZ2A
12 |
13 | #include
14 | #include
15 |
16 |
17 | using namespace cv;
18 | using std::vector;
19 | //trackbars
20 | int H_MIN13_2 = 74;
21 | int H_MAX13_2 = 158;
22 | int S_MIN13_2 = 100;
23 | int S_MAX13_2 = 256;
24 | int V_MIN13_2 = 95;
25 | int V_MAX13_2 = 203;
26 |
27 | void my_trackbars(int, void*) {// called when trackbars are instantiated
28 | }
29 |
30 | void createTrackbars(){
31 | //create window for trackbars
32 | namedWindow("trackbars", 0);
33 | //create memory to store trackbar name on window
34 | char TrackbarName[50];
35 | sprintf(TrackbarName, "H_MIN", H_MIN13_2);
36 | sprintf(TrackbarName, "H_MAX", H_MAX13_2);
37 | sprintf(TrackbarName, "S_MIN", S_MIN13_2);
38 | sprintf(TrackbarName, "S_MAX", S_MAX13_2);
39 | sprintf(TrackbarName, "V_MIN", V_MIN13_2);
40 | sprintf(TrackbarName, "V_MAX", V_MAX13_2);
41 | //create trackbars and insert them into window
42 | createTrackbar("H_MIN", "trackbars", &H_MIN13_2, H_MAX13_2, my_trackbars);
43 | createTrackbar("H_MAX", "trackbars", &H_MAX13_2, H_MAX13_2, my_trackbars);
44 | createTrackbar("S_MIN", "trackbars", &S_MIN13_2, S_MAX13_2, my_trackbars);
45 | createTrackbar("S_MAX", "trackbars", &S_MAX13_2, S_MAX13_2, my_trackbars);
46 | createTrackbar("V_MIN", "trackbars", &V_MIN13_2, V_MAX13_2, my_trackbars);
47 | createTrackbar("V_MAX", "trackbars", &V_MAX13_2, V_MAX13_2, my_trackbars);
48 | }
49 |
50 | void track_object(int &color, int &x, int &y, Mat threshold, Mat &cameraFeed){
51 | Mat temp;
52 | threshold.copyTo(temp);
53 | //these two vectors needed for output of findContours
54 | vector< vector > contours;
55 | vector hierarchy;
56 | //find contours of filtered image using openCV findContours function
57 | findContours(temp, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);
58 | //use moments method to find our filtered object
59 | double refArea = 0;
60 | bool objectFound = false;
61 | if (hierarchy.size() > 0) {
62 | int numObjects = hierarchy.size(); //if this is big, we have a noisy image
63 | for (int index = 0; index >= 0; index = hierarchy[index][0]) {
64 | Moments moment = moments((cv::Mat)contours[index]);
65 | double area = moment.m00; //area
66 | x = moment.m10 / area;
67 | y = moment.m01 / area;
68 | objectFound = true;
69 | refArea = area;
70 | }
71 | //let user know you found an object
72 | if (objectFound == true){
73 | putText(cameraFeed, "Tracking Object", Point(0, 50), 2, 1, Scalar(0, 255, 0), 2);
74 | //draw object location on screen
75 | circle(cameraFeed, Point(x, y), 10, Scalar(0, 255, 0), 2);
76 | printf("Color %d position: x = %d, y = %d, \n", color, x, y);
77 | }
78 | }
79 | }
80 |
81 | int main()
82 | {
83 | Mat cameraFeed;
84 | Mat HSV;
85 | Mat threshold;
86 | Mat green_threshold;
87 | //x and y values for the location of the object
88 | int bx = 0, by = 0; //blue x and y
89 | int gx = 0, gy = 0; //green x and y
90 | int color = 0;
91 | createTrackbars();
92 | VideoCapture capture;
93 | capture.open(0);
94 |
95 | int i;
96 | while (1){ //100 iterations should take round 10 seconds
97 | capture.read(cameraFeed);
98 | //convert frame from BGR to HSV colorspace
99 | cvtColor(cameraFeed, HSV, COLOR_BGR2HSV);
100 | //filter and store in threshold matrix
101 | //blue
102 | inRange(HSV, Scalar(H_MIN13_2, S_MIN13_2, V_MIN13_2), Scalar(H_MAX13_2, S_MAX13_2, V_MAX13_2), threshold);
103 | //erode and dilate to clean up the image
104 | Mat erodeElement = getStructuringElement(MORPH_RECT, Size(3, 3));
105 | Mat dilateElement = getStructuringElement(MORPH_RECT, Size(8, 8));
106 | erode(threshold, threshold, erodeElement);
107 | dilate(threshold, threshold, dilateElement);
108 | //track the object
109 | color = 1;
110 | track_object(color, bx, by, threshold, cameraFeed);
111 | //printf("blue position x = %d, y = %d, \n", x ,y);
112 |
113 | imshow("blue_threshold", threshold);
114 | imshow("camera_feed", cameraFeed);
115 |
116 | waitKey(30);
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/13_contours/13_contours.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/13_contours/main.cpp:
--------------------------------------------------------------------------------
1 | //Contour filtering with canny and sliders
2 |
3 | #include
4 | #include
5 |
6 | using namespace std;
7 | using namespace cv;
8 |
9 | #include
10 | #include
11 |
12 |
13 | #include
14 | #include
15 | #include
16 |
17 |
18 | void my_trackbar19(int, void*){};
19 | RNG rng19(12345);
20 | /** @function main */
21 | int main()
22 | {
23 | Mat src, srcGray;
24 | VideoCapture myCapture;
25 | myCapture.open(0);
26 | Mat canny_output;
27 |
28 | int threshMin = 0; //0 to 256
29 | int threshMax = 256;
30 | namedWindow("canny output", 0);
31 | char TrackbarName[50];
32 | sprintf(TrackbarName, "thresh min", threshMax);
33 | sprintf(TrackbarName, "thresh max", threshMax);
34 |
35 | createTrackbar("threshold min", "canny output", &threshMin, threshMax, my_trackbar19);
36 | createTrackbar("threshold max", "canny output", &threshMax, threshMax, my_trackbar19);
37 |
38 | while (1)
39 | {
40 | myCapture >> src;
41 |
42 |
43 | (src, srcGray, CV_BGR2GRAY);
44 | /// Detect edges using canny
45 | //Canny( srcGray, canny_output, 20, 220, 3 );
46 | Canny(src, canny_output, threshMin, threshMax, 3);
47 |
48 | imshow("canny output", canny_output);
49 | waitKey(20);
50 |
51 | vector > contours;
52 | vector hierarchy;
53 |
54 | // Find contours
55 | findContours(canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));
56 |
57 |
58 |
59 | /// Draw contours
60 |
61 | Mat drawing = Mat::zeros(canny_output.size(), CV_8UC3);
62 | for (int i = 0; i< contours.size(); i++)
63 | {
64 | Scalar color = Scalar(rng19.uniform(0, 255), rng19.uniform(0, 255), rng19.uniform(0, 255));
65 | drawContours(drawing, contours, i, color, 2, 8, hierarchy, 0, Point());
66 | }
67 | namedWindow("Contours", CV_WINDOW_AUTOSIZE);
68 | imshow("Contours", drawing);
69 | waitKey(20);
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/14_motion_tracking/10_track_motion.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/15_write_file_to_disk/15_write_file_to_disk.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/15_write_file_to_disk/main.cpp:
--------------------------------------------------------------------------------
1 | //This program writes a file to disk called tester.jpg
2 |
3 | #include "opencv2/highgui/highgui.hpp"
4 | #include "opencv2/imgproc/imgproc.hpp"
5 |
6 | #include
7 | #include
8 |
9 | #include
10 |
11 | using namespace cv;
12 | using namespace std;
13 |
14 | int main(int argc, char** argv)
15 | {
16 | const char* filename = argc >= 2 ? argv[1] : "../images/baboon.jpg";
17 |
18 | Mat image;
19 | image = imread(filename, CV_LOAD_IMAGE_COLOR); // Read the file
20 |
21 | if (!image.data) // Check for invalid input
22 | {
23 | cout << "Could not open or find the image" << std::endl;
24 | return -1;
25 | }
26 | imwrite("tester.jpg", image);
27 |
28 | namedWindow("Display window", WINDOW_AUTOSIZE);// Create a window for display.
29 | imshow("Display window", image); // Show our image inside it.
30 |
31 | waitKey(0); // Wait for a keystroke in the window
32 |
33 | return 0;
34 | }
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/15a_shrink_crop_save/15a_shrink_crop_save.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {3E958B09-5F3F-4CEB-B5F4-4B7D22BA3BE7}
18 | _15a_shrink_crop_save
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/15a_shrink_crop_save/15a_shrink_crop_save.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/15a_shrink_crop_save/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | using namespace cv;
9 | using namespace std;
10 |
11 | #include
12 |
13 | int main(int argc, char** argv)
14 | {
15 | Mat image;
16 | Size goalSize = Size(140, 140);
17 | //const std::string& directoryPath = "";
18 | Mat resized;
19 | Size originalSize = image.size();
20 | //float ratio = static_cast(goalSize.height) / originalSize.height;
21 | //Size newSize((int)(originalSize.width * ratio), (int)(originalSize.height * ratio));
22 |
23 | //Mat clipRect;
24 |
25 | const char* filename = argc >= 2 ? argv[1] : "../images/baboon.jpg";
26 |
27 | image = imread(filename, CV_LOAD_IMAGE_COLOR); // Read the file
28 | if (!image.data) // Check for invalid input
29 | {
30 | cout << "Could not open or find the image" << std::endl;
31 | return -1;
32 | }
33 | namedWindow("Display window", WINDOW_AUTOSIZE);// Create a window for display.
34 | imshow("Display window", image); // Show our image inside it.
35 |
36 | resize(image, resized, goalSize);
37 | imshow("resized window", resized);
38 |
39 | Rect clipRect(100, 100, 200, 200);// goalSize.width, resized.size().height);
40 | //Rect clipRect()
41 | Mat croppedRect = image(clipRect);
42 | //resized = resized(clipRect);
43 | imshow("clipped window", croppedRect);
44 |
45 | string my_string;
46 | string my_number = "1";
47 |
48 | imwrite("..\\images\\image.jpg", croppedRect);
49 | waitKey(0); // Wait for a keystroke in the window
50 | return 0;
51 | ;
52 | }
53 |
--------------------------------------------------------------------------------
/16_hough_lines/hough_lines.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/16_hough_lines/main.cpp:
--------------------------------------------------------------------------------
1 | //http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html
2 | //http://opencvexamples.blogspot.com/2013/10/line-detection-by-hough-line-transform.html#.VEjGgDbn8kk
3 |
4 | #include "opencv2/highgui/highgui.hpp"
5 | #include "opencv2/imgproc/imgproc.hpp"
6 |
7 | #include
8 |
9 | using namespace cv;
10 | using namespace std;
11 |
12 | int main(int argc, char** argv)
13 | {
14 | const char* filename = argc >= 2 ? argv[1] : "../images/pic1.jpg";
15 |
16 | Mat src = imread(filename, 0);
17 | if (src.empty())
18 | {
19 | cout << "can not open " << filename << endl;
20 | return -1;
21 | }
22 |
23 | Mat dst, cdst;
24 | Canny(src, dst, 50, 200, 3);
25 | cvtColor(dst, cdst, CV_GRAY2BGR);
26 |
27 | #if 0
28 | vector lines;
29 | HoughLines(dst, lines, 1, CV_PI / 180, 100, 0, 0);
30 |
31 | for (size_t i = 0; i < lines.size(); i++)
32 | {
33 |
34 | float rho = lines[i][0], theta = lines[i][1];
35 | Point pt1, pt2;
36 | double a = cos(theta), b = sin(theta);
37 | double x0 = a*rho, y0 = b*rho;
38 | pt1.x = cvRound(x0 + 1000 * (-b));
39 | pt1.y = cvRound(y0 + 1000 * (a));
40 | pt2.x = cvRound(x0 - 1000 * (-b));
41 | pt2.y = cvRound(y0 - 1000 * (a));
42 | line(cdst, pt1, pt2, Scalar(0, 0, 255), 3, CV_AA);
43 | }
44 | #else
45 | vector lines;
46 | HoughLinesP(dst, lines, 1, CV_PI / 180, 50, 50, 10);
47 | for (size_t i = 0; i < lines.size(); i++)
48 | {
49 | Vec4i l = lines[i];
50 | line(cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 0, 255), 3, CV_AA);
51 | }
52 | #endif
53 | imshow("source", src);
54 | imshow("detected lines", cdst);
55 |
56 | waitKey();
57 |
58 | return 0;
59 | }
60 |
--------------------------------------------------------------------------------
/16a_hough_lines_with_video/16a_hough_lines_with_video.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/16a_hough_lines_with_video/main.cpp:
--------------------------------------------------------------------------------
1 | //create hough lines, and superimpose on the video feed
2 |
3 | #include "opencv2/highgui/highgui.hpp"
4 | #include "opencv2/imgproc/imgproc.hpp"
5 | #include
6 |
7 | using namespace cv;
8 | using namespace std;
9 |
10 | int main()
11 | {
12 | Mat src;
13 | VideoCapture myCapture;
14 | myCapture.open(0);
15 | Mat dst, cdst;
16 |
17 | while (1)
18 | {
19 | myCapture >> src;
20 | Canny(src, dst, 20, 200, 3);
21 | cvtColor(dst, cdst, CV_GRAY2BGR);
22 | vector lines;
23 | HoughLinesP(dst, lines, 1, CV_PI / 180, 50, 50, 10);
24 | for (size_t i = 0; i < lines.size(); i++)
25 | {
26 | Vec4i l = lines[i];
27 | line(cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 0, 255), 3, CV_AA);
28 | }
29 | imshow("source", src);
30 | imshow("detected lines", cdst);
31 | waitKey(10);
32 | }
33 | return 0;
34 | }
35 |
--------------------------------------------------------------------------------
/17_sobel_transform/17_sobel_transform.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/17_sobel_transform/main.cpp:
--------------------------------------------------------------------------------
1 | //This program applies the sobel transform on a video feed
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | using namespace cv;
9 |
10 | int main()
11 | {
12 | Mat my_image, blur_image;
13 | Mat gray_image;
14 | Mat grad_x, grad_y;
15 | Mat abs_grad_x, abs_grad_y;
16 | Mat grad;
17 |
18 | int scale = 1;
19 | int delta = 0;
20 | int ddepth = CV_16S;
21 |
22 | //cv capture pointer
23 | VideoCapture my_capture;
24 |
25 | //open the img device
26 | my_capture.open(0);
27 |
28 | //loop through, apply the sobel transform to each image captured, and display it
29 | while (1)
30 | {
31 | Mat src, src_gray;
32 | my_capture.read(src);
33 |
34 | Mat grad;
35 | const char* window_name = "Sobel Demo - Simple Edge Detector";
36 | int scale = 1;
37 | int delta = 0;
38 | int ddepth = CV_16S;
39 |
40 | if (src.empty())
41 | {
42 | return -1;
43 | }
44 | GaussianBlur(src, src, Size(3, 3), 0, 0, BORDER_DEFAULT);
45 | cvtColor(src, src_gray, COLOR_RGB2GRAY);
46 | namedWindow(window_name, WINDOW_AUTOSIZE);
47 | Mat grad_x, grad_y;
48 | Mat abs_grad_x, abs_grad_y;
49 | Sobel(src_gray, grad_x, ddepth, 1, 0, 3, scale, delta, BORDER_DEFAULT);
50 | convertScaleAbs(grad_x, abs_grad_x);
51 | Sobel(src_gray, grad_y, ddepth, 0, 1, 3, scale, delta, BORDER_DEFAULT);
52 | convertScaleAbs(grad_y, abs_grad_y);
53 | addWeighted(abs_grad_x, 0.5, abs_grad_y, 0.5, 0, grad);
54 |
55 | imshow("my_window", grad);
56 | waitKey(33);
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/18_scharr_transform/18_scharr_transform.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/18_scharr_transform/main.cpp:
--------------------------------------------------------------------------------
1 | //This program applies the sobel transform on a video feed
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | using namespace cv;
9 |
10 | int main()
11 | {
12 | Mat my_image, blur_image;
13 | Mat gray_image;
14 | Mat grad_x, grad_y;
15 | Mat abs_grad_x, abs_grad_y;
16 | Mat grad;
17 |
18 | int scale = 1;
19 | int delta = 0;
20 | int ddepth = CV_16S;
21 |
22 | //cv capture pointer
23 | VideoCapture my_capture;
24 |
25 | //open the img device
26 | my_capture.open(0);
27 |
28 | //loop through, apply the sobel transform to each image captured, and display it
29 | while (1)
30 | {
31 | Mat src, src_gray;
32 | my_capture.read(src);
33 |
34 | Mat grad;
35 | const char* window_name = "Sobel Demo - Simple Edge Detector";
36 | int scale = 1;
37 | int delta = 0;
38 | int ddepth = CV_16S;
39 |
40 | if (src.empty())
41 | {
42 | return -1;
43 | }
44 | GaussianBlur(src, src, Size(3, 3), 0, 0, BORDER_DEFAULT);
45 | cvtColor(src, src_gray, COLOR_RGB2GRAY);
46 | namedWindow(window_name, WINDOW_AUTOSIZE);
47 | Mat grad_x, grad_y;
48 | Mat abs_grad_x, abs_grad_y;
49 | Scharr(src_gray, grad_x, ddepth, 1, 0, scale, delta, BORDER_DEFAULT);
50 | convertScaleAbs(grad_x, abs_grad_x);
51 | Scharr( src_gray, grad_y, ddepth, 0, 1, scale, delta, BORDER_DEFAULT );
52 | convertScaleAbs(grad_y, abs_grad_y);
53 | addWeighted(abs_grad_x, 0.5, abs_grad_y, 0.5, 0, grad);
54 |
55 | imshow("my_window", grad);
56 | waitKey(33);
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/19_track_red_and_paint/19_track_red_and_paint.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {34A1FE60-7A28-4804-8E63-6765B30C7675}
18 | _19_track_red_and_paint
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/19_track_red_and_paint/19_track_red_and_paint.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/19_track_red_and_paint/main.cpp:
--------------------------------------------------------------------------------
1 | //track red draw a line where it goes - also has trackbars
2 | //http://opencv-srf.blogspot.ro/2010/09/object-detection-using-color-seperation.html
3 | #include
4 | #include "opencv2/highgui/highgui.hpp"
5 | #include "opencv2/imgproc/imgproc.hpp"
6 |
7 | using namespace cv;
8 | using namespace std;
9 |
10 | int main(int argc, char** argv)
11 | {
12 | VideoCapture cap(0); //capture the video from webcam
13 |
14 | if (!cap.isOpened()) // if not success, exit program
15 | {
16 | cout << "Cannot open the web cam" << endl;
17 | return -1;
18 | }
19 |
20 | namedWindow("Control", CV_WINDOW_AUTOSIZE); //create a window called "Control"
21 |
22 | int iLowH = 170;
23 | int iHighH = 179;
24 |
25 | int iLowS = 150;
26 | int iHighS = 255;
27 |
28 | int iLowV = 60;
29 | int iHighV = 255;
30 |
31 | //Create trackbars in "Control" window
32 | createTrackbar("LowH", "Control", &iLowH, 179); //Hue (0 - 179)
33 | createTrackbar("HighH", "Control", &iHighH, 179);
34 |
35 | createTrackbar("LowS", "Control", &iLowS, 255); //Saturation (0 - 255)
36 | createTrackbar("HighS", "Control", &iHighS, 255);
37 |
38 | createTrackbar("LowV", "Control", &iLowV, 255);//Value (0 - 255)
39 | createTrackbar("HighV", "Control", &iHighV, 255);
40 |
41 | int iLastX = -1;
42 | int iLastY = -1;
43 |
44 | //Capture a temporary image from the camera
45 | Mat imgTmp;
46 | cap.read(imgTmp);
47 |
48 | //Create a black image with the size as the camera output
49 | Mat imgLines = Mat::zeros(imgTmp.size(), CV_8UC3);;
50 |
51 |
52 | while (true)
53 | {
54 | Mat imgOriginal;
55 |
56 | bool bSuccess = cap.read(imgOriginal); // read a new frame from video
57 |
58 |
59 |
60 | if (!bSuccess) //if not success, break loop
61 | {
62 | cout << "Cannot read a frame from video stream" << endl;
63 | break;
64 | }
65 |
66 | Mat imgHSV;
67 |
68 | cvtColor(imgOriginal, imgHSV, COLOR_BGR2HSV); //Convert the captured frame from BGR to HSV
69 |
70 | Mat imgThresholded;
71 |
72 | inRange(imgHSV, Scalar(iLowH, iLowS, iLowV), Scalar(iHighH, iHighS, iHighV), imgThresholded); //Threshold the image
73 |
74 | //morphological opening (removes small objects from the foreground)
75 | erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));
76 | dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));
77 |
78 | //morphological closing (removes small holes from the foreground)
79 | dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));
80 | erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));
81 |
82 | //Calculate the moments of the thresholded image
83 | Moments oMoments = moments(imgThresholded);
84 |
85 | double dM01 = oMoments.m01;
86 | double dM10 = oMoments.m10;
87 | double dArea = oMoments.m00;
88 |
89 | // if the area <= 10000, I consider that the there are no object in the image and it's because of the noise, the area is not zero
90 | if (dArea > 10000)
91 | {
92 | //calculate the position of the ball
93 | int posX = dM10 / dArea;
94 | int posY = dM01 / dArea;
95 |
96 | if (iLastX >= 0 && iLastY >= 0 && posX >= 0 && posY >= 0)
97 | {
98 | //Draw a red line from the previous point to the current point
99 | line(imgLines, Point(posX, posY), Point(iLastX, iLastY), Scalar(0, 0, 255), 2);
100 | }
101 |
102 | iLastX = posX;
103 | iLastY = posY;
104 | }
105 |
106 | imshow("Thresholded Image", imgThresholded); //show the thresholded image
107 |
108 | imgOriginal = imgOriginal + imgLines;
109 | imshow("Original", imgOriginal); //show the original image
110 |
111 | if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
112 | {
113 | cout << "esc key is pressed by user" << endl;
114 | break;
115 | }
116 | }
117 |
118 | return 0;
119 | }
--------------------------------------------------------------------------------
/20_warp_affine_video/20_warp_affine_video.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {44BCA874-F8BC-4F23-B2BE-5919755A1356}
18 | _20_warp_affine_video
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/20_warp_affine_video/20_warp_affine_video.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/20_warp_affine_video/main.cpp:
--------------------------------------------------------------------------------
1 | //this program warps the angle of the feed
2 |
3 | #include "opencv2/highgui/highgui.hpp"
4 | #include "opencv2/imgproc/imgproc.hpp"
5 | #include
6 | #include
7 |
8 | using namespace cv;
9 | using namespace std;
10 |
11 | int main(int argc, char** argv)
12 | {
13 | VideoCapture my_capture2;
14 | my_capture2.open(0);
15 |
16 | Point2f srcTri[3];
17 | Point2f dstTri[3];
18 |
19 | Mat rot_mat(2, 3, CV_32FC1);
20 | Mat warp_mat(2, 3, CV_32FC1);
21 | Mat src, warp_dst, warp_rotate_dst;
22 |
23 | while (1)
24 | {
25 | my_capture2 >> src;
26 |
27 | /// Set the dst image the same type and size as src
28 | warp_dst = Mat::zeros(src.rows, src.cols, src.type());
29 |
30 | /// Set your 3 points to calculate the Affine Transform
31 | srcTri[0] = Point2f(0, 0);
32 | srcTri[1] = Point2f(src.cols - 1, 0);
33 | srcTri[2] = Point2f(0, src.rows - 1);
34 |
35 | dstTri[0] = Point2f(src.cols*0.0, src.rows*0.33);
36 | dstTri[1] = Point2f(src.cols*0.85, src.rows*0.25);
37 | dstTri[2] = Point2f(src.cols*0.15, src.rows*0.7);
38 |
39 | /// Get the Affine Transform
40 | warp_mat = getAffineTransform(srcTri, dstTri);
41 |
42 | /// Apply the Affine Transform just found to the src image
43 | warpAffine(src, warp_dst, warp_mat, warp_dst.size());
44 |
45 | // Rotating the image after Warp
46 |
47 | /// Compute a rotation matrix with respect to the center of the image
48 | Point center = Point(warp_dst.cols / 2, warp_dst.rows / 2);
49 | double angle = -50.0;
50 | double scale = 0.6;
51 |
52 | /// Get the rotation matrix with the specifications above
53 | rot_mat = getRotationMatrix2D(center, angle, scale);
54 |
55 | /// Rotate the warped image
56 | warpAffine(warp_dst, warp_rotate_dst, rot_mat, warp_dst.size());
57 |
58 | /// Show what you got
59 | imshow("source_window", src);
60 | imshow("warp_window", warp_dst);
61 | imshow("warp_rotate_window", warp_rotate_dst);
62 |
63 | /// Wait until user exits the program
64 | waitKey(30);
65 | }
66 | return 0;
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/21_contours_with_canny/21_contours_with_canny.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {B2A65142-BC2E-4025-87E6-5A8183FA14DE}
18 | _21_contours_with_canny
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/21_contours_with_canny/21_contours_with_canny.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/21_contours_with_canny/main.cpp:
--------------------------------------------------------------------------------
1 | //good demonstration of contours discovered with canny
2 |
3 | #include "opencv2/imgproc/imgproc.hpp"
4 | #include "opencv2/highgui/highgui.hpp"
5 | #include
6 | #include
7 |
8 | using namespace cv;
9 |
10 | /// Global variables
11 |
12 | Mat src, src_gray;
13 | Mat dst, detected_edges;
14 |
15 | int edgeThresh = 1;
16 | int lowThreshold;
17 | int const max_lowThreshold = 100;
18 | int ratio = 3;
19 | int kernel_size = 3;
20 | char* window_name = "Edge Map";
21 |
22 |
23 |
24 | /**
25 | * @function CannyThreshold
26 | * @brief Trackbar callback - Canny thresholds input with a ratio 1:3
27 | */
28 | void CannyThreshold(int, void*)
29 | {
30 | /// Reduce noise with a kernel 3x3
31 | blur(src_gray, detected_edges, Size(3, 3));
32 |
33 | /// Canny detector
34 | Canny(detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size);
35 |
36 | /// Using Canny's output as a mask, we display our result
37 | dst = Scalar::all(0);
38 |
39 | src.copyTo(dst, detected_edges);
40 | imshow(window_name, dst);
41 | }
42 |
43 |
44 | /** @function main */
45 | int main(int argc, char** argv)
46 | {
47 | VideoCapture my_capture;
48 |
49 | //open the img device
50 | my_capture.open(0);
51 |
52 | while (1)
53 | {
54 | my_capture >> src;
55 | /// Create a matrix of the same type and size as src (for dst)
56 | dst.create(src.size(), src.type());
57 |
58 | /// Convert the image to grayscale
59 | cvtColor(src, src_gray, CV_BGR2GRAY);
60 |
61 | /// Create a window
62 | namedWindow(window_name, CV_WINDOW_AUTOSIZE);
63 |
64 | /// Create a Trackbar for user to enter threshold
65 | createTrackbar("Min Threshold:", window_name, &lowThreshold, max_lowThreshold, CannyThreshold);
66 |
67 | /// Show the image
68 | CannyThreshold(0, 0);
69 |
70 | /// Wait until user exit program by pressing a key
71 | waitKey(30);
72 | }
73 |
74 | return 0;
75 | }
--------------------------------------------------------------------------------
/22_color_maps/22_color_maps.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {BFA83BAA-8CD9-4784-9750-CCA6436492B0}
18 | _22_color_maps
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/22_color_maps/22_color_maps.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/22_color_maps/main.cpp:
--------------------------------------------------------------------------------
1 | //this program cycles through the different color maps - autumn, cool, jet, etc.
2 |
3 | //http://docs.opencv.org/trunk/modules/contrib/doc/facerec/colormaps.html
4 |
5 | #include "opencv2/highgui/highgui.hpp"
6 | #include "opencv2/imgproc/imgproc.hpp"
7 | #include
8 | #include
9 |
10 | using namespace cv;
11 |
12 | int main(int argc, const char *argv[]) {
13 | //const char* filename = argc >= 2 ? argv[1] : "../images/baboon.jpg"; //uncomment to use an image passed in
14 | String filename = "../images/maui.jpg";
15 |
16 | if (!filename.empty()) {
17 | Mat img0 = imread(filename);
18 | // Throw an exception, if the image can't be read:
19 | if (img0.empty()) {
20 | CV_Error(CV_StsBadArg, "Failed to load image");
21 | }
22 | // Holds the colormap version of the image:
23 | Mat cm_img0;
24 | // Apply the colormap:
25 | for (int i = 0; i < 12; i++){
26 | applyColorMap(img0, cm_img0, i);
27 | // Show the result:
28 | imshow("cm_img0", cm_img0);
29 | waitKey(1500);
30 | }
31 | }
32 | return 0;
33 | }
34 |
35 | /* Colormaps
36 | COLORMAP_AUTUMN = 0,
37 | COLORMAP_BONE = 1,
38 | COLORMAP_JET = 2,
39 | COLORMAP_WINTER = 3,
40 | COLORMAP_RAINBOW = 4,
41 | COLORMAP_OCEAN = 5,
42 | COLORMAP_SUMMER = 6,
43 | COLORMAP_SPRING = 7,
44 | COLORMAP_COOL = 8,
45 | COLORMAP_HSV = 9,
46 | COLORMAP_PINK = 10,
47 | COLORMAP_HOT = 11
48 |
49 | */
--------------------------------------------------------------------------------
/23_skeletonization/23_skeletonization.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {D45A6A35-1014-4011-B8D3-511C56FDE10D}
18 | _23_skeletonization
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/23_skeletonization/23_skeletonization.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/23_skeletonization/main.cpp:
--------------------------------------------------------------------------------
1 | //this program things the image until only a skeleton representation is left.
2 |
3 | //http://opencv-code.com/quick-tips/implementation-of-thinning-algorithm-in-opencv/
4 |
5 | /**
6 | * Code for thinning a binary image using Zhang-Suen algorithm.
7 | */
8 | #include
9 | #include
10 | using namespace cv;
11 | /**
12 | * Perform one thinning iteration.
13 | * Normally you wouldn't call this function directly from your code.
14 | *
15 | * @param im Binary image with range = 0-1
16 | * @param iter 0=even, 1=odd
17 | */
18 | void thinningIteration(Mat& im, int iter)
19 | {
20 | Mat marker = Mat::zeros(im.size(), CV_8UC1);
21 |
22 | for (int i = 1; i < im.rows - 1; i++)
23 | {
24 | for (int j = 1; j < im.cols - 1; j++)
25 | {
26 | uchar p2 = im.at(i - 1, j);
27 | uchar p3 = im.at(i - 1, j + 1);
28 | uchar p4 = im.at(i, j + 1);
29 | uchar p5 = im.at(i + 1, j + 1);
30 | uchar p6 = im.at(i + 1, j);
31 | uchar p7 = im.at(i + 1, j - 1);
32 | uchar p8 = im.at(i, j - 1);
33 | uchar p9 = im.at(i - 1, j - 1);
34 |
35 | int A = (p2 == 0 && p3 == 1) + (p3 == 0 && p4 == 1) +
36 | (p4 == 0 && p5 == 1) + (p5 == 0 && p6 == 1) +
37 | (p6 == 0 && p7 == 1) + (p7 == 0 && p8 == 1) +
38 | (p8 == 0 && p9 == 1) + (p9 == 0 && p2 == 1);
39 | int B = p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9;
40 | int m1 = iter == 0 ? (p2 * p4 * p6) : (p2 * p4 * p8);
41 | int m2 = iter == 0 ? (p4 * p6 * p8) : (p2 * p6 * p8);
42 |
43 | if (A == 1 && (B >= 2 && B <= 6) && m1 == 0 && m2 == 0)
44 | marker.at(i, j) = 1;
45 | }
46 | }
47 |
48 | im &= ~marker;
49 | }
50 |
51 | /**
52 | * Function for thinning the given binary image
53 | *
54 | * @param im Binary image with range = 0-255
55 | */
56 | void thinning(Mat& im, int i)
57 | {
58 | im /= 255;
59 |
60 | Mat prev = Mat::zeros(im.size(), CV_8UC1);
61 | Mat diff;
62 |
63 | do {
64 | thinningIteration(im, 0);
65 | thinningIteration(im, 1);
66 | absdiff(im, prev, diff);
67 | im.copyTo(prev);
68 | } while (countNonZero(diff) > i * 10000);
69 |
70 | im *= 255;
71 | }
72 |
73 | /**
74 | * This is an example on how to call the thinning function above.
75 | */
76 | int main()
77 | {
78 | //Mat src = imread("../images/horse.jpg");
79 | Mat src = imread("../images/person.jpg");
80 | if (src.empty())
81 | return -1;
82 |
83 | Mat bw;
84 | cvtColor(src, bw, CV_BGR2GRAY);
85 | threshold(bw, bw, 10, 255, CV_THRESH_BINARY);
86 |
87 | //show the original image
88 | imshow("src", src);
89 |
90 | //loop through, thin, and show the image (note, remove this loop, and set the 10k value above to zero to have the algo finish quickly)
91 | for (int i = 1; i < 40; i++)
92 | {
93 | thinning(bw, i);
94 | imshow("dst", bw);
95 | waitKey(40);
96 | }
97 |
98 | imshow("dst", bw);
99 | waitKey(0);
100 |
101 | return 0;
102 | }
--------------------------------------------------------------------------------
/24_shape_detection/24_shape_detection.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {523611CF-9938-4BEB-9610-49F2635F1C3E}
18 | _24_shape_detection
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/24_shape_detection/24_shape_detection.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/24_shape_detection/main.cpp:
--------------------------------------------------------------------------------
1 | //find different shapes in an image and outline them
2 |
3 | #include "opencv2/objdetect/objdetect.hpp"
4 | #include "opencv2/highgui/highgui.hpp"
5 | #include "opencv2/imgproc/imgproc.hpp"
6 | #include
7 |
8 | #include
9 | #include
10 |
11 | using namespace std;
12 | using namespace cv;
13 |
14 | int main()
15 | {
16 |
17 | IplImage* img = cvLoadImage("../images/shapes.png");
18 |
19 | //show the original image
20 | cvNamedWindow("Raw");
21 | cvShowImage("Raw", img);
22 |
23 | //converting the original image into grayscale
24 | IplImage* imgGrayScale = cvCreateImage(cvGetSize(img), 8, 1);
25 | cvCvtColor(img, imgGrayScale, CV_BGR2GRAY);
26 |
27 | //thresholding the grayscale image to get better results
28 | cvThreshold(imgGrayScale, imgGrayScale, 128, 255, CV_THRESH_BINARY);
29 |
30 | CvSeq* contours; //hold the pointer to a contour in the memory block
31 | CvSeq* result; //hold sequence of points of a contour
32 | CvMemStorage *storage = cvCreateMemStorage(0); //storage area for all contours
33 |
34 | //finding all contours in the image
35 | cvFindContours(imgGrayScale, storage, &contours, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0, 0));
36 |
37 | //iterating through each contour
38 | while (contours)
39 | {
40 | //obtain a sequence of points of contour, pointed by the variable 'contour'
41 | result = cvApproxPoly(contours, sizeof(CvContour), storage, CV_POLY_APPROX_DP, cvContourPerimeter(contours)*0.02, 0);
42 |
43 | //if there are 3 vertices in the contour(It should be a triangle)
44 | if (result->total == 3)
45 | {
46 | //iterating through each point
47 | CvPoint *pt[3];
48 | for (int i = 0; i<3; i++){
49 | pt[i] = (CvPoint*)cvGetSeqElem(result, i);
50 | }
51 |
52 | //drawing lines around the triangle
53 | cvLine(img, *pt[0], *pt[1], cvScalar(255, 0, 0), 4);
54 | cvLine(img, *pt[1], *pt[2], cvScalar(255, 0, 0), 4);
55 | cvLine(img, *pt[2], *pt[0], cvScalar(255, 0, 0), 4);
56 |
57 | }
58 |
59 | //if there are 4 vertices in the contour(It should be a quadrilateral)
60 | else if (result->total == 4)
61 | {
62 | //iterating through each point
63 | CvPoint *pt[4];
64 | for (int i = 0; i<4; i++){
65 | pt[i] = (CvPoint*)cvGetSeqElem(result, i);
66 | }
67 |
68 | //drawing lines around the quadrilateral
69 | cvLine(img, *pt[0], *pt[1], cvScalar(0, 255, 0), 4);
70 | cvLine(img, *pt[1], *pt[2], cvScalar(0, 255, 0), 4);
71 | cvLine(img, *pt[2], *pt[3], cvScalar(0, 255, 0), 4);
72 | cvLine(img, *pt[3], *pt[0], cvScalar(0, 255, 0), 4);
73 | }
74 |
75 | //if there are 7 vertices in the contour(It should be a heptagon)
76 | else if (result->total == 7)
77 | {
78 | //iterating through each point
79 | CvPoint *pt[7];
80 | for (int i = 0; i<7; i++){
81 | pt[i] = (CvPoint*)cvGetSeqElem(result, i);
82 | }
83 |
84 | //drawing lines around the heptagon
85 | cvLine(img, *pt[0], *pt[1], cvScalar(0, 0, 255), 4);
86 | cvLine(img, *pt[1], *pt[2], cvScalar(0, 0, 255), 4);
87 | cvLine(img, *pt[2], *pt[3], cvScalar(0, 0, 255), 4);
88 | cvLine(img, *pt[3], *pt[4], cvScalar(0, 0, 255), 4);
89 | cvLine(img, *pt[4], *pt[5], cvScalar(0, 0, 255), 4);
90 | cvLine(img, *pt[5], *pt[6], cvScalar(0, 0, 255), 4);
91 | cvLine(img, *pt[6], *pt[0], cvScalar(0, 0, 255), 4);
92 | }
93 |
94 | //obtain the next contour
95 | contours = contours->h_next;
96 | }
97 |
98 | //show the image in which identified shapes are marked
99 | cvNamedWindow("Tracked");
100 | cvShowImage("Tracked", img);
101 |
102 | cvWaitKey(0); //wait for a key press
103 |
104 | //cleaning up
105 | cvDestroyAllWindows();
106 | cvReleaseMemStorage(&storage);
107 | cvReleaseImage(&img);
108 | cvReleaseImage(&imgGrayScale);
109 |
110 | return 0;
111 | }
--------------------------------------------------------------------------------
/25_corner_detection/25_corner_detection.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {D77AAAC3-57AD-4111-9286-43BB9FCF7A56}
18 | _25_corner_detection
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/25_corner_detection/25_corner_detection.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/25_corner_detection/main.cpp:
--------------------------------------------------------------------------------
1 | //corner detection
2 |
3 | //http://docs.opencv.org/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.html
4 | //http://opencvexamples.blogspot.com/2013/10/harris-corner-detection.html#.VEjZgDbn8kk
5 | #include "opencv2/highgui/highgui.hpp"
6 | #include "opencv2/imgproc/imgproc.hpp"
7 | #include
8 | #include
9 | #include
10 |
11 | using namespace cv;
12 | using namespace std;
13 |
14 | int main()
15 | {
16 | int thresh = 200;
17 | Mat src, gray;
18 | VideoCapture my_capture;
19 |
20 | //open the img device
21 | my_capture.open(0);
22 |
23 | while (1)
24 | {
25 | //show the image from the webcam
26 | my_capture >> src;
27 |
28 | cvtColor(src, gray, CV_BGR2GRAY);
29 | Mat dst, dst_norm, dst_norm_scaled;
30 | dst = Mat::zeros(src.size(), CV_32FC1);
31 |
32 | // Detecting corners
33 | cornerHarris(gray, dst, 7, 5, 0.05, BORDER_DEFAULT);
34 |
35 | // Normalizing
36 | normalize(dst, dst_norm, 0, 255, NORM_MINMAX, CV_32FC1, Mat());
37 | convertScaleAbs(dst_norm, dst_norm_scaled);
38 |
39 | // Drawing a circle around corners
40 | for (int j = 0; j < dst_norm.rows; j++)
41 | {
42 | for (int i = 0; i < dst_norm.cols; i++)
43 | {
44 | if ((int)dst_norm.at(j, i) > thresh)
45 | {
46 | circle(dst_norm_scaled, Point(i, j), 5, Scalar(0), 2, 8, 0);
47 | }
48 | }
49 | }
50 |
51 | // Showing the result
52 | namedWindow("corners_window", CV_WINDOW_AUTOSIZE);
53 | imshow("corners_window", dst_norm_scaled);
54 | waitKey(33);
55 | }
56 | return(0);
57 | }
58 |
--------------------------------------------------------------------------------
/26_morph_selector/26_morph_selector.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {A1AB6622-17F3-4D62-8A88-479666CBFC64}
18 | _26_morph_selector
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/26_morph_selector/26_morph_selector.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/26_morph_selector/main.cpp:
--------------------------------------------------------------------------------
1 | //apply different types of morphs to the video stream using sliders
2 |
3 | //http://docs.opencv.org/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.html
4 |
5 | #include "opencv2/imgproc/imgproc.hpp"
6 | #include "opencv2/highgui/highgui.hpp"
7 | #include
8 | #include
9 |
10 | using namespace cv;
11 |
12 | /// Global variables
13 | Mat morph_src, morph_dst;
14 |
15 | int live_morph_elem = 0;
16 | int live_morph_size = 0;
17 | int live_morph_operator = 0;
18 | int const live_max_operator = 4;
19 | int const live_max_elem = 2;
20 | int const live_max_kernel_size = 21;
21 |
22 | char* live_window_name = "Morphology Transformations Demo";
23 |
24 | /** Function Headers */
25 | void Morphology_Operations3(int, void*);
26 |
27 | /** @function main */
28 | int main()
29 | {
30 | //cv capture pointer
31 | VideoCapture my_capture;
32 |
33 | //open the img device
34 | my_capture.open(0);
35 |
36 | while (1)
37 | {
38 | //show the image from the webcam
39 | my_capture >> morph_src;
40 |
41 | if (!morph_src.data)
42 | return -1;
43 |
44 | /// Create window
45 | namedWindow(live_window_name, CV_WINDOW_AUTOSIZE);
46 |
47 | /// Create Trackbar to select Morphology operation
48 | createTrackbar("Operator:\n 0: Opening - 1: Closing \n 2: Gradient - 3: Top Hat \n 4: Black Hat", live_window_name, &live_morph_operator, live_max_operator, Morphology_Operations3);
49 |
50 | /// Create Trackbar to select kernel type
51 | createTrackbar("Element:\n 0: Rect - 1: Cross - 2: Ellipse", live_window_name,
52 | &live_morph_elem, live_max_elem,
53 | Morphology_Operations3);
54 |
55 | /// Create Trackbar to choose kernel size
56 | createTrackbar("Kernel size:\n 2n +1", live_window_name,
57 | &live_morph_size, live_max_kernel_size,
58 | Morphology_Operations3);
59 |
60 | /// Default start
61 | Morphology_Operations3(0, 0);
62 |
63 | waitKey(20);
64 | //return 0;
65 | }
66 | }
67 |
68 | /**
69 | * @function Morphology_Operations
70 | */
71 | void Morphology_Operations3(int, void*)
72 | {
73 | // Since MORPH_X : 2,3,4,5 and 6
74 | int operation = live_morph_operator + 2;
75 |
76 | Mat element = getStructuringElement(live_morph_elem, Size(2 * live_morph_size + 1, 2 * live_morph_size + 1), Point(live_morph_size, live_morph_size));
77 |
78 | /// Apply the specified morphology operation
79 | morphologyEx(morph_src, morph_dst, operation, element);
80 | imshow(live_window_name, morph_dst);
81 | }
--------------------------------------------------------------------------------
/27_face_detection/27_face_detection.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 | {1206C688-1516-4FB1-9510-5BFF26FEA11E}
18 | _27_face_detection
19 |
20 |
21 |
22 | Application
23 | true
24 | v120
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v120
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Level3
48 | Disabled
49 | true
50 | $(Opencv4VS)\include
51 |
52 |
53 | true
54 | $(Opencv4VS)\lib
55 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_cuda300d.lib;opencv_cudaarithm300d.lib;opencv_cudabgsegm300d.lib;opencv_cudacodec300d.lib;opencv_cudafeatures2d300d.lib;opencv_cudafilters300d.lib;opencv_cudaimgproc300d.lib;opencv_cudalegacy300d.lib;opencv_cudaoptflow300d.lib;opencv_cudastereo300d.lib;opencv_cudawarping300d.lib;opencv_cudev300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;opencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;opencv_videoio300d.lib;opencv_videostab300d.lib;opengl32.lib;glu32.lib
56 |
57 |
58 |
59 |
60 | Level3
61 | MaxSpeed
62 | true
63 | true
64 | true
65 | $(Opencv4VS)\include
66 |
67 |
68 | true
69 | true
70 | true
71 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);StatTimer.lib;clBLAS.lib;clFFT.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_cuda300.lib;opencv_cudaarithm300.lib;opencv_cudabgsegm300.lib;opencv_cudacodec300.lib;opencv_cudafeatures2d300.lib;opencv_cudafilters300.lib;opencv_cudaimgproc300.lib;opencv_cudalegacy300.lib;opencv_cudaoptflow300.lib;opencv_cudastereo300.lib;opencv_cudawarping300.lib;opencv_cudev300.lib;opencv_features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;opencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitching300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_videostab300.lib;opengl32.lib;glu32.lib
72 | $(Opencv4VS)\lib
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/27_face_detection/27_face_detection.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/27_face_detection/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | using namespace cv;
9 | using namespace std;
10 |
11 |
12 | int main(int argc, char** argv)
13 | {
14 | // capture from web camera init
15 | VideoCapture cap(0);
16 | cap.open(0);
17 |
18 | Mat img;
19 |
20 | // Load cascate classifier placed in sulution folder
21 | CascadeClassifier detector;
22 | string cascadeName = "../cascades/haarcascade_frontalface_alt.xml";
23 | bool loaded = detector.load(cascadeName);
24 |
25 | // Parameters of detectMultiscale Cascade Classifier
26 |
27 | int groundThreshold = 2;
28 | double scaleStep = 1.1;
29 | Size minimalObjectSize(80, 80);
30 | Size maximalObjectSize(200, 200);
31 |
32 |
33 | // Vector of returned faces
34 | vector found;
35 |
36 | for (;;)
37 | {
38 |
39 | // Image from camera to Mat
40 | cap >> img;
41 |
42 | // Convert input to greyscale
43 | Mat image_grey;
44 | cvtColor(img, image_grey, CV_BGR2GRAY);
45 |
46 | // why not
47 | found.clear();
48 |
49 | // Detect faces
50 | detector.detectMultiScale(image_grey, found, scaleStep, groundThreshold, 0 | 2, minimalObjectSize, maximalObjectSize);
51 |
52 | // Draw the results into mat retrieved from webcam
53 | if (found.size() > 0) {
54 | for (int i = 0; i <= found.size() - 1; i++) {
55 |
56 | rectangle(img, found[i].br(), found[i].tl(), Scalar(0, 0, 0), 1, 8, 0);
57 |
58 | }
59 | }
60 |
61 | //Show the results
62 | imshow("wooohooo", img);
63 | int key2 = waitKey(20);
64 |
65 |
66 | }
67 |
68 |
69 | return 0;
70 | }
--------------------------------------------------------------------------------
/28_face_detect_superimpose_mask/28_face_detect_superimpose_mask.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/28_face_detect_superimpose_mask/main.cpp:
--------------------------------------------------------------------------------
1 | #include "opencv2/objdetect/objdetect.hpp"
2 | #include "opencv2/highgui/highgui.hpp"
3 | #include "opencv2/imgproc/imgproc.hpp"
4 |
5 | #include
6 | #include
7 |
8 | using namespace std;
9 | using namespace cv;
10 |
11 | double min_face_size = 20;
12 | double max_face_size = 200;
13 | Mat mask;
14 |
15 | Mat detectFace(Mat src);
16 | Mat putMask(Mat src, Point center, Size face_size);
17 |
18 | int main()
19 | {
20 | VideoCapture cap(0);
21 | namedWindow("window1", 1);
22 | mask = imread("../images/masks/5.jpg");
23 |
24 | while (1)
25 | {
26 | Mat frame;
27 | cap >> frame;
28 | frame = detectFace(frame);
29 |
30 | imshow("window1", frame);
31 | // Press 'c' to escape
32 | if (waitKey(1) == 'c') break;
33 | }
34 |
35 | waitKey(0);
36 | return 0;
37 | }
38 |
39 | Mat detectFace(Mat image)
40 | {
41 | // Load Face cascade (.xml file)
42 | CascadeClassifier face_cascade("../cascades/haarcascade_frontalface_alt.xml");
43 |
44 | // Detect faces
45 | std::vector faces;
46 |
47 | face_cascade.detectMultiScale(image, faces, 1.2, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(min_face_size, min_face_size), Size(max_face_size, max_face_size));
48 |
49 | // Draw circles on the detected faces
50 | for (int i = 0; i < faces.size(); i++)
51 | { // Lets only track the first face, i.e. face[0]
52 | min_face_size = faces[0].width*0.7;
53 | max_face_size = faces[0].width*1.5;
54 | Point center(faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5);
55 | image = putMask(image, center, Size(faces[i].width, faces[i].height));
56 | }
57 | return image;
58 | }
59 |
60 |
61 | Mat putMask(Mat src, Point center, Size face_size)
62 | {
63 | Mat mask1, src1;
64 | resize(mask, mask1, face_size);
65 |
66 | // ROI selection
67 | Rect roi(center.x - face_size.width / 2, center.y - face_size.width / 2, face_size.width, face_size.width);
68 | src(roi).copyTo(src1);
69 |
70 | // to make the white region transparent
71 | Mat mask2, m, m1;
72 | cvtColor(mask1, mask2, CV_BGR2GRAY);
73 | threshold(mask2, mask2, 230, 255, CV_THRESH_BINARY_INV);
74 |
75 | vector maskChannels(3), result_mask(3);
76 | split(mask1, maskChannels);
77 | bitwise_and(maskChannels[0], mask2, result_mask[0]);
78 | bitwise_and(maskChannels[1], mask2, result_mask[1]);
79 | bitwise_and(maskChannels[2], mask2, result_mask[2]);
80 | merge(result_mask, m); // imshow("m",m);
81 |
82 | mask2 = 255 - mask2;
83 | vector srcChannels(3);
84 | split(src1, srcChannels);
85 | bitwise_and(srcChannels[0], mask2, result_mask[0]);
86 | bitwise_and(srcChannels[1], mask2, result_mask[1]);
87 | bitwise_and(srcChannels[2], mask2, result_mask[2]);
88 | merge(result_mask, m1); // imshow("m1",m1);
89 |
90 | addWeighted(m, 1, m1, 1, 0, m1); // imshow("m2",m1);
91 |
92 | m1.copyTo(src(roi));
93 |
94 | return src;
95 | }
96 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # opencv_files
2 | OpenCV collection of files
3 |
4 | This page was started to help collect useful OpenCV code, and provide a location for tutorial code. Each program comes with a Visual Studio project that was tested working using visual studio 2013 with the Ceemple plugin installed. The code will work fine on other operating system that have OpenCV installed.
5 |
6 | Here is a link to tutorials that accompany this code:
7 |
8 | https://www.youtube.com/watch?v=Q6NkiY9fylw&list=PLpV2_Uaul7v_i88gZRwIwPgNGpakZnOhs
9 |
10 | Please contact Tony if you have suggestions for items to add: tonymuilenburg [at] gmail.
--------------------------------------------------------------------------------
/images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/1.png
--------------------------------------------------------------------------------
/images/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/5.jpg
--------------------------------------------------------------------------------
/images/768x576.avi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/768x576.avi
--------------------------------------------------------------------------------
/images/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | file(GLOB HAAR_CASCADES haarcascades/*.xml)
2 | file(GLOB LBP_CASCADES lbpcascades/*.xml)
3 |
4 | if(ANDROID)
5 | install(FILES ${HAAR_CASCADES} DESTINATION sdk/etc/haarcascades COMPONENT libs)
6 | install(FILES ${LBP_CASCADES} DESTINATION sdk/etc/lbpcascades COMPONENT libs)
7 | elseif(NOT WIN32)
8 | install(FILES ${HAAR_CASCADES} DESTINATION share/OpenCV/haarcascades COMPONENT libs)
9 | install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT libs)
10 | endif()
11 |
12 | if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
13 | install(DIRECTORY "${OPENCV_TEST_DATA_PATH}/" DESTINATION "${OPENCV_TEST_DATA_INSTALL_PATH}" COMPONENT "tests")
14 | endif()
--------------------------------------------------------------------------------
/images/DetectingContours.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/DetectingContours.jpg
--------------------------------------------------------------------------------
/images/HappyFish.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/HappyFish.jpg
--------------------------------------------------------------------------------
/images/LinuxLogo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/LinuxLogo.jpg
--------------------------------------------------------------------------------
/images/WindowsLogo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/WindowsLogo.jpg
--------------------------------------------------------------------------------
/images/aero1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/aero1.jpg
--------------------------------------------------------------------------------
/images/aero3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/aero3.jpg
--------------------------------------------------------------------------------
/images/aloeL.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/aloeL.jpg
--------------------------------------------------------------------------------
/images/aloeR.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/aloeR.jpg
--------------------------------------------------------------------------------
/images/baboon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/baboon.jpg
--------------------------------------------------------------------------------
/images/baby_blanket.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/baby_blanket.png
--------------------------------------------------------------------------------
/images/basketball1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/basketball1.png
--------------------------------------------------------------------------------
/images/basketball2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/basketball2.png
--------------------------------------------------------------------------------
/images/board.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/board.jpg
--------------------------------------------------------------------------------
/images/box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/box.png
--------------------------------------------------------------------------------
/images/box_in_scene.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/box_in_scene.png
--------------------------------------------------------------------------------
/images/building.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/building.jpg
--------------------------------------------------------------------------------
/images/cat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/cat.jpg
--------------------------------------------------------------------------------
/images/chess.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/chess.JPG
--------------------------------------------------------------------------------
/images/chicky_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/chicky_512.png
--------------------------------------------------------------------------------
/images/digits.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/digits.png
--------------------------------------------------------------------------------
/images/fruits.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/fruits.jpg
--------------------------------------------------------------------------------
/images/glasses.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/glasses.jpg
--------------------------------------------------------------------------------
/images/graf1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/graf1.png
--------------------------------------------------------------------------------
/images/graf3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/graf3.png
--------------------------------------------------------------------------------
/images/hand1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/hand1.png
--------------------------------------------------------------------------------
/images/hand2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/hand2.png
--------------------------------------------------------------------------------
/images/hand3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/hand3.png
--------------------------------------------------------------------------------
/images/horse.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/horse.jpg
--------------------------------------------------------------------------------
/images/image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/image.jpg
--------------------------------------------------------------------------------
/images/imageTextN.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/imageTextN.png
--------------------------------------------------------------------------------
/images/imageTextR.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/imageTextR.png
--------------------------------------------------------------------------------
/images/intrinsics.yml:
--------------------------------------------------------------------------------
1 | %YAML:1.0
2 | M1: !!opencv-matrix
3 | rows: 3
4 | cols: 3
5 | dt: d
6 | data: [ 5.3480326845051309e+02, 0., 3.3568643204394891e+02, 0.,
7 | 5.3480326845051309e+02, 2.4066183054066337e+02, 0., 0., 1. ]
8 | D1: !!opencv-matrix
9 | rows: 1
10 | cols: 5
11 | dt: d
12 | data: [ 2.9589439552724328e-01, -1.0354662043042675e+00, 0., 0., 0. ]
13 | M2: !!opencv-matrix
14 | rows: 3
15 | cols: 3
16 | dt: d
17 | data: [ 5.3480326845051309e+02, 0., 3.3455744527912015e+02, 0.,
18 | 5.3480326845051309e+02, 2.4205324573376600e+02, 0., 0., 1. ]
19 | D2: !!opencv-matrix
20 | rows: 1
21 | cols: 5
22 | dt: d
23 | data: [ -1.6916358306948096e-01, -1.1214173641213163e-01, 0., 0., 0. ]
24 |
--------------------------------------------------------------------------------
/images/left01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left01.jpg
--------------------------------------------------------------------------------
/images/left02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left02.jpg
--------------------------------------------------------------------------------
/images/left03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left03.jpg
--------------------------------------------------------------------------------
/images/left04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left04.jpg
--------------------------------------------------------------------------------
/images/left05.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left05.jpg
--------------------------------------------------------------------------------
/images/left06.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left06.jpg
--------------------------------------------------------------------------------
/images/left07.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left07.jpg
--------------------------------------------------------------------------------
/images/left08.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left08.jpg
--------------------------------------------------------------------------------
/images/left09.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left09.jpg
--------------------------------------------------------------------------------
/images/left11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left11.jpg
--------------------------------------------------------------------------------
/images/left12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left12.jpg
--------------------------------------------------------------------------------
/images/left13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left13.jpg
--------------------------------------------------------------------------------
/images/left14.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/left14.jpg
--------------------------------------------------------------------------------
/images/lena.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/lena.jpg
--------------------------------------------------------------------------------
/images/licenseplate_motion.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/licenseplate_motion.jpg
--------------------------------------------------------------------------------
/images/masks/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/1.jpg
--------------------------------------------------------------------------------
/images/masks/10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/10.jpg
--------------------------------------------------------------------------------
/images/masks/11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/11.jpg
--------------------------------------------------------------------------------
/images/masks/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/2.jpg
--------------------------------------------------------------------------------
/images/masks/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/3.jpg
--------------------------------------------------------------------------------
/images/masks/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/4.jpg
--------------------------------------------------------------------------------
/images/masks/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/5.jpg
--------------------------------------------------------------------------------
/images/masks/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/6.jpg
--------------------------------------------------------------------------------
/images/masks/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/7.jpg
--------------------------------------------------------------------------------
/images/masks/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/8.png
--------------------------------------------------------------------------------
/images/masks/9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/masks/9.jpg
--------------------------------------------------------------------------------
/images/maui.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/maui.jpg
--------------------------------------------------------------------------------
/images/moon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/moon.jpg
--------------------------------------------------------------------------------
/images/my_capture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/my_capture.jpg
--------------------------------------------------------------------------------
/images/o.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/o.png
--------------------------------------------------------------------------------
/images/opencv-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/opencv-logo.png
--------------------------------------------------------------------------------
/images/opencv_cheatsheet.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/opencv_cheatsheet.pdf
--------------------------------------------------------------------------------
/images/person.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/person.jpg
--------------------------------------------------------------------------------
/images/pic1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/pic1.jpg
--------------------------------------------------------------------------------
/images/pic1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/pic1.png
--------------------------------------------------------------------------------
/images/pic2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/pic2.png
--------------------------------------------------------------------------------
/images/pic3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/pic3.png
--------------------------------------------------------------------------------
/images/pic4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/pic4.png
--------------------------------------------------------------------------------
/images/pic5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/pic5.png
--------------------------------------------------------------------------------
/images/pic6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/pic6.png
--------------------------------------------------------------------------------
/images/readme.txt:
--------------------------------------------------------------------------------
1 | This folder contains various data that is used by cv libraries and/or demo applications.
2 | ----------------------------------------------------------------------------------------
3 |
4 | haarcascades - the folder contains trained classifiers for detecting objects
5 | of a particular type, e.g. faces (frontal, profile), pedestrians etc.
6 | Some of the classifiers have a special license - please,
7 | look into the files for details.
8 |
--------------------------------------------------------------------------------
/images/right01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right01.jpg
--------------------------------------------------------------------------------
/images/right02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right02.jpg
--------------------------------------------------------------------------------
/images/right03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right03.jpg
--------------------------------------------------------------------------------
/images/right04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right04.jpg
--------------------------------------------------------------------------------
/images/right05.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right05.jpg
--------------------------------------------------------------------------------
/images/right06.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right06.jpg
--------------------------------------------------------------------------------
/images/right07.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right07.jpg
--------------------------------------------------------------------------------
/images/right08.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right08.jpg
--------------------------------------------------------------------------------
/images/right09.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right09.jpg
--------------------------------------------------------------------------------
/images/right11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right11.jpg
--------------------------------------------------------------------------------
/images/right12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right12.jpg
--------------------------------------------------------------------------------
/images/right13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right13.jpg
--------------------------------------------------------------------------------
/images/right14.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/right14.jpg
--------------------------------------------------------------------------------
/images/robot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/robot.png
--------------------------------------------------------------------------------
/images/rubberwhale1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/rubberwhale1.png
--------------------------------------------------------------------------------
/images/rubberwhale2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/rubberwhale2.png
--------------------------------------------------------------------------------
/images/scratchcard-ocr-sample-image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/scratchcard-ocr-sample-image.png
--------------------------------------------------------------------------------
/images/shape_sample/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/1.png
--------------------------------------------------------------------------------
/images/shape_sample/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/10.png
--------------------------------------------------------------------------------
/images/shape_sample/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/11.png
--------------------------------------------------------------------------------
/images/shape_sample/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/12.png
--------------------------------------------------------------------------------
/images/shape_sample/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/13.png
--------------------------------------------------------------------------------
/images/shape_sample/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/14.png
--------------------------------------------------------------------------------
/images/shape_sample/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/15.png
--------------------------------------------------------------------------------
/images/shape_sample/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/16.png
--------------------------------------------------------------------------------
/images/shape_sample/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/17.png
--------------------------------------------------------------------------------
/images/shape_sample/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/18.png
--------------------------------------------------------------------------------
/images/shape_sample/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/19.png
--------------------------------------------------------------------------------
/images/shape_sample/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/2.png
--------------------------------------------------------------------------------
/images/shape_sample/20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/20.png
--------------------------------------------------------------------------------
/images/shape_sample/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/3.png
--------------------------------------------------------------------------------
/images/shape_sample/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/4.png
--------------------------------------------------------------------------------
/images/shape_sample/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/5.png
--------------------------------------------------------------------------------
/images/shape_sample/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/6.png
--------------------------------------------------------------------------------
/images/shape_sample/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/7.png
--------------------------------------------------------------------------------
/images/shape_sample/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/8.png
--------------------------------------------------------------------------------
/images/shape_sample/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shape_sample/9.png
--------------------------------------------------------------------------------
/images/shapes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/shapes.png
--------------------------------------------------------------------------------
/images/source1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/source1.png
--------------------------------------------------------------------------------
/images/starry_night.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/starry_night.jpg
--------------------------------------------------------------------------------
/images/stereo_calib.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | "left01.jpg"
5 | "right01.jpg"
6 | "left02.jpg"
7 | "right02.jpg"
8 | "left03.jpg"
9 | "right03.jpg"
10 | "left04.jpg"
11 | "right04.jpg"
12 | "left05.jpg"
13 | "right05.jpg"
14 | "left06.jpg"
15 | "right06.jpg"
16 | "left07.jpg"
17 | "right07.jpg"
18 | "left08.jpg"
19 | "right08.jpg"
20 | "left09.jpg"
21 | "right09.jpg"
22 | "left11.jpg"
23 | "right11.jpg"
24 | "left12.jpg"
25 | "right12.jpg"
26 | "left13.jpg"
27 | "right13.jpg"
28 | "left14.jpg"
29 | "right14.jpg"
30 |
31 |
32 |
--------------------------------------------------------------------------------
/images/stuff.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/stuff.jpg
--------------------------------------------------------------------------------
/images/templ.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/templ.png
--------------------------------------------------------------------------------
/images/text_defocus.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/text_defocus.jpg
--------------------------------------------------------------------------------
/images/text_motion.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/text_motion.jpg
--------------------------------------------------------------------------------
/images/tony.mpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/tony.mpg
--------------------------------------------------------------------------------
/images/tony.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/tony.png
--------------------------------------------------------------------------------
/images/tree.avi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/tree.avi
--------------------------------------------------------------------------------
/images/vec_files/trainingfaces_24-24.vec:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/vec_files/trainingfaces_24-24.vec
--------------------------------------------------------------------------------
/images/water_coins.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/water_coins.jpg
--------------------------------------------------------------------------------
/images/xyed.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muilenta/opencv_files/54cb61cdae8e530d553f81049e39048f6fc87f8b/images/xyed.jpg
--------------------------------------------------------------------------------