Subversion Repositories seema-scanner

Rev

Rev 17 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17 Rev 20
1
#include "Camera.h"
1
#include "Camera.h"
2
#include "CameraPointGrey.h"
2
#include "CameraPointGrey.h"
3
#include <opencv2/opencv.hpp>
3
#include <opencv2/opencv.hpp>
4
 
4
 
5
int main(int argc, char *argv[]){
5
int main(int argc, char *argv[]){
6
 
6
 
7
    std::vector< std::vector<CameraInfo> > camInfo = Camera::GetInterfaceCameraList();
7
    std::vector< std::vector<CameraInfo> > camInfo = Camera::GetInterfaceCameraList();
8
 
8
 
9
    for(int i=0; i<camInfo.size(); i++){
9
    for(unsigned int i=0; i<camInfo.size(); i++){
10
        for(int j=0; j<camInfo[i].size(); j++){
10
        for(unsigned int j=0; j<camInfo[i].size(); j++){
11
            CameraInfo info = camInfo[i][j];
11
            CameraInfo info = camInfo[i][j];
12
            std::cout << "(" << i << "," << j << ")" << info.vendor << " " << info.model << " " << info.busID << std::endl;
12
            std::cout << "(" << i << "," << j << ")" << info.vendor << " " << info.model << " " << info.busID << std::endl;
13
        }
13
        }
14
    }
14
    }
15
 
15
 
16
    Camera *cam = Camera::NewCamera(0, 0);
16
    Camera *cam = Camera::NewCamera(0, 0, triggerModeSoftware);
-
 
17
    cam->startCapture();
-
 
18
 
-
 
19
    vector<int> compression_params;
-
 
20
    compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
-
 
21
    compression_params.push_back(95);
17
 
22
 
18
    for(int i=0; i<5; i++){
23
    for(int i=0; i<5; i++){
19
        CameraFrame frame = cam->getSingleFrame();
24
        CameraFrame frame = cam->getFrame();
20
        cv::Mat frameCV(frame.height, frame.width, CV_8U, frame.memory);
25
        cv::Mat frameCV(frame.height, frame.width, CV_16UC3, frame.memory);
-
 
26
        cv::Mat frameCV8bit;
-
 
27
        frameCV.convertTo(frameCV8bit, CV_8UC3, 1.0/255.0);
-
 
28
        cv::cvtColor(frameCV8bit, frameCV8bit, CV_RGB2BGR);
21
        char filename[10];
29
        char filename[10];
22
        sprintf(filename, "%d.png", i);
30
        sprintf(filename, "%d.jpg", i);
23
        frameCV.convertTo(frameCV, CV_8U);
-
 
24
        cv::imwrite(std::string(filename), frameCV);
31
        cv::imwrite(std::string(filename), frameCV8bit, compression_params);
25
    }
32
    }
26
 
33
 
-
 
34
    cam->stopCapture();
27
 
35
 
28
}
36
}
29
 
37