Add example in README.

This commit is contained in:
Bert Chang 2013-12-17 20:51:10 +08:00
parent 11ebb18493
commit 2841b29029

View file

@ -3,10 +3,6 @@
## Why fork? ## Why fork?
Original project (https://code.google.com/p/go-opencv) looks abandoned. Therefore, I decide to fork it and host it on Github, so that others can help to maintain this package. Original project (https://code.google.com/p/go-opencv) looks abandoned. Therefore, I decide to fork it and host it on Github, so that others can help to maintain this package.
## TODOs
- More details doc
- Implement more bindings
## Install ## Install
### Linux ### Linux
@ -24,9 +20,37 @@ Original project (https://code.google.com/p/go-opencv) looks abandoned. Therefor
- go get code.google.com/p/go-opencv/trunk/opencv - go get code.google.com/p/go-opencv/trunk/opencv
- cd ${GoOpenCVRoot}/trunk/samples && go run hellocv.go - cd ${GoOpenCVRoot}/trunk/samples && go run hellocv.go
## Example
```go
package main
import opencv "github.com/lazywei/go-opencv/opencv"
func main() {
filename := "bert.jpg"
srcImg := opencv.LoadImage(filename)
if srcImg == nil {
panic("Loading Image failed")
}
defer srcImg.Release()
resized1 := opencv.Resize(srcImg, 400, 0, 0)
resized2 := opencv.Resize(srcImg, 300, 500, 0)
resized3 := opencv.Resize(srcImg, 300, 500, 2)
opencv.SaveImage("resized1.jpg", resized1, 0)
opencv.SaveImage("resized2.jpg", resized2, 0)
opencv.SaveImage("resized3.jpg", resized3, 0)
}
```
You can find more samples at: https://github.com/lazywei/go-opencv/tree/master/samples
## Contribute ## Contribute
- Fork this repo - Fork this repo
- Create new feature branch, `git checkout -b your-feature-branch` - Create new feature branch, `git checkout -b your-feature-branch`
- Commit your change and push it to your repo `git commit -m 'new feature'; git push origin your-feature-branch` - Commit your change and push it to your repo `git commit -m 'new feature'; git push origin your-feature-branch`
- Open pull request! - Open pull request!
## TODOs
- More details doc
- Implement more bindings