May-04-2023, 08:18 PM
Hello all, i am Jayson...
I have really gotten into flask because of this forum and am also starting to make android apps with my scripts
in P4a w buildozer.
right now i have made a dual or Two Cam solution for cell phones.......
when i run it in termux it cannot get permissions to access /dev/0 or anything
so i made it an app.
here is the script for having two webcams or a cell phone....
however i have a probem.... remember...it doesnt exit good a lot with the movie compiled in time.
I have really gotten into flask because of this forum and am also starting to make android apps with my scripts
in P4a w buildozer.
right now i have made a dual or Two Cam solution for cell phones.......
when i run it in termux it cannot get permissions to access /dev/0 or anything
so i made it an app.
here is the script for having two webcams or a cell phone....
however i have a probem.... remember...it doesnt exit good a lot with the movie compiled in time.
from flask import Flask, Response, request, render_template, redirect, url_for import cv2 import numpy as np app = Flask(__name__) @app.route('/') def fishmap(): def output(): yield """<html>Android TWO CAM...</html>""" cap = cv2.VideoCapture(0) cap1 = cv2.VideoCapture(1) out = cv2.VideoWriter('output.avi',cv2.VideoWriter_fourcc(*'XVID'), cap.get(cv2.CAP_PROP_FPS), (1440,720)) while(cap.isOpened()): ret, frame = cap.read() ret1, frame1 = cap1.read() if ret == True: print (frame) reframe = cv2.resize(frame,(720, 720), interpolation = cv2.INTER_AREA) reframe1 = cv2.resize(frame1,(720, 720), interpolation = cv2.INTER_AREA) both = np.column_stack((reframe, reframe1)) out.write(both) cv2.imshow('Frame', both) if cv2.waitKey(1) & 0xFF == ord('q'): break else: break cap.release() cap1.release() out.release() cv2.waitKey(0) cv2.destroyAllWindows() return Response(output()) if __name__ == "__main__": app.run(host='0.0.0.0', debug=True, port=80)