Subversion Repositories seema-scanner

Rev

Rev 20 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20 Rev 23
Line 1... Line 1...
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
#include "cvtools.h"
4
 
5
 
5
int main(int argc, char *argv[]){
6
int main(int argc, char *argv[]){
6
 
7
 
7
    std::vector< std::vector<CameraInfo> > camInfo = Camera::GetInterfaceCameraList();
8
    std::vector< std::vector<CameraInfo> > camInfo = Camera::GetInterfaceCameraList();
8
 
9
 
Line 20... Line 21...
20
    compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
21
    compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
21
    compression_params.push_back(95);
22
    compression_params.push_back(95);
22
 
23
 
23
    for(int i=0; i<5; i++){
24
    for(int i=0; i<5; i++){
24
        CameraFrame frame = cam->getFrame();
25
        CameraFrame frame = cam->getFrame();
25
        cv::Mat frameCV(frame.height, frame.width, CV_16UC3, frame.memory);
26
        cv::Mat frameCV(frame.height, frame.width, CV_8UC3, frame.memory);
26
        cv::Mat frameCV8bit;
27
        // save as matlab mat file
27
        frameCV.convertTo(frameCV8bit, CV_8UC3, 1.0/255.0);
-
 
28
        cv::cvtColor(frameCV8bit, frameCV8bit, CV_RGB2BGR);
-
 
29
        char filename[10];
28
        char filename[10];
-
 
29
        sprintf(filename, "%d.mat", i);
-
 
30
        cvtools::writeMat(frameCV, filename, "frame");
-
 
31
        // save as jpg image
-
 
32
        cv::cvtColor(frameCV, frameCV, CV_RGB2BGR);
30
        sprintf(filename, "%d.jpg", i);
33
        sprintf(filename, "%d.jpg", i);
31
        cv::imwrite(std::string(filename), frameCV8bit, compression_params);
34
        cv::imwrite(std::string(filename), frameCV, compression_params);
32
    }
35
    }
33
 
36
 
34
    cam->stopCapture();
37
    cam->stopCapture();
35
 
38
 
36
}
39
}