Ignore:
Timestamp:
09/04/19 15:11:26 (5 years ago)
Author:
Sanahuja Guillaume
Message:

add imagesize to iplimage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sanscv/lib/FlairSensorActuator/src/V4LCamera.cpp

    r324 r328  
    2929#include <cstring>
    3030#include <sys/mman.h>
     31#include <VisionFilter.h>
    3132
    3233#define DEFAULT_V4L_BUFFERS 4
     
    104105        QueueBuffer(bufferIndex);
    105106    }
     107   
     108    //alloc img buf
     109    Printf("TODO: alloc bufs in cmem and uses it for v4l\n");
     110    output->buffer=AllocFunction(width*height*2);
    106111   
    107112    // enable the streaming
     
    133138
    134139V4LCamera::~V4LCamera() {
     140    FreeFunction(output->buffer);
    135141    SafeStop();
    136142    Join();
     
    139145void V4LCamera::Run(void) {
    140146  Time cam_time, new_time, fpsNow, fpsPrev;
    141   char* buffer; // raw image
    142147  int fpsCounter = 0;
    143148
     
    215220      hasProblems=true;
    216221    }
    217 Printf("todo allocate 1 frame and copy here\n");
     222//Printf("todo allocate 1 frame and copy here\n");
    218223    output->GetMutex();
    219     output->buffer = buffer;
     224    memcpy(output->buffer,buffers[bufferIndex].start,buffers[bufferIndex].length);
    220225    output->ReleaseMutex();
    221226
     
    280285        //Printf("%lld ioctl\n",GetTimeMS());
    281286        if (xioctl (device, VIDIOC_DQBUF, &buf)==-1) {
    282            // Printf("iter %i err %i\n",i,errno);
     287            //Printf("iter %i err %i\n",i,errno);
    283288            if (errno==EAGAIN) {
    284289                //Printf("exit buf %i\n",buf.index);
     
    362367               MAP_SHARED /* recommended */,
    363368               device, buf.m.offset);
    364 Printf("buffer %i start %x length %i\n",n_buffers,buffers[n_buffers].start,buffers[n_buffers].length);
     369//Printf("buffer %i start %x length %i\n",n_buffers,buffers[n_buffers].start,buffers[n_buffers].length);
    365370       if (MAP_FAILED == buffers[n_buffers].start) {
    366371           Thread::Err("mmap\n");
     
    369374   }
    370375   nbBuffers=requestbuffers.count;
    371 Printf("allocated %i buffers\n",nbBuffers);
     376//Printf("allocated %i buffers\n",nbBuffers);
    372377   return 1;
    373378};
Note: See TracChangeset for help on using the changeset viewer.