Proyectos
Ver en GitHub
Comdex/imgo
Acerca de
golang图像处理工具库(golang image process lib)
Herramientas de desarrolloCrecimiento de estrellas medido
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Recopilando historial
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
Originalimgo
golang图像处理工具库,图像相似度计算,图像二值化(golang image process lib)
目前只支持jpg,png
安装
go get github.com/Comdex/imgo
示例
package main
import(
"github.com/Comdex/imgo"
)
func main(){
//如果读取出错会panic,返回图像矩阵img
//img[height][width][4],height为图像高度,width为图像宽度
//img[height][width][4]为第height行第width列上像素点的RGBA数值数组,值范围为0-255
//如img[150][20][0]是150行20列处像素的红色值,img[150][20][1]是150行20列处像素的绿
//色值,img[150][20][2]是150行20列处像素的蓝色值,img[150][20][3]是150行20列处像素
//的alpha数值,一般用作不透明度参数,如果一个像素的alpha通道数值为0%,那它就是完全透明的.
img:=imgo.MustRead("example/test.jpg")
//对原图像矩阵进行日落效果处理
img2:=imgo.SunsetEffect(img)
//保存为jpeg,100为质量,1-100
err:=imgo.SaveAsJPEG("example/new.jpg",img2,100)
if err!=nil {
panic(err)
}
}
计算两张图片的余弦相似度
cos,err:=imgo.CosineSimilarity("test1.jpg","test2.jpg")
if err!=nil{
panic(err)
}
fmt.Println(cos)
2015.8.23 update :添加使用感知哈希算法的GetFingerprint函数获取图片的“指纹”字符串
fp,err:=imgo.GetFingerprint("test1.jpg")
if err!=nil {
panic(err)
}
fmt.Println(fp)//输出64位的01字符串
效果
![]() 原图 |
![]() 横向镜像imgo.HorizontalMirror |
|---|---|
![]() 日落imgo.SunsetEffect |
![]() 负片imgo.NegativeFilmEffect |
![]() 调整亮度imgo.AdjustBrightness |
![]() 垂直镜像imgo.VerticalMirror |
更多api及帮助请访问:http://godoc.org/github.com/Comdex/imgo
版权
Explorar proyectos relacionados
Cargando…





