Modifying the a JFeatureLib class

23 views
Skip to first unread message

matt von

unread,
Feb 18, 2015, 3:55:19 PM2/18/15
to jfeat...@googlegroups.com
Hi,

I am making used of a Tamura  feature extraction from a library (JFeatureLib). While I managed to get great results with the contrast and directionality value of this feature, I cannot see any relation at all between the coarseness value and the roughness of the image. Therefore I was thinking to tweak the Tamura class, to maybe get the results that I am hoping for. 

More specifically I was considering to modify the loop below to consider more then just 3 neighborhood pixels:
for (int k = 0; k < 3; k++) {
         tmp
= Math.max(this
                   
.differencesBetweenNeighborhoodsHorizontal(
                                       x
, y, k),
                     
this.differencesBetweenNeighborhoodsVertical(
                                       x
, y, k));
         
if (result < tmp) {
                  maxK
= k;
                  result
= tmp;
         
}
}
}

First of all, is it permitted to modify a class

If yes, is their an easy way how to modify the source code of a library? I am still a bit green at this and till know I cannot succeed. 

Regards,
Mat

Franz Graf

unread,
Feb 19, 2015, 6:20:17 AM2/19/15
to jfeat...@googlegroups.com
Hi Mat,

sure you are allowed to modify the files.
The Tamura features are parts of the LIRE project. JFeatureLib "just"
provides wrappers for it.
So if you want to change the Tamura Features, you're going to deal a bit
with LIRE:
https://code.google.com/p/lire/source/browse/trunk/src/main/java/net/semanticmetadata/lire/imageanalysis/Tamura.java

If I'd be in your situation, I'd try to follow the following approach:

Checkout the JFeatureLib Source and add a "MyTamura" class into a
package structure similar to LIRE (
net.semanticmetadata.lire.imageanalysis.MyTamura). Just copy the
original Tamura file.

Then just copy the JFeatureLib Tamura-Wrapper (
https://github.com/locked-fg/JFeatureLib/blob/master/src/main/java/de/lmu/ifi/dbs/jfeaturelib/features/Tamura.java
), call it MyTamura and refrence the new MyTamura-class you just created.

public class MyTamura extends LireWrapper {
public Tamura() {
super(new net.semanticmetadata.lire.imageanalysis.MyTamura());
}
}

Then you should be able to call your "MyTamura" easily via standard
workflow in JFeaturelib - AND you still have the possibility to compare
agains the regular tamura features (and you don't have to modify Lire
directly).

Hope this helps!

Franz


Am 18.02.2015 um 21:55 schrieb matt von:
> Hi,
>
> I am making used of a Tamura feature extraction from a library
> (JFeatureLib). While I managed to get great results with the *contrast*
> and *directionality* value of this feature, I cannot see any relation at
> all between the *coarseness* value and the roughness of the image.
> Therefore I was thinking to tweak the Tamura class, to maybe get the
> results that I am hoping for.
>
> More specifically I was considering to modify the loop below to consider
> more then just 3 neighborhood pixels:
> |
> for(intk =0;k <3;k++){
> tmp =Math.max(this
> .differencesBetweenNeighborhoodsHorizontal(
> x,y,k),
> this.differencesBetweenNeighborhoodsVertical(
> x,y,k));
> if(result <tmp){
> maxK =k;
> result =tmp;
> }
> }
> }
> |
>
> First of all, is it permitted to modify a class?
>
> If yes, is their an easy way how to modify the source code of a library?
> I am still a bit green at this and till know I cannot succeed.
>
> Regards,
> Mat
>
> --
> You received this message because you are subscribed to the Google
> Groups "JFeatureLib" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jfeaturelib...@googlegroups.com
> <mailto:jfeaturelib...@googlegroups.com>.
> To post to this group, send email to jfeat...@googlegroups.com
> <mailto:jfeat...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--
Dr. Franz Graf
http://www.Lockede.de

matt von

unread,
Feb 22, 2015, 4:38:27 AM2/22/15
to jfeat...@googlegroups.com
Hi Franz,

Thanks for your help I managed to perform changes to the Tamura class with the instructions you provided! Still no luck with obtaining the desired result for the Tamura's coarseness feature though hehe! 

Matthew
Reply all
Reply to author
Forward
0 new messages