Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Storing images in a variable

Status
Not open for further replies.

KPJYOTHIS

Newbie level 3
Joined
Jun 11, 2011
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
I want 2 variables each stores a set of images say trueset and testset.then compare each images in the testset with the trueset to findout the similarities using the functions such as overlap,IOF functions etc.Then have to rank the images in the testset.Is there any efficient matlabcode for this.
 

KPJYOTHIS

Newbie level 3
Joined
Jun 11, 2011
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
Can the variable I store number of images or a single image?
 

kalyanasv

Full Member level 4
Joined
May 17, 2011
Messages
192
Helped
48
Reputation
96
Reaction score
46
Trophy points
1,308
Location
NY
Activity points
2,455
If you want to process two separate images, I would simply store it in two variables. Its easier to handle logically.
That having said, matlab treats I as a matrix. So you can add, subtract do all the image processing you want on it. i.e. store multiple images.
 

KPJYOTHIS

Newbie level 3
Joined
Jun 11, 2011
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
Actually i want 2 variables where each variable holds a set of images.Then want to compare each images from one variable to all images in the second variable to find out the similarities.
 

kalyanasv

Full Member level 4
Joined
May 17, 2011
Messages
192
Helped
48
Reputation
96
Reaction score
46
Trophy points
1,308
Location
NY
Activity points
2,455
Try this:
Code:
N = 100
IMAGES = cell(1,N);
FNAMEFMT = 'image_%d.png';

for i=1:N
  IMAGES{i} = imread(sprintf(FNAMEFMT, i));
end
 

andre_teprom

Super Moderator
Staff member
Joined
Nov 7, 2006
Messages
9,181
Helped
1,141
Reputation
2,301
Reaction score
1,116
Trophy points
1,403
Location
Brazil
Activity points
53,328
Can the variable I store number of images or a single image?
You can read separatelly.
The above code was mentioned just for template.
Code:
ima1 = imread('trueset.jpg');
ima2 = imread('testset.jpg');
In example posted at refered link - now transcripted here - ima1 and ima2 could receive each figure :

Code:
% Template matching code based on correlation 
% Threshold should be in [0,1]
% YRP 2005

function Corr = TemplateMatching(ima1,ima2,threshold)

s = size(ima1);
% Performs Correlation
corr = StandardCorrelation(ima1,ima2);

% Dislays image
figure(1); imagesc(ima1); axis image;
% Displays correlation
figure(2); imagesc(corr); axis image;
% Display detection results
% Creates an RGB image
ima3 = zeros(s(1),s(2),3);
% Allocates Red plane to scene
ima1 = double(ima1);
ima3(:,:,1) = double(ima1-min(min(ima1)))/(max(max(ima1))-min(min(ima1))); %/512 as data must be in [0,1]
% Allocates Green and Blue to correlation
max(max(corr))
ima3(:,:,2) = (corr > threshold);
ima3(:,:,3) = (corr > threshold);
figure(3); imagesc(ima3); axis image;
+++
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top