{"id":735,"date":"2009-07-23T19:05:51","date_gmt":"2009-07-23T10:05:51","guid":{"rendered":"https:\/\/www.iss.ai\/?p=735"},"modified":"2009-07-23T19:21:26","modified_gmt":"2009-07-23T10:21:26","slug":"mingpythonopencv%e3%81%a7%e9%81%8a%e3%81%b6","status":"publish","type":"post","link":"https:\/\/www.iss.ai\/?p=735","title":{"rendered":"ming+python+OpenCV\u3067\u904a\u3076"},"content":{"rendered":"\t\t\t\t<p>\u307e\u305a\u624b\u59cb\u3081\u306b\uff0cming\u3067\u30e9\u30f3\u30c0\u30e0\u306a\u7d75\u3092\u63cf\u3044\u3066\u307f\u3088\u3046<\/p>\n\t\t\t\t<pre>\r\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#-------------------------------------------------------------------------------\r\n# Name:        Test1\r\n# Purpose:     Testing ming with OpenCV&amp;Python on Windows Vista SP2\r\n# Author:      T.Kamata\r\n# Created:     23\/07\/2009\r\n# Copyright:   (c) Innovative System Solutions 2009\r\n# Licence:     GPL\r\n#-------------------------------------------------------------------------------\r\n#!\/usr\/bin\/env python\r\n\r\nfrom ming import *\r\nfrom opencv.cv import *\r\nfrom opencv.highgui import *\r\nfrom random import random\r\n\r\ndef draw_noise(image_filename, width, height, N = 100):\r\n    im = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 3)\r\n    cvZero(im)\r\n    for i in range(N):\r\n        x,y,r = map(lambda x: int(x*random())+1, &#x5B;width-2, height-2,2])\r\n        color = CV_RGB(int(random()*255),int(random()*255),int(random()*255))\r\n        cvCircle(im, cvPoint(x,y), r, color, CV_FILLED)\r\n    cvSaveImage(image_filename, im)\r\n    del im\r\n\r\ndef main():\r\n    import os\r\n    WIDTH, HEIGHT = 400, 300\r\n    m = SWFMovie()\r\n    m.setDimension(WIDTH, HEIGHT)\r\n    m.setBackground(0, 0, 0)\r\n    m.setRate(30.0)\r\n\r\n    for i in range(10):\r\n        jpg_file = &quot;tmp%d.jpg&quot; % i\r\n        draw_noise(jpg_file, WIDTH, HEIGHT)\r\n        b = SWFBitmap(jpg_file)\r\n        m.add(b)\r\n        m.nextFrame()\r\n    m.save(&quot;test1.swf&quot;)\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n<\/pre>\n\t\t\t\t<p>\u304a\u7d75\u63cf\u304d\u3059\u308b\u306e\u306b\u6163\u308c\u3066\u3044\u308bOpenCV\u3092\u4f7f\u3063\u3066\uff0c\uff11\u30d5\u30ec\u30fc\u30e0\u306e\u753b\u50cf\u3092jpeg\u306b\u4fdd\u5b58\u3057<br \/>\n\t\t\t\tSWFMovie\u306badd\u3057\u3066\u307f\u305f\uff0e<br \/>\n\t\t\t\t\u3067\u304d\u305fFlash\u30e0\u30fc\u30d3\u30fc(SWF)\u306f\uff0c\u3053\u3061\u3089\uff0e<br \/>\n\t\t\t\tOpenCV\u306e\u753b\u50cf\u51e6\u7406\u306e\u6a21\u69d8\u3092SWF\u306b\u3059\u308b\u306b\u3082\uff0c\u4fbf\u5229\u304b\u3082\u3057\u308c\u306a\u3044\uff0e<br \/>\n\t\t\t\t\u6b21\u306f\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306aFlash\u306b\u30c1\u30e3\u30ec\u30f3\u30b8\u3057\u3066\u307f\u3088\u3046\u304b<\/p>\n\t\t\t\t<p><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"400\" height=\"300\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0\"><param name=\"src\" value=\"https:\/\/www.iss.ai\/wp-content\/uploads\/2009\/07\/test1.swf\" \/><embed type=\"application\/x-shockwave-flash\" width=\"400\" height=\"300\" src=\"https:\/\/www.iss.ai\/wp-content\/uploads\/2009\/07\/test1.swf\"><\/embed><\/object><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u307e\u305a\u624b\u59cb\u3081\u306b\uff0cming\u3067\u30e9\u30f3\u30c0\u30e0\u306a\u7d75\u3092\u63cf\u3044\u3066\u307f\u3088\u3046 #&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- # N [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,3],"tags":[18,19,17],"class_list":["post-735","post","type-post","status-publish","format-standard","hentry","category-soft","category-tech","tag-ming","tag-opencv","tag-python"],"_links":{"self":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=735"}],"version-history":[{"count":15,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/735\/revisions"}],"predecessor-version":[{"id":777,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/735\/revisions\/777"}],"wp:attachment":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}