Advertisement
Guest User

facefilter.cpp

a guest
Oct 29th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include "facefilter.h"
  2. #include <QVideoFrame>
  3.  
  4. QVideoFilterRunnable *FaceFilter::createFilterRunnable() {
  5.  
  6.     return new Runnable(this);
  7. }
  8.  
  9. QVideoFrame FaceFilter::Runnable::run(QVideoFrame *input, const QVideoSurfaceFormat &,
  10.                                       QVideoFilterRunnable::RunFlags )
  11. {
  12.     if( input->isValid() && input->map(QAbstractVideoBuffer::ReadWrite))
  13.     {
  14.  
  15.         auto ptr = input->bits();
  16.         for(auto i= 0; i <input->width() * input->height() * 4; i++)
  17.         {
  18.             if(i%4 == 2)
  19.                 ptr[i] = 0 ;
  20.         }
  21.  
  22.         input->unmap();
  23.     }
  24.     return *input;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement