Home Image-Pro General Discussions

Can I get the Fourier Descriptor coefficients for an object outline without using macro code?

I want to study the outlines of objects using Fourier descriptors.  I see that their is a macro that uses the maximum of the Fourier descriptor coefficients to rename obects.  Can I get the coefficients withour writing macro code?  In particular, I would like to get output to Excel for the first 20 coefficients for all the objects in an image.

 

Thanks

Answers

  • Mark, You can see all Fourier descriptor coefficients in the Object window. It shows data for the selected object. Yuri
  • Hello

    I'm using also the Fourier descriptors but i would like to have 128 instead of the 32 that are by default. How can I change it.

    Thanks
  • You can set the number of elements after executing the Count operation running the following macro:

        Public Sub SetNumberOfElements
            Dim md As MediaCy.Addins.Measurements.McMMData=ThisApplication.ActiveImage.MeasurementsData
            If md.Rows>0 Then
                Dim rgn As MediaCy.IQL.Features.McRegions=md.Item(0).MainSubFeature.GetFeatures()
                rgn.maRgnFourierDescriptor.NumElements=128
            End If
        End Sub
    
    Yuri

  • Hello again

    It's my first time using this program and I don't know very well how to run macros. I tried to do it using your instructions but when I try to run it a error occurs in this "If md.Rows>0 Then"
  • The error is Unexpected text

    Module 'Project6.ipp', line 16, character 0
  • You must have an active image with some counted objects to make it work, so execute Count first and then run the macro.
  • I did that but still same error just shows up
  • edited September 2014
    You may not have proper references. Please use my project (load it to Premier by double clicking on it and then run SetNumberOfElements macro).
  • Ok I did that and now it shows up that the number set was 128, but still when I go to the active image only 32 shows up
  • Sorry it took some time but it change now. Thank you so much for your help Yuri.
  • edited September 2014
    I have added a function to print out all Fourier Descriptor coefficients for every feature to Output window, from which you can send data to Excel.

        Public Sub SetNumberOfElements
            If ThisApplication.ActiveImage Is Nothing Then
                MsgBox "No active image"
                Exit Sub
            End If
            Dim md As MediaCy.Addins.Measurements.McMMData=ThisApplication.ActiveImage.MeasurementsData
            If md.Rows>0 Then
                With ThisApplication
                    Dim rgn As MediaCy.IQL.Features.McRegions=md.Item(0).MainSubFeature.GetFeatures()
                    rgn.maRgnFourierDescriptor.NumElements=128
                    'MsgBox "Number of elements for Fourier Descriptor is set to 128"
                    .Output.Show
                    .Output.Clear
                    Dim fd As New MeasEntry(eMeasures.aRgnFourierDescriptor,mcmmStatField.Values)
                    For Each sf As McMMSubFeature In md.SubFeatures
                        .Output.PrintMessage(sf.Name & vbTab & .McObjects.GlobalTools.McToText(sf.Value(fd),New Object() {"%f3", "",vbTab}).Value)
                    Next
                End With
            Else
                MsgBox "No measurement objects"
                Exit Sub
            End If
        End Sub
    

    The project attached.

    Yuri
  • Once again thank you very much. Best regards
  • Do I copy that to the project that you sent me?
  • Sorry once again, the attached project wasn't showing up. No help needed.

    Thanks
Sign In or Register to comment.