added target cmake stuff, adding functions for manipulating two images
This commit is contained in:
parent
6ca6aa2a7b
commit
d34b4e0b5f
@ -1,12 +1,16 @@
|
|||||||
# CMakeList.txt : CMake project for ImageMan, include source and define
|
# CMakeList.txt : CMake project for ImageMan, include source and define
|
||||||
# project specific logic here.
|
# project specific logic here.
|
||||||
#
|
#
|
||||||
cmake_minimum_required (VERSION 3.8)
|
cmake_minimum_required(VERSION 3.7...3.19)
|
||||||
|
|
||||||
project (ImageMan)
|
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||||
|
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
project(ImageMan VERSION 1.0 DESCRIPTION "Playing with conan package manager and OpenCV" LANGUAGES CXX)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
#set(CMAKE_CXX_STANDARD 17)
|
||||||
|
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
|
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
|
||||||
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
|
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
|
||||||
@ -24,6 +28,17 @@ conan_cmake_run(REQUIRES opencv/4.5.1
|
|||||||
configure_file(clouds.jpg bin/clouds.jpg COPYONLY)
|
configure_file(clouds.jpg bin/clouds.jpg COPYONLY)
|
||||||
configure_file(holoshot.png bin/holoshot.png COPYONLY)
|
configure_file(holoshot.png bin/holoshot.png COPYONLY)
|
||||||
|
|
||||||
# Add source to this project's executable.
|
# ImageMan Target
|
||||||
add_executable (ImageMan "ImageMan.cpp" "ImageMan.h")
|
add_executable (ImageMan src/ImageMan.cpp)
|
||||||
target_link_libraries(ImageMan CONAN_PKG::opencv)
|
target_link_libraries(ImageMan CONAN_PKG::opencv)
|
||||||
|
|
||||||
|
target_include_directories(ImageMan
|
||||||
|
PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
#set_property(TARGET ImageMan PROPERTY CXX_STANDARD 17)
|
||||||
|
target_compile_features(ImageMan PRIVATE cxx_std_17)
|
||||||
|
26
ImageMan.cpp
26
ImageMan.cpp
@ -1,26 +0,0 @@
|
|||||||
// ImageMan.cpp : Defines the entry point for the application.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "ImageMan.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace cv;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
//Mat image = imread("clouds.jpg");
|
|
||||||
Mat image = imread("holoshot.png");
|
|
||||||
cout << "image size: (" << image.size() << ")" << endl;
|
|
||||||
try {
|
|
||||||
//resize(image, image, cv::Size(1000, 1000), INTER_AREA);
|
|
||||||
GaussianBlur(image, image, Size(17, 17), 3.0, 3.0);
|
|
||||||
//Sobel(image, image, -1, 1, 1);
|
|
||||||
|
|
||||||
imshow("image", image);
|
|
||||||
waitKey();
|
|
||||||
}
|
|
||||||
catch (cv::Exception e) {
|
|
||||||
cout << "error: " << e.what() << endl;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
54
src/ImageMan.cpp
Normal file
54
src/ImageMan.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// ImageMan.cpp : Defines the entry point for the application.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "ImageMan/ImageMan.hpp"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace cv;
|
||||||
|
|
||||||
|
void Resize(Mat &image, int height, int width)
|
||||||
|
{
|
||||||
|
resize(image, image, cv::Size(height, width), INTER_AREA);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SobelFilter(Mat image, int dx = 1, int dy = 0)
|
||||||
|
{
|
||||||
|
Sobel(image, image, -1, dx, dy);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Blur(Mat image)
|
||||||
|
{
|
||||||
|
GaussianBlur(image, image, Size(17, 17), 3.0, 3.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dilate(Mat image, int dilation_size = 5)
|
||||||
|
{
|
||||||
|
Mat element = getStructuringElement(MORPH_RECT,
|
||||||
|
Size(2 * dilation_size + 1, 2 * dilation_size + 1),
|
||||||
|
Point(dilation_size, dilation_size));
|
||||||
|
dilate(image, image, element);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
Mat clouds = imread("clouds.jpg");
|
||||||
|
Mat holo = imread("holoshot.png");
|
||||||
|
cout << "image size: (" << holo.size() << ")" << endl;
|
||||||
|
try {
|
||||||
|
//SobelFilter(holo);
|
||||||
|
Dilate(holo);
|
||||||
|
Blur(holo);
|
||||||
|
|
||||||
|
Resize(clouds, 800, 400);
|
||||||
|
SobelFilter(clouds, 0, 1);
|
||||||
|
Dilate(clouds);
|
||||||
|
|
||||||
|
imshow("holo", holo);
|
||||||
|
imshow("clouds", clouds);
|
||||||
|
waitKey();
|
||||||
|
}
|
||||||
|
catch (cv::Exception e) {
|
||||||
|
cout << "error: " << e.what() << endl;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user