LoginSignup
1
2

More than 3 years have passed since last update.

2017-03-08 ImageMagick > link > 画像の違いを ImageMagick でビジュアル化 | bashスクリプト > diff_image_180918_exec > v0.1

Last updated at Posted at 2017-03-08
動作環境
// 差分画像作成
CentOS 6.8 (64bit)
// 元画像生成
Raspberry Pi 2 Model B (以下RPi)
Raspbian Jessie
Tektronix TDS 2024C (200 MHz, 2GS/s)
とあるI2Cセンサ

@fujiwarasoftservice さんに教えていただいたblog(Rabbit Noteさん)。
その中で気に入ったのがImageMagickによる差分画像の作成。
http://rabbit-note.com/2015/11/14/image-diff-by-imagemagick/

現在取り組んでいるI2C通信の差分画像を作ってみた。

F0002TEK.png

F0003TEK.png

$ convert -type GrayScale +level-colors Red,White F0002TEK.png a_red.png

qiita.png

$ convert -type GrayScale +level-colors Blue,White F0003TEK.png b_blue.png

qiita.png

$ convert -compose Multiply -composite a_red.png b_blue.png diff.png

qiita.png

どこが変化したか見やすくなりました。
情報感謝です。

この「変化をとらえる」というのはNeural Network関連でも使えるかもしれない。

bashスクリプト

(2018-09-18追記)

2つの画像から差分画像を作るbashスクリプトを追加。

diff_image_180918_exec
#/usr/bin/env bash
set -eu # just in case

#v0.1 Sep. 18, 2018
#   - can make image with the difference of two images

if [ $# -lt 2 ];then
    echo "Error: insufficient parameters"
    echo 
    echo "[cmd] [redImage.png] [blueImage.png]"
    exit
fi

RESFILE="res_diff.png"
WRKRED="work_red.png"
WRKBLUE="work_blue.png"

convert -type GrayScale +level-colors Red,White $1 $WRKRED
convert -type GrayScale +level-colors Blue,White $2 $WRKBLUE
convert -compose Multiply -composite $WRKRED $WRKBLUE $RESFILE

rm -f $WRKRED $WRKBLUE
echo "[$RESFILE] is produced".
$ bash diff_image_180918_exec 20171206_220000_48.png 20171206_220000_36.png 
[res_diff.png] is produced.

検索用キーワード (2020-07-10)

  • RGB
  • color

- オシロスコープ

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2