hybridgroup / gocv

Go package for computer vision using OpenCV 4 and beyond. Includes support for DNN, CUDA, and OpenCV Contrib.
https://gocv.io
Other
6.42k stars 853 forks source link

Add TestDivideWithStream, TestMultiplyWithStream and Fix NewTemplateMatching, TestTemplateMatching_Match #1167

Closed dwchoo closed 3 months ago

dwchoo commented 3 months ago

Add TestDivideWithStream and TestMultiplyWithStream

The cuda/arithm_test.go file was missing test code for two functions, so we added them.

Fix NewTemplateMatching and TestTemplateMatching_Match

Invalid arguments in the NewTemplateMatching function and an error in the TestTemplateMatching_Match code in cuda/imgproc.go

NewTemplateMatching

// Original code
func NewTemplateMatching(srcType int, method gocv.TemplateMatchMode) TemplateMatching {
    return TemplateMatching{p: unsafe.Pointer(C.TemplateMatching_Create(C.int(srcType), C.int(method)))}
}

We change srcType int -> srcType gocv.MatType

// Edit code
func NewTemplateMatching(srcType gocv.MatType, method gocv.TemplateMatchMode) TemplateMatching {
    return TemplateMatching{p: unsafe.Pointer(C.TemplateMatching_Create(C.int(srcType), C.int(method)))}
}

TestTemplateMatching_Match

We believe that the TestMatchTemplateMatching_Match Test code is designed incorrectly, and we have modified it by referring to the TestMatchTemplate in the imgproc_test.go file. The error in the test code is now gone, and you shouldn't see FAIL.

geon0430 commented 3 months ago

This picture shows fail as a test result before modification.

스크린샷 2024-04-02 오후 5 20 19

This picture is the code that shows the test code result pass after modification.

스크린샷 2024-04-02 오후 5 21 43
deadprogram commented 3 months ago

Thank you very much for this fix @dwchoo now merging.