|
hace 3 años | |
---|---|---|
.idea | hace 3 años | |
java | hace 3 años | |
jni | hace 3 años | |
opencv | hace 3 años | |
output | hace 3 años | |
.gitignore | hace 3 años | |
CMakeLists.txt | hace 3 años | |
README.md | hace 3 años | |
build.sh | hace 3 años | |
count_down_latch.h | hace 3 años | |
main.cpp | hace 3 años |
整个算法的原理和拉普拉斯算子本身的定义有关,该算子主要用来测量图像的二阶导数。它强调了包含快速强度变化的图像区域。拉普拉斯算子经常被用来做边缘检测。这里存在着一个假设,即如果一个图像中包含着高方差,那么在图像中会有较大范围的响应,包括边缘和非边缘,这代表着一张正常图像。但是如果该图像的方差很低,那么响应的范围很小,这表明图像中的边缘很小。众所周知的是当图像越模糊时,包含的边缘信息就会越少
实现步骤:
必须安装的环境
JAVA_HOME
git clone https://git.yishihui.com/VideoProcessing/PQCVMedia.git
cd PQCVMedia
./build.sh
echo "安装成功,在当前 output/lib 下"
配置 JAVA_HOME 环境变量
export JAVA_HOME=xxx
命令安装 必须 4.5.5 版本
sudo yum install opencv opencv-devel
#检查版本
pkg-config --modversion opencv
源码安装 4.5.5
#opencv 环境 4.5.5
#安装依赖包
sudo yum install freeglut-devel mesa-libGL mesa-libGL-devel boost boost-thread boost-devel libv4l-devel libjpeg-turbo-devel libtiff-devel libdc1394-devel tbb-devel eigen3-devel gstreamer-plugins-base-devel python-devel numpy python34-numpy gtk2-devel libpng-devel jasper-devel openexr-devel libwebp-devel python3 python3-devel python3-pip python3-devel python3-numpy
#下载 OpenCV 源码
wget -O opencv-4.5.5.zip https://github.com/opencv/opencv/archive/refs/tags/4.5.5.zip
wget -O opencv_contrib-4.5.5.zip https://github.com/opencv/opencv_contrib/archive/refs/tags/4.5.5.zip
unzip opencv-4.5.5.zip
unzip opencv_contrib-4.5.5.zip
cd opencv-4.5.5
mkdir build && cd build
OPENCV_CONTRIB_DIR=/root/opencv/opencv_contrib-4.5.5/modules
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH="${OPENCV_CONTRIB_DIR}" \
-D BUILD_EXAMPLES=ON ..
#使用 8cpu 编译并安装
make -j8 && make install
命令安装
brew install opencv
如果安装慢可以换一个源:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
将 jar copy 至你的项目
cp PQCVMedia/output/jar/libpq-cv-media.jar 你的目录
1、初始化 SDK
PQCVMediaProcessor.initSDK("/root/libpiaoquan_java_opencv.so");
2、以 bytes 流形式传递
PQCVMediaProcessor.blurDetectionFromImageBytes(byte[] data)
2、以 path 流形式传递
PQCVMediaProcessor.blurDetectionFromImagePath(String path);