1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Enabled VAS OT in G-API Python interface

This commit is contained in:
Anastasiya Pronina
2023-09-04 17:10:46 +01:00
parent 850ebec135
commit d20727a5be
13 changed files with 176 additions and 58 deletions
@@ -0,0 +1,58 @@
#!/usr/bin/env python
import numpy as np
import cv2 as cv
import os
import sys
import unittest
from tests_common import NewOpenCVTests
try:
if sys.version_info[:2] < (3, 0):
raise unittest.SkipTest('Python 2.x is not supported')
class gapi_ot_test(NewOpenCVTests):
def test_ot_smoke(self):
# Input
img_path = self.find_file('cv/face/david2.jpg', [os.environ.get('OPENCV_TEST_DATA_PATH')])
in_image = cv.cvtColor(cv.imread(img_path), cv.COLOR_RGB2BGR)
in_rects = [ (138, 89, 71, 64) ]
in_rects_cls = [ 0 ]
# G-API
g_in = cv.GMat()
g_in_rects = cv.GArray.Rect()
g_in_rects_cls = cv.GArray.Int()
delta = 0.5
g_out_rects, g_out_rects_cls, g_track_ids, g_track_sts = \
cv.gapi.ot.track(g_in, g_in_rects, g_in_rects_cls, delta)
comp = cv.GComputation(cv.GIn(g_in, g_in_rects, g_in_rects_cls),
cv.GOut(g_out_rects, g_out_rects_cls,
g_track_ids, g_track_sts))
__, __, __, sts = comp.apply(cv.gin(in_image, in_rects, in_rects_cls),
args=cv.gapi.compile_args(cv.gapi.ot.cpu.kernels()))
self.assertEqual(cv.gapi.ot.NEW, sts[0])
except unittest.SkipTest as e:
message = str(e)
class TestSkip(unittest.TestCase):
def setUp(self):
self.skipTest('Skip tests: ' + message)
def test_skip():
pass
if __name__ == '__main__':
NewOpenCVTests.bootstrap()
@@ -17,10 +17,10 @@ try:
class gapi_types_test(NewOpenCVTests):
def test_garray_type(self):
types = [cv.gapi.CV_BOOL , cv.gapi.CV_INT , cv.gapi.CV_DOUBLE , cv.gapi.CV_FLOAT,
cv.gapi.CV_STRING, cv.gapi.CV_POINT , cv.gapi.CV_POINT2F, cv.gapi.CV_POINT3F ,
cv.gapi.CV_SIZE , cv.gapi.CV_RECT , cv.gapi.CV_SCALAR , cv.gapi.CV_MAT ,
cv.gapi.CV_GMAT]
types = [cv.gapi.CV_BOOL , cv.gapi.CV_INT , cv.gapi.CV_INT64 , cv.gapi.CV_UINT64,
cv.gapi.CV_DOUBLE , cv.gapi.CV_FLOAT , cv.gapi.CV_STRING, cv.gapi.CV_POINT ,
cv.gapi.CV_POINT2F, cv.gapi.CV_POINT3F, cv.gapi.CV_SIZE , cv.gapi.CV_RECT ,
cv.gapi.CV_SCALAR , cv.gapi.CV_MAT , cv.gapi.CV_GMAT]
for t in types:
g_array = cv.GArrayT(t)
@@ -28,9 +28,9 @@ try:
def test_gopaque_type(self):
types = [cv.gapi.CV_BOOL , cv.gapi.CV_INT , cv.gapi.CV_DOUBLE , cv.gapi.CV_FLOAT ,
cv.gapi.CV_STRING, cv.gapi.CV_POINT, cv.gapi.CV_POINT2F, cv.gapi.CV_POINT3F,
cv.gapi.CV_SIZE , cv.gapi.CV_RECT]
types = [cv.gapi.CV_BOOL , cv.gapi.CV_INT , cv.gapi.CV_INT64 , cv.gapi.CV_UINT64,
cv.gapi.CV_DOUBLE , cv.gapi.CV_FLOAT , cv.gapi.CV_STRING, cv.gapi.CV_POINT ,
cv.gapi.CV_POINT2F, cv.gapi.CV_POINT3F, cv.gapi.CV_SIZE , cv.gapi.CV_RECT]
for t in types:
g_opaque = cv.GOpaqueT(t)