Azzera filtri
Azzera filtri

extract image from array.

2 visualizzazioni (ultimi 30 giorni)
Naseeb Gill
Naseeb Gill il 30 Dic 2015
Commentato: Walter Roberson il 31 Dic 2015
I take down some snapshots from logitech camera and images are stored in array form in pics folder name. Now I want to see those pictures (in png format). So how can i extract iamges from those array. number of images are 20.

Risposta accettata

Walter Roberson
Walter Roberson il 30 Dic 2015
  6 Commenti
Naseeb Gill
Naseeb Gill il 31 Dic 2015
Thanks for pointing out my mistake. I solved this problem using following code:
vid1 = videoinput('winvideo',1,'RGB24_640x480');
vid2 = videoinput('winvideo',2,'RGB24_640x480');
start(vid1);
start(vid2);
preview(vid1);
preview(vid2);
pics1 = cell(1,10)
pics2 = cell(1,10)
for i = 1: 10
pause(5);
pics1{i} = getsnapshot(vid1);
pics2{i} = getsnapshot(vid2);
end
for i = 1:10
FileName1 = sprintf( 'pica%d.png',i) ;
fullFileName1 = fullfile( FileName1);
imwrite(pics1{i}, fullFileName1);
FileName2 = sprintf( 'picb%d.png',i) ;
fullFileName2 = fullfile( FileName2);
imwrite(pics2{i}, fullFileName2);
end
closepreview(vid1);
closepreview(vid2);
clear ('vid1');
clear ('vid2');
but now I'm facing a new problem that images store in default folder but i want to save images in predetermined folder say in 'image_folder' folder present on desktop. How can I do it???
Walter Roberson
Walter Roberson il 31 Dic 2015
project_dir = 'C:\wherever\the\desktop\is\image_folder';
Then
fullFileName1 = fullfile( project_dir, FileName1);
and the corresponding for the second file.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by