Error in imread (line 343) [fid,errmsg] = fopen(filename, 'r'); Error in calistir (line 6) A = imread( fullfile(datapath, TestImage));
4 views (last 30 days)
Show older comments
clear all
close all
clc
datapath = ('C:\Users\Lenovo\Desktop\DATASET');
TestImage = ('C:\Users\Lenovo\Desktop\DATASET\test\gayefulin.jpg');
A = imread( fullfile(datapath, TestImage));
FaceDetector = vision.CascadeObjectDetector();
BBOX = step(FaceDetector, A);
resimsayisi = size(BBOX,1);
anaresim = zeros(1,resimsayisi);
tanit = [];
for sayi=1:resimsayisi
I2 = imcrop(A,BBOX(sayi,:));
I2 = imresize (I2,[2048 1536]);
[taninma dbadi recog_img] = pcayontemi(datapath,I2);
taninma
dbdi
recog_img
anaresim(1,sayi) = dbadi;
tanit(sayi) = taninma;
end
word = cell(1);
for i=1:length(anaresim)
olanbu = eslestir(anaresim(i), tanit(i));
word(i) = {olanbu};
end
B = insertObjectAnnotation(A,'rectangle', BBOX, word,'TextBoxOpacity',0.8,'FontSize',30);
imshow(B);
0 Comments
Answers (2)
Voss
on 13 Mar 2022
Let's check what fullfile() returns with the input arguments you have there:
datapath = ('C:\Users\Lenovo\Desktop\DATASET');
TestImage = ('C:\Users\Lenovo\Desktop\DATASET\test\gayefulin.jpg');
fullfile(datapath, TestImage)
That is not a valid file name. Since TestImage is already the full path to an image file, try this:
datapath = 'C:\Users\Lenovo\Desktop\DATASET';
TestImage = 'C:\Users\Lenovo\Desktop\DATASET\test\gayefulin.jpg';
A = imread(TestImage);
0 Comments
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!