Coder Social home page Coder Social logo

wdetect's Introduction

wdetect

wdetect is a php extension for detecting numbers and digital info from weixin/wechat mp-platform's data-screenshot.

wdetect 是一个php扩展,功能主要是:

  • 从微信数据截图上找到那个 漏斗形的图表 并读取里面包含的转化率数值信息;
  • 在图片的指定区域内扫描、定位数字;
  • 从图片上指定的矩形框里读取数值;
  • 判断图片上指定的矩形框里包含的文本的宽度(像素数) 与 给定的文本 是否相近(用于粗略判断 图上文本内容跟指定文本内容是否相同,下面安装的版本里被阉了)

wdetect 依赖opencv2boost>=1.41(filesystem/preprocessor/lexical_cast等)、staging(c/c++脚手架,私人物品),上述第四个功能依赖 ImageMagick

#####installation CentO上安装: 先安装依赖:

  1. 安装opencv2,要下载89M的源码,这里有:192.168.100.141:/home/wumengchun/opencv-2.4.9.zip (http://jaist.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip)
  2. 安装boost:
sudo yum install boost141-devel.x86_64 boost141-filesystem.x86_64 -y
(wdetect、staging代码svn地址:http://dev.xundameng.com/weiboyi-api/Plugins/ImageRecognition/trunk)
  1. 进wdetect源码的目录,修改config.m4,设置 CXX=g++44 后再
/usr/local/php/bin/phpize
./configure --enable-wdetect --with-staging=/opt/release/staging --with-php-config=/usr/local/php/bin/php-config
make && sudo make install
  1. 修改 /usr/local/php/etc/php.ini 设置 enable_dl=On

就可以用了(建议看看 /usr/local/php/bin/php -r 'error_reporting(-1); dl("wdetect.so"); var_dump(class_exists("WDetecter"));' 对不对)。

#####test 测试:进wdetect源码目录,执行

/usr/local/php/bin/php test.php   # 用 ./data/16.jpg 这个图片做测试
/usr/local/php/bin/php test.php ./data  # 用 ./data 下的所有图片文件做测试,输出每次测试的详细结果和统计结果

#####for CentOS users: 安装 cmake28、gcc44 前可能要加软件源:

装完boost141可能要:

for lib in ls /usr/lib64/libboost_*so.5; do test ! -e ${lib/so.5/so} && sudo ln -s $lib ${lib/so.5/so} ; done

centos上安装opencv2:

  1. 先把cmake升级到2.8.1x,然后 cmake28(不能cmake)
  2. 记得把CC/CXX设置为gcc4.4版:env CC=/usr/bin/gcc44 CXX=/usr/bin/g++44 cmake28 -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr -D BUILD_NEW_PYTHON_SUPPORT=NO ..
  3. make前先解决依赖:
sudo yum install gtk+-devel.x86_64 gimp-devel.x86_64 gimp-devel-tools.x86_64 gimp-help-browser.x86_64 zlib-devel.x86_64 libtiff-devel.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 gstreamer-devel.x86_64 libavc1394-devel.x86_64 libraw1394-devel.x86_64 libdc1394-devel.x86_64 jasper-devel.x86_64 jasper-utils.x86_84 swig python libtool nasm.x86_84

wdetect's People

Watchers

James Cloos avatar wumuch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.