ぬの部屋(仮)
nu-no-he-ya
  •     123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
       1234
    567891011
    12131415161718
    19202122232425
    26272829   
           
    1234567
    891011121314
    15161718192021
    22232425262728
    293031    
           
        123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
      12345
    6789101112
    13141516171819
    20212223242526
    27282930   
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     
        123
    45678910
    11121314151617
    18192021222324
    252627282930 
           
     123456
    78910111213
    14151617181920
    21222324252627
    28293031   
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31      
       1234
    567891011
    12131415161718
    19202122232425
    2627282930  
           
    1234567
    891011121314
    15161718192021
    22232425262728
    293031    
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
           
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
           
      12345
    6789101112
    13141516171819
    20212223242526
    2728     
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     
       1234
    567891011
    12131415161718
    19202122232425
    262728293031 
           
     123456
    78910111213
    14151617181920
    21222324252627
    282930    
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31      
       1234
    567891011
    12131415161718
    19202122232425
    2627282930  
           
    1234567
    891011121314
    15161718192021
    22232425262728
    293031    
           
        123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
      12345
    6789101112
    13141516171819
    20212223242526
    27282930   
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     
        123
    45678910
    11121314151617
    18192021222324
    252627282930 
           
     123456
    78910111213
    14151617181920
    21222324252627
    28293031   
           
     123456
    78910111213
    14151617181920
    21222324252627
    28      
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31      
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
           
    1234567
    891011121314
    15161718192021
    22232425262728
    2930     
           
        123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
      12345
    6789101112
    13141516171819
    20212223242526
    27282930   
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     
       1234
    567891011
    12131415161718
    19202122232425
    262728293031 
           
     123456
    78910111213
    14151617181920
    21222324252627
    282930    
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31      
       1234
    567891011
    12131415161718
    19202122232425
    2627282930  
           
    1234567
    891011121314
    15161718192021
    22232425262728
    293031    
           
    1234567
    891011121314
    15161718192021
    22232425262728
           
           
        123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
     123456
    78910111213
    14151617181920
    21222324252627
    28293031   
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    30      
       1234
    567891011
    12131415161718
    19202122232425
    262728293031 
           
     123456
    78910111213
    14151617181920
    21222324252627
    282930    
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31      
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
           
    1234567
    891011121314
    15161718192021
    22232425262728
    2930     
           
        123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
      12345
    6789101112
    13141516171819
    20212223242526
    27282930   
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     
         12
    3456789
    10111213141516
    17181920212223
    242526272829 
           
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     
        123
    45678910
    11121314151617
    18192021222324
    252627282930 
           
     123456
    78910111213
    14151617181920
    21222324252627
    28293031   
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    30      
       1234
    567891011
    12131415161718
    19202122232425
    262728293031 
           
    1234567
    891011121314
    15161718192021
    22232425262728
    293031    
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
           
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
           
    1234567
    891011121314
    15161718192021
    22232425262728
    2930     
           
        123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
        123
    45678910
    11121314151617
    18192021222324
    25262728   
           
     123456
    78910111213
    14151617181920
    21222324252627
    28293031   
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31      
       1234
    567891011
    12131415161718
    19202122232425
    2627282930  
           
    1234567
    15161718192021
    293031    
           
         12
    3456789
    10111213141516
           
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     
        123
    45678910
    11121314151617
    18192021222324
    252627282930 
           
     123456
    78910111213
    14151617181920
    21222324252627
    28293031   
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    30      
       1234
    567891011
    12131415161718
    19202122232425
    262728293031 
           
    1234567
    891011121314
    15161718192021
    22232425262728
    293031    
           
        123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
      12345
    6789101112
    13141516171819
    20212223242526
    27282930   
           
        123
    45678910
    11121314151617
    18192021222324
    252627282930 
           
     123456
    78910111213
    14151617181920
    21222324252627
    28293031   
           
       1234
    567891011
    12131415161718
    19202122232425
    2627282930  
           
    1234567
    891011121314
    15161718192021
    22232425262728
    293031    
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
           
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
           
      12345
    6789101112
    13141516171819
    20212223242526
    2728     
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     
     123456
    78910111213
    14151617181920
    21222324252627
    282930    
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31      
    1234567
    891011121314
    15161718192021
    22232425262728
    293031    
           
        123
    45678910
    11121314151617
    18192021222324
    252627282930 
           
     123456
    78910111213
    14151617181920
    21222324252627
    28293031   
           
     123456
    78910111213
    14151617181920
    21222324252627
    28293031   
           
       1234
    567891011
    12131415161718
    19202122232425
    262728293031 
           
     123456
    78910111213
    14151617181920
    21222324252627
    282930    
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31      
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
           
    1234567
    891011121314
    15161718192021
    22232425262728
    2930     
           
        123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
      12345
    6789101112
    13141516171819
    20212223242526
    27282930   
           
          1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031     
          1
    2345678
    9101112131415
    16171819202122
    232425262728 
           
       1234
    567891011
    12131415161718
    19202122232425
    262728293031 
           
    1234567
    891011121314
    15161718192021
    22232425262728
    293031    
           
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
           
      12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
           
    1234567
    891011121314
    15161718192021
    22232425262728
    2930     
           
        123
    45678910
    11121314151617
    18192021222324
    25262728293031
           
  • ICUライブラリによる文字コード変換

     

    ファイルを見込み、shift-jisからeuc-jpへ変換する

     

    #include <unicode/ucnv.h>
    #pragma comment(lib, "icuuc.lib")
    void Converter(){
    	
    	std::fstream r("C:\\dev\\shiftjis.txt");
    	std::string src_data;
    	r >> src_data;
    //エラーを受け取る変数
    UErrorCode err = U_ZERO_ERROR;
    //入力・出力の各文字コード
    char srcCode[] = "shift-jis";
    char dstCode[] = "euc-jp";
    //UnicodeStringに渡す文字列の文字コードを指定する
    	UConverter* srccnv = ucnv_open(srcCode, &err);
    //入力された文字の文字コードを内部形式に変換
    	icu::UnicodeString srcstr(src_data.c_str(), src_data.length(), srccnv, err);
    //内部形式の文字コードを目的の文字コードへ変換
    char* dst_data = new char[100];
    	srcstr.extract(0, srcstr.length(), dst_data, dstCode);
    using namespace std;
    	std::fstream w("C:\\dev\\dst.txt", ios::out | ios::binary | ios::trunc);
    	w << dst_data;
    }
    

     

     

     

    MISTでGIFを読んでOpenCVで表示する

     

    OpenCVではgifは扱えない

    MISTでgifの読み込みができる。

     

    #include <Mist/include/mist/mist.h>
    #include <Mist/include/mist/io/gif.h>
    
    #include <OpenCV/include/opencv2/opencv.hpp>
    #include <OpenCV/include/opencv2/highgui/highgui.hpp>
    
    #pragma comment(lib,"OpenCV/lib/x86/vc12/lib/opencv_core249")
    #pragma comment(lib,"OpenCV/lib/x86/vc12/lib/opencv_highgui249.lib")
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	typedef mist::rgb< unsigned char > value_type;
    	typedef mist::array2< value_type > image_type;
    
    	image_type mistimg;
    	if (!mist::read_gif(mistimg, "C:\\test.gif")){
    		return 1;
    	}
    	else{
    		
    		cv::Mat cvimage(mistimg.height(), mistimg.width(), CV_8UC3);
    
    		for (int x = 0; x < mistimg.width(); x++){
    			for (int y = 0; y < mistimg.height(); y++){
    				cv::Vec3b p;
    				p.val[0] = mistimg(x, y).r;
    				p.val[1] = mistimg(x, y).g;
    				p.val[2] = mistimg(x, y).b;
    				cvimage.at<cv::Vec3b>(y, x) = p;
    			}
    		}
    		cv::namedWindow("hoge");
    		cv::imshow("hoge", cvimage);
    		cv::waitKey(0);
    	}
    
    
    	getchar();
    
    	return 0;
    }

     

    mist側:

    画像の読み込み

    bool read_gif(読み込む先のMISTコンテナ , ファイル名)

    Mist/include/mist/io/gif.hをインクルード

    bool mist::read_gif (
     array2< T, Allocator > & image,
     const std::string & filename
    );

    http://mist.murase.m.is.nagoya-u.ac.jp/document/group__image__gif__group.html

     

     

    画素へのアクセス

    operator() ( X座標, Y座標)

    reference mist::array2< T, Allocator >::operator() (
     size_type i,
     size_type j,
     size_type = 0
    );

    i:コンテナ内のX軸方向の位置

     

    jコンテナ内のY軸方向の位置

     

    http://mist.murase.m.is.nagoya-u.ac.jp/document/classmist_1_1array2.html#adaacb132a18b787f30dbc61c00a2a846

     

    mistinstance.operator() ( x , y );

     

     

     

     

     

    C言語ソースコード ある日付と今日の差を求める

    参考:
    http://www1.cts.ne.jp/~clab/hsample/Time/Time5.html
    
    
    #include <time.h>
    
    
    double diffTimeFrom(struct tm& tmlimit){
    
    	//西暦 1970 年1月1日からの秒へ変換
    	time_t ttlimit;
    	ttlimit = mktime(&tmlimit);
    
    	//今日の日付を西暦 1970 年1月1日からの秒で取得
    	time_t now = time(NULL);
    
    	double sa = difftime(ttlimit, now);
    
    	return sa;
    }
    
    tm getDate(const int Year, const int Month, const int Day,const int Hour=0,const int Minutes=0,const int Second=0){
    	struct tm tmlimit;
    
    	tmlimit.tm_sec = Second;       /* 秒 */
    	tmlimit.tm_min = Minutes;       /* 分 */
    	tmlimit.tm_hour = Hour;      /* 時 */
    	tmlimit.tm_mday = Day;      /* 日 */
    	tmlimit.tm_mon = Month-1;       /* 月 ( 1月=0 ) */
    	tmlimit.tm_year = Year-1900;    /* 西暦年 - 1900 */
    	tmlimit.tm_isdst = -1;    /* サマータイムフラグ */
    
    	return tmlimit;
    }
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	double result = diffTimeFrom(getDate(2014,8,25));
    
    	printf("%lf", result);
    	getchar();
    
    	return 0;
    }
    

    海流と大気の流れを見られるサイト

    海流と大気の流れを動画で見られるサイトを見つけた。

    http://earth.nullschool.net/jp/#current/wind/surface/level/orthographic=136.03,36.87,3000

    サイトについて→http://earth.nullschool.net/jp/about.html

     

    nullschool

     

    設定項目はこんな感じ

    nullschool