本文主要是介绍CT——圆中圆sino图的实现,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
时间:10-8
作者:老李
目标
我们要做出以下图像的sino图
过程
首先,什么是sino图,sino图是图像做radon变换所得的投影按列的叠加。如果我们做的是0-179度的radon变换,那我们所得的矩阵的行数是180行。
因为一次所得的投影可以得到一个向量(一排像素点)
我同时通过matlab自带的radon函数,以及用自己的方法实现了作图。结果如图
代码如下:
img = imread('picture');
gImg = rgb2gray(img); %这里用的是灰度图
gImg0=radon(gImg); %radon变换
[w0,l0] = size(gImg0);
fImg = round(gImg0/w);
subplot(1,3,1);
imagesc(fImg'); %# Create a colored plot of the matrix values
colormap(flipud(gray));%# Change the colormap to gray
hold on;
subplot(1,3,2);
imagesc(gImg); %# Create a colored plot of the matrix values
colormap(flipud(gray));%# Change the colormap to gray
B = zeros(180,1);
for i = 1:180rImg = imrotate(gImg,-(i-1));[w,l] = size(rImg);B(i) = length(round(sum(rImg)));
end
[j,k] = max(B);
A = zeros(180,j);
for m = 1:180rImg = imrotate(gImg,-(m-1));[w,l] = size(rImg);C = round(sum(rImg)/l);k = round((j-B(m))/2);for n = 1:B(m)A(m,k+n) = C(n); end
end
subplot(1,3,3);
imagesc(A);
colormap(flipud(gray));
中间是原图,左边是radon变换所得的图,右边是我用自己的想法做的图
我的想法是这样的,对图像做θ度角的radon变换,等同于对图像旋转-θ做正投影。
如果我以这种想法运用在其他图像上。
以及吴宣仪
大家加油!
这篇关于CT——圆中圆sino图的实现的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!