發表文章

目前顯示的是有「opencv_on_WPF」標籤的文章

C++/CLI Syntax part1_在C#中結合C++類別去印出字串的練習

圖片
Project setting Let us start to New a project At first , I new a  " C# Console Application" program In chinese we say 主控台應用程式 新增一個C# Console Application Add New Project 新加入一個CLR 類別庫 小複習link :  http://coolmandiary.blogspot.tw/2016/04/blog-post_30.html Setting the same CPU Configuration Go to the solution properties Both of  Debug and release are set x64 Go to the project properties Solution properties --> properties dependencies(專案相依性) Let us try some simple code In the ClassLibrary1.h Block 創建一個對於在託管堆中對象的應用(reference class) 還有這裡的class由於是相依於C#這個project 所以有ref這個字    ref是創建一個位於託管堆上的引用類型, 對應的是value, 它創建一個位於託管棧上的類型, 都由垃圾回收器負責回收內存 以下有附上一些參考連結: 托管类类型的声明 https://msdn.microsoft.com/zh-cn/library/ms235220(VS.80).aspx In the  ClassLibrary1.cpp Block The Class has one function test() to print the hello world string on the screen 寫好了這兩份(.cpp及.h檔) 我們先進行建置 ...

C++/CLI with OpenCV+WPF example_a version of C++ you can run in the .Net_L0

圖片
Part1. C++/CLI Syntax How to convert an object C++  Array Using C++  Delegate Using How to convert from the .Net String to traditional C style character pointer We will using C++ CLI to make an image processing program We will combine the opencv Library and WPF grid Library In this example , we will draw the contour in the image It's a version of C++ you can run in the .Net Runtime means  a  process or timing When the program is running RunTime就是運行時的意思。 程序分為幾個狀態,(1)編輯時->(2)編譯時->(3)靜態時->(4)運行時 C代碼編譯成可執行文件的時候,指令沒有被CPU執行, 這個時候算是編譯時,就是編譯的時候。 運行的時候指的是指令加載到內存並由CPU執行的時候。 比如有些錯誤在編譯的時候是不會出現的,就是程序在語法上沒有問題。但在運行時,因為缺少資源等因素可能出現運行時錯誤。叫做runtime error! C語言的時候, printf、malloc、strcpy之類的函數,是系統實現好的,這套東西就叫做C runtime。 C++語言的時候, runtime中又多了cout、異常處理的支持函數、RTTI的支持函數等等。 這類runtime都是函數庫形式,被應用程序靜態鏈接或者動態鏈接。 C# is running in the .Net runtime C# can use function call bu...