How to generate the video to VHDL code generaion in MATLAB?(HDL Code)

1 view (last 30 days)
Dear All, I am trying to generate the simple video in code generation using hdlcoder_ command. I simulated the code for function and testvideo and the code is running successfully in Matlab Editor. But in the case of HDL coder,it has an issue saying that code fails coz of command (videoreader,movie,read).
1. its accepting the input code from the matlab editor and video too displaying , but it fails to generate in HDL Code.
Here i can producing this code for reference,
1.Function Code:
if true
function readerobj = video(in) readerobj = VideoReader(in);
vidFrames = read(readerobj);
numFrames = get(readerobj, 'NumberOfFrames');
for k = 1 : numFrames
mov(k).cdata = vidFrames(:,:,:,k);
mov(k).colormap = [];
hf = figure;
set(hf, 'position', [500 300 readerobj.Width readerobj.Height])
movie(hf, mov, 1, readerobj.FrameRate);
2.testbench code
in = uigetfile('*.avi');
readerobj = video(in);
Kindly reply this with your response , it will be very helpful.
Regards, Deepak.

Answers (1)

Tim McBrayer
Tim McBrayer on 7 Nov 2016
As the Readiness report states, you are using several functions not supported for HDL code generation. The VideoReader object accesses a disk file and reads the file into memory. This is not something that can be performed on an FPGA, which has no file system. Similarly, you are displaying the file via the movie function. This requires a display, which also is not available on an FPGA.
You need to ask yourself what it is that you are trying to do with the hardware, and what portion of your overall design can be placed onto an FPGA. A typical flow will have the testbench reading the input data stream, passing it to the hardware portion of the design, and finally displaying the resulting processed output data. The portion of the design converted to HDL is the video transform that sits in the middle.
My suggestion is to start with some of the simple HDL Coder Examples in the documentation to learn the tool flow and some of its capabilities. Once you are familiar with the basics of the tool, there are more advanced HDL Coder Image Processing examples that demonstrate some of the techniques necessary to efficiently handle and process a video stream.



Community Treasure Hunt

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

Start Hunting!