トップ «前の日記(2012-06-24) 最新 次の日記(2012-06-26)» 編集

ヨタの日々

2001|08|09|10|11|12|
2002|01|02|03|04|05|06|07|08|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|12|
2024|01|02|03|04|

2012-06-25 :-(

_ 午前

0520 起床

0830 出勤

0900 検討

_ 午後

1300 検討

1740 退勤

_

1900 画像ほげ

2100 飯。ホイコーロー 辛い

_ C言語による画像処理プログラミング入門 の入門

環境

  • Microsoft Windows 7 64bit
  • cygwin
  • gcc 4.5.3

lenna

書籍内で使用している lenna の画像は レナ (画像データ) - Wikipedia から貰う。wikipedia のレナが TIFF ( Tagged Image File Format - Wikipedia )なのだが書籍では PGM ( PNM (画像フォーマット) - Wikipedia )を前提としているのでテキトーな手段で PGM に変換しておく。

サンプルソース

書籍の サンプルソース があるのでダウンロードしておく。書籍内で使っている画像ライブラリ pgmlib.h も入っている。

nkf

作業を開始する前に、サンプルソースの文字コードが Shift_JIS なので都合により UTF-8 に変換するんだがさらにその前に NKF を入れる。

% tar xzf nkf-2.1.2.tar.gz
% make
% make install

サンプルソースのディレクトリへ移動などして

% find . -type f -name "*.[c|h]" | while read f; do nkf -W --overwrite $f; done

ビルド

% cd chap01
% gcc copyimage.c
% ./a.exe
入力ファイル名 (*.pgm) : ../../lena.pgm
横の画素数 = 512, 縦の画素数 = 512
最大階調値 = 255
画像は正常に読み込まれました.
出力ファイル名 (*.pgm) : out.pgm
画像は正常に出力されました.

have fun!

_ [NetBSD][/bin/rm]/bin/rm

Big Sky :: 最近の rm は rm -rf / する時 --no-preserve-root 付けないと / は消せない

NetBSD の /bin/rm CVS log for src/bin/rm/rm.c にはそういうオプションが無かった。無差別に虐殺できるらしい。

ところで /bin/rm の rm_overwrite() というのを初めて知った。

* rm_overwrite --
 *	Overwrite the file 3 times with varying bit patterns.

rm_overwrite() の前のコメントにあるコレ。

U.S. DoD 5220.22-M "National Industrial Security Program Operating Manual"

データの完全消去 - Wikipedia

米国政府が定めたNational Industrial Security Program(NISP)の1995年版のオペレーティングマニュアルDoD 5220.22-Mでは、データの完全消去処理について「全てのマッピング可能なセクタに何らかの文字で上書きを行った後、その補数の文字で上書きを行い、さらにランダムな文字コードで上書き処理を行う」という手法を認めていたが、2001年にはトップ・シークレット情報を扱った記憶媒体の消去手法としては認定しない旨、決定された。現在、多くの民生市販のソフトウエアは、この手法を維持している。

ということらしい。

/bin/rm では -P オプションに該当する。へー

 if (Pflag) {
   if (rm_overwrite(p->fts_accpath, NULL))

rm - NetBSD Manual Pages

-P    Overwrite regular files before deleting them.  Files are overwrit-
          ten three times, first with the byte pattern 0xff, then 0x00, and
          then with random data, before they are deleted.  Some care is taken
          to ensure that the data are actually written to disk, but this can-
          not be guaranteed, even on traditional filesystems; on log-struc-
          tured filesystems or if any block-journaling scheme is in use, this
          option is completely useless.  If the file cannot be overwritten,
          it will not be removed.
本日のツッコミ(全2件) [ツッコミを入れる]
_ さぁぶ (2012-06-27 16:31)

lenna、懐かしいですなぁ。<br>学生時代、画像処理の研究やってたころ、よくテストデータに<br>使ってました。髪の毛の部分が細かいので、符号化がしんどい<br>一例でしたわ。

_ みわ (2012-06-27 22:32)

画像処理の研究なう。なのよ<br><br>画像処理の本によく使われる画像なんだけど、もともとはヌードだったのね (*´Д`)