Changeset 328 in flair-src for branches


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

add imagesize to iplimage

Location:
branches/sanscv
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/sanscv/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp

    r325 r328  
    114114}
    115115
    116 void DemoOpticalFlow::SignalEvent(Event_t event) {
     116void DemoOpticalFlow::SignalEvent(Event_t event) {/*
    117117    UavStateMachine::SignalEvent(event);
    118118    switch(event) {
     
    129129        opticalFlowRealAcceleration->SetValue(1,0,opticalFlowAcceleration->Output(1,0)*scale);
    130130        break;
    131     }
     131    }*/
    132132}
    133133
  • branches/sanscv/lib/FlairSensorActuator/src/Camera.cpp

    r324 r328  
    2424#include <DataPlot1D.h>
    2525#include <Picture.h>
    26 #include <VisionFilter.h>
     26//#include <VisionFilter.h>
    2727#include <fstream>
    2828
  • 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};
  • branches/sanscv/lib/FlairVisionFilter/src/CvtColor.cpp

    r326 r328  
    5555            inIplImage->height=img->GetDataType().GetHeight();
    5656            inIplImage->imageData=img->buffer;
     57            inIplImage->imageSize=img->GetDataType().GetSize();
    5758            */
    5859            output->GetMutex();/*
     
    6061            outIplImage->height=output->GetDataType().GetHeight();
    6162            outIplImage->imageData=output->buffer;
     63            outIplImage->imageSize=output->GetDataType().GetSize();
    6264*/
    6365            switch(conversion) {
  • branches/sanscv/lib/FlairVisionFilter/src/HoughLines.cpp

    r326 r328  
    2020#include <GroupBox.h>
    2121#include <SpinBox.h>
    22 #include <DoubleSpinBox.h>>
     22#include <DoubleSpinBox.h>
    2323#include <typeinfo>
    2424#include <math.h>
     
    8888        gimg->height=img->GetDataType().GetHeight();
    8989        gimg->imageData=img->buffer;
     90        gimg->imageSize=img->GetDataType().GetSize();
    9091   
    9192        size_t nbLines;
  • branches/sanscv/lib/FlairVisionFilter/src/ImgThreshold.cpp

    r326 r328  
    6161        inIplImage->height=img->GetDataType().GetHeight();
    6262        inIplImage->imageData=img->buffer;
     63        inIplImage->imageSize=img->GetDataType().GetSize();
    6364       
    6465        output->GetMutex();
     
    6667        outIplImage->height=output->GetDataType().GetHeight();
    6768        outIplImage->imageData=output->buffer;
     69        outIplImage->imageSize=output->GetDataType().GetSize();
    6870               
    6971        dspThreshold(inIplImage,outIplImage, threshold->Value(), 255, CV_THRESH_BINARY);
  • branches/sanscv/lib/FlairVisionFilter/src/OpticalFlow.cpp

    r326 r328  
    5858            iplpyr->width=imageType.GetWidth();
    5959            iplpyr->height=imageType.GetHeight();
     60            iplpyr->imageSize=imageType.GetSize();
    6061            iplpyr_old->width=imageType.GetWidth();
    6162            iplpyr_old->height=imageType.GetHeight();
     63            iplpyr_old->imageSize=imageType.GetSize();
     64           
     65            iplgimg->roi=NULL;
     66            iplgimg_old->roi=NULL;
     67            iplpyr->roi=NULL;
     68            iplpyr_old->roi=NULL;
    6269*/ 
    6370      } catch(std::bad_cast& bc) {
     
    8996        iplgimg->height=img->GetDataType().GetHeight();
    9097        iplgimg->imageData=img->buffer;
     98        iplgimg->imageSize=img->GetDataType().GetSize();
    9199       
    92100        iplgimg_old->width=img_old->GetDataType().GetWidth();
    93101        iplgimg_old->height=img_old->GetDataType().GetHeight();
    94102        iplgimg_old->imageData=img_old->buffer;
     103        iplgimg_old->imageSize=img_old->GetDataType().GetSize();
    95104       
    96105        iplpyr->imageData=pyr->buffer;
  • branches/sanscv/lib/FlairVisionFilter/src/Sobel.cpp

    r326 r328  
    6262        inIplImage->height=image->GetDataType().GetHeight();
    6363        inIplImage->imageData=image->buffer;
     64        inIplImage->imageSize=image->GetDataType().GetSize();
    6465       
    6566        output->GetMutex();
     
    6768        outIplImage->height=output->GetDataType().GetHeight();
    6869        outIplImage->imageData=output->buffer;
     70        outIplImage->imageSize=output->GetDataType().GetSize();
    6971               
    7072        dspSobel(inIplImage,outIplImage,dx->Value(),dy->Value());
  • branches/sanscv/lib/FlairVisionFilter/src/VisionFilter.cpp

    r325 r328  
    2121 
    2222}
     23
     24char* AllocFunction(ssize_t size) {
     25    return (char*)malloc(size);
     26}
     27
     28void FreeFunction(char* buffer) {
     29    free(buffer);
     30}
  • branches/sanscv/lib/FlairVisionFilter/src/VisionFilter.h

    r325 r328  
    2626                                                               
    2727void saveToJpeg(flair::core::Image* src_img,std::string filename,PictureFormat_t input_format,PictureFormat_t output_format,unsigned char compression_level=95);
     28
     29//for amrv7a, these functions use CMEM
     30char* AllocFunction(ssize_t size);
     31void FreeFunction(char* buffer);
Note: See TracChangeset for help on using the changeset viewer.