How to get the variance of a binaryFeature object?
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm trying to write a program for object recognition using the bagOfFeatures approach described in Matlab. I want to create a custom extractor since I'm getting low accuracy with the default one. From the description, the function "extractFeatures" returns either a M by N matrix OR a binaryFeature object. I believe that the provided code in "exampleBagOfFeaturesExtractor.m" gets the variance assuming a M by N matrix is returned as follows:
multiscaleSURFPoints = detectSURFFeatures(grayImage);
features = extractFeatures(grayImage, multiscaleSURFPoints, 'Upright', true);
featureMetrix = var(features, [], 2);
When I change the type of feature detector to detectHarrisFeatures or detectBRISKFeatures I get the following error in var:
Undefined function 'sum' for input arguments of type 'binaryFeatures'.
This would suggest that a binaryFeature object was returned by extractFeatures instead of the matrix. From the documentation a binaryFeature object has a property 'Features' which is an M by N matrix, so I tried doing:
featureMetrix = var(features.Features, [], 2);
but this only generates more errors, telling me that the first argument must be single or double.
댓글 수: 0
답변 (1개)
Birju Patel
2015년 5월 14일
Hi David,
The error is due to the use of binaryFeatures in your custom extractor. bagOfFeatures does not support binaryFeatures as a custom feature type. This is the cause of the error you see at the end: "the first output must be double or single".
The reason you are getting binaryFeatures from extractFeatures is because the detected points are cornerPoints (the output of either detectHarrisFeatures or detectBRISKFeatures). By default, extractFeatures returns binaryFeatures whenever it gets cornerPoint inputs.
You can change this behavior by setting extractFeatures 'Method' parameter to 'SURF'. That way, when you pass in the points detected by either the Harris or BRISK detectors, the extracted features will be SURF features. SURF features are stored as a matrix, so these can be used within your custom extractor.
You can get more info on the 'Method' parameter here:
HTH, Birju
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!