OpenCV4 daily practice day2: Run OpenCV sample programs (edge detection, kmeans clustering)

One: Add the C++ sample program that comes with OpenCV into the VS2015 source file

Insert picture description here
Insert picture description here
Insert picture description here

Two: run the edge detection sample program

The picture called by default is like this, if you want to use our own picture, you need to modify the default parameters:
Insert picture description here
step1: Put the picture in the project source file:
Insert picture description here
step2: View——Property Manager——Double-click "Debug|x64"—— Debugging-command parameters-Hepburn.jpg running results (GIF animation) -here
Insert picture description here
is actually using the Canny operator for edge detection:
Insert picture description here

Three: Use the windows terminal interface (not using VS2015) to run the edge detection sample program

step1: Open the windows terminal
Insert picture description here
step2: find the exe program and image path just built by VS2015
Insert picture description here
Insert picture description here
step3: terminal enter the executable file path + space + image path + carriage return to run the
Insert picture description here
operation results (GIF animation):
Insert picture description here

Four: run the K clustering sample program

step1: find kmeans.cpp sample program source file added to the VS2015
Insert picture description here
step2: Due to the need for external kmeans.cpp pictures, input parameters can not run, so you want to cancel the default parameters Hepburn.jpg added when the edge detection
Insert picture description here
Insert picture description here
operation results (GIF move Figure): Run, press the space bar to continue, press the ESC key to exit . (Common operation of OpenCV sample program)
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43297891/article/details/114286041