How to find the angle of object by using other function instead of using minFeretProperties because it is not supported for code generation.
2 次查看(过去 30 天)
显示 更早的评论
I need to deploy my algorithm to NVIDIA Jetson and I have created my coding and ready for code generation using MATLAB Coder. Unfortunately, the process for code generation is unsuccessful as the minFeretProperties is not supported for code generation. Can anyone help me to detect the angle of object using other way or function?. I am running out of time. Thank you
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1251397/image.jpeg)
0 个评论
回答(4 个)
Matt J
2023-1-6
Here is possibly another way to compute the MinFeretAngle, based on radon. According to the documentation, the Coder does support it.
load('BWImage');
BW=imrotate(BW0,-30,'crop');
immontage({BW0,BW},'Border',5,'Back','w');
minferetAngle(BW)
function out=minferetAngle(BW)
t=linspace(0,180,1000); t(end)=[];
[~,i]=min(max(radon(BW,t)));
out=t(i)-90;
end
2 个评论
Matt J
2023-1-6
编辑:Matt J
2023-1-6
That seems unlikely. The only function it uses is radon(), linspace(), min(), and max(), as you can see. All of those are supported for Code Generation according to the documentation. Have you tried to compile it? If so, which command is it complaining about? You should always display results of things of you've tried so the discussion can progress more briskly.
Image Analyst
2023-1-6
See attached demo.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1254072/image.png)
2 个评论
Image Analyst
2023-1-6
编辑:Image Analyst
2023-1-6
@Matt J yes, true it won't solve the problem and the feret diameter is the way to go. This (radon) suffers from the same problem as regionprops in that it tends to get the axis angled along a diagonal for a rectangle rather than along the axis parallel to the long edge. I just thought this might be a related topic that he might want to know about.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image and Video Ground Truth Labeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!