« 2021年09月 | メイン | 2021年11月 »

2021年10月19日

opencvアフィン変換

参考 https://imagingsolution.net/imaging/affine-transformation/

#拡大縮小
scale_matrix = np.array([[scale_x,0,0],[0,scale_y,0],[0,0,1]])

#回転
rotation_matrix = np.array([[math.cos(math.radians(deg)) , -math.sin(math.radians(deg)) , 0.0],[math.sin(math.radians(deg)) , math.cos(math.radians(deg)) , 0.0],[0,0,1]])

#移動
move_matrix = np.array([[1,0,move_x],[0,1,move_y],[0,0,1]])


#拡大して → 回転して → 移動する場合 この順で
matrix_all = move_matrix.dot(rotation_matrix).dot(scale_matrix)

#cv2で使う部分を切り取り
matrix = matrix_tmp[0:2,0:3]

affine_img = cv2.warpAffine(useImg, matrix, (new_w,new_h))#最後の引数は出力サイズ 

投稿者 muuming : 12:56 | コメント (0)

2021年10月18日

phpでコマンド実行するとき

phpでコマンド実行するときは escapeshellarg を使おうって話

投稿者 muuming : 07:25

2021年10月11日

tinymiceのプラグインのあんちょこ

/* global tinymce*/
(function () {
	tinymce.create('tinymce.plugins.ExamplePlugin', { // 'ExamplePlugin' の部分には任意のプラグイン名が入ります。

		init: function (ed, url) {
			// ed には現在開いてるエディタの情報が入る
			// url にはこのJsファイルまでのパスが入る

			// コマンドを作る    
			ed.addCommand('example_cd', // 任意のコマンド名
				// ↓追加したいコマンド(機能)内容を記入    
				function () {
					ed.execCommand("mceInsertContent", false, "
example
"); // ↑ これだと <div>example</div> を挿入するコマンドです }); // 上で書いたコマンドを実行するボタンを作る ed.addButton('example', { // 任意のボタン名 title: 'example.desc', // ボタンのタイトル(マウスオーバー時に表示される) cmd: 'example_cd', // 上で書いたコマンド名 image: url + '/img/example.gif' // ボタン画像のパス }); }, // プラグインに関する情報(著者、ver など)を記入 getInfo: function () { return { longname: 'Example plugin', author: 'Some author', authorurl: 'http://tinymce.moxiecode.com', infourl: 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example', version: 1.0 }; } }); // ここまでに書いたプラグインコードを tinymce.PluginManager に登録。引数には行頭に書いたプラグイン名を入れる。 tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin); })();


from https://memocarilog.info/wordpress/6227

投稿者 muuming : 11:24

iframeのdocument ready

var iframe = document.getElementById('frameID'),
iframeDoc = iframe.contentDocument || iframe.contentWindow.document;

$(iframeDoc).ready(function (event) {

投稿者 muuming : 08:21

2021年10月10日

smartyで文字連結

{assign var=comment value='プレイヤーレベル'|cat:{$presentLevelLimit}|cat:'以上から'}

結構不細工だなぁースマートに書けないものか・・・

投稿者 muuming : 11:39