Exemplo n.º 1
0
int main()  {
    init(0);
    open_screen_stream();
    int edgeDetectedImage[320][240];
    int prevEdgeDetected[320][240];
    double correlation[32][32];

    while(1)
    {
        take_picture();
        convert_camera_to_screen();

        for(int i=16;i<320-16;i++)  {
            for(int j=16;j<240-16;j++)  {
                for(int k=-16;k<16;k++) {
                    for(int l=-16;l<16;l++) {
                        correlation[k+16][l+16] = sqrt((double)(get_pixel(i,j,3)*prevEdgeDetected[i+k][j+l]));
                    }
                }
            }
        }
        for(int k=0;k<32;k++)   {
            for(int l=0;l<32;l++)   {
                put_pixel(k+400,l+400,correlation[k][l],0,0);
            }
        }
        update_screen();
        for(int i=0;i<320;i++)  {
            for(int j=0;j<240;j++)  {
                prevEdgeDetected[i][j] = edgeDetectedImage[i][j];
            }
        }
    }
}
Exemplo n.º 2
0
int update_screen()
{
   if ((int)fbp == -1) {
        printf("UpdateScreen() - no screen buffer handle\n");
        return -1;
   }
   //  memcpy(&(cam_disp[0]),fbp,screensize);
   // modify cam_disp with camera image
   convert_camera_to_screen(); //
    // copy original sceen fb to "original" buffer
   //memcpy(&(original[0]),fbp,screensize);
   // original screen -> cam_disp
   //memcpy(&(cam_disp[0]),fbp,screensize);
   // put cam_disp to screen
   memcpy(fbp,&(cam_disp[0]),screensize);
   usleep(3000);
   return 0;
}