CvArr → CvMat → IplImage ( 繼承關係 )
Even though OpenCV is implemented in C, the structures used in OpenCV have an object-oriented design; in effect, IplImage is derived from CvMat, which is derived from CvArr
1.
When CvArr* appears, it is acceptable to pass CvMat* or IplImage* to the routine.
可以用 CvArr * 去接 CvMat 或是 IplImage
上層往下指,上層的每一個成員下層也一定都有,所以一定都會對滿
反之,下層有的上層不見得有,所以下層的指標有些會接不到東西,就錯誤
故可以用上層的指標去接下層的成員函式。
2.
CvArr, can be thought of as an abstract base class from which CvMat is itself derived.
抽象基礎類別
是把最底層的class成員函數都宣告成virtual,本身的class沒辦法實體化
只提供該有哪些function的功能
實體的使用內容卻是由衍生出來的class去各自設計
也就是提供類似模組或樣版
第二點的參考資料來源:奇摩知識+
沒有留言:
張貼留言