日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

CImg库中部分函数的作用和用法

發布時間:2023/11/27 生活经验 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CImg库中部分函数的作用和用法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

部分內容來自于CImg參考手冊或CImg的Doxygen手冊

?

1、宏cimg_usage(usage):可以被用來描述程序的目的和使用情況。它通常被插入到 int main(int argc, char **argv)的定義之后。

???? 參數:usage:描述程序目的和使用情況的字符串。

???? 前置條件:使用cimg_usage()的函數必須正確的定義了變量argc和argv。

2、CImg<unsigned char> image("lean.jpg"), visu(500, 400, 1, 3, 0);

??? 創建兩個使用unsigned char型像素的圖像的實例。第一個圖像image通過從磁盤讀取一幅圖像文件來初始化。此處,lena.jpg必須同當前程序在同一目錄下。第二個圖像visu被初始化為一幅黑色的彩色圖,它的大小事dx=500(長), dy=400(寬), dz=1(深)(這里,它是一幅2D圖像,而不是一幅3D圖像),并且dv=3(每個像素擁有3個‘向量’通道R,G,B)。在構造函數中的最后一個參數定義了像素值的缺省值(這里是0,也就是說visu將被初始化為黑色)。

3、宏cimg_option(name, default, usage):用來從命令行檢索一個選項值。

??? 參數:name:將從命令行檢索的選項的名字;

??????????? default:在運行程序時如果選項name沒有被指定,此宏返回的缺省值;

??????????? usage:選項的一個簡要說明。如果usage==0,當帶有參數-h或-help運行程序時,此選項不會出現在選項列表中(隱藏此選項)。

??? 返回值:cimg_option()返回一個同缺省值default有相同類型的對象。返回的值同在命令行中所指定的那個相同。如果某選項沒有被指定,返回的值等于缺省值default。

??? 前置條件:使用cimg_option的函數必須正確的定義了變量argc和argv。

4、CImg get_norm_pointwise():return the scalar image of vector norms,when dealing with vector-valued images (i.e images with dimv()>1), this function computes the L1,L2 or Linf norm of each vector-valued pixel。

5、CImg normalize():linear normalization of the pixel values between a and b

6、CImg resize():resize an image。

7、CImgDisplay main_disp(image, "Click a point");

???? 為圖像image創建一個顯示窗口,缺省情況下,CImgDisplay處理(來自鼠標、鍵盤,...)的事件。在windows上,有一個創建全屏顯示的方法。

8、const unsigned char red[] = { 255, 0, 0 }, green[] = { 0, 255, 0 };

??? 定義了兩種不同的顏色,每種顏色都是const unsigned char數組。

9、CImg dimx():return the number of columns of the instance image (size along the X-axis, i.e image width)。

10、cimg::dialog():display a dialog box, where a user can click standard buttons。

11、cimg::basename():compute the basename of a filename。

12、CImg get_resize():return a resized image。

13、CImgDisplay is_closed:closed state of the window。

14、CImgDisplay key:key value if pressed。

15、CImgDisplay wait(CImgDisplay& disp1, CImgDisplay& disp2):wait for any event occuring either on the display disp1 or disp2。

16、CImg get_gradientXY():return a list of images, corresponding to the XY-gradients of an image。

17、CImg blur():blur the image with a Canny-Deriche filter。

18、CImg fill(val):fill an image by a value val。

19、CImg display(CImgDisplay& disp):display an image into a CImgDisplay window。

?

GitHub:https://github.com/fengbingchun/CImg_Test

總結

以上是生活随笔為你收集整理的CImg库中部分函数的作用和用法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

歡迎分享!

轉載請說明來源于"生活随笔",并保留原作者的名字。

本文地址:CImg库中部分函数的作用和用法