type problem with cv.detail.resultRoi [closed]
My python program :
import cv2 as cv
import numpy as np
fs=cv.FileStorage("testYaml.yml",cv.FileStorage_READ)
if not fs.isOpened():
print("Check file path")
exit()
coin=[]
w=fs.getNode("coin0").mat()
coin.append(tuple(w.transpose()[0]))
w=fs.getNode("coin1").mat()
coin.append(tuple(w.transpose()[0]))
print('I am happy : ')
s=[(-319, -239), (-249, -224)]
print(cv.detail.resultRoi(s,[(638, 478), (674, 526)]))
print('I am NOT happy : ')
print(cv.detail.resultRoi(coin,[(638, 478), (674, 526)]))
print('I am happy with ',type(s[0][0]),' != but not with ',type(coin[0][0]))
Now results are
I am happy : (-319, -239, 71, 17)
I am NOT happy :
Traceback (most recent call last): File "C:\Users\Laurent\Desktop\testYaml.py", line 13, in <module> print(cv.detail.resultRoi(coin,[(638, 478), (674, 526)])) SystemError: <built-in function="" resultroi=""> returned NULL without setting an error
I am happy with < class 'int '> != but not with < class 'numpy.int32 '>
Only difference is class 'int and class 'numpy.int32 but it cannot be that ?
my yaml file is
%YAML:1.0
---
coin0: !!opencv-matrix
rows: 2
cols: 1
dt: i
data: [ -319, -239 ]
coin1: !!opencv-matrix
rows: 2
cols: 1
dt: i
data: [ -249, -224 ]
may be it's already a bug
int != numpy.int32 in python, and your c++ wrapper is not happy about it
(it did not find a corresponding opencv_to() template at runtime)
( i also think, it's the same issue)
and there is a new one
@berak why do you thnik of https://github.com/opencv/opencv/pull... ?
sorry, but i could not follow up the discussion or previous pr's on this ;(