2016-07-12 31 views
-1

私はカメラから画像を保存するコードを使用していますが、画像が撮影された現在の日付と時刻でファイル名を保存する必要があります。これどうやってするの?私はインターネットから多くの異なるコードを試しましたが、私はいつも多くのエラーを受け取り、プログラミングは私の強い側面ではありません。アドバイスや助けをいただければ幸いです。 https://github.com/stereolabs/zed-save-depth/blob/master/src/main.cppC++で日付と時刻の画像ファイル名を保存するには?

+0

ます画像からメタデータを抽出する必要があります。これには、カメラの設定に関する情報と撮影時の情報が含まれています。数多くの図書館があります。特に画像がjpegの場合。 – doug

答えて

0

あなたが使用することができます:時間のため

#include <time.h> 

これはコードです。現在の時刻を取得するには:現在の日付を取得するには

time_t current_time = clock(); 

を、あなたが使用することができます。このようになります。現地時間のための構造体を返す

struct tm *localtime(const time_t *time); 

struct tm { 
     int tm_sec; // seconds of minutes from 0 to 61 
     int tm_min; // minutes of hour from 0 to 59 
     int tm_hour; // hours of day from 0 to 24 
     int tm_mday; // day of month from 1 to 31 
     int tm_mon; // month of year from 0 to 11 
     int tm_year; // year since 1900 
     int tm_wday; // days since sunday 
     int tm_yday; // days since January 1st 
     int tm_isdst; // hours of daylight savings time 
    } 
関連する問題