Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

test with video file, played with some params

  • Loading branch information...
commit ff4e30240eb283c0fd3966f44b78e56664c903c8 1 parent e89e170
@oleclerc authored
View
4 FeatureDetectAs3.as3proj
@@ -6,7 +6,7 @@
<movie input="" />
<movie path="bin\FeatureDetectAs3.swf" />
<movie fps="30" />
- <movie width="800" />
+ <movie width="1000" />
<movie height="600" />
<movie version="11" />
<movie minorVersion="1" />
@@ -50,7 +50,7 @@
</includeLibraries>
<!-- SWC Libraries -->
<libraryPaths>
- <!-- example: <element path="..." /> -->
+ <element path="lib\MinimalComps_0_9_10.swc" />
</libraryPaths>
<!-- External Libraries -->
<externalLibraryPaths>
View
2  src/Detector/Fast9Detector.as
@@ -12,7 +12,7 @@ package Detector
*/
public class Fast9Detector
{
- private static var FAST9_BORDER:Param = new Param("FAST9_Border", 5);
+ private static var FAST9_BORDER:Param = new Param("FAST9_Border", 6);
private static var FAST9_NONMAX:Param = new Param("FAST9_Nonmax", 1);
public function Fast9Detector()
View
27 src/GroundTruthEditor.as
@@ -0,0 +1,27 @@
+package
+{
+ import flash.display.Sprite;
+ import flash.events.Event;
+ /**
+ * ...
+ * @author Olivier Leclerc
+ */
+ public class GroundTruthEditor extends Sprite
+ {
+
+ public function GroundTruthEditor()
+ {
+ if (stage) init();
+ else addEventListener(Event.ADDED_TO_STAGE, init);
+ }
+
+ private function init(e:Event = null):void
+ {
+ removeEventListener(Event.ADDED_TO_STAGE, init);
+
+
+ }
+
+ }
+
+}
View
50 src/ImageSource/SourceVideo.as
@@ -1,15 +1,63 @@
package ImageSource
{
+ import flash.display.Bitmap;
+ import flash.display.BitmapData;
+ import flash.display.Sprite;
+ import flash.events.AsyncErrorEvent;
+ import flash.filters.BlurFilter;
+ import flash.geom.Matrix;
+ import flash.media.Video;
+ import flash.net.NetConnection;
+ import flash.net.NetStream;
/**
* ...
* @author Olivier Leclerc
*/
- public class SourceVideo
+ public class SourceVideo extends Sprite
{
+ private var video:Video;
+ private var scaleMatrix:Matrix;
+ private var currentFrame:BitmapData;
+
public function SourceVideo()
{
+ var netConnect:NetConnection = new NetConnection();
+ netConnect.connect(null);
+ var ns:NetStream = new NetStream(netConnect);
+ ns.client = new Object();
+ ns.client.onMetaData = OnMetaData;
+ ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, AsyncErrorHandler);
+ ns.play("../test.flv");
+
+ video = new Video(480,360);
+ video.attachNetStream(ns);
+ //video.filters = [new BlurFilter(BlurSize.value, BlurSize.value, BlurAmount.value)];
+ currentFrame = new BitmapData(Main.ImageWidth.value, Main.ImageHeight.value, false);
+
+ scaleMatrix = new Matrix();
+ scaleMatrix.scale(Main.ImageWidth.value / video.width, Main.ImageHeight.value / video.height);
+
+ addChild(video);
+
+ //addChild(new Bitmap(currentFrame));
+ }
+
+ private function AsyncErrorHandler(e:AsyncErrorEvent):void
+ {
+
+ }
+
+ private function OnMetaData(e:Object):void
+ {
+
+ }
+
+ public function GetCurrentFrame():BitmapData
+ {
+ currentFrame.draw(video, scaleMatrix);
+ return currentFrame;
}
}
View
5 src/ImageSource/SourceWebcam.as
@@ -13,9 +13,6 @@ package ImageSource
*/
public class SourceWebcam extends Sprite
{
- private var BlurSize:Param = new Param("BlurSize", 4);
- private var BlurAmount:Param = new Param("BlurAmount", 2);
-
private var cam:Camera;
private var video:Video;
private var scaleMatrix:Matrix;
@@ -27,7 +24,7 @@ package ImageSource
cam.setMode(camWidth, camHeight, 30, false);
video = new Video(camWidth, camHeight);
video.attachCamera(cam);
- video.filters = [new BlurFilter(BlurSize.value, BlurSize.value, BlurAmount.value)];
+ video.filters = [new BlurFilter(Main.BlurSize.value, Main.BlurSize.value, Main.BlurAmount.value)];
currentFrame = new BitmapData(scaledWidth, scaledHeight, false);
View
32 src/Main.as
@@ -9,6 +9,7 @@ package
import General.Feature
import General.Param;
import General.Util;
+ import ImageSource.SourceVideo;
import Matcher.MatchBruteforce;
import flash.display.Bitmap;
@@ -31,15 +32,17 @@ package
*/
public class Main extends Sprite
{
- private var WebcamResX:Param = new Param("WebcamResX", 640);
- private var WebcamResY:Param = new Param("WebcamResY", 480);
- private var ImageWidth:Param = new Param("ImageWidth", 280);
- private var ImageHeight:Param = new Param("ImageHeight", 210);
- private var Fast9Threshold:Param = new Param("Fast9Threshold", 40, 5, 140);
- private var WantedFeatureCount:Param = new Param("WantedFeatureCount", 200, 20, 1000);
+ public static var WebcamResX:Param = new Param("WebcamResX", 480);
+ public static var WebcamResY:Param = new Param("WebcamResY", 360);
+ public static var ImageWidth:Param = new Param("ImageWidth", 240);
+ public static var ImageHeight:Param = new Param("ImageHeight", 180);
+ public static var Fast9Threshold:Param = new Param("Fast9Threshold", 40, 5, 140);
+ public static var WantedFeatureCount:Param = new Param("WantedFeatureCount", 200, 20, 1000);
+ public static var BlurSize:Param = new Param("CamBlurSize", 4);
+ public static var BlurAmount:Param = new Param("CamBlurAmount", 2);
-
- private var imgSource:SourceWebcam
+ //private var imgSource:SourceWebcam;
+ private var imgSource:SourceVideo;
private var inputImage:BitmapData;
private var overlay:Sprite;
private var greyscaleFilter:ColorMatrixFilter;
@@ -60,7 +63,8 @@ package
stage.addEventListener(KeyboardEvent.KEY_DOWN, OnKeyDown);
//Create image source
- imgSource = new SourceWebcam(WebcamResX.value, WebcamResY.value, ImageWidth.value, ImageHeight.value);
+ //imgSource = new SourceWebcam(WebcamResX.value, WebcamResY.value, ImageWidth.value, ImageHeight.value);
+ imgSource = new SourceVideo();
addChild(imgSource);
var matrix:Array = new Array();
@@ -132,7 +136,7 @@ package
DescribeFeatures(input, features);
//cutoff if too many features, to avoid lag when debugging
- //if (prevFeatures != null && prevFeatures.length < 300 && features.length < 300)
+ if (prevFeatures != null && prevFeatures.length < 350 && features.length < 350)
{
//Match previous frame features with current frame features
MatchBruteforce.Match(prevFeatures, features);
@@ -174,15 +178,15 @@ package
{
if (f.match != null && f.consecutiveMatches >= 2)
{
- //overlay.graphics.lineStyle(1, 0xff0000);
- //overlay.graphics.drawCircle(f.pos.x, f.pos.y, 2);
+ overlay.graphics.lineStyle(1, 0xff0000);
+ overlay.graphics.drawCircle(f.pos.x, f.pos.y, 2);
overlay.graphics.lineStyle(1, 0x3300ff);
overlay.graphics.moveTo(f.pos.x, f.pos.y);
overlay.graphics.lineTo(f.match.pos.x, f.match.pos.y);
- //overlay.graphics.lineStyle(1, 0x00ff00);
- //overlay.graphics.drawCircle(f.match.pos.x, f.match.pos.y, 2);
+ overlay.graphics.lineStyle(1, 0x00ff00);
+ overlay.graphics.drawCircle(f.match.pos.x, f.match.pos.y, 2);
}
}
}
View
2  src/Matcher/MatchBruteforce.as
@@ -11,7 +11,7 @@ package Matcher
public class MatchBruteforce
{
private static var MAX_DIFFERENCE:Param = new Param("MATCH_MAX_DIFFERENCE", 45);
- private static var MAX_DISTANCE:Param = new Param("MATCH_MAX_DISTANCE", 25);
+ private static var MAX_DISTANCE:Param = new Param("MATCH_MAX_DISTANCE", 24);
public function MatchBruteforce()
{
Please sign in to comment.
Something went wrong with that request. Please try again.