Пример #1
0
Uint32 test_raw_read()
{
    Uint32 test_failures = 0;

    VFSStatus read_status;
    Uint32 buffer_size = 110;
    char buf[buffer_size];
    char filename[] = "/ext2_tests/indirect_block_file";
    Uint32 bytes_read;
    Uint32 offset = 10;

    buf[0] = '\0';
    read_status =
        raw_read (filename, buf, &bytes_read, offset, buffer_size-1);

    if( read_status )
    {
        serial_printf( "Failed to read '%s', error #%d\n\r",
                       filename, read_status );
        test_failures++;
    }

    buf[bytes_read] = '\0';
    serial_string ( "\n\r" );
    serial_string( buf );
    serial_string ( "\n\r" );

    return test_failures;
}
Пример #2
0
Uint32 vfs_run_tests()
{
    serial_string( "running VFS tests\n\r" );
    Uint32 test_failures = 0;
    test_failures += test_raw_read();

    serial_printf("==> VFS tests completed, %d failures.\n\r",
                  test_failures );

    return test_failures;
}
Пример #3
0
int Preprocessor::montage(){
    string src = para.mon_src;
    string dst = para.mon_dst;
    string sys_del = para.sys_del;
    unsigned int serial_beg = para.serial_beg, serial_end = para.serial_end, 
                        x_beg = para.x_beg, x_end = para.x_end, 
                        y_beg = para.y_beg, y_end = para.y_end, 
                        block_width = para.block_width, block_height = para.block_height, serial_bits = para.serial_bits,
                        thread_num = para.thread_num;
    unsigned int image_depth = para.image_depth;
    string image_pre = para.mon_in_pre, image_post = para.mon_in_post;
    string out_pre = para.mon_out_pre, out_post = para.mon_out_post; 
#pragma omp parallel for num_threads(thread_num) 
    for(int serial_num = int(serial_beg); serial_num <= int(serial_end); ++ serial_num){
        stringstream string_buffer;
        string serial_string("");
        cv::Mat out_image, block_image, re_block_image;
        cout<<serial_num<<": "<<omp_get_thread_num()<<endl;
        if(image_depth ==  16){
            out_image = cv::Mat((y_end - y_beg + 1) * block_height, (x_end - x_beg + 1) * block_width, CV_16UC1, cv::Scalar(0, 0, 0));
            //cout<<out_image.rows<<" "<<out_image.cols<<" "<<out_image.depth()<<endl;
            block_image = cv::Mat(block_height, block_width, CV_16UC1, cv::Scalar(0, 0, 0));
            re_block_image = cv::Mat(block_height, block_width, CV_16UC1, cv::Scalar(0, 0, 0));        
        }else{
            out_image = cv::Mat((y_end - y_beg + 1) * block_height, (x_end - x_beg + 1) * block_width, CV_8UC1, cv::Scalar(0, 0, 0));
            //cout<<out_image.rows<<" "<<out_image.cols<<" "<<out_image.depth()<<endl;
            block_image = cv::Mat(block_height, block_width, CV_8UC1, cv::Scalar(0, 0, 0));
            re_block_image = cv::Mat(block_height, block_width, CV_8UC1, cv::Scalar(0, 0, 0));    
        
        }
        string x_str, y_str, image_str, out_image_name;       
        string_buffer<<setw(serial_bits)<<setfill('0')<<serial_num;    
        string_buffer>>serial_string;
        string_buffer.clear();
        //cout<<serial_string<<endl;
        for(unsigned int x_in = x_beg; x_in <= x_end; ++ x_in){
            for(unsigned int y_in = y_beg; y_in <= y_end; ++ y_in){
                string_buffer<<setw(2)<<setfill('0')<<x_in;
                string_buffer>>x_str;
                string_buffer.clear();
                string_buffer<<setw(2)<<setfill('0')<<y_in;
                string_buffer>>y_str;
                string_buffer.clear();
                image_str = src + sys_del + serial_string + sys_del +image_pre + serial_string + "_" + x_str + "_" + y_str + image_post;
                block_image = cv::imread(image_str.c_str(), CV_LOAD_IMAGE_UNCHANGED);
                if(!block_image.data){
                    cout<<"----------------------"<<endl;
                    cout<<"Image Loaded Error!"<<endl;
                    cout<<image_str<<endl;
                    cout<<"----------------------"<<endl;
                    if(image_depth == 8){
                        block_image = cv::Mat::zeros(block_height, block_width, CV_8UC1);
                    }else if(image_depth == 16){
                        block_image = cv::Mat::zeros(block_height, block_width, CV_16UC1);
                    }
                    
                }
                for(int y_block = 0; y_block < block_image.cols; ++ y_block){
                    block_image.col(y_block).copyTo(re_block_image.col(block_image.cols - y_block - 1));       
                }
                cv::Rect sub_roi((x_in - x_beg) * block_width, (y_in - y_beg) * block_height, block_width, block_height);                 
                cv::Mat sub_image(out_image, sub_roi);
                re_block_image.clone().copyTo(sub_image);
            }
                        
        }
        
        out_image_name = dst + sys_del + out_pre + serial_string + out_post;
        cout<<out_image_name<<endl;
        cv::imwrite(out_image_name, out_image);            
    }
    
    
    
    return 0;
}