以下からダウンロード
http://valgrind.org/downloads/current.html
apt-get install libc6-dbg
mzmttks's blog for my memorandum の略で mzrandum. Topics are: python, book review, and my hobbies.
2011年11月3日木曜日
2011年10月16日日曜日
Read m2ts videos via OpenCV
Installation
The support formats of OpenCV depend on ffmpeg.
Thus, install
sudo apt-get install libx264-dev yasm
git clone git://git.videolan.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure
make
sudo make install
if you can play the file with ffmpeg, you can load it.
Sample code
import cv
import numpy
capture = cv.CreateFileCapture("yourvideo.m2ts")
cv.NamedWindow("Test", cv.CV_WINDOW_AUTOSIZE)
while 1:
img = cv.QueryFrame(capture)
cv.ShowImage("Test", img)
c = cv.WaitKey(2)
if c ==ord('q'):
break
ラベル:
python
Python and OpenCV2.2
IPLImage (opencv) and Nnmpy Array converter
just copied from
http://opencv.willowgarage.com/wiki/PythonInterface
save the following code as adaptor.py
import cv
import numpy as np
def cv2array(im):
depth2dtype = {
cv.IPL_DEPTH_8U: 'uint8',
cv.IPL_DEPTH_8S: 'int8',
cv.IPL_DEPTH_16U: 'uint16',
cv.IPL_DEPTH_16S: 'int16',
cv.IPL_DEPTH_32S: 'int32',
cv.IPL_DEPTH_32F: 'float32',
cv.IPL_DEPTH_64F: 'float64',
}
arrdtype=im.depth
a = np.fromstring(
im.tostring(),
dtype=depth2dtype[im.depth],
count=im.width*im.height*im.nChannels)
a.shape = (im.height,im.width,im.nChannels)
return a
def array2cv(a):
dtype2depth = {
'uint8': cv.IPL_DEPTH_8U,
'int8': cv.IPL_DEPTH_8S,
'uint16': cv.IPL_DEPTH_16U,
'int16': cv.IPL_DEPTH_16S,
'int32': cv.IPL_DEPTH_32S,
'float32': cv.IPL_DEPTH_32F,
'float64': cv.IPL_DEPTH_64F,
}
try:
nChannels = a.shape[2]
except:
nChannels = 1
cv_im = cv.CreateImageHeader((a.shape[1],a.shape[0]),
dtype2depth[str(a.dtype)],
nChannels)
cv.SetData(cv_im, a.tostring(),
a.dtype.itemsize*nChannels*a.shape[1])
return cv_im
Sample cod: Yellow image
import cv
import numpy
import adaptor
capture = cv.CaptureFromCAM(0)#CreateCameraCapture(0)
cv.NamedWindow("Test", cv.CV_WINDOW_AUTOSIZE)
while 1:
img = cv.QueryFrame(capture)
array = adaptor.cv2array(img)
array[:, :, 0] = 0
cv.ShowImage("Test", adaptor.array2cv(array))
c = cv.WaitKey(2)
if c ==ord('q'):
break
ラベル:
python
Compiling and Installing OpenCV 2.2 on Ubuntu
Compiling and Installing
Download source from:
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/
Then apply the following modifications
https://code.ros.org/trac/opencv/changeset/5206
Then,
cd OpenCV-2.2.0
mkdir build
cd build
cmake .
make
sudo make install
Sample python code
A sample code to grab images and show it.
Press q to finish.
import cv
capture = cv.CaptureFromCAM(0)#CreateCameraCapture(0)
cv.NamedWindow("Test", cv.CV_WINDOW_AUTOSIZE)
while 1:
img = cv.QueryFrame(capture)
cv.ShowImage("Test", img)
c = cv.WaitKey(2)
print c
if c ==ord('q'):
break
Download source from:
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/
Then apply the following modifications
https://code.ros.org/trac/opencv/changeset/5206
Then,
cd OpenCV-2.2.0
mkdir build
cd build
cmake .
make
sudo make install
Sample python code
A sample code to grab images and show it.
Press q to finish.
import cv
capture = cv.CaptureFromCAM(0)#CreateCameraCapture(0)
cv.NamedWindow("Test", cv.CV_WINDOW_AUTOSIZE)
while 1:
img = cv.QueryFrame(capture)
cv.ShowImage("Test", img)
c = cv.WaitKey(2)
print c
if c ==ord('q'):
break
2011年7月23日土曜日
wmf2eps on windows 7
以下の URL から wmf2eps と windows 7 用の ps プリンタドライバをダウンロード
http://www.wolf-s.homepage.t-online.de/wmf2eps/win7.htm
で、
デバイスとプリンタをクリック
WMF2EPS Color PS L2 を右クリック
印刷設定を選択
詳細設定
(1) グラフィックスの
TrueType フォントをソフトフォンととしてのダウンロードに
(2) 一番下の PostScript オプションで
PostScript 出力オプションを EPS に
TrueType フォントダウンロードオプションを アウトラインに
とすると、wmf2eps がつかえる。
参考文献:
http://yuu.nkjm.info/diary/20091116.html
http://yuu.nkjm.info/diary/20100409.html
http://www.wolf-s.homepage.t-online.de/wmf2eps/win7.htm
で、
デバイスとプリンタをクリック
WMF2EPS Color PS L2 を右クリック
印刷設定を選択
詳細設定
(1) グラフィックスの
TrueType フォントをソフトフォンととしてのダウンロードに
(2) 一番下の PostScript オプションで
PostScript 出力オプションを EPS に
TrueType フォントダウンロードオプションを アウトラインに
とすると、wmf2eps がつかえる。
参考文献:
http://yuu.nkjm.info/diary/20091116.html
http://yuu.nkjm.info/diary/20100409.html
ラベル:
tips
2011年7月10日日曜日
2011年7月1日金曜日
Could not find encoding file "H"
Ubuntu 10.04 LTS で dvipdfmx で dvi -> pdf に変換しようとすると、
Could not find encoding file "H"
というエラーが出る。
そういうときは、
エンコーディングファイルH があるパス (/usr/share/fonts/cmap/adobe-japan1)
を、 /usr/share/texmf/web2c/texmf.cnf の
CMAPFONTS = の行に追加すればよい。
% CMap files.
CMAPFONTS = .;$TEXMF/fonts/cmap//;/usr/share/fonts/cmap/adobe-japan1/
ちなみに、
find /usr/share/ -name H で、 H があるパスは分かるし、
find /usr/share/ -name texmf.cnf で texmf.cnf があるパスは見つかる。
参考文献
https://groups.google.com/group/fj.comp.texhax/browse_thread/thread/72b421245869931d?hl=ja&pli=1
http://www.massi.mydns.jp/massis_easy_laboratory/2009/08/latexdvipdfmxencoding-file-h.html
Could not find encoding file "H"
というエラーが出る。
そういうときは、
エンコーディングファイルH があるパス (/usr/share/fonts/cmap/adobe-japan1)
を、 /usr/share/texmf/web2c/texmf.cnf の
CMAPFONTS = の行に追加すればよい。
% CMap files.
CMAPFONTS = .;$TEXMF/fonts/cmap//;/usr/share/fonts/cmap/adobe-japan1/
ここの最後。
ちなみに、
find /usr/share/ -name H で、 H があるパスは分かるし、
find /usr/share/ -name texmf.cnf で texmf.cnf があるパスは見つかる。
参考文献
https://groups.google.com/group/fj.comp.texhax/browse_thread/thread/72b421245869931d?hl=ja&pli=1
http://www.massi.mydns.jp/massis_easy_laboratory/2009/08/latexdvipdfmxencoding-file-h.html
ラベル:
tips
登録:
コメント (Atom)