{"id":1084,"date":"2009-09-11T18:09:40","date_gmt":"2009-09-11T09:09:40","guid":{"rendered":"https:\/\/www.iss.ai\/?p=1084"},"modified":"2009-10-29T10:16:47","modified_gmt":"2009-10-29T01:16:47","slug":"iplimage%e3%82%92%e8%87%aa%e5%8b%95%e3%81%a7release","status":"publish","type":"post","link":"https:\/\/www.iss.ai\/?p=1084","title":{"rendered":"IplImage*\u3092\u81ea\u52d5\u3067Release"},"content":{"rendered":"\t\t\t\t<p>\u4e16\u9593\u3067\u306f\u30dd\u30a4\u30f3\u30bf\u306edelete\u3057\u5fd8\u308c\u3092\u9632\u6b62\u3059\u308b\u305f\u3081\u306bauto_ptr\u3068\u304b\u305d\u3046\u3044\u3046\u985e\u306e\u3082\u306e\u304c\u3042\u308b\u307f\u305f\u3044\u3067\u3059\u304c\uff0c<br \/>\n\t\t\t\t\u305d\u308c\u306eIplImage*\u7248\u307f\u305f\u3044\u306a\u3084\u3064\u3092\u4f55\u6545\u304b\u81ea\u524d\u3067\u66f8\u3044\u3066\u307f\u305f\u3088\uff0c\u3068\u3044\u3046\u4f4e\u30ec\u30d9\u30eb\u306a\u904a\u3073\uff0e<\/p>\n\t\t\t\t<p>\u25cf\u52d5\u6a5f<br \/>\n\t\t\t\tOpenCV\u306e\u95a2\u6570\u306f\u5f15\u6570\u304c(\u51e6\u7406\u5bfe\u8c61\u753b\u50cf,\u51e6\u7406\u7d50\u679c\u683c\u7d0d\u9818\u57df)\u3068\u3044\u3046\u5f62\u304c\u591a\u3044\u306e\u3067\uff0c<br \/>\n\t\t\t\t\u753b\u50cf\u3092\u3044\u3058\u304f\u308b\u51e6\u7406\u3092\u66f8\u304f\u3068\u5927\u62b5\u3000\u753b\u50cf\u9818\u57df\u3092\u4f5c\u3063\u3066\u2192\u5fc5\u8981\u306a\u9593\u6301\u3063\u3066\u304a\u304d\u2192\u8981\u3089\u306a\u304f\u306a\u3063\u305f\u3089\u6368\u3066\u308b\u3000\u3068\u3044\u3046\u3053\u3068\u3092\u3059\u308b\u3053\u3068\u306b\u306a\u308b\uff0e<br \/>\n\t\t\t\t\u753b\u50cf\u306fcvReleaseImage()\u95a2\u6570\u3067\u6368\u3066\u308b\u306e\u3060\u304c\uff0c<br \/>\n\t\t\t\t\u51e6\u7406\u3092\u9014\u4e2d\u3067\u4e2d\u6b62\uff08return\u3067\u95a2\u6570\u3092\u629c\u3051\u308b\u3068\u304b\uff09\u3059\u308b\u3068\u306a\u308b\u3068\uff0c<br \/>\n\t\t\t\t\u4e2d\u6b62\u5834\u6240\u306b\u3088\u3063\u3066\u6368\u3066\u308b\u3079\u304d\u753b\u50cf\u304c\u3069\u308c\u3068\u3069\u308c\u306a\u306e\u304b\u9055\u3063\u305f\u308a\u3057\u3066\u3053\u306e\u5f8c\u59cb\u672b\u304c\u305f\u3044\u305d\u3046\u9762\u5012\u2026\u2026\u306a\u306e\u3060\u304c\uff0c<br \/>\n\t\t\t\t\u4f55\u6545\u304b\u4eca\u307e\u3067\u753b\u50cf\u9818\u57df\u3092\u6368\u3066\u308b\u4f5c\u696d\u3092\u81ea\u52d5\u5316\u3055\u305b\u3066\u3053\u306a\u304b\u3063\u305f\uff0e\u4f55\u6545\u3060\u308d\u3046\uff1f\u4e0d\u601d\u8b70\uff0e<\/p>\n\t\t\t\t<p>\u3067\uff0c\u3042\u308b\u65e5\uff0c\u51e6\u7406\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u307f\u305f\u3044\u306a\u95a2\u6570\u30b3\u30fc\u30c9\u3092\u96a3\u4eba\u306b\u6e21\u3057\u305f\u3089<br \/>\n\t\t\t\t\u300c\u305d\u306e\u95a2\u6570\u3092\u5225\u30b9\u30ec\u30c3\u30c9\u306b\u3057\u3066\u305d\u306e\u307e\u307e\u4f7f\u3046\uff0e\u4efb\u610f\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u4e2d\u6b62\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u300d\u3068\u304b\u8a00\u308f\u308c\u305f\uff0e\uff08\u81ea\u5206\u3067\u3084\u3063\u3066\u304f\u308c\uff09<br \/>\n\t\t\t\t\u6368\u3066\u308b\u51e6\u7406\u3092\u95a2\u6570\u672b\u5c3e\u306b\u307e\u3068\u3081\u3066\u4e2d\u6b62\u6642\u306bgoto\u3067\u305d\u3053\u306b\u98db\u3076\uff0c\u3068\u304b\u3084\u308d\u3046\u3068\u3057\u305f\u3089\u95a2\u6570\u306e\u9014\u4e2d\u3067\u5909\u6570\u5ba3\u8a00\u3057\u3066\u308b\u304b\u3089\u6012\u6d9b\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u6ce3\u3044\u305f\uff0e<\/p>\n\t\t\t\t<p>\u25cf\u3084\u308b\u3053\u3068<br \/>\n\t\t\t\t\u8981\u3059\u308b\u306b\uff0c<br \/>\n\t\t\t\t\u30fbIplImage*\u3092\u30e1\u30f3\u30d0\u5909\u6570\u3068\u3057\u3066\u6301\u3063\u3066\u3044\u3066<br \/>\n\t\t\t\t\u30fb\u30c7\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u305d\u308c\u3092cvReleaseImage()\u3059\u308b<br \/>\n\t\t\t\t\u30fbIplImage*\u3060\u3068\u601d\u3063\u3066\u4f7f\u3048\u308b<br \/>\n\t\t\t\t\u3088\u3046\u306a\u30af\u30e9\u30b9\u3092\u66f8\u3044\u3066\u307f\u308b\uff0e<\/p>\n\t\t\t\t<p>\u25cf\u500b\u4eba\u7684\u306b\u4e88\u60f3\u3055\u308c\u308b\u8ffd\u52a0\u306e\u6069\u6075<br \/>\n\t\t\t\tOpenCV\u3092\u4f7f\u3044\u59cb\u3081\u305f\u5f53\u521d\uff0c\u300ccvReleaseImage()\u3057\u305f\u3089\u30dd\u30a4\u30f3\u30bf\u306e\u5024\u306f\u3069\u3046\u306a\u308b\u306e\uff1f\u300d\u3068\u3044\u3046\u7591\u554f\u3092\u6301\u3063\u305f\uff0e<br \/>\n\t\t\t\t\u7d50\u5c40cvReleaseImage()\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u898b\u308b\u3068\u3061\u3083\u3093\u30680\u3092\u4ee3\u5165\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u306e\u3060\u304c\uff0c<br \/>\n\t\t\t\t\u300c\u5b9f\u88c5\u304c\u5909\u308f\u308b\u304b\u3082\u3057\u308c\u306a\u3044\uff01(?)\u3000\u305b\u3063\u304b\u304f\u3060\u304b\u3089\u4ffa\u306f\u81ea\u5206\u3067NULL\u3092\u4ee3\u5165\u3059\u308b\u305c\uff01\u300d\u3068\u3044\u3046\u8b0e\u306e\u610f\u6c17\u8fbc\u307f\u3068<br \/>\n\t\t\t\t\u300c\u30dd\u30a4\u30f3\u30bf\u306e\u30dd\u30a4\u30f3\u30bf\u3068\u304b\u3063\u3066\u306a\u3093\u3068\u306a\u304f\u5acc\uff08\u203b\uff11\uff09\u300d\u3068\u3044\u3046\u534a\u7aef\u306a\u3053\u3060\u308f\u308a\u3092\u7406\u7531\u306b\uff0c<br \/>\n\t\t\t\t\u2193\u306e\u5927\u4ef0\u306a\u540d\u524d\u306e\u95a2\u6570\u3092\u308f\u3056\u308f\u3056\u7528\u610f\u3057\u3066\u4f7f\u3063\u305f\u308a\u3057\u3066\u3044\u305f\uff0e<\/p>\n\t\t\t\t<pre><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\/\/IplImage\u306e\u89e3\u653e\uff0e\r\n\/\/\t\uff08\u3053\u308c\u3092\u6b63\u3057\u304f\u50cd\u304b\u305b\u308b\u305f\u3081\u306b\uff0c\u753b\u50cf\u3092\u6307\u3055\u306a\u3044IplImage*\u5909\u6570\u306f\u5e38\u306bNULL\u306b\u3057\u3066\u304a\u304f\u3053\u3068\uff0e\u521d\u671f\u5316\u3068\u304b\uff0e\uff09\r\ninline void cvSafeReleaseImage( IplImage* &amp;pImg )\r\n{\r\n\tif( pImg ){\tcvReleaseImage( &amp;pImg );\tpImg=NULL;\t}\r\n}\r\n<\/pre>\n\t\t\t\t<p>\u300c&#038;\u300d\u4e00\u500b\u3092\u30bf\u30a4\u30d7\u3057\u305f\u304f\u306a\u3044\u306e\u3068\u5f15\u304d\u63db\u3048\u306b\uff0c\u304b\u3048\u3063\u3066\u9577\u3063\u305f\u3089\u3057\u3044\u95a2\u6570\u540d\u3092\u30bf\u30a4\u30d7\u3059\u308b\u3068\u3044\u3046\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u4e8b\u614b\uff0e<br \/>\n\t\t\t\t\u305d\u308c\u306f\u305d\u308c\u3067\u305d\u308c\u306a\u308a\u306b\u697d\u3057\u3044\u306e\u3060\u304c\uff0c\u753b\u50cf\u7834\u68c4\u3092\u81ea\u52d5\u5316\u3059\u308c\u3070\u7121\u610f\u5473\u306b\u8171\u9798\u708e\u306b\u306a\u308b\u5371\u967a\u6027\u304c\u3044\u304f\u3089\u304b\u6e1b\u308b\u304b\u3082\u3057\u308c\u306a\u3044\uff0e<\/p>\n\t\t\t\t<p>\u25cf\u66f8\u3044\u3066\u307f\u307e\u3057\u305f<\/p>\n\t\t\t\t<pre><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\/\/NULL\u521d\u671f\u5316\u3068\uff0c\u6307\u3059\u9818\u57df\u306eRelease\u3092\u81ea\u52d5\u5316\u3057\u305fIplImage*\r\nclass UCpIplImage\r\n{\r\npublic:\r\n\tUCpIplImage( IplImage* const pImg=NULL ){\toperator=(pImg);\t}\r\n\t~UCpIplImage(){\tRelease();\t}\r\n\tvoid Release(){\tcvSafeReleaseImage(m_pImg);\t}\r\n\r\n\toperator IplImage*&amp;(){\treturn m_pImg;\t}\r\n\toperator const IplImage* () const {\treturn m_pImg;\t}\r\n\tIplImage *operator =( IplImage* const pImg ){\treturn (m_pImg = pImg);\t}\r\n\tIplImage *operator-&gt;(){\treturn m_pImg;\t}\r\n\tconst IplImage *operator-&gt;() const {\treturn m_pImg;\t}\r\n\r\nprivate:\r\n\t\/\/\u203b\u3053\u306e\u30dd\u30a4\u30f3\u30bf\u306f\uff0c\u6709\u52b9\u306a\u753b\u50cf\u9818\u57df\u3092\u6307\u3055\u306a\u3044\u3068\u304d\u306fNULL\u306b\u4fdd\u3063\u3066\u304a\u304b\u306d\u3070\u306a\u3089\u306a\u3044\r\n\tIplImage *m_pImg;\r\n};\r\n<\/pre>\n\t\t\t\t<p>\uff08\u3057\u3064\u3053\u304fcvSafeReleaseImage\u3092\u4ed5\u8fbc\u3093\u3067\u307f\u307e\u3057\u305f\uff09<\/p>\n\t\t\t\t<p>\u3048\u3068\uff0c\u3053\u308c\u3067\u3044\u3044\u306e\u304b\u2026\u2026\u306a\uff1f<br \/>\n\t\t\t\t\u3068\u308a\u3042\u3048\u305a\u3061\u3087\u3063\u3068\u4f7f\u3063\u3066\u307f\u305f\u611f\u3058\u5927\u4e08\u592b\u305d\u3046\u306b\u898b\u3048\u308b\u304c\uff0e<\/p>\n\t\t\t\t<p>\u3068\u306f\u8a00\u3048\uff0c\u300c\u52dd\u624b\u306b\u753b\u50cf\u3092\u6368\u3066\u3066\u3057\u307e\u3046\u300d\u3053\u3068\u304c\u554f\u984c\u3068\u306a\u308b\u5834\u9762\u3067\u306f\u3053\u308c\u3067\u306f\u9006\u306b\u4f7f\u3048\u306a\u3044\uff0e<br \/>\n\t\t\t\t\u3046\u3063\u304b\u308a\u30b3\u30d4\u30fc\u304c\u3067\u304d\u3066\uff12\u91cd\u7834\u68c4\u7b49\u306e\u554f\u984c\u304c\u51fa\u306a\u3044\u3088\u3046\u306b\u3053\u306e\u30af\u30e9\u30b9\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u8907\u88fd\u3092\u7981\u6b62\uff0e<\/p>\n\t\t\t\t<pre>\r\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\t\/\/\u8907\u88fd\u306e\u7981\u6b62\r\nprivate:\r\n\tUCpIplImage( const UCpIplImage &amp; );\r\n\tUCpIplImage &amp;operator =( const UCpIplImage &amp; );\r\n<\/pre>\n\t\t\t\t<p>\u3057\u304b\u3057IplImage*\u578b\u30dd\u30a4\u30f3\u30bf\u3092\u9593\u306b\u4ecb\u305b\u3070\u30b3\u30d4\u30fc\u3067\u304d\u308b\u308f\u3051\u3067\u2026\u2026<br \/>\n\t\t\t\t\u7d50\u5c40\uff0c\u6700\u521d\u306b\u6319\u3052\u305f\u3088\u3046\u306a\u9650\u3089\u308c\u305f\u5834\u9762\uff08\u4f5c\u3063\u3066\uff0c\u4f7f\u3063\u3066\uff0c\u3059\u3050\u6368\u3066\u308b\u3088\u3046\u306a\u4e00\u6642\u753b\u50cf\uff09\u306b\u9650\u3063\u3066\u3057\u304b\u4f7f\u3048\u306a\u3044\u306e\u304b\u3082\uff0e<br \/>\n\t\t\t\t\u3046\u30fc\u3093\u2026<\/p>\n\t\t\t\t<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n\t\t\t\t<p>\u203b\uff11<br \/>\n\t\t\t\t\u5b66\u751f\u306e\u3053\u308d\uff0c\u300c\u52d5\u7684\u591a\u6b21\u5143\u914d\u5217\u300d\u3068\u304b\u8a00\u3063\u3066\uff0c\uff14\u91cd\u304f\u3089\u3044\u306e\u30dd\u30a4\u30f3\u30bf\u3092\u3061\u308a\u3070\u3081\u305f\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u81ea\u5206\u3067\u53ce\u96c6\u304c\u3064\u304b\u306a\u304f\u306a\u3063\u305f\uff0e<br \/>\n\t\t\t\t\u3057\u304b\u3082\u305d\u306e\u60aa\u5922\u306e\u30b3\u30fc\u30c9\u3092\u8aad\u307e\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u5f8c\u8f29\u304c\u51fa\u3066\u304d\u3066\uff0c\u7814\u7a76\u5ba4\u306e\u307f\u3093\u306a\u306e\u524d\u3067<br \/>\n\t\t\t\t\u300c\u306a\u3093\u3067\u305d\u3093\u306a\u30dd\u30a4\u30f3\u30bf\u5730\u7344\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u304b\u300d\u306b\u3064\u3044\u3066\u30b9\u30e9\u30a4\u30c9\u767a\u8868\u3057\u305f\uff0e<br \/>\n\t\t\t\t\u4e8c\u5ea6\u3068\u3084\u308b\u307e\u3044\u3068\u56fa\u304f\u8a93\u3063\u305f\uff0e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e16\u9593\u3067\u306f\u30dd\u30a4\u30f3\u30bf\u306edelete\u3057\u5fd8\u308c\u3092\u9632\u6b62\u3059\u308b\u305f\u3081\u306bauto_ptr\u3068\u304b\u305d\u3046\u3044\u3046\u985e\u306e\u3082\u306e\u304c\u3042\u308b\u307f\u305f\u3044\u3067\u3059\u304c\uff0c \u305d\u308c\u306eIplImage*\u7248\u307f\u305f\u3044\u306a\u3084\u3064\u3092\u4f55\u6545\u304b\u81ea\u524d\u3067\u66f8\u3044\u3066\u307f\u305f\u3088\uff0c\u3068\u3044\u3046\u4f4e\u30ec\u30d9\u30eb\u306a\u904a\u3073\uff0e \u25cf\u52d5\u6a5f OpenCV [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[19],"class_list":["post-1084","post","type-post","status-publish","format-standard","hentry","category-soft","tag-opencv"],"_links":{"self":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/1084","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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1084"}],"version-history":[{"count":14,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/1084\/revisions"}],"predecessor-version":[{"id":1096,"href":"https:\/\/www.iss.ai\/index.php?rest_route=\/wp\/v2\/posts\/1084\/revisions\/1096"}],"wp:attachment":[{"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iss.ai\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}