aidlearning / AidLearning-FrameWork

🔥🔥🔥AidLearning is a powerful AIOT development platform, AidLearning builds a linux env supporting GUI, deep learning and visual IDE on Android...Now Aid supports CPU+GPU+NPU for inference with high performance acceleration...Linux on Android or HarmonyOS
https://docs.aidlux.com
Other
5.53k stars 703 forks source link

第一个cvs demo无法运行 #209

Closed coldtigerqd closed 2 years ago

coldtigerqd commented 2 years ago

源代码:

from cvs import *
import numpy as np

class MyApp(App):
    def __init__(self, *args):
        super(MyApp, self).__init__(*args)

    def main(self):
        #creating a container VBox type, vertical (you can use also HBox or Widget)
        main_container = gui.VBox(width=360, height=680, style={'margin':'0px auto'})

        self.aidcam = OpencvVideoWidget(self, width=340, height=480)
        self.aidcam.style['margin'] = '10px'

        self.aidcam.set_identifier("myimage_receiver")
        main_container.append(self.aidcam)

        # returning the root widget
        return main_container

def process():

    cap=cvs.VideoCapture(1)

    while True:
        sleep(30)
        img =cap.read()

        if img is None :
            continue
        cvs.imshow(img)

if __name__ == '__main__':
    #init proceess thread
    initcv(process)
    #start gui show
    startcv(MyApp)

返回错误:

root@localhost:/home/project/weiyi_tools# python test_andorid.py 
('app runs on port:', 38672)
Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
TypeError: process() takes 0 positional arguments but 1 was given

remi.server      INFO     Started httpserver http://0.0.0.0:38672/
^Cremi.server      INFO     *** signal 2 received.

似乎这个用法过时了

aidlearning commented 2 years ago

这个例子要和特定的版本结合使用