当前位置: 首页 > news >正文

一个网站怎么做关键词搜索建设云网站

一个网站怎么做关键词搜索,建设云网站,免费推广的网站,网络推广的细节提供了直线检测python与C版本#xff0c;用于检测竖直线与横线#xff0c;主要流程为#xff1a;图像二值化Canny边缘检测霍夫直线变换直线检测 一、python实现 import shutilimport osimport cv2 import numpy as npfilename 20230525-173637.jpg file_ext …提供了直线检测python与C版本用于检测竖直线与横线主要流程为图像二值化Canny边缘检测霍夫直线变换直线检测 一、python实现 import shutilimport osimport cv2 import numpy as npfilename 20230525-173637.jpg file_ext .jpgsrc_path ./ filename dirpath ./ print(src_path) # TODO: 在此处添加对图片的处理代码new_filename filename.split(.)[0] _result. file_extnew_file_path os.path.join(dirpath, new_filename)img_path src_path# 读取图像 img2 cv2.imread(img_path) img cv2.imread(img_path,0)lower 25 upper 255# 将图像二值化到指定范围内 binary_img cv2.inRange(img, lower, upper) # # 显示结果 cv2.imshow(Binary Image, binary_img) cv2.waitKey(0) cv2.destroyAllWindows()cv2.imwrite(new_file_path,binary_img)# 边缘检测 edges cv2.Canny(binary_img, 50, 150, apertureSize3)# 使用霍夫直线变换检测直线 lines cv2.HoughLinesP(edges, rho1, theta0.5*np.pi/180, threshold50, minLineLength1000, maxLineGap80)# shutil.copy2(src_path, new_file_path)# 遍历所有直线绘制竖直方向的直线 for line in lines:x1, y1, x2, y2 line[0]# 计算直线的斜率# print(x2-x1)# k (y2 - y1) / (x2 - x1)# 当斜率大于0.5时认为是竖直方向的直线if x2 -x1 0 :# img cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)cv2.line(img2, (x1, y1), (x2, y2), (0, 0, 255), 5)# print(6666)cv2.imwrite(new_file_path,img2) 二、C实现 #include iostream #include string #include opencv2/opencv.hpp #include cmath const std::string file_ext .jpeg; const int lower 10; const int upper 255;double distance(int x1, int y1, int x2, int y2) {// 计算两点直线距离double dx x1 - x2;double dy y1 - y2;return std::sqrt(dx*dx dy*dy); }int main() {std::string src_path ../1/top3.jpeg;// 读取图片// cv::Mat img cv::imread(src_path, 0);cv::Mat img2 cv::imread(src_path);cv::Mat img;cv::cvtColor(img2, img, cv::COLOR_BGR2GRAY);// 判断是否读取成功if (img.empty()) {std::cout read image failed std::endl;return -1;}// 将图像二值化到指定范围内cv::Mat binary_img;cv::inRange(img, lower, upper, binary_img);// 边缘检测cv::Mat edges;cv::Canny(binary_img, edges, 50, 150, 3);// 使用霍夫直线变换检测直线std::vectorcv::Vec4i lines;cv::HoughLinesP(edges, lines, 1, 0.5*CV_PI/180, 50, 1000, 80);// 遍历所有直线绘制竖直方向的直线bool ifLeft false;bool iRight false;for (auto line : lines){int x1 line[0], y1 line[1], x2 line[2], y2 line[3];// 当斜率大于0.5时认为是竖直方向的直线if (x2 - x1 0){double dis distance(x1, y1, x2, y2);if ((630 x1 x1 650) (dis 1000)){cv::line(img2, cv::Point(x1, y1), cv::Point(x2, y2), cv::Scalar(0, 0, 255), 5);std::cout x1 std::endl;ifLeft true;// cv::imwrite(new_file_path, img2);}if ((1270 x1 x1 1290) (dis 1000)){cv::line(img2, cv::Point(x1, y1), cv::Point(x2, y2), cv::Scalar(0, 0, 255), 5);std::cout x1 std::endl;iRight true;}}}// cv::imshow(image, img2);// cv::waitKey(0);if( ifLeft iRight){std::cout 2 std::endl;return 2;}if( ifLeft !iRight){std::cout 1 std::endl;return 1;}std::cout 0 std::endl;return 0;cv::imshow(image, img2);cv::waitKey(0); } cmake # For more information about using CMake with Android Studio, read the # documentation: https://d.android.com/studio/projects/add-native-code.html# Sets the minimum version of CMake required to build the native library. project(linedetector) cmake_minimum_required(VERSION 3.4.1)# Declares and names the project.set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -fexceptions) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fexceptions )# 添加opencv set(thirdPath ${CMAKE_SOURCE_DIR}/thirdParty) set(OPENCV_ANDROID_SDK_PATH ${thirdPath}/opencv/) include_directories(${OPENCV_ANDROID_SDK_PATH}/native/jni/include) add_library(opencvSHAREDIMPORTED) set_target_properties(opencvPROPERTIESIMPORTED_LOCATION${OPENCV_ANDROID_SDK_PATH}/native/libs/${ANDROID_ABI}/libopencv_java3.so)# 添加自定义文件 set(INTERFACE_SRC ${CMAKE_SOURCE_DIR}/src/main/cpp) include_directories(${INTERFACE_SRC}/)file(GLOB_RECURSE INTERFACE_SRC${INTERFACE_SRC}/linedetector.cpp)add_library(linedetector SHARED ${INTERFACE_SRC})find_library( # Sets the name of the path variable.log-lib# Specifies the name of the NDK library that# you want CMake to locate.log)# Specifies libraries CMake should link to your target library. You # can link multiple libraries, such as libraries you define in this # build script, prebuilt third-party libraries, or system libraries.target_link_libraries( # Specifies the target library.linedetectoropencvjnigraphics# Links the target library to the log library# included in the NDK.${log-lib}) 编译运行 mkdir build cd build cmake .. make ./linedetector
http://www.zqtcl.cn/news/61146/

相关文章:

  • 烟台网站建设-中国互联定制型网站建设价格
  • 傻瓜式网站源码公司制作网站多少钱
  • 怎么做网站旺铺装修杭州哪家公司网站做的好
  • 网站设计设计目的西安网页设计工资
  • 网站开发安装win10家庭版宁晋网站开发
  • 网站参考模板电商静态网页模板
  • 铜山区建设局局网站周保春天猫店购买交易平台
  • 做公司网站要多久网站制作需要多少钱品牌
  • 旅游网站设计页面做网站客户总是要退款
  • 做seo是要先有网站吗云虚拟主机做网站
  • mip手机网站模板写作网站推荐
  • 乐清网站制作推荐全域seo
  • 如何制作一个自己的网站?网页制作素材网站
  • 包装设计灵感网站南沙网站建设
  • 罗源县建设局网站荷兰网站开发价格
  • 公众号怎么建网站重庆网站制作公司重庆
  • 黄山做网站公司wordpress内容查看
  • 学做网站论坛好吗网站域名在山东备案却在苏州
  • 专业建站公司收费标准龙岩招聘求职网站有哪些
  • 网站服务器做缓存吗怎么用php源代码做网站
  • 天翼云主机怎么建设网站wordpress臃肿
  • 兖州网站建设公司自己做众筹网站
  • html简单网站建设代码wordpress交互主题
  • 北京app网站建设西安网站建设工程
  • 河南秋实网站建设wordpress注册页面修改密码
  • 百度网站搜索排名怎样创建网站收益
  • 一个好网站应具备哪些条件网站建设困难吗
  • 做网站准备的资料深圳市住房和城乡建设局网站
  • 如何做网站粘贴广告中国建筑网络安全意识培训
  • 博客网站推广法企业网站全屏轮播怎么做