CTA算法-各向异性测度-Conditional Texture Anisotropy

CTA算法
Conditional Texture Anisotropy
Roli 提 出 了 各 向 异 性 测 度 ( Conditional Texture Anisotropy, CTA) 的概念和计算原理, Nguyen 提出了各向异性测度的具体计算方法
选取某个像素的灰度,计算4个方向的P值,再计算CTA,然后把CTA从[0,1]映射到[0,255],生成灰度图,便于观察。
A是原图,B是灰度图

在这里插入图片描述在这里插入图片描述

X是一个向量,由(均值,方差)组成。

在这里插入图片描述m 和 σ 分别为整张图像的深度均值和标准差;
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
j表示4个方向,每个方向产生一条线,当成一个向量,线上有2d+1个像素,计算他们的P值

沿中心像素的 0°、45°、90° 和 135° 四个方向
L2为裂缝点,l1非裂缝点

在这里插入图片描述
裂缝的某个方向的P值会与其他方向的P值有很大的差距,使得CTA的值接近1,
非裂缝则是4个方向大致一样,使CTA接近0.

在这里插入图片描述
把4个P中的最大和最小值选出来计算CTA。
在这里插入图片描述
自己的代码测试效果图
上干货代码:(需要opencv 3.5以上版本)
CTA_function.cpp

#include "pch.h"
#include <iostream>
#include  "math.h"
#include <algorithm>
#include<core/core.hpp>
#include<highgui/highgui.hpp>
#include "opencv2/opencv.hpp"
#include <opencv2/core/core.hpp>
#include <imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/ml/ml.hpp>
using namespace  std;
using namespace cv;
/*
	计算每一个像素点的CTA
*/
/*
	求均值,0度
	X(rows)动,Y不动
 */
float fun_sum_1(pixel px1, int d, Mat pic) {

/*
	135度
	X增Y增
*/
float fun_sum_2(pixel px1, int d, Mat pic) {

}

/*
 求均值,90度,
 */
float fun_sum_3(pixel px1, int d, Mat pic) {

}
/*
	45度
	X增Y减
*/
float fun_sum_4(pixel px1, int d, Mat pic) {

}
/*
  差的平方的求和,0度
  X动,Y不动
 */
float fun_dif_1(pixel px1, int d, float mean, Mat pic) {

}
/*
  差的平方的求和,45度
  X增Y增
 */
float fun_dif_2(pixel px1, int d, float mean, Mat pic) {

}
/*
  差的平方的求和,90度
  X不动,Y动
 */
float fun_dif_3(pixel px1, int d, float mean, Mat pic) {

}
/*
  差的平方的求和,135度
  X增,Y减
 */
float fun_dif_4(pixel px1, int d, float mean, Mat pic) {

}
/*
	标准差
*/
float fun_dif(float means, Mat pic) {
}

float fun_p(float mean1, float stdev1, float means, float stdev)
{
	
}
float fun_CTA(pixel px1, int d, Mat pic) {

}
/*
	映射[0,1]->[0,255]
*/
int Projection01to0255(float cta) {

}

 Mat CTA(Mat inPut, int distance) {
}


CTA_function.h

#include "pch.h"
#include <iostream>
#include  "math.h"
#include <algorithm>
#include<core/core.hpp>
#include<highgui/highgui.hpp>
#include "opencv2/opencv.hpp"
#include <opencv2/core/core.hpp>
#include <imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/ml/ml.hpp>
using namespace  std;
using namespace cv;
typedef struct
{
	int x;
	int y;
}pixel;
float fun_sum_1(pixel px1, int d, Mat pic);
float fun_sum_2(pixel px1, int d, Mat pic);
float fun_sum_3(pixel px1, int d, Mat pic);
float fun_sum_4(pixel px1, int d, Mat pic);
float fun_dif_1(pixel px1, int d, float mean, Mat pic);
float fun_dif_2(pixel px1, int d, float mean, Mat pic);
float fun_dif_3(pixel px1, int d, float mean, Mat pic);
float fun_dif_4(pixel px1, int d, float mean, Mat pic);
float fun_dif(float means, Mat pic);
float fun_means(Mat pic);
float fun_p(float mean1, float stdev1, float means, float stdev);
float fun_CTA(pixel px1, int d, Mat pic);
int Projection01to0255(float cta);
Mat CTA(Mat inPut,int distance) ;
void test();

之后发现,计算速度很慢,又进行了多线程的优化,是原来的2.5倍速(笑)。
这里给出文件:
CTA_function_thread.cpp
最后,引用论文是
【Automatic Detection and Classification of Defect on road Pavement using Anisotropy Measure】 Tien Sy Nguyen, Manuel Avila, St´ephane Begot

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值