回答
为了填充一个黑色区域中,执行以下操作:
1)确定含有所述黑色区域的子区域,越小越好。最好的情况就是黑洞的边界点。
2)通过在子区域内创建非黑色点的Delaunay三角剖分:
tri = DelaunayTri(x,y); %# x, y (column vectors) are coordinates of the non-black points.
3)确定的黑点,其中德洛奈三角形由:
[t, bc] = pointLocation(tri, [x_b, y_b]); %# x_b, y_b (column vectors) are coordinates of the black points
tri = tri(t,:);
4)插值:
v_b = sum(v(tri).*bc,2); %# v contains the pixel values at the non-black points, and v_b are the interpolated values at the black points.
似乎它会工作让我试试。谢谢你的努力 –
这样做的一个好方法是解决linear heat equation。你要做的是修正好区域像素的“温度”(强度),让热量流入坏像素。一个可以通过,但有点慢,是这样做的是重复平均图像,然后设置好的像素回到其原始值与newImage(~badPixels) = myData(~badPixels);
。
我做以下步骤:
- 找到坏像素在图像是零,然后扩张,以确保我们得到的一切
- 应用一个大的模糊让我们开始更快
- 平均的图像,然后设定好像素回其原始
- 重复步骤3
- 显示
你可以重复平均,直至图像停止变化,你可以使用更高的精度更小的平均内核---但是这给了良好的效果:
的代码如下:
numIterations = 30;
avgPrecisionSize = 16; % smaller is better, but takes longer
% Read in the image grayscale:
originalImage = double(rgb2gray(imread('c:\temp\testimage.jpg')));
% get the bad pixels where = 0 and dilate to make sure they get everything:
badPixels = (originalImage == 0);
badPixels = imdilate(badPixels, ones(12));
%# Create a big gaussian and an averaging kernel to use:
G = fspecial('gaussian',[1 1]*100,50);
H = fspecial('average', [1,1]*avgPrecisionSize);
%# User a big filter to get started:
newImage = imfilter(originalImage,G,'same');
newImage(~badPixels) = originalImage(~badPixels);
% Now average to
for count = 1:numIterations
newImage = imfilter(newImage, H, 'same');
newImage(~badPixels) = originalImage(~badPixels);
end
%% Plot the results
figure(123);
clf;
% Display the mask:
subplot(1,2,1);
imagesc(badPixels);
axis image
title('Region Of the Bad Pixels');
% Display the result:
subplot(1,2,2);
imagesc(newImage);
axis image
set(gca,'clim', [0 255])
title('Infilled Image');
colormap gray
但你可以使用roifill
从图像处理工具箱,像这样类似的解决方案:
newImage2 = roifill(originalImage, badPixels);
figure(44);
clf;
imagesc(newImage2);
colormap gray
通知我使用的是与之前定义的相同的badPixels。
http://cs.stackexchange.com/questions/23794/interpolation-optimization-problem – Royi
- 1. 平均值范围
- 2. 向量元素范围的平均值
- 3. R每周平均值
- 4. 每周计算平均值
- 5. cv ::非黑色像素的平均值
- 6. MySQL范围和平均值
- 7. R生成有界随机样本周围特定平均值
- 8. 找到所有周围细胞的平均值
- 9. REGEX - 去除东西周围的东西?
- 10. Tensorflow:如何减去平均图像?
- 11. 如何去除html和css中元素周围的边框线?
- 12. 数值范围的平均值
- 13. 由平均
- 14. 用图像去除按钮周围的所有额外空间?
- 15. 如何去除图像周围的空白?
- 16. 如何在图像周围去除此锚标记的填充?
- 17. scipy.sparse矩阵:将行平均值减去非零元素
- 18. x的平均值的误差线除以y的平均值
- 19. 平均的变量由两个因素
- 20. 平均排由多种因素
- 21. 最大平均值,最小平均值和平均值
- 22. 使用CUDA查找一堆图像的像素平均值
- 23. 找到平均值最大的因素为范围
- 24. 获取过去4周的数据,如SQLSERVER平均2008
- 25. Excel VBA平均值(可变范围)
- 26. 周围元素
- 27. 计算平均值的平均值
- 28. pandas - 添加一组最后3个元素的平均值由
- 29. 样品由段R平均值
- 30. 周围图像
在DSP上重复:http://dsp.stackexchange.com/q/2803/590 – Chris
解决此问题:http://cs.stackexchange.com/questions/23794/interpolation-optimization-problem会做.. – Royi