Skip to content

Commit

Permalink
fix camera change resolution bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Neutree committed Jul 27, 2024
1 parent 9823d6e commit d5492dd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion projects/app_maixhub_cliennt/app.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: maixhub
name: MaixHub Client
version: 1.0.0
version: 1.0.1
author: Sipeed
icon: app.png
desc: MaixHub client to collect image or deploy AI model etc.
Expand Down
3 changes: 2 additions & 1 deletion projects/app_maixhub_cliennt/maixhub/demos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def load_saved_models(models_dir):
"name": os.path.splitext(os.path.basename(model_path))[0],
"path": os.path.abspath(model_path),
"model_type": model_type,
"is_dir": True
"is_dir": True,
"dir": os.path.dirname(os.path.abspath(model_path))
}
models.append(model)
elif os.path.splitext(path)[1] == ".mud":
Expand Down
12 changes: 9 additions & 3 deletions projects/app_maixhub_cliennt/maixhub/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,19 @@ def on_progress(curr, total):
print(f"Load model {model_dir} failed")
err_msg = tr("Load model failed")
continue
cam.set_resolution(demo.input_size()[0], demo.input_size()[1])
del cam
cam = camera.Camera(demo.input_size()[0], demo.input_size()[1])
# cam.set_resolution(demo.input_size()[0], demo.input_size()[1])
model_init = True
continue
demo.loop(img, dis_img, clicked and idx == 1)
draw_frame(dis_img, dis_size, tr("back"))
if clicked and idx == 0:
print("exit run")
break
del cam
cam = camera.Camera(cam_size[0], cam_size[1])
status = "scan"
saved_models_info = None
elif status == "view_model":
if not saved_models_info:
names = [tr("back")]
Expand Down Expand Up @@ -546,11 +551,12 @@ def on_progress(curr, total):
status = "run"
model_init = False
model_dir = saved_models_info[slected_idx]["path"]
ui_model_sub_list = None
print("now run", model_dir)
elif item == tr("delete"):
model_dir = saved_models_info[slected_idx]["path"]
if saved_models_info[slected_idx]["is_dir"]:
remove_dir(model_dir)
remove_dir(saved_models_info[slected_idx]["dir"])
else:
remove_mud_model(model_dir)
ui_model_list.remove(slected_idx + 1)
Expand Down

0 comments on commit d5492dd

Please sign in to comment.