フィルターのクリア

Enter values into a FIFO array

9 ビュー (過去 30 日間)
Alber
Alber 2020 年 4 月 20 日
編集済み: Alber 2020 年 4 月 22 日
Hello,
I have an array called
frameBuffer = zeros (height, width, numChannels, framesPerSymbol);
and a video. The parameters of the frameBuffer are height, width, number of color channels and framesPerSymbol, which will be the number of frames that my symbol lasts.My goal is to insert frames of the video in the array as if it were a FIFO queue, that is, if framesPerSymbol is 5:
F = frames E = empty
1) E E E E E
2) F E E E E
3) F F E E E
4) F F F E E
5) F F F F E
6) F F F F F
Thanks in advance.

採用された回答

Mehmed Saad
Mehmed Saad 2020 年 4 月 20 日
編集済み: Mehmed Saad 2020 年 4 月 20 日
I think you are trying to save last five frames in a buffer, but a for loop is not required for that purpose
frameBuffer=zeros (height, width, numChannels, framesPerSymbol);
framesInBuffer = 0;
While loop
while hasFrame(videoObject)
frame = double(readFrame(videoObject));
I made a change here
frameBuffer = shiftBuffer(frameBuffer,frame);
framesInBuffer = framesInBuffer + 1;
if framesInBuffer > framesPerSymbol
framesInBuffer = framesPerSymbol;
bypassEncoding = false;
else
bypassEncoding = true;
end
if ~bypassEncoding
if canWeEncode(frameBuffer,alpha,threshold)
encodedBuffer = steganographicEncoding(frameBuffer,width,height,codeRows,codeCols,alpha,sigma);
writeBufferToFinalVideo(encodedBuffer,100);
else
writeFrameToFinalVideo(squeeze(frameBuffer(:,:,:,1)));
end
end
end
and a change here
function frameBuffer = shiftBuffer (frameBuffer,frame)
frameBuffer = circshift(frameBuffer,1,4);
frameBuffer(:,:,:,1) = frame;
end
  1 件のコメント
Alber
Alber 2020 年 4 月 20 日
編集済み: Alber 2020 年 4 月 20 日
Yes, my idea is that when the buffer is full, to see if I can encode and after this is done it will take me another 5 frames, so until I complete all the frames of the video and can you explain this part?
function frameBuffer = shiftBuffer (frameBuffer,frame)
frameBuffer = circshift(frameBuffer,1,4);
frameBuffer(:,:,:,1) = frame;
end
I want to take 5 frames, I encode (the whole loop below) and I will take another 5, like this until I complete all the frames of the video.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by