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

Correct MinMaxIdx function minIdx and maxIdx #1153

Open HIGHER98 opened 4 months ago

HIGHER98 commented 4 months ago

Addresses issue #1151

This PR looks into changing return type of minIdx and maxIdx in the MinMaxIdx function to be an []int rather than int, i.e.

func MinMaxIdx(input Mat) (minVal, maxVal float32, minIdx, maxIdx []int) {
  ...
}

The return arrays will have input.dims elements.


Example:

    src := NewMatWithSize(10, 10, MatTypeCV32FC1)
    defer src.Close()
    src.SetFloatAt(3, 3, 17)
    src.SetFloatAt(4, 4, 16)

    minVal, maxVal, minIdx, maxIdx := MinMaxIdx(src)

In the above code snippet, minVal will be 0, maxVal will be 17, minIdx will be [0,0], maxIdx will be [3,3]

HIGHER98 commented 3 months ago

The Appveyor tests appear to be failing for this PR, and I'm unsure why... :confused:

The tests seem to be failing on something which I'm pretty sure should be unaffected by changes introduced here. Also, the most recent builds on Appveyor seem to be taking >30 minutes. I can see about a month ago, most builds were compiling in ~3 minutes. I suspect this is something cache-based and possibly has something to do with what's going awry. Any help would be appreciated!

Tests are failing here

=== RUN   TestOnnxMemory
Exception 0xc0000005 0x0 0x0 0x64728886
PC=0x64728886
runtime: unknown pc 0x64728886