0
A
回答
0
您可以遵循这样的事情。首先,从图像中删除白色背景。我在这里使用了输入,我假设你使用imfindcircle寻找圈子,所以你应该有中心在手。使用中心坐标,我会画出极端点,顶部,左侧,底部和右侧,然后计算这些点与中心之间的距离。
rgbImage = imread('JjkrL.jpg') ;
%% Remove the white background
grayImage = min(rgbImage, [], 3);
binaryImage = grayImage < 200;
binaryImage = bwareafilt(binaryImage, 1);
[rows, columns] = find(binaryImage);
row1 = min(rows);
row2 = max(rows);
col1 = min(columns);
col2 = max(columns);
% Crop
croppedImage = rgbImage(row1:row2, col1:col2, :);
[nx,ny,t] = size(croppedImage) ;
imshow(croppedImage) ;
%%
% Centers of circles
C1 = [84 142] ;
C2 = [76 136] ;
%% Get distances
% circle 1/ Big circle
% Edge points
top = [C1(1) 1] ;
bottom = [C1(1) nx] ;
left = [1 C1(2)] ;
right = [ny C1(2)] ;
pts = [top ;left ;bottom ; right] ;
hold on
plot(C1(1),C1(2),'*r')
plot(pts(:,1),pts(:,2),'*k') ;
%% Get distances
data = repmat(C1,[length(pts),1])-pts ;
dist = sqrt(data(:,1).^2+data(:,2).^2);
相关问题
- 1. OpenCV:使用cvHoughCircle进行圆检测
- 2. 使用python,numpy进行圆圈检测?
- 3. 使用OpenCV进行实时圆检测
- 4. 使用CTest运行嵌套测试
- 5. 使用MATLAB进行形状检测
- 6. 使用matlab进行边缘检测normxcorr2
- 7. 使用React&Redux内部酶进行测试的嵌套组件
- 8. 使用嵌套表格和DMX进行预测
- 9. 如何使用嵌套值对嵌套字典进行排序?
- 10. 使用嵌套聚合进行计数
- 11. 使用lapply进行嵌套循环
- 12. 使用Datasource进行嵌套控制
- 13. MATLAB - array2table嵌套
- 14. 嵌套圆圈D3
- 15. 是否可以使用SSE为此嵌套进行矢量化?
- 16. MATLAB矢量化嵌套for循环
- 17. Matlab parfor嵌套循环变量访问
- 18. 在MATLAB使用PARFOR嵌套循环
- 19. 使用向量化在Matlab中优化嵌套for循环使用向量化
- 20. MATLAB嵌套表达
- 21. 我可以调用嵌套函数进行单元测试吗?
- 22. 故障绘图嵌套圆
- 23. 使用svm进行人脸检测和使用matlab进行特征提取
- 24. 回归使用K-NN进行预测使用matlab?
- 25. 使用OpenCV在ios应用程序中进行圆检测
- 26. 使用MATLAB进行微分
- 27. 使用PHP嵌套数组列表使用optgroup进行下拉
- 28. 使用ASIHTTPRequest使用NSDictionary对嵌套参数进行POST POST
- 29. 使用Javascript进行三维测量
- 30. 使用SLURM进行时间测量
如果你使用了'imfindcircle',那么你有圆心和半径。从那里它只是算术。如果您在编码解决方案时遇到问题,请发布代码以及您正在讨论的*距离(最小,最大,平均值,所有距离?)。 – beaker
是的,我有两个值,但我不知道如何使用它。我需要从所有侧面(顶部,底部,左侧,右侧)的外侧圆的内侧圆的边缘之间找到距离 –
您是否研究了距离度量[这里](https://www.mathworks.com/help/stats/pdist2.html)? – kedarps