Template Matching with Rotation ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Template Matching with Rotation ?

ultrah
Hi,

I want to detect objects in a binary image that roughly match a certain shape. I use the Template Matching Plugin, which gets acceptable results if the object is not rotated. Is there a simple way to detect rotated shapes ?

Reply | Threaded
Open this post in threaded view
|

Equivalent function for the IJ.run(...)

Md Tamjidul Hoque
Dear All

        I was applying some of the functions of ImageJ to the currently
open Image window,

such as:

     IJ.run("Watershed");
     IJ.run("Median...", "radius=2");
     IJ.run("OtsuThresholding 16Bit");
     ........

How can I call the equivalent functions (or apply the same IJ.run(...) )
for particular image-file rather than the current window?

If "equivalent function" exists, is there a manual for that?

Any help is much appreciated.

Thanks
Tamjid
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent function for the IJ.run(...)

BenTupper
Hi,

On May 13, 2010, at 7:49 PM, Md Tamjidul Hoque wrote:

> Dear All
>
>       I was applying some of the functions of ImageJ to the  
> currently open Image window,
>
> such as:
>
>    IJ.run("Watershed");
>    IJ.run("Median...", "radius=2");
>    IJ.run("OtsuThresholding 16Bit");
>    ........
>
> How can I call the equivalent functions (or apply the same  
> IJ.run(...) ) for particular image-file rather than the current  
> window?
>

I think you are looking for the IJ.run method that takes the ImagePlus  
reference as input.

IJ.run(myImp, "Watershed");

Cheers,
Ben




> If "equivalent function" exists, is there a manual for that?
>
> Any help is much appreciated.
>
> Thanks
> Tamjid
Reply | Threaded
Open this post in threaded view
|

Re: Equivalent function for the IJ.run(...)

dscho
In reply to this post by Md Tamjidul Hoque
Hi,

On Fri, 14 May 2010, Md Tamjidul Hoque wrote:

>     IJ.run("Watershed");
>     IJ.run("Median...", "radius=2");
>     IJ.run("OtsuThresholding 16Bit");
>     ........
>
> How can I call the equivalent functions (or apply the same IJ.run(...) ) for
> particular image-file rather than the current window?
>
> If "equivalent function" exists, is there a manual for that?

There is a fantastic website about ImageJ:

        http://rsb.info.nih.gov/ij/

It is even categorized into a series of sections, including one called
"macros/dev" ("dev" meaning "development"), which brings you here:

        http://rsb.info.nih.gov/ij/developer/index.html

On this awesome page, there is a link to "API Documentation", which get
you here:

        http://rsb.info.nih.gov/ij/developer/api/index.html

On the lower left side, you will find a list of all classes in ImageJ. And
sure enough, there is also "IJ". For your convenience, all of these class
names are actually hyperlinks, so if you click on "IJ", it will load the
documentation for that class into the right side of the web browser.
There, you will see -- amongst other very useful and thoroughly documented
functions -- this one:

        http://rsb.info.nih.gov/ij/developer/api/ij/IJ.html#run(ij.ImagePlus, java.lang.String, java.lang.String)

Hth,
Johannes
Reply | Threaded
Open this post in threaded view
|

Re: Template Matching with Rotation ?

Michael Schmid
In reply to this post by ultrah
Hi Anonymous,

template matching does not work with rotated shapes (unless you do it  
for many templates with different rotation angles, which will take a  
lot of processing time).
You might need some kind of generalized Hough Transform. To my  
knowledge, this has not been implemented in ImageJ.

Michael
________________________________________________________________

On 13 May 2010, at 21:50, ultrah wrote:

> Hi,
>
> I want to detect objects in a binary image that roughly match a  
> certain
> shape. I use the Template Matching Plugin, which gets acceptable  
> results if
> the object is not rotated. Is there a simple way to detect rotated  
> shapes ?
Reply | Threaded
Open this post in threaded view
|

Re: Template Matching with Rotation ?

ultrah
Hi Michael,

thank you for your reply. I already suspected that this was not going to be easy. I will try to solve the problem with a batch of manually rotated templates. If someone has another idea I would be very grateful

Thanks,

Felix
Reply | Threaded
Open this post in threaded view
|

Re: Template Matching with Rotation ?

Winnok H. De Vos
Hi,

I'm not sure whether this might be of help but I think this is somewhat similar to registration of moving objects across images.
One approach of dealing with this, is presented in the following article:

IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 15, NO. 7, JULY 2006, A Correlation-Based Approach to Calculate Rotation and Translation of Moving Cells, Cyrus A. Wilson and Julie A. Theriot

This approach is intended to retrieve the rotation angle and translation of an object, but could also be used for finding your object I guess.
I'm just not sure whether imageJ is capable of displaying the polar transformed magnitude spectra (I think there's a plugin for that).
Kind regards,
Winnok

___________________________

Winnok H. De Vos, PhD

Bio-imaging and Cytometry Unit
Dept. Molecular Biotechnology
University of Ghent
Coupure Links 653
9000 Ghent, Belgium

Tel +32 (0)9 264.59.71
Fax +32 (0)9 264.62.19



On 14 May 2010, at 12:06, ultrah wrote:

Hi Michael,

thank you for your reply. I already suspected that this was not going to be
easy. I will try to solve the problem with a batch of manually rotated
templates. If someone has another idea I would be very grateful

Thanks,

Felix
--
View this message in context: http://imagej.588099.n2.nabble.com/Template-Matching-with-Rotation-tp5047908p5050274.html
Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Template Matching with Rotation ?

Ronald Michaels
In reply to this post by ultrah
Is there a simple way to detect rotated shapes ?

Hi -

In concept, yes.

Disclaimer:  I work with convolution in the x,y coordinate system and I have no direct experience with r, theta systems.

In x,y coordinates, convolution will find the similar shaped (and oriented) object anywhere in the x, y coordinates of the image.  Convolution using r, theta coordinates should find a similar object anywhere along the theta axis.

Here is a possible route to a solution.  Convert the "certain shape" and the object in question to r, theta coordinates.  The r, theta origin should be at some definable, repeatable point like center of mass of the shape.  Convolve the images using the Convolution Theorem.  The result should have a response at the angle of rotation of the object in question.

I suspect that the hard part may be finding the location and center point of the individual shapes.

Perhaps someone more familiar with ImageJ plugins may be able to suggest a computational route within ImageJ.  I personally would use a Math package like Scilab for this problem.

Best wishes

Ron