Pregunta

i am trying to use fftn function but I get errors. My code is:

clc;
clear all;
close all;
% video=VideoReader('C:\Users\Public\Videos\Sample Videos\Wildlife.wmv');
video=read('C:\Users\Public\Videos\Sample Videos\gray\myvideo.avi');
f=fftn(v);
i=imread('C:\Users\Public\Videos\Sample Videos\gray\2.jpg');
f=fftshift(fftn(i));
figure,imshow(i);
figure,imshow(log(1+f),[]);
  1. When I apply fftn for a single frame I get the same results as fft2 function

    i=imread('C:\Users\Public\Videos\Sample Videos\gray\2.jpg');
    f=fftshift(fftn(i));
    
  2. But when I apply fftn on video I get an error:

??? Undefined function or method 'read' for input arguments of type 'char'
at line
v=read('C:\Users\Public\Videos\Sample Videos\gray\myvideo.avi');

when I un-comment this line:

video=VideoReader('C:\Users\Public\Videos\Sample Videos\Wildlife.wmv');  

I get this error:

??? Undefined function or method 'VideoReader' for input arguments of type 'char'.

I went through algorithms of fftn and ifftn but couldn't find out solution.

Questions:

  1. How should I use fftn and ifftn to apply 3d FFT on a video sequence and get back frames from phase spectrum only?
  2. Also, is there any need to convert rgb video to gray video before applying fftn function on video?
¿Fue útil?

Solución

If i understand correctly, the problem is not with "fftn" but rather the "read" and "VideoReader" functions. Usually "Undefined function or method 'read' for input arguments of type 'char'" error stems from the fact that the specific function isn't in the MATLAB path or in the pwd (it's been answered before, you should be able to find more info on this).

Anyways,

$ which -all read

and

$ which -all VideoReader

will tell you where they are. If you see "'read'/'VideoReader' not found." then they're not there. In that case check that they are in a sub-directory that is actually on the matlab path (>> PATH). Make sure it's not a private dir either or they won't be accessible by the cmd line (see http://www.mathworks.ch/ch/help/matlab/matlab_prog/private-functions.html for more info on this)

Once you get this sorted, check if it's getting loaded properly, do:

$ video=VideoReader('C:\Users\Public\Videos\Sample Videos\Wildlife.wmv');

$ get(video)

Cheers

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top