コード例 #1
0
ファイル: c_flow.c プロジェクト: kkelchte/Flownet-Experiments
void c_flow (float* xyflow, float *img, int m, int n) {

    int i, j ;
    int pixindex = 0;
    
    float R=0,G=0,B=0;
    float xflow, yflow;
    int pageoff = m*n;
    
    for (i = 0; i < m; i++) { //height rows
        for (j = 0; j < n; j++) { //width cols
                
                int index = pixindex*2;
                
                xflow = xyflow[index+0];
                yflow = xyflow[index+1];
                
                int imgindex = (j*m+i)*3;
                
                cartesianToRGB(xflow, yflow, &R, &G, &B);
                
                img[imgindex+0] = B / 255.0;
                img[imgindex+1] = G / 255.0;
                img[imgindex+2] = R / 255.0;
                
                pixindex++;            
        }
    }
    return ;
}
コード例 #2
0
ファイル: ColorFlow.cpp プロジェクト: haeusser/caffe
void ColorFlow2(const float* input, unsigned char* output, int size, float scale)
{
  float pix[3] = {0.f, 0.f, 0.f};

  for (int i = 0; i < size; ++i) {
    const float* inpixel = &(input[i*2]);
    unsigned char* outpixel = &(output[i*3]);

    cartesianToRGB(inpixel[0]*scale, inpixel[1]*scale, 
                   &pix[0], &pix[1], &pix[2]);

    outpixel[0] = (unsigned char)(pix[0]);
    outpixel[1] = (unsigned char)(pix[1]);
    outpixel[2] = (unsigned char)(pix[2]);
  }
}