Example #1
0
int main(int argc, char** argv)
{
    GetPot clArgs(argc,argv);

    hal::Camera Cam( clArgs.follow("", "-cam" ) );

    pb::ImageArray Imgs;

    std::vector< cv::Mat > vBuff;

    Thumbnails Thmbs;

    for(unsigned int nFrame = 0; ; ++nFrame ) {

        Cam.Capture( Imgs );

        cv::Mat Img( Imgs[0] );

        for( int ii = 0; ii < 5; ++ii ) {
            cv::Mat Tmp;
            cv::resize( Img, Tmp, cv::Size(0,0), 0.5, 0.5 );
            Img = Tmp;
        }

        vBuff.push_back( Img );

        std::vector< unsigned int >    vMatches;
        Thmbs.FindBestMatch( vBuff[vBuff.size()-1].data, nullptr, vMatches );

        std::cout << "Matches for " << nFrame << ":" << std::endl;
        for( int ii = 0; ii < vMatches.size(); ++ii ) {
            std::cout << vMatches[ii] << ", ";
        }
        std::cout << std::endl;

        Thmbs.PushThumbnails( nFrame, Img.rows * Img.cols, vBuff[vBuff.size()-1].data );


        ///----------------------------------------------------


        // clear whole screen
//        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

//        pangolin::FinishGlutFrame();

        std::cout << "."; fflush(stdout);
        sleep(1);
    }

    return 0;
}
// @brief  : 行列の作成
//--------------------------------------------------------------------
void TransLookCameraDx9::CreateMatrix(void)
{
    const D3DXVECTOR3 pos = Vector3(Position);
    const Camera *cam = Cam();

    D3DXMATRIX mtx_rot;
    {
        D3DXVECTOR3 eye = -Vector3(cam->Eye);
        D3DXVECTOR3 at  = -Vector3(cam->At);
        D3DXVECTOR3 up  = -Vector3(cam->Up);

        D3DXMatrixLookAtLH(&mtx_rot,&eye,&at,&up);
        D3DXMatrixInverse(&mtx_rot,NULL,&mtx_rot);
        mtx_rot._14 = mtx_rot._24 = mtx_rot._34 =
            mtx_rot._41 = mtx_rot._42 = mtx_rot._43 = 0.0f;
        mtx_rot._44 = 1.0f;
    }

    D3DXMATRIX mtx_pos;
    D3DXMatrixTranslation(&mtx_pos,pos.x,pos.y,pos.z);
    D3DXMatrixMultiply(&m_Matrix,&mtx_rot,&mtx_pos);
}
Example #3
0
void KeyActions::CameraMovement::CamUp()
{
	Cam("Up", 5);
}
Example #4
0
void KeyActions::CameraMovement::CamDown()
{
	Cam("Down", 5);
}
Example #5
0
void KeyActions::CameraMovement::CamLeft()
{
	Cam("Left", 5);
}
Example #6
0
void KeyActions::CameraMovement::CamRight()
{
	Cam("Right", 5);
}
Example #7
0
void keyboardInteraction(unsigned char key, int xMouse, int yMouse) {
    
    bool refresh = true;
    bool updateCam = false;
                std::string nomO;
    switch (key) {
        case 'h':
            cout << "This are the keys avilable:" << endl;
            cout << "-------------------------- KEYBOARD --------------------------" << endl;
            cout << "· ESC: quit the app" << endl;
            cout << "· UP / DOWN: move the cam in the y axis" << endl;
            cout << "· LEFT / RIGHT: move the camera in the x axis" << endl;
            cout << "· x / p: Change the cam type to axonometric / perspective" << endl;
            cout << "· a / e: Change the cam posicionament glLookAt / euler transformations" << endl;
            cout << "· f / l: Change the paint mode fill or lines" << endl;
            cout << "· z: Change the zoom type: zomm modifing ortho/fovy or move the cam" << endl;
            cout << "· c: Load an external .obj" << endl;
            cout << "· 1: Move the cam to the position (0,0,distance)" << endl;
            cout << "· 2: Move the cam to the position (0,distance,0)" << endl << endl;
            cout << "--------------------------- MOUSE ----------------------------" << endl;
            cout << "· Move with left clic: change the X / Y angle of the camera" << endl;
            cout << "· SHIFT + movement: zoom" << endl;
            cout << "· ALT + movement: apply PAN" << endl;
            break;
        case 27:
            exit(0);
            break;
        case 'x':
            cout << "Changed cam to axonometric" << endl;
            camera.type = AXONOMETRIC_CAM;
            updateCam = true;
            break;
        case 'p':
            cout << "Changed cam to prespective" << endl;
            camera.type = PRESPECTIVE_CAM;
            updateCam = true;
            break;
        case 'a':
            cout << "Changed cam positionament mode to glLookAt" << endl;
            camera.changePaintMode(CAM_MOVEMENT_LOOKAT);
            break;
        case 'e':
            cout << "Changed cam positionament mode to Euler tranformations" << endl;
            camera.changePaintMode(CAM_MOVEMENT_EULER);
            break;
        case 'l':
            cout << "Change Light mode to lines" << endl;
            lightMode = GL_LINE;
            refresh = true;
            break;
        case 'f':
            cout << "Change Light mode to fill" << endl;
            lightMode = GL_FILL;
            refresh = true;
            break;
        case 'z':
            if(zoomMode == CAM_ZOOM_FOVYORTHO) {
                zoomMode = CAM_ZOOM_MOVEMENT;
                cout << "Zoom mode changed to 'moving the cam'" << endl;
            }
            else {
                zoomMode = CAM_ZOOM_FOVYORTHO;
                cout << "Zoom mode changed to 'modifying the fovy/glortho'" << endl;
            }
            updateCam = true;
            break;
        case 'c':
            cout << "Introdueix el nom de l'objecte amb l'extensió: ";
            cin >> nomO;
            cout << "Carregant objecte..." << endl;
            camera.updateCamSphere(scene.carregaObjecte(nomO) , aWidth, aheigth);
            
            break;
        case '1':
            cout << "Changed cam position 1(0,0,X)" << endl;
            camera = Cam(CAM_MOVEMENT_LOOKAT, Point(0.0,1.0,0.0), Point (0,0,0), contSphere, SCREEN_W, SCREEN_H);
            updateCam = true;
            break;
        case '2':
            cout << "Changed cam position 2(0,X,0)" << endl;
            camera = Cam(CAM_MOVEMENT_LOOKAT, Point(0.0,0.0,-1.0), Point (-90,0,0), contSphere, SCREEN_W, SCREEN_H);
            updateCam = true;
            break;
        default:
            refresh = false;
            break;
    }
    
    if(updateCam) camera.updateCamType(aWidth, aheigth);
    if(refresh) glutPostRedisplay();
}
Example #8
0
//  CLTest
//
//  Created by Antar - SSD on 08/12/12.
//  Copyright (c) 2012 Àlex Vergara. All rights reserved.
//

#include "glMethods.h"

//globals
static int mode = NORMAL_MODE;
static double aWidth = SCREEN_W, aheigth = SCREEN_H;
static Scene scene = Scene();
static ContainSphere contSphere = scene.calculateSphere();

//Cams
static Cam camera = Cam(CAM_MOVEMENT_LOOKAT, Point (0,1,0), Point (0,0,0), contSphere, SCREEN_W, SCREEN_H);
static int zoomMode = CAM_ZOOM_FOVYORTHO;
static int lightMode = GL_FILL;

//mouse
static int xO, yO;


void firstPaint(void)
{
    //Clear Zone
    glClearColor(0.0 , 0.0, 0.0,0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    //Set Up Enables Only first time
    glEnable(GL_DEPTH);