* 6. 三幅裁剪图,尺寸统一为(W-1) x (H-1),
crop_part (ImageCopy, Partimg00, 0, 0, Width - 1, Height - 1)
crop_part (ImageCopy, Partimg10, 1, 0, Width - 1, Height - 1)
crop_part (ImageCopy, Partimg01, 0, 1, Width - 1, Height - 1)

* 7. 必须转real: byte图像平方会溢出截断到255
convert_image_type (Partimg00, Partimg00R, 'real')
convert_image_type (Partimg10, Partimg10R, 'real')
convert_image_type (Partimg01, Partimg01R, 'real')

* 8. 行方向梯度平方
sub_image (Partimg10R, Partimg00R, ImageSub1, 1, 0)
mult_image (ImageSub1, ImageSub1, ImageResult1, 1, 0)

* 9. 列方向梯度平方
sub_image (Partimg01R, Partimg00R, ImageSub2, 1, 0)
mult_image (ImageSub2, ImageSub2, ImageResult2, 1, 0)

* 10. 能量合成 + 取均值
add_image (ImageResult1, ImageResult2, ImageResult, 1, 0)
intensity (ImageReduced, ImageResult, Value, Deviation)

ImagePart00就是左上角的(W-1) x (H-1)子图,ImagePart10就是右上角的子图,ImagePart01是左下角的子图;

所以10-00,代表水平方向梯度(相邻像素差),01-00,代表垂直方向梯度(相邻像素差)

sub_image(a,b,c,d,e) c = (a-b)*d+e

mult_image(a,b,c,d,e) c = (a b) d+e

add_image(a,b,c,d,e) c = (a+b)*d+e

intensity(a, b, c, d,) c = b图像在a区域内的平均灰度值 ,d = b图像在a区域内的偏差(减均值平方和/a的像素个数)

标签: none

添加新评论