i am not aware about features.mat. solve this error
1 view (last 30 days)
Show older comments
detector = vision.CascadeObjectDetector;
I = imread('C:\Users\HP\Desktop\image\img.jpg');
bbox = step(detector, I);
face = imcrop(I, bbox(1,:)); % Crop the first detected face
features = extractLBPFeatures(face);
% Load the feature vectors for all the faces in the group photo
load('features.mat')
% Extract the features for the face you want to identify
face_id = input('Enter the ID of the person you want to find: ');
query_features = features(face_id,:);
% Calculate the distances between the query features and all the other features
distances = pdist2(query_features, features);
% Find the index of the closest match
[~,idx] = min(distances);
% Display the group photo with the bounding box around the matched face
imshow(I);
hold on
rectangle('Position', bbox(idx,:),'EdgeColor','r','LineWidth',2);
hold off
-----------------------------------------------
error-
Error using load
Unable to find file or directory 'features.mat'.
Error in project (line 7)
load('features.mat')
0 Comments
Answers (1)
Sachin
on 20 Mar 2023
I understand that you are getting an error in loading the ‘features.mat’ file.
You do not need to load ‘features.mat’ because the ‘extractLBPFeatures’ function returns 1 x N vector (Features which you can use for classification, recognition, etc). So, you can use that features vector for your tasks and remove ‘load('features.mat').’
detector = vision.CascadeObjectDetector;
I = imread('C:\Users\HP\Desktop\image\img.jpg');
bbox = step(detector, I);
face = imcrop(I, bbox(1,:)); % Crop the first detected face
features = extractLBPFeatures(face);
% Load the feature vectors for all the faces in the group photo
% load('features.mat') -- don't need to load remove this line
% Extract the features for the face you want to identify
face_id = input('Enter the ID of the person you want to find: ');
query_features = features(face_id,:);
% Calculate the distances between the query features and all the other features
distances = pdist2(query_features, features);
% Find the index of the closest match
[~,idx] = min(distances);
% Display the group photo with the bounding box around the matched face
imshow(I);
hold on
rectangle('Position', bbox(idx,:),'EdgeColor','r','LineWidth',2);
hold off
For more information on ‘extractLBPFeatures’, refer to the following page:
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!