Last change
on this file since 533 was
497,
checked in by sommeria, 12 years ago
|
cleaning and small bug repair.
pb of histogram for filter data solved
display of uicontrol by right mouse selection improved
|
File size:
1.4 KB
|
Line | |
---|
1 | %'read_image': read images or video objects |
---|
2 | %---------------------------------------------------------------------- |
---|
3 | % function [A,ObjectOut]=read_image(FileName,FileType,VideoObject,num) |
---|
4 | % |
---|
5 | % OUTPUT: |
---|
6 | % A(npy,npx,rgb): matrix of integers (iunt8 or uint16) representing the image, with sizes npy, npx, and possibly color component rgb=1:3 |
---|
7 | % ObjectOut: video object (=[] for images) |
---|
8 | % |
---|
9 | % INPUT: |
---|
10 | % FileName: input file name |
---|
11 | % FileType: input file type, as determined by the function get_file_type.m |
---|
12 | % VideoObject: video object (for faster reading if availlable) |
---|
13 | % num: frame index for movies or multimage types |
---|
14 | % |
---|
15 | function [A,ObjectOut]=read_image(FileName,FileType,VideoObject,num) |
---|
16 | %----------------------------------------------------------------------- |
---|
17 | if ~exist('VideoObject','var') |
---|
18 | VideoObject=[]; |
---|
19 | end |
---|
20 | if ~exist('num','var') |
---|
21 | num=1; |
---|
22 | end |
---|
23 | ObjectOut=VideoObject;%default |
---|
24 | switch FileType |
---|
25 | case 'video' |
---|
26 | if strcmp(class(VideoObject),'VideoReader') |
---|
27 | A=read(VideoObject,num); |
---|
28 | else |
---|
29 | ObjectOut=VideoReader(FileName); |
---|
30 | A=read(ObjectOut,num); |
---|
31 | end |
---|
32 | case 'mmreader' |
---|
33 | if strcmp(class(VideoObject),'mmreader') |
---|
34 | A=read(VideoObject,num); |
---|
35 | else |
---|
36 | ObjectOut=mmreader(FileName); |
---|
37 | A=read(ObjectOut,num); |
---|
38 | end |
---|
39 | case 'multimage' |
---|
40 | A=imread(FileName,num); |
---|
41 | case 'image' |
---|
42 | A=imread(FileName); |
---|
43 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.