Giter Club home page Giter Club logo

vahadane's Introduction

Vahadane论文normalization

简要说明

代码支持python3,未进行2、3兼容检查。

核心代码在vahadane.py

需要额外安装的库有:spams, opencv。我spams安装的时候遇到一些问题,但是因为我的mac的原因。直接使用pip安装spams。opencv可自己找相应操作系统下的教程安装。

如果你装了jupyter notebook,可以运行一下main.ipynb,这里面是一个写好了的demo。

Report.md是我写给学姐看的,分析了一下参数选择的效果。可以不看。

使用方法

1 首先调用utils.py里的read_image函数读取图片。这个函数将输入图片从opencv默认的BGR转成RGB,并且对整体颜色进行了一些加强。读出来的图像矩阵是$nm3$的。

2 新建一个vahadane对象。两个LAMBDA已经调到最优。fast_mode是是否快速分解,getH_mode也会影响分解速度。ITER是getW时的一个参数。可以都试一下看看效果。

vhd = vahadane(LAMBDA1=0.01, LAMBDA2=0.01, fast_mode=1, getH_mode=0, ITER=50)
vhd.show_config()

3 矩阵分解

Ws, Hs = vhd.stain_separate(source_image)
vhd.fast_mode=0;vhd.getH_mode=0;  # 在获取target的分解时,为了更精确,不用fast模式
Wt, Ht = vhd.stain_separate(target_image)

4 合成target

img = vhd.SPCN(source_image, Ws, Hs, Wt, Ht)

vahadane's People

Contributors

xindubawukong 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.