Skip to content

Commit

Permalink
docs: update all OpenCV 3.3.1 references to v3.4.0
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Dec 25, 2017
1 parent 636dc35 commit 152d0b8
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 138 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Now you should be able to build or run any of the examples:
The version program should output the following:

gocv version: 0.2.0
opencv lib version: 3.3.1
opencv lib version: 3.4.0

You might want to copy the `env.sh` script into your own projects, to make it easier to setup these vars when building your own code.

Expand Down Expand Up @@ -236,7 +236,7 @@ Now you should be able to build or run any of the command examples:
The version program should output the following:

gocv version: 0.2.0
opencv lib version: 3.3.1
opencv lib version: 3.4.0

You might want to copy the `env.sh` script into your own projects, to make it easier to setup these vars when building your own code.

Expand All @@ -260,13 +260,13 @@ Download and install CMake [https://cmake.org/download/](https://cmake.org/downl

#### Download OpenCV 3.3 and OpenCV Contrib Modules

Download the source code for the latest OpenCV release from [https://github.com/opencv/opencv/archive/3.3.1.zip](https://github.com/opencv/opencv/archive/3.3.1.zip) and extract it to the directory `C:\opencv\opencv-3.3.1`
Download the source code for the latest OpenCV release from [https://github.com/opencv/opencv/archive/3.4.0.zip](https://github.com/opencv/opencv/archive/3.4.0.zip) and extract it to the directory `C:\opencv\opencv-3.4.0`

Download the source code for the latest OpenCV Contrib release from [https://github.com/opencv/opencv_contrib/archive/3.3.1.zip](https://github.com/opencv/opencv_contrib/archive/3.3.1.zip) and extract it to the directory `C:\opencv\opencv_contrib-3.3.1`
Download the source code for the latest OpenCV Contrib release from [https://github.com/opencv/opencv_contrib/archive/3.4.0.zip](https://github.com/opencv/opencv_contrib/archive/3.4.0.zip) and extract it to the directory `C:\opencv\opencv_contrib-3.4.0`

Create the directory `C:\opencv\build` as the build directory.

Now launch the `cmake-gui` program, and set the "Where is the source code" to `C:\opencv\opencv-3.3.1`, and the "Where to build the binaries" to `C:\opencv\build`.
Now launch the `cmake-gui` program, and set the "Where is the source code" to `C:\opencv\opencv-3.4.0`, and the "Where to build the binaries" to `C:\opencv\build`.

Click on "Configure" and select "MinGW MakeFile" from the window, then click on the "Next" button.

Expand All @@ -278,7 +278,7 @@ Now, scroll down the list and change the following settings as follows:
- `BUILD_PERF_TESTS` should be unchecked (aka disabled).
- `ENABLE_PRECOMPILED_HEADERS` should be unchecked.
- `ENABLE_CXX11` should be checked.
- `OPENCV_EXTRA_MODULES_PATH` should be set to `C:\opencv\opencv_contrib-3.3.1\modules`
- `OPENCV_EXTRA_MODULES_PATH` should be set to `C:\opencv\opencv_contrib-3.4.0\modules`

Click on the "Configure" button again, and wait for the configuration step.

Expand Down Expand Up @@ -307,7 +307,7 @@ You should now have OpenCV 3.3 installed on your Windows 10 machine.
Run these commands to configure Go to know about the include and lib directories:

set CGO_CPPFLAGS=-IC:\opencv\build\install\include
set CGO_LDFLAGS=-LC:\opencv\build\install\x64\mingw\lib -lopencv_core331 -lopencv_videoio331 -lopencv_imgproc331 -lopencv_highgui331 -lopencv_imgcodecs331 -lopencv_objdetect331 -lopencv_calib3d331 -lopencv_video331 -lopencv_xfeatures2d331 -lopencv_face331
set CGO_LDFLAGS=-LC:\opencv\build\install\x64\mingw\lib -lopencv_core340 -lopencv_videoio340 -lopencv_imgproc340 -lopencv_highgui340 -lopencv_imgcodecs340 -lopencv_objdetect340 -lopencv_calib3d340 -lopencv_video340 -lopencv_xfeatures2d340 -lopencv_face340

Now you should be able to build or run any of the command examples:

Expand All @@ -316,7 +316,7 @@ Now you should be able to build or run any of the command examples:
The version program should output the following:

gocv version: 0.2.0
opencv lib version: 3.3.1
opencv lib version: 3.4.0

## How to contribute

Expand Down
25 changes: 13 additions & 12 deletions contrib/face.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ package contrib
*/
import "C"
import (
"gocv.io/x/gocv"
"unsafe"

"gocv.io/x/gocv"
)

type PredictResponse struct {
Expand All @@ -21,15 +22,15 @@ type LBPHFaceRecognizer struct {

// Create new LBPH Recognizer model
//
// see https://docs.opencv.org/3.3.1/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html
// see https://docs.opencv.org/3.4.0/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html
//
func NewLBPHFaceRecognizer() *LBPHFaceRecognizer {
return &LBPHFaceRecognizer{p: C.CreateLBPHFaceRecognizer()}
}

// Train loaded model with images and their labels
//
// see https://docs.opencv.org/3.3.1/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ac8680c2aa9649ad3f55e27761165c0d6
// see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ac8680c2aa9649ad3f55e27761165c0d6
//
func (fr *LBPHFaceRecognizer) Train(images []gocv.Mat, labels []int) {
cparams := []C.int{}
Expand All @@ -54,7 +55,7 @@ func (fr *LBPHFaceRecognizer) Train(images []gocv.Mat, labels []int) {

// update existing trained model with new images and labels
//
// see https://docs.opencv.org/3.3.1/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a8a4e73ea878dcd0c235d0487189d25f3
// see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a8a4e73ea878dcd0c235d0487189d25f3
//
func (fr *LBPHFaceRecognizer) Update(newImages []gocv.Mat, newLabels []int) {
cparams := []C.int{}
Expand All @@ -79,7 +80,7 @@ func (fr *LBPHFaceRecognizer) Update(newImages []gocv.Mat, newLabels []int) {

// predict image for trained model, retun label for correctly predicted image, return -1 if not found
//
// see https://docs.opencv.org/3.3.1/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#aa2d2f02faffab1bf01317ae6502fb631
// see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#aa2d2f02faffab1bf01317ae6502fb631
//
func (fr *LBPHFaceRecognizer) Predict(sample gocv.Mat) int {
label := C.LBPHFaceRecognizer_Predict(fr.p, (C.Mat)(sample.Ptr()))
Expand All @@ -89,7 +90,7 @@ func (fr *LBPHFaceRecognizer) Predict(sample gocv.Mat) int {

// the same as above but returns some more info
//
// see https://docs.opencv.org/3.3.1/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ab0d593e53ebd9a0f350c989fcac7f251
// see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ab0d593e53ebd9a0f350c989fcac7f251
//
func (fr *LBPHFaceRecognizer) PredictExtendedResponse(sample gocv.Mat) PredictResponse {
respp := C.LBPHFaceRecognizer_PredictExtended(fr.p, (C.Mat)(sample.Ptr()))
Expand All @@ -103,15 +104,15 @@ func (fr *LBPHFaceRecognizer) PredictExtendedResponse(sample gocv.Mat) PredictRe

// set Threshold value
//
// see https://docs.opencv.org/3.3.1/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a3182081e5f8023e658ad8ab96656dd63
// see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a3182081e5f8023e658ad8ab96656dd63
//
func (fr *LBPHFaceRecognizer) SetThreshold(threshold float32) {
C.LBPHFaceRecognizer_SetThreshold(fr.p, (C.double)(threshold))
}

// set Neighbors
//
// see https://docs.opencv.org/3.3.1/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#ab225f7bf353ce8697a506eda10124a92
// see https://docs.opencv.org/3.4.0/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#ab225f7bf353ce8697a506eda10124a92
// wrong neighbors can raise opencv exception!
//
func (fr *LBPHFaceRecognizer) SetNeighbors(neighbors int) {
Expand All @@ -120,7 +121,7 @@ func (fr *LBPHFaceRecognizer) SetNeighbors(neighbors int) {

// get Neighbors
//
// see https://docs.opencv.org/3.3.1/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#a50a3e2ca6e8464166e153c9df84b0a77
// see https://docs.opencv.org/3.4.0/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#a50a3e2ca6e8464166e153c9df84b0a77
//
func (fr *LBPHFaceRecognizer) GetNeighbors() int {
n := C.LBPHFaceRecognizer_GetNeighbors(fr.p)
Expand All @@ -130,15 +131,15 @@ func (fr *LBPHFaceRecognizer) GetNeighbors() int {

// set Radius
//
// see https://docs.opencv.org/3.3.1/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#a62d94c75cade902fd3b487b1ef9883fc
// see https://docs.opencv.org/3.4.0/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#a62d94c75cade902fd3b487b1ef9883fc
//
func (fr *LBPHFaceRecognizer) SetRadius(radius int) {
C.LBPHFaceRecognizer_SetRadius(fr.p, (C.int)(radius))
}

// save trained model data to file
//
// see https://docs.opencv.org/3.3.1/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a2adf2d555550194244b05c91fefcb4d6
// see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a2adf2d555550194244b05c91fefcb4d6
//
func (fr *LBPHFaceRecognizer) SaveFile(fname string) {
cName := C.CString(fname)
Expand All @@ -148,7 +149,7 @@ func (fr *LBPHFaceRecognizer) SaveFile(fname string) {

// load traned model data from file
//
// see https://docs.opencv.org/3.3.1/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#acc42e5b04595dba71f0777c7179af8c3
// see https://docs.opencv.org/3.4.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#acc42e5b04595dba71f0777c7179af8c3
//
func (fr *LBPHFaceRecognizer) LoadFile(fname string) {
cName := C.CString(fname)
Expand Down
12 changes: 6 additions & 6 deletions contrib/xfeatures2d.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type SIFT struct {
// NewSIFT returns a new SIFT algorithm.
//
// For further details, please see:
// https://docs.opencv.org/3.3.1/d5/d3c/classcv_1_1xfeatures2d_1_1SIFT.html
// https://docs.opencv.org/3.4.0/d5/d3c/classcv_1_1xfeatures2d_1_1SIFT.html
//
func NewSIFT() SIFT {
return SIFT{p: unsafe.Pointer(C.SIFT_Create())}
Expand All @@ -38,7 +38,7 @@ func (d *SIFT) Close() error {
// Detect keypoints in an image using SIFT.
//
// For further details, please see:
// https://docs.opencv.org/3.3.1/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
// https://docs.opencv.org/3.4.0/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
//
func (d *SIFT) Detect(src gocv.Mat) []gocv.KeyPoint {
ret := C.SIFT_Detect((C.SIFT)(d.p), C.Mat(src.Ptr()))
Expand All @@ -50,7 +50,7 @@ func (d *SIFT) Detect(src gocv.Mat) []gocv.KeyPoint {
// DetectAndCompute detects and computes keypoints in an image using SIFT.
//
// For further details, please see:
// https://docs.opencv.org/3.3.1/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
// https://docs.opencv.org/3.4.0/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
//
func (d *SIFT) DetectAndCompute(src gocv.Mat, mask gocv.Mat) ([]gocv.KeyPoint, gocv.Mat) {
desc := gocv.NewMat()
Expand All @@ -70,7 +70,7 @@ type SURF struct {
// NewSURF returns a new SURF algorithm.
//
// For further details, please see:
// https://docs.opencv.org/3.3.1/d5/df7/classcv_1_1xfeatures2d_1_1SURF.html
// https://docs.opencv.org/3.4.0/d5/df7/classcv_1_1xfeatures2d_1_1SURF.html
//
func NewSURF() SURF {
return SURF{p: unsafe.Pointer(C.SURF_Create())}
Expand All @@ -86,7 +86,7 @@ func (d *SURF) Close() error {
// Detect keypoints in an image using SURF.
//
// For further details, please see:
// https://docs.opencv.org/3.3.1/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
// https://docs.opencv.org/3.4.0/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
//
func (d *SURF) Detect(src gocv.Mat) []gocv.KeyPoint {
ret := C.SURF_Detect((C.SURF)(d.p), C.Mat(src.Ptr()))
Expand All @@ -98,7 +98,7 @@ func (d *SURF) Detect(src gocv.Mat) []gocv.KeyPoint {
// DetectAndCompute detects and computes keypoints in an image using SURF.
//
// For further details, please see:
// https://docs.opencv.org/3.3.1/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
// https://docs.opencv.org/3.4.0/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
//
func (d *SURF) DetectAndCompute(src gocv.Mat, mask gocv.Mat) ([]gocv.KeyPoint, gocv.Mat) {
desc := gocv.NewMat()
Expand Down
Loading

0 comments on commit 152d0b8

Please sign in to comment.