# How to find the angle of object by using other function instead of using minFeretProperties because it is not supported for code generation.

3 visualizaciones (últimos 30 días)
Nurul Farhana Mohd Fadzli el 4 de En. de 2023
Editada: Image Analyst el 6 de En. de 2023
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
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (4)

Matt J el 4 de En. de 2023
Editada: Matt J el 4 de En. de 2023
##### 9 comentariosMostrar 7 comentarios más antiguosOcultar 7 comentarios más antiguos
Matt J el 6 de En. de 2023
I2 needs to be a 2D matrix.
I2=any( imbinarize(I1),3);
Nurul Farhana Mohd Fadzli el 6 de En. de 2023
Thank you sir, it works but the angles are sometimes not correct but i will try. Sir, how can I display the output image with the angle on it?

Iniciar sesión para comentar.

Matt J el 6 de En. de 2023
Here is possibly another way to compute the MinFeretAngle, based on radon. According to the documentation, the Coder does support it.
BW=imrotate(BW0,-30,'crop');
immontage({BW0,BW},'Border',5,'Back','w');
minferetAngle(BW)
ans = -30
function out=minferetAngle(BW)
t=linspace(0,180,1000); t(end)=[];
out=t(i)-90;
end
##### 2 comentariosMostrar NingunoOcultar Ninguno
Nurul Farhana Mohd Fadzli el 6 de En. de 2023
Thank you sir but the minferetAngle is not supported for code generation
Matt J el 6 de En. de 2023
Editada: Matt J el 6 de En. de 2023
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.

Iniciar sesión para comentar.

Image Analyst el 6 de En. de 2023
See attached demo.
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Nurul Farhana Mohd Fadzli el 6 de En. de 2023
I have tried your example but the angle produce is not correct. It should be +-17 degrees

Iniciar sesión para comentar.

Image Analyst el 6 de En. de 2023
See attached demo.
##### 2 comentariosMostrar NingunoOcultar Ninguno
Matt J el 6 de En. de 2023
This will not give the min feret angle because it looks at the global max over the radon transform. I think you need the min(max()) which ist what my version proposes.
Image Analyst el 6 de En. de 2023
Editada: Image Analyst el 6 de En. de 2023
@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.

Iniciar sesión para comentar.

### Categorías

Más información sobre Image and Video Ground Truth Labeling en Help Center y File Exchange.

R2019b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by