MimArith()函数

MimArith()函数

Synopsis

Perform a point-to-point arithmetic operation.

Format

void MimArith(Src1ImageBufId, Src2ImageBufId, DestImageBufId, Operation)

double Src1ImageBufId; Source 1 image buffer identifier or a constant
double Src2ImageBufId; Source 2 image buffer identifier or a constant
MIL_ID DestImageBufId; Destination image buffer identifier
long Operation; Operation to perform
Description

MimBinarize转二值图

Format

void MimBinarize(SrcImageBufId, DestImageBufId, Condition, CondLow, CondHigh)

MIL_ID SrcImageBufId; Source image buffer identifier
MIL_ID DestImageBufId; Destination image buffer identifier
long Condition; Conditional operator for selection
double CondLow; Low compare value for the condition
double CondHigh; High compare value for the condition

Description

This function performs binary thresholding on the specified image. Each pixel that meets the specified condition is set to the highest unsigned destination buffer value, while other pixels are set to 0. For example, the highest buffer value for an 8-bit buffer is 0xff.
The SrcImageBufId parameter specifies the identifier of the data source of the operation. This parameter must be given an image buffer identifier.
The DestImageBufId parameter specifies the identifier of the destination of the results. This parameter must be given an image buffer identifier.

The Condition parameter specifies the thresholding condition. This parameter can be set to one of two types of conditions.

MimClip剪切点操作

Format

void MimClip(SrcImageBufId, DestImageBufId, Condition, CondLow, CondHigh, WriteLow, WriteHigh)

MIL_ID SrcImageBufId; Source image buffer identifier
MIL_ID DestImageBufId; Destination image buffer identifier
long Condition; Clipping condition
double CondLow; Low clipping point
double CondHigh; High clipping point
double WriteLow; Value written if low clipping condition satisfied
double WriteHigh; Value written if high clipping condition satisfied

Description

This function clips each image pixel that meets the specified condition. If the condition has one clipping point, each pixel that satisfies this condition is replaced with the specified WriteLow value. If it has two clipping points, they are either replaced with the WriteLow or WriteHigh value depending on the condition. Pixels that do not satisfy the condition are not affected.
The SrcImageBufId parameter specifies the identifier of the image data source.

The DestImageBufId parameter specifies the identifier of the destination image buffer.
The Condition parameter specifies the clipping condition. This parameter can be set to one of two types of conditions.

imagej工程导入Eclipse方法,Eclipse编译imagej

imagej工程导入Eclipse方法:

1.imagej是开放源代码,可以下载源代码地址:https://imagej.nih.gov/ij/download.html

下载完后,解压,如下图

imagej源代码

2.开启Eclipse软件,新建一个空的工程,将imagej源文件全部复制到src(刚建的工程)文件里,

Mmeas测量模块介绍

一般mil测量步骤如下;

1.使用MmeasAllocMarker函数,先分配测量的MIL_ID。

2.使用MmeasSetMarker函数,设置 边(Edge)或条纹(stripe)参数, 如极性,强度,宽度,测量范围,角度等

3.使用MmeasFindMarker函数,寻找 边(Edge)或条纹(stripe)位置

4.使用MmeasGetResult函数,获取结果,分数,角度,位置等

5.使用MmeasFree函数, 释放分配测量的MIL_ID

百分比阈值Percentile

Doyle于1962年提出的P-Tile (即P分位数法)可以说是最古老的一种阈值选取方法。该方法根据先验概率来设定阈值,使得二值化后的目标或背景像素比例等于先验概率,该方法简单高效,但是对于先验概率难于估计的图像却无能为力。

对于先验概率不知道的情况下不建意选用此方法,除了已知目标或背景像素比例等于先验概率,更简单的讲就是在找阈值前已经知道,目标或背景占整幅图比率多少。

编程函数实现可以输入两数,hist直方图数据、Tile先验概率,用两重for循环,第一层用于统计总像素数,第二层用于判断是否达到了Tile先验概率,达到就返回。

计算直方图方法

直方图(Histogram),又称质量分布图,是一种统计报告图,由一系列高度不等的纵向条纹或线段表示数据分布的情况。 一般用横轴表示数据类型,纵轴表示分布情况。

简单来讲的话,以8位灰度图为例256个灰度等级,直方图统计就是计算相同像素值总数,C语言中可以用一维数组来暂存直方图数据(long hist[256]).

具体统计方法也比较简单,有图像地址pimage,图像宽度imageWidth,图像高度imageHeight,有了已经这三个数后,可以用两重for循环得到直方图数据hist[]。

阈值-灰度平均值计算方法

阈值,灰度平均值计算方法,将图像上所有像素值相加除以总像素数。可以通过直接访问图像内存地址,用两重for循环计算得到,这种方法可行,但不够系统化、模块化,一般不这样使用,更多的计算方法先得到图像的直方图数组,然后再for循环统计计算得到平均值。

灰度图转二值图阈(阀)值方法介绍

灰度平均值的阈值

将一幅图所有像素值加总除以总像素个数,得到平均值,这种方法最简单但有很多盲区,一般用来做初始分割的猜测值。

谷底最小值的阈值

用于具有明显双峰直方图的图像,其寻找双峰的谷底作为阈值,但是该方法不一定能获得阈值,对于那些具有平坦的直方图或单峰图像,该方法不合适。

百分比阈值

Doyle于1962年提出的P-Tile (即P分位数法)可以说是最古老的一种阈值选取方法。该方法根据先验概率来设定阈值,使得二值化后的目标或背景像素比例等于先验概率,该方法简单高效,但是对于先验概率难于估计的图像却无能为力。

Mblob粒子分析介绍和头文件

Blob分析:对处理后的图像一般为二值图像,进行连通区域分析、拓扑关系等信息提取等。一般用于检测脏污,分析形状等。

具体可以提取的特征有面积、周长、质心、长、宽、紧密度等,通过提取的这些特征单独或组合分析可以达到一些智能的运用(比如数字提取)。