Add object detection, tracking, mobile notifications, and search to any security camera.
dont get frames for now
roryclear5d3e9e045d0f
diff --git a/clearcam/FileServer.m b/clearcam/FileServer.mindex 6610ec3..42f7865 100644--- a/clearcam/FileServer.m+++ b/clearcam/FileServer.m@@ -120,50 +120,10 @@double timeStamp = [[segment valueForKey:@"timeStamp"] doubleValue];double duration = [[segment valueForKey:@"duration"] doubleValue];- NSMutableArray *frameDicts = [NSMutableArray array];- NSArray *frames = [[segment valueForKey:@"frames"] array]; // Copy frames-- for (NSManagedObject *frame in frames) {- double frameTimeStamp = [[frame valueForKey:@"frame_timeStamp"] doubleValue];- double aspectRatio = [[frame valueForKey:@"aspect_ratio"] doubleValue];- int res = [[frame valueForKey:@"res"] intValue];-- NSMutableArray *squareDicts = [NSMutableArray array];- NSArray *squares = [[frame valueForKey:@"squares"] array]; // Copy squares-- for (NSManagedObject *square in squares) {- double originX = [[square valueForKey:@"originX"] doubleValue];- double originY = [[square valueForKey:@"originY"] doubleValue];- double bottomRightX = [[square valueForKey:@"bottomRightX"] doubleValue];- double bottomRightY = [[square valueForKey:@"bottomRightY"] doubleValue];- int classIndex = [[square valueForKey:@"classIndex"] intValue];-- NSDictionary *squareDict = @{- @"originX": @(originX),- @"originY": @(originY),- @"bottomRightX": @(bottomRightX),- @"bottomRightY": @(bottomRightY),- @"classIndex": @(classIndex)- };-- [squareDicts addObject:squareDict];- }-- NSDictionary *frameDict = @{- @"frame_timeStamp": @(frameTimeStamp),- @"aspect_ratio": @(aspectRatio),- @"res": @(res),- @"squares": squareDicts- };-- [frameDicts addObject:frameDict];- }-NSDictionary *segmentDict = @{@"url": url,@"timeStamp": @(timeStamp),- @"duration": @(duration),- @"frames": frameDicts+ @"duration": @(duration)};[processedSegments addObject:segmentDict];diff --git a/clearcam/player.html b/clearcam/player.htmlindex f2bbf84..380fce0 100644--- a/clearcam/player.html+++ b/clearcam/player.html@@ -548,34 +548,36 @@let frames = segments[currentSegment].frames;let show_new = false;- while((shape_idx+1 < frames.length) && (currentTime > frames[shape_idx+1].frame_timeStamp)) {- shape_idx += 1;- show_new = true;- }-- if(show_new == true){- let n_boxes = document.querySelectorAll(".bounding-box").length;- let aspect_ratio = frames[shape_idx].aspect_ratio;- let res = frames[shape_idx].res;- //drawBoundingBox(0.0,0.0,0.5,0.5,"red","rory");- for(let i = 0; i < frames[shape_idx].squares.length; i++){- if(portrait){ //todo, can just send the correct aspect ratio instead?- let originX = (frames[shape_idx].squares[i].originX / (res / aspect_ratio));- let originY = (frames[shape_idx].squares[i].originY / res);- let length = ((frames[shape_idx].squares[i].bottomRightX - frames[shape_idx].squares[i].originX) / (res / aspect_ratio));- let height = ((frames[shape_idx].squares[i].bottomRightY - frames[shape_idx].squares[i].originY) / res);- drawBoundingBox(originX, originY, length, height,yolo_classes[frames[shape_idx].squares[i].classIndex][1],yolo_classes[frames[shape_idx].squares[i].classIndex][0]);- } else {- let originX = (frames[shape_idx].squares[i].originX / res);- let originY = (frames[shape_idx].squares[i].originY / (res / aspect_ratio));- let length = ((frames[shape_idx].squares[i].bottomRightX - frames[shape_idx].squares[i].originX) / res);- let height = ((frames[shape_idx].squares[i].bottomRightY - frames[shape_idx].squares[i].originY) / (res / aspect_ratio));- drawBoundingBox(originX, originY, length, height,yolo_classes[frames[shape_idx].squares[i].classIndex][1],yolo_classes[frames[shape_idx].squares[i].classIndex][0]);- }+ if(frames){+ while((shape_idx+1 < frames.length) && (currentTime > frames[shape_idx+1].frame_timeStamp)) {+ shape_idx += 1;+ show_new = true;}- let boundingBoxes = document.querySelectorAll(".bounding-box");- for (let i = 0; i < n_boxes; i++) {- boundingBoxes[i].remove();++ if(show_new == true){+ let n_boxes = document.querySelectorAll(".bounding-box").length;+ let aspect_ratio = frames[shape_idx].aspect_ratio;+ let res = frames[shape_idx].res;+ //drawBoundingBox(0.0,0.0,0.5,0.5,"red","rory");+ for(let i = 0; i < frames[shape_idx].squares.length; i++){+ if(portrait){ //todo, can just send the correct aspect ratio instead?+ let originX = (frames[shape_idx].squares[i].originX / (res / aspect_ratio));+ let originY = (frames[shape_idx].squares[i].originY / res);+ let length = ((frames[shape_idx].squares[i].bottomRightX - frames[shape_idx].squares[i].originX) / (res / aspect_ratio));+ let height = ((frames[shape_idx].squares[i].bottomRightY - frames[shape_idx].squares[i].originY) / res);+ drawBoundingBox(originX, originY, length, height,yolo_classes[frames[shape_idx].squares[i].classIndex][1],yolo_classes[frames[shape_idx].squares[i].classIndex][0]);+ } else {+ let originX = (frames[shape_idx].squares[i].originX / res);+ let originY = (frames[shape_idx].squares[i].originY / (res / aspect_ratio));+ let length = ((frames[shape_idx].squares[i].bottomRightX - frames[shape_idx].squares[i].originX) / res);+ let height = ((frames[shape_idx].squares[i].bottomRightY - frames[shape_idx].squares[i].originY) / (res / aspect_ratio));+ drawBoundingBox(originX, originY, length, height,yolo_classes[frames[shape_idx].squares[i].classIndex][1],yolo_classes[frames[shape_idx].squares[i].classIndex][0]);+ }+ }+ let boundingBoxes = document.querySelectorAll(".bounding-box");+ for (let i = 0; i < n_boxes; i++) {+ boundingBoxes[i].remove();+ }}}