Skip to content

Commit

Permalink
checkbox in ui to enable/disable FPS Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Mar 21, 2017
1 parent 50ce35c commit 1ef4562
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 200 deletions.
7 changes: 4 additions & 3 deletions system/Camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class IPCamera(object):
detect_recognise_track. These can be found in the
SureveillanceSystem object, within the process_frame function"""

def __init__(self,camURL, cameraFunction, dlibDetection):
def __init__(self,camURL, cameraFunction, dlibDetection, fpsTweak):
logger.info("Loading Stream From IP Camera: " + camURL)
self.motionDetector = MotionDetector.MotionDetector()
self.faceDetector = FaceDetector.FaceDetector()
Expand All @@ -77,6 +77,7 @@ def __init__(self,camURL, cameraFunction, dlibDetection):
self.trackers = [] # Holds all alive trackers
self.cameraFunction = cameraFunction
self.dlibDetection = dlibDetection # Used to choose detection method for camera (dlib - True vs opencv - False)
self.fpsTweak = fpsTweak # used to know if we should apply the FPS work around when you have many cameras
self.rgbFrame = None
self.faceBoxes = None
self.captureEvent = threading.Event()
Expand Down Expand Up @@ -104,7 +105,7 @@ def get_frame(self):
logger.debug('Getting Frames')
FPScount = 0
warmup = 0
fpsTweak = 0
#fpsTweak = 0 # set that to 1 if you want to enable Brandon's fps tweak. that break most video feeds so recommend not to
FPSstart = time.time()

while True:
Expand All @@ -121,7 +122,7 @@ def get_frame(self):
FPSstart = time.time()
FPScount = 0

if fpsTweak:
if self.fpsTweak:
if self.streamingFPS != 0: # If frame rate gets too fast slow it down, if it gets too slow speed it up
if self.streamingFPS > CAPTURE_HZ:
time.sleep(1/CAPTURE_HZ)
Expand Down
6 changes: 4 additions & 2 deletions system/WebApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,14 @@ def add_camera():
if request.method == 'POST':
camURL = request.form.get('camURL')
application = request.form.get('application')
detectionMethod = request.form.get('detectionMethod')
detectionMethod = request.form.get('detectionMethod')
fpsTweak = request.form.get('fpstweak')
with HomeSurveillance.camerasLock :
HomeSurveillance.add_camera(SurveillanceSystem.Camera.IPCamera(camURL,application,detectionMethod))
HomeSurveillance.add_camera(SurveillanceSystem.Camera.IPCamera(camURL,application,detectionMethod,fpsTweak))
data = {"camNum": len(HomeSurveillance.cameras) -1}
app.logger.info("Addding a new camera with url: ")
app.logger.info(camURL)
app.logger.info(fpsTweak)
return jsonify(data)
return render_template('index.html')

Expand Down
205 changes: 10 additions & 195 deletions system/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ <h3 class="box-title">Camera Control Panel</h3>
<option value="opencv">Opencv Haar Cascade</option>
<option value="dlib">Dlib HOG Face Detector</option>
</select>
</div>
</div>
<div class="form-group">
<label>Check for many simultaneous cameras (FPS Tweak)</label>
<input type="checkbox" id="fpstweak" value="fpstweak">
</div>
</div>

</div>
Expand Down Expand Up @@ -601,8 +605,7 @@ <h3 class="box-title">System Monitoring</h3>

<!-- /.Left col -->
<!-- right col (We are only adding the ID to make the widgets sortable)-->




</div>
<!-- /.content-wrapper -->
Expand All @@ -611,196 +614,7 @@ <h3 class="box-title">System Monitoring</h3>
reserved.
</footer>

<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<!-- Home tab content -->
<div class="tab-pane" id="control-sidebar-home-tab">
<h3 class="control-sidebar-heading">Recent Activity</h3>
<ul class="control-sidebar-menu">
<li>
<a href="javascript:void(0)">
<i class="menu-icon fa fa-birthday-cake bg-red"></i>

<div class="menu-info">
<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>

<p>Will be 23 on April 24th</p>
</div>
</a>
</li>
<li>
<a href="javascript:void(0)">
<i class="menu-icon fa fa-user bg-yellow"></i>

<div class="menu-info">
<h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4>

<p>New phone +1(800)555-1234</p>
</div>
</a>
</li>
<li>
<a href="javascript:void(0)">
<i class="menu-icon fa fa-envelope-o bg-light-blue"></i>

<div class="menu-info">
<h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4>

<p>[email protected]</p>
</div>
</a>
</li>
<li>
<a href="javascript:void(0)">
<i class="menu-icon fa fa-file-code-o bg-green"></i>

<div class="menu-info">
<h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4>

<p>Execution time 5 seconds</p>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->

<h3 class="control-sidebar-heading">Tasks Progress</h3>
<ul class="control-sidebar-menu">
<li>
<a href="javascript:void(0)">
<h4 class="control-sidebar-subheading">
Custom Template Design
<span class="label label-danger pull-right">70%</span>
</h4>

<div class="progress progress-xxs">
<div class="progress-bar progress-bar-danger" style="width: 70%"></div>
</div>
</a>
</li>
<li>
<a href="javascript:void(0)">
<h4 class="control-sidebar-subheading">
Update Resume
<span class="label label-success pull-right">95%</span>
</h4>

<div class="progress progress-xxs">
<div class="progress-bar progress-bar-success" style="width: 95%"></div>
</div>
</a>
</li>
<li>
<a href="javascript:void(0)">
<h4 class="control-sidebar-subheading">
Laravel Integration
<span class="label label-warning pull-right">50%</span>
</h4>

<div class="progress progress-xxs">
<div class="progress-bar progress-bar-warning" style="width: 50%"></div>
</div>
</a>
</li>
<li>
<a href="javascript:void(0)">
<h4 class="control-sidebar-subheading">
Back End Framework
<span class="label label-primary pull-right">68%</span>
</h4>

<div class="progress progress-xxs">
<div class="progress-bar progress-bar-primary" style="width: 68%"></div>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->

</div>
<!-- /.tab-pane -->
<!-- Stats tab content -->
<div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
<!-- /.tab-pane -->
<!-- Settings tab content -->
<div class="tab-pane" id="control-sidebar-settings-tab">
<form method="post">
<h3 class="control-sidebar-heading">General Settings</h3>

<div class="form-group">
<label class="control-sidebar-subheading">
Report panel usage
<input type="checkbox" class="pull-right" checked>
</label>

<p>
Some information about this general settings option
</p>
</div>
<!-- /.form-group -->

<div class="form-group">
<label class="control-sidebar-subheading">
Allow mail redirect
<input type="checkbox" class="pull-right" checked>
</label>

<p>
Other sets of options are available
</p>
</div>
<!-- /.form-group -->

<div class="form-group">
<label class="control-sidebar-subheading">
Expose author name in posts
<input type="checkbox" class="pull-right" checked>
</label>

<p>
Allow the user to show his name in blog posts
</p>
</div>
<!-- /.form-group -->

<h3 class="control-sidebar-heading">Chat Settings</h3>

<div class="form-group">
<label class="control-sidebar-subheading">
Show me as online
<input type="checkbox" class="pull-right" checked>
</label>
</div>
<!-- /.form-group -->

<div class="form-group">
<label class="control-sidebar-subheading">
Turn off notifications
<input type="checkbox" class="pull-right">
</label>
</div>
<!-- /.form-group -->

<div class="form-group">
<label class="control-sidebar-subheading">
Delete chat history
<a href="javascript:void(0)" class="text-red pull-right"><i class="fa fa-trash-o"></i></a>
</label>
</div>
<!-- /.form-group -->
</form>
</div>
<!-- /.tab-pane -->
</div>
</aside>
<!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
Expand Down Expand Up @@ -836,7 +650,8 @@ <h3 class="control-sidebar-heading">Chat Settings</h3>
var e1 = document.getElementById("application");
var application = e1.options[e1.selectedIndex].value;
var e2 = document.getElementById("detectionMethod");
var detectionMethod = e2.options[e2.selectedIndex].value;
var detectionMethod = e2.options[e2.selectedIndex].value;
var fpstweak = document.getElementById("fpstweak");

alertstyle = "alert-success";

Expand All @@ -853,11 +668,11 @@ <h3 class="control-sidebar-heading">Chat Settings</h3>

$('#addcam').html('<i class="fa fa-spin fa-cog fa-3x fa-fw" style="font-size:12px;"></i> Adding Camera');

console.log(camURL + " " + application + " " + detectionMethod);
console.log("Front end logging:" + camURL + " " + application + " " + detectionMethod + " FPS Tweak: " + fpstweak);
$.ajax({
type: "POST",
url: "{{ url_for('add_camera') }}",
data : {'camURL': camURL, 'application': application, 'detectionMethod': dlibDetection},
data : {'camURL': camURL, 'application': application, 'detectionMethod': dlibDetection, 'fpstweak': fpstweak},
success: function(cam) {
console.log(cam);

Expand Down

0 comments on commit 1ef4562

Please sign in to comment.