-
大小: 67KB文件类型: .rar金币: 1下载: 0 次发布日期: 2021-05-07
- 语言: 其他
- 标签: labwindows/c 直方图
资源简介
利用labwindows/cvi 对图像进行直方图统计
代码片段和文件信息
#include “Imaq_CVI.h“
#include /* Needed if linking in external compiler; harmless otherwise */
#include
#include “his.h“
IPIImageRef SourceImage;
static int panelHandle;
int main (int argc char *argv[])
{
if (InitCVIRTE (0 argv 0) == 0) /* Needed if linking in external compiler; harmless otherwise */
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0 “his.uir“ PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
IPI_Create (&SourceImageIPI_PIXEL_U82);
RunUserInterface ();
IPI_CloseSys();
return 0;
}
int CVICALLBACK Load_and_display (int panel int control int event
void *callbackData int eventData1 int eventData2)
{
IPIError lError;
char lPath[260];
int lStatuslHistogram[256];
if(event == EVENT_COMMIT)
{
lStatus = FileSelectPopup(“..\\..“ “*.apd;*.bmp;*.tif“““““VAL_LOAD_BUTTON 0 0 1 0 lPath);
if(lStatus == VAL_EXISTING_FILE_SELECTED)
{
lError = IPI_ReadFile(SourceImagelPathFALSENULLNULL);
if(lError == IPI_ERR_NOERROR)
{
IPI_SetWindowAttribute(0ATTR_LEFT10);
IPI_SetWindowAttribute(0ATTR_TOP15);
IPI_WindDraw(SourceImage0“Sample Image“TRUE);
IPI_Histogram(SourceImageIPI_NOMASK 2560255lHistogramNULL);
/*256//256 classes
0 //from pixel value 0
255 //to pixel value 255
lHistogram//retrieve the histogram
NULL); //we don‘t need the report*/
DeleteGraphPlot(panelPANEL_HISTOGRAM-1
VAL_IMMEDIATE_DRAW);
PlotY(panelPANEL_HISTOGRAMlHistogram256
VAL_INTEGERVAL_THIN_LINEVAL_SIMPLE_DOT
VAL_SOLID1VAL_BLACK);
}
}
}
return 0;
}
int CVICALLBACK Quit (int panel int control int event
void *callbackData int eventData1 int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
QuitUserInterface (0);
break;
}
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2026 2010-04-17 21:55 图像直方图\his.c
文件 1333 2010-04-17 21:15 图像直方图\his.h
文件 3682 2010-04-18 00:00 图像直方图\his.prj
文件 2372 2010-04-17 21:15 图像直方图\his.uir
文件 250250 1997-02-18 11:12 图像直方图\Imaq_CVI.fp
文件 39899 1997-02-17 12:52 图像直方图\Imaq_CVI.h
文件 48140 1997-03-10 11:45 图像直方图\Imaq_Cvi.lib
目录 0 2010-04-18 00:00 图像直方图
----------- --------- ---------- ----- ----
347702 8
评论
共有 条评论