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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

使用labview读取一副位图,并进行BCG校准(或修改其BCG)程序解析

發(fā)布時(shí)間:2023/11/30 编程问答 56 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用labview读取一副位图,并进行BCG校准(或修改其BCG)程序解析 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

進(jìn)行圖像處理第一步肯定就是要讀取一副圖片,然后再進(jìn)行圖像的BCG校準(zhǔn)。

首先講解一下用到的函數(shù)第一個(gè)函數(shù)為IMAQ Create,位于 ?視覺與運(yùn)動(dòng)--Vision Utilities---Image Management---IMAQ create

函數(shù)如圖,對(duì)于如何看函數(shù)功能,還是需要看幫助說明。其幫助說明如下圖

Creates a temporary memory location for an image. Use IMAQ Create in conjunction with the IMAQ Dispose VI to create or dispose of NI Vision images in LabVIEW.

這一句為對(duì)次函數(shù)的功能描述,創(chuàng)建一個(gè)為圖片創(chuàng)建一個(gè)緩沖空間,用于存放該圖片,讀取圖片均是從這個(gè)緩沖區(qū)讀出,若該緩存區(qū)的圖片發(fā)生變化,則讀取的圖片也發(fā)生變化。所以如果要是兩個(gè)讀取同一緩存區(qū)的話,就要考慮該緩存區(qū)的圖片是否發(fā)生變化。若要撤銷該緩存區(qū),使用IMAQ Dispose VI。這兩個(gè)一般成對(duì)出現(xiàn)。

然后看每個(gè)輸入?yún)?shù)的功能描述

第一個(gè)輸入?yún)?shù)為邊界大小設(shè)定,默認(rèn)值是3,可以根據(jù)需要來調(diào)整邊界。說明中說,該邊界不會(huì)隨圖像存到文件中。

Image Name is the name associated with the created image. Each image created must have a unique name.

第二個(gè)輸入?yún)?shù)為圖像名字,此名字唯一標(biāo)識(shí)該圖像。

第三個(gè)輸入?yún)?shù)為圖像的類型,并對(duì)圖像類型進(jìn)行了說明,示例中的圖像為8bit的位圖。若是彩色圖像則應(yīng)選擇RGB的圖像類型。

(嘗試中若輸入是一個(gè)彩色圖像,選擇圖像類型為8bit時(shí),顯示樣式為一個(gè)灰度圖)

?

New Image is the Image reference that is supplied as input to all subsequent (downstream) functions used by NI Vision. Multiple images can be created in a LabVIEW application.

輸出參數(shù)為新圖像,用于為下面的函數(shù)提供函數(shù)連接。

第二個(gè)函數(shù)為IMAQ Readfile 位于視覺與運(yùn)動(dòng)---Vision Utilities----Files

Reads an image file. The file format can be a standard format (BMP, TIFF, JPEG, JPEG2000, PNG, and AIPD) or a nonstandard format known to the user. In all cases, the read pixels are converted automatically into the image type passed by Image.

該函數(shù)的功能為讀取一個(gè)圖像文件,這個(gè)文件的格式可以是標(biāo)準(zhǔn)格式(BMP,TIFF,JPEG等),也可以是非標(biāo)準(zhǔn)格式的圖像,非標(biāo)準(zhǔn)格式的圖像就要根據(jù)File Options,進(jìn)行配置。

下面對(duì)每個(gè)輸入輸出參數(shù)進(jìn)行說明,取自函數(shù)幫助文檔里。

File Path is the complete pathname, including drive, directory, and filename, of the file to read.

第一個(gè)參數(shù)為File Path,文件路徑,即為所要導(dǎo)入圖像的路徑。

Image is a reference to the image to which data from the image file is applied.

第二個(gè)參數(shù)為圖像的引用,可用于該圖像的引用??梢岳斫鉃橹赶蛟搱D像的指針。

Load Color Palette? (No) determines whether to load the color table present in the file, if the color table exists. If loaded, this table is read and returned by the output Color Palette. The default is FALSE.?

第三個(gè)參數(shù),詢問是否加載顏色調(diào)色板的數(shù)據(jù),如果加載將在輸出端子Color Palette輸出顏色數(shù)組。

File Options is a cluster of user-optional values that you can use to read nonstandard file formats. The structure must be known to the user.?

第四個(gè)參數(shù)為文件選擇項(xiàng),這個(gè)為導(dǎo)入一個(gè)自定義的圖片時(shí)使用,一般我們使用的都是標(biāo)準(zhǔn)的圖片,不需要設(shè)置該參數(shù)。

Color Palette out contains the RGB color table (if the file has one) read from the file when the user passes the value TRUE for the input Load Color Palette? (No).

第一個(gè)輸出參數(shù),顏色調(diào)色板的輸出,RGB顏色的表格。在輸入端子Load Color Palette? 為真時(shí)才有輸出。

Image Out is a reference to the destination image. If Image Dst is connected, Image Dst Out is the same as Image Dst. Otherwise, Image Dst Out refers to the image referenced by Image Src.?

第二個(gè)輸出參數(shù)為圖像的輸出引用。下面的說明很有用,如果Image Dst這個(gè)端子連接,則Image Dst Out的輸出引用同Image Dst,否則,指代的是?Image Src的輸出引用。比如說下面我們用到的函數(shù)就有Image Dst ?Image Dst Out端子,如圖。當(dāng)遇到是否要替換掉原始緩存區(qū)的圖像時(shí)需要考慮該點(diǎn)。

File Type out indicates the file type that is read. This string returns an identifier of the file format, which can be BMP, TIFF, JPEG, PNG, or AIPD (internal file format). File Type returns xxx if the file format is unknown.?

第三個(gè)輸出參數(shù)為文件類型輸出,比如例子中用到的文件為BMP文件,則輸出為BMP。

File Data Type out indicates the pixel size defined in the header for standard image file types. File Options are not necessary for reading standard image files. For other types of image files, the returned values are passed from File Options/File Data Type.?

第四個(gè)輸出參數(shù)為文件數(shù)據(jù)類型輸出,表示的是定義在標(biāo)準(zhǔn)圖像文件類型的像素大小。在程序運(yùn)行時(shí)輸出為3不知何意?

?使用這兩個(gè)函數(shù)就可以將圖像顯示出來,程序和效果如下圖。

使用這兩個(gè)函數(shù)就可以將圖像讀出來了,注意一點(diǎn)是需要在圖像顯示控件上右擊選擇snapshot(快照),不然圖片運(yùn)行之后會(huì)被清除掉。

下面學(xué)習(xí)第三個(gè)函數(shù)IMAQ BCGLookup,該函數(shù)位于視覺與運(yùn)動(dòng)--Image Processing--IMAQ BCGLookup.

Applies a brightness, contrast, and gamma correction to an image. The correction is performed by computing and applying a lookup table. Brightness, Contrast, and Gamma control the changes made to the transfer function represented by the lookup table.

該函數(shù)功能是應(yīng)用亮度,對(duì)比度,伽馬校正圖像,使用的方法是查表法,增加圖像的對(duì)比效果 伽瑪校正(Gamma Correction),對(duì)圖象的伽瑪曲線進(jìn)行編輯,以對(duì)圖象進(jìn)行非線性色調(diào)編輯的方法。 (Gamma Correction,伽瑪校正):所謂伽瑪校正就是對(duì)圖像的伽瑪曲線進(jìn)行編輯,以對(duì)圖像進(jìn)行非線性色調(diào)編輯的方法,檢出圖像信號(hào)中的深色部分和淺色部分,并使兩者比例增大,從而提高圖像對(duì)比度效果。計(jì)算機(jī)繪圖領(lǐng)域慣以此屏幕輸出電壓與對(duì)應(yīng)亮度的轉(zhuǎn)換關(guān)系曲線,稱為伽瑪曲線(Gamma Curve)。 對(duì)比度只是增加畫面的黑白對(duì)比,也就是說,亮的地方更亮,暗的地方更暗。 下面對(duì)其參數(shù)進(jìn)行說明 第一個(gè)輸入?yún)?shù)為BCG值,BCG分別是brightness,contrast 和gamma的首字母。這個(gè)元素為一個(gè)簇元素,里面分別是這三個(gè)量的值。詳細(xì)每個(gè)量的說明看說明。

Image Src is a reference to the source image.

第二個(gè)輸入?yún)?shù)為圖像的引用。

Image Mask is an 8-bit image that specifies the region of the small image that will be copied. Only pixels in the Image Src (Small) image that correspond to a non-zero pixel in the mask image are copied. All other pixels keep their original values. The entire image is processed if Image Mask is not connected.?

第三個(gè)輸入?yún)?shù)為圖像掩膜,輸入為掩膜圖像的引用。

圖像掩模 。英文: image masking,image mask 。釋文: 用選定的圖像、圖形或物體,對(duì)待處理的圖像(全部或局部)進(jìn)行遮擋,來控制圖像處理的區(qū)域或處理過程。用于覆蓋的特定圖像或物體稱為掩?;蚰0?。光學(xué)圖像處理中,掩??梢允悄z片、濾光片等。數(shù)字圖像處理中,掩模為二維矩陣數(shù)組,有時(shí)也用多值圖像。數(shù)字圖像處理中,圖像掩模主要用于:①提取感興趣區(qū),用預(yù)先制作的感興趣區(qū)掩模與待處理圖像相乘,得到感興趣區(qū)圖像,感興趣區(qū)內(nèi)圖像值保持不變,而區(qū)外圖像值都為0。②屏蔽作用,用掩模對(duì)圖像上某些區(qū)域作屏蔽,使其不參加處理或不參加處理參數(shù)的計(jì)算,或僅對(duì)屏蔽區(qū)作處理或統(tǒng)計(jì)。③結(jié)構(gòu)特征提取,用相似性變量或圖像匹配方法檢測和提取圖像中與掩模相似的結(jié)構(gòu)特征。④特殊形狀圖像的制作。

Image Dst is a reference to the destination image.

第四個(gè)輸入?yún)?shù)為目的圖像的引用。經(jīng)過BCG校準(zhǔn)之后的圖像存放的緩存區(qū)。

Image Dst Out is a reference to the destination image. If Image Dst is connected, Image Dst Out is the same as Image Dst. Otherwise, Image Dst Out refers to the image referenced by Image Src.

第一個(gè)輸出參數(shù)為目的圖像的輸出。

這個(gè)程序?yàn)槔蒙鲜龅娜齻€(gè)函數(shù)完成圖像的BCG校準(zhǔn)程序。

程序的顯示效果圖,通過更改BCG Values來改變對(duì)比度,亮度和伽馬值。從而增加圖像的對(duì)比度。 其中不明白的地方就是圖像掩膜的使用,繼續(xù)努力。 對(duì)于圖像掩膜的含義見網(wǎng)頁http://blog.csdn.net/meng4411yu/article/details/10033325

?如何獲得8bit的位圖,在圖像保存時(shí)需要選擇保存類型,如下圖是在畫圖工具保存一張照片時(shí)可以有的圖片類型

?

?

轉(zhuǎn)載于:https://www.cnblogs.com/yuexinzheng1989/p/4440040.html

總結(jié)

以上是生活随笔為你收集整理的使用labview读取一副位图,并进行BCG校准(或修改其BCG)程序解析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。