0

I'm trying to make a script so that I can compare multiple frames to a background frame. My script is the following:

close all
clear all
clc

A=imread('background.jpg');       
coords = [imread('*.jpg')];

numImages = size(coords,1);
images = cell(1,numImages);
data = cell(1, numImages);
for ii = 1 : numImages
    images{ii} = imabsdiff(A,coords(ii,:));
end

for ii = 1 : numImages 
     E= im2bw(images{ii},0.1);
    s = regionprops(E,'centroid');

   data{ii} = reshape([s.Centroid],2,[]).';
end

for ii = 1 : numImages
    csvwrite(sprintf('data%d.csv', ii), data{ii});
end

I'm trying to compare the images from coords with A and then convert them to binary images and get the regionprops into a .csv file. But it doesn't work like I want it to. imread is failing.

John
  • 5,735
  • 3
  • 46
  • 62
Mikkel Astrup
  • 405
  • 6
  • 18

1 Answers1

0

imread does not understand wild cards.

I would recommend looking at the file exchange for glob, or use matlab's native ls to deal with wild cards.

John
  • 5,735
  • 3
  • 46
  • 62