Open JohnMcLear opened 10 years ago
Fast feature detector is meant to detect corners not edges. You may want to give a try with Sobel for detecting the edges:
tracking.Image.sobel(pixels, width, height);
Did Sobel work for what you were looking for?
Should this work?
window.fastThreshold = 10;
var doFindFeatures = function() {
tracking.Fast.THRESHOLD = window.fastThreshold;
context.drawImage(image, 0, 0, width, height);
var imageData = context.getImageData(0, 0, width, height);
var gray = tracking.Image.grayscale(imageData.data, width, height);
var edges = tracking.Image.sobel(gray, width, height);
for (var i = 0; i < edges.length; i += 2) {
context.fillStyle = '#f00';
context.fillRect(edges[i], edges[i + 1], 3, 3);
}
};
doFindFeatures();
The output is just two lines across the screen ;\
@eduardolundgren any thoughts on this?
Hello @JohnMcLear, sorry for delaying this answer, I have been traveling in a project.
Hey @thiago-rocha, @pablocp could you help @JohnMcLear here?
@JohnMcLear, @eduardolundgren did you get it working? I get two similar lines, one horizontal and another oblique starting from the upper left corner of the image.
Here are the first few values of the array of pixels produced by sobel : 8.9442720413208,8.9442720413208, 8.9442720413208, 255, 5.656854152679443, 5.656854152679443, 5.656854152679443, 255, 17.262676239013672, 17.262676239013672, 17.262676239013672, 255, 18, 18, 18, 255, 3.1622776985168457... It might look like r,g,b,a values but I don't get the coords. It does explain the origin of those two lines. I suspect it is simply me not passing the imageData.data values it needs. Is there an example for the sobel function?
Hello @JohnMcLear, @eduardolundgren, @JohnMcLear,
i have exactly the same problem. @JohnMcLear did you have a solution? Is there an example for the sobel function?
So I may be barking up the wrong tree here but I was using the feature detection just to do some basic edge detection of an object and I guess maybe I took the wrong approach to the problem but I expected the edges of the object to be "features" and not minor details inside of the feature.. I tried different thresholds to no avail..
http://i.imgur.com/k2V3Pz6.png <-- Note a lot of "Edges" are not shown as features despite the threshold being low (5).