type problem with cv.detail.resultRoi [closed]

asked 2019-01-02 10:53:41 -0600

LBerger gravatar image

updated 2019-01-02 11:05:50 -0600

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 ]
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by LBerger
close date 2019-01-02 11:49:57.563196

Comments

may be it's already a bug

LBerger gravatar imageLBerger ( 2019-01-02 11:43:39 -0600 )edit
1

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)

berak gravatar imageberak ( 2019-01-03 01:51:02 -0600 )edit

and there is a new one

LBerger gravatar imageLBerger ( 2019-01-03 02:02:24 -0600 )edit
LBerger gravatar imageLBerger ( 2019-01-15 03:53:26 -0600 )edit
1

sorry, but i could not follow up the discussion or previous pr's on this ;(

berak gravatar imageberak ( 2019-01-15 04:13:36 -0600 )edit