Last active
September 17, 2020 09:54
-
-
Save rodolfoap/728014d9388507362892c298a6aea3ea to your computer and use it in GitHub Desktop.
Compiling filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/bilateral_filter.* | |
/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <opencv2/opencv.hpp> | |
#include "bilateral_filter.simd.hpp" | |
int main(int argc, char** argv) { | |
if(argc<5){ std::cerr<<"Usage: "<<argv[0]<<" [INPUT OUTPUT DIAMETER SIGMA_COLOR SIGMA_SPACE]"<<std::endl; exit(1); } | |
cv::Mat input=cv::imread(argv[1]), output; | |
bilateralFilter(input, output, std::stoi(argv[3]), std::stod(argv[4]), std::stoi(argv[5]), cv::BORDER_DEFAULT); | |
cv::namedWindow("Result", cv::WINDOW_NORMAL); | |
cv::imwrite(argv[2], output); | |
cv::imshow("Result", output); | |
cv::waitKey(0); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.10) | |
project(app) | |
# Force C++17 | |
set(CMAKE_CXX_STANDARD 17) | |
set(CMAKE_CXX_STANDARD_REQUIRED True) | |
# Equivalent to (CFLAGS) -g | |
set(CMAKE_BUILD_TYPE Debug) | |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | |
# Equivalent to (CFLAGS) -g | |
set(CMAKE_C_FLAGS "-g") | |
# OPENCV #################################### | |
find_package(OpenCV REQUIRED) | |
add_executable(app app.cpp bilateral_filter.dispatch.cpp) | |
include_directories(${OpenCV_INCLUDE_DIRS}) | |
target_link_libraries(app ${OpenCV_LIBS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[ -f bilateral_filter.dispatch.cpp ] || wget https://raw.githubusercontent.com/opencv/opencv/master/modules/imgproc/src/bilateral_filter.dispatch.cpp | |
[ -f bilateral_filter.simd.hpp ] || wget https://raw.githubusercontent.com/opencv/opencv/master/modules/imgproc/src/bilateral_filter.simd.hpp | |
[ -d build ] || mkdir build; | |
[ -f app ] || { pushd build &>/dev/null; cmake ..; make -j$(nproc); popd &>/dev/null; } | |
./app vis1000.jpg result.jpg 3 75 75 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment