Identification and counting of breeding birds

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

Identification and counting of breeding birds

EOF
I'm a ImageJ newbie. I'm trying semi-automatically count breeding birds (terns) in a colony. I have attached an rgb image and an inverted 8-bit image. Looking at the images I'd think it would not be too hard of a problem. It's somewhat similar to counting cells or nuclei and I have gone through examples so I know what I am doing. Unfortunately I'm not getting good results using either ITCN (http://biodev.ece.ucsb.edu/projects/bioimage/downloader/download/category/7) or Template matching plugins (https://sites.google.com/site/qingzongtseng/template-matching-ij-plugin) for the pictures I attached. I have also tried thresholding and then particle counting with no good results.

I'd appreciate suggestions on how to approach this probem.
Kind regards,
Eelke

terns_8bit
terns_rgb
Reply | Threaded
Open this post in threaded view
|

Re: Identification and counting of breeding birds

Emanuele Martini
This post was updated on .
Hi EOF,
do you need "birds segmentation" in order to extract morphological parameters or do you need a bird counter, that 'only' identify and count them?
In second case, I think that you have to move to something like feature extraction SIFT (staying in FIJI http://fiji.sc/Feature_Extraction) or SURF features or something in this field.
I never tried, but I think that it could be a good starting point.
Have a nice day,
Emanuele Martini
 
Image Analyst @Ifom-IEO research campus -MI-
Reply | Threaded
Open this post in threaded view
|

Re: Identification and counting of breeding birds

Romain Guiet
Hi Eelke,

you'll find below a short macro that "try" to count birds on your images, by detecting their black cap.
The detection is not 100% accurate, you will find some false positive and false negative. These errors could be due to the jpg artifacts. Do you have original (raw / tiff ) images without the compression artifact ? the result "could" be better...

Strategy : birds have black cap that I tried to detect.
a- convert image to HSB
b- use the saturation component
c- by default use a gaussian blur ( optionnal : use FeatureJ Laplacian because cap are "roundish" )
d- find the local maxima

You can
- decide to use gaussianBlur or Laplacian (gaussianBlurStatus = true / false)
-tune two parameters :
#gaussianBlur (/laplacianSmoothing) for  step c
#noiseTolerance for step d

Do not hesitate to contact me if you have questions,

Cheers,

Romain


////////////////////////////////////////////////////////////// start
//
gaussianBlurStatus = false ; // use false to use the Laplacian approach

if (gaussianBlurStatus){ // set gaussianBlur value
        gaussianBlur = 2;
}else{
        laplacianSmoothing = 3 ; // or laplacianSmoothing value
}

noiseTolerance = 10; // set noiseTolerance value

title = getTitle();

run("Select All");
run("Duplicate...", "title=hsb");
run("HSB Stack"); // convert to HSB
Stack.setChannel(2); // selection the channel 2, which is saturation

run("Brightness/Contrast..."); // not necessary for the workflow, just so ...
run("Enhance Contrast", "saturated=0.35"); // ... you can see jpg artifact, the macro could work better on tif images
run("Duplicate...", "title=saturation"); // duplicate it

if (gaussianBlurStatus){
        run("Gaussian Blur...", "sigma="+gaussianBlur); // blur a bit
} else{
        run("FeatureJ Laplacian", "compute smoothing="+laplacianSmoothing); // or use FeatureJ Laplacian to highlight "roundish" black cap
}

if (gaussianBlurStatus){
        run("Find Maxima...", "noise="+noiseTolerance+" output=[Point Selection]"); // detect local maxima, decrease the value if using laplacian
} else{
        run("Find Maxima...", "noise=10 output=[Point Selection] light");
}

selectWindow(title); // select the original image
run("Restore Selection"); // apply the detection

getSelectionCoordinates(x,y); // get the points coordinates
print (title+" : "+ lengthOf(x) + " birds detected"); // print in the log
//
////////////////////////////////////////////////////////////// end



---------------------------------------------------------------
Dr. Romain Guiet
Bioimaging and Optics Platform (PT-BIOP)
Ecole Polytechnique Fédérale de Lausanne (EPFL)
Faculty of Life Sciences
Station 19, AI 0140
CH-1015 Lausanne

Phone: [+4121 69] 39629
http://biop.epfl.ch/
---------------------------------------------------------------

________________________________________
De : ImageJ Interest Group [[hidden email]] de la part de Emanuele Martini [[hidden email]]
Envoyé : mardi 8 septembre 2015 18:14
À : [hidden email]
Objet : Re: Identification and counting of breeding birds

Hi EOF,
do you need "birds segmentation" in order to extract morphological
parameters or do you need a bird counter, that 'only' identify and count
them?
In second case, I think that you have to move to something SURF (staying in
FIJI http://fiji.sc/Feature_Extraction)
I never tried, but I think that it could be a good starting point.
Have a nice day,
Emanuele Martini




-----
Image Analyst @Ifom-IEO research campus -MI-
--
View this message in context: http://imagej.1557.x6.nabble.com/Identification-and-counting-of-breeding-birds-tp5014264p5014269.html
Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Identification and counting of breeding birds

Romain Guiet
Me again ,
Some parameters that gave me "satisfying" results

gaussianBlurStatus = false ;
laplacianSmoothing = 3 ;
noiseTolerance = 6;

gaussianBlurStatus = true;
gaussianBlur = 2;
noiseTolerance = 50;

for the corrected code below :

////////////////////////////////////////////////////////////// start
//
gaussianBlurStatus = false ; // use false to use the Laplacian approach

if (gaussianBlurStatus){ // set gaussianBlur value
        gaussianBlur = 2;
}else{
        laplacianSmoothing = 3 ; // or laplacianSmoothing value
}

noiseTolerance = 6; // set noiseTolerance value

title = getTitle();

run("Select All");
run("Duplicate...", "title=hsb");
run("HSB Stack"); // convert to HSB
Stack.setChannel(2); // selection the channel 2, which is saturation

run("Brightness/Contrast..."); // not necessary for the workflow, just so ...
run("Enhance Contrast", "saturated=0.35"); // ... you can see jpg artifact, the macro could work better on tif images
run("Duplicate...", "title=saturation"); // duplicate it

if (gaussianBlurStatus){
        run("Gaussian Blur...", "sigma="+gaussianBlur); // blur a bit
} else{
        run("FeatureJ Laplacian", "compute smoothing="+laplacianSmoothing); // or use FeatureJ Laplacian to highlight "roundish" black cap
}

if (gaussianBlurStatus){
        run("Find Maxima...", "noise="+noiseTolerance+" output=[Point Selection]"); // detect local maxima, decrease the value if using laplacian
} else{
        run("Find Maxima...", "noise="+noiseTolerance+" output=[Point Selection] light");
}

selectWindow(title); // select the original image
run("Restore Selection"); // apply the detection

getSelectionCoordinates(x,y); // get the points coordinates
print (title+" : "+ lengthOf(x) + " birds detected"); // print in the log
//
////////////////////////////////////////////////////////////// end


---------------------------------------------------------------
Dr. Romain Guiet
Bioimaging and Optics Platform (PT-BIOP)
Ecole Polytechnique Fédérale de Lausanne (EPFL)
Faculty of Life Sciences
Station 19, AI 0140
CH-1015 Lausanne

Phone: [+4121 69] 39629
http://biop.epfl.ch/
---------------------------------------------------------------

________________________________________
De : ImageJ Interest Group [[hidden email]] de la part de Romain Guiet [[hidden email]]
Envoyé : jeudi 10 septembre 2015 12:39
À : [hidden email]
Objet : Re: Identification and counting of breeding birds

Hi Eelke,

you'll find below a short macro that "try" to count birds on your images, by detecting their black cap.
The detection is not 100% accurate, you will find some false positive and false negative. These errors could be due to the jpg artifacts. Do you have original (raw / tiff ) images without the compression artifact ? the result "could" be better...

Strategy : birds have black cap that I tried to detect.
a- convert image to HSB
b- use the saturation component
c- by default use a gaussian blur ( optionnal : use FeatureJ Laplacian because cap are "roundish" )
d- find the local maxima

You can
- decide to use gaussianBlur or Laplacian (gaussianBlurStatus = true / false)
-tune two parameters :
#gaussianBlur (/laplacianSmoothing) for  step c
#noiseTolerance for step d

Do not hesitate to contact me if you have questions,

Cheers,

Romain


////////////////////////////////////////////////////////////// start
//
gaussianBlurStatus = false ;                                                            // use false to use the Laplacian approach

if (gaussianBlurStatus){                                                                        // set gaussianBlur value
        gaussianBlur = 2;
}else{
        laplacianSmoothing = 3 ;                                                                // or laplacianSmoothing value
}

noiseTolerance = 10;                                                                            // set noiseTolerance value

title = getTitle();

run("Select All");
run("Duplicate...", "title=hsb");
run("HSB Stack");                                                                                       // convert to HSB
Stack.setChannel(2);                                                                            // selection the channel 2, which is saturation

run("Brightness/Contrast...");                                                          // not necessary for the workflow, just so ...
run("Enhance Contrast", "saturated=0.35");                                      // ... you can see jpg artifact, the macro could work better on tif images
run("Duplicate...", "title=saturation");                                        // duplicate it

if (gaussianBlurStatus){
        run("Gaussian Blur...", "sigma="+gaussianBlur);                 // blur a bit
} else{
        run("FeatureJ Laplacian", "compute smoothing="+laplacianSmoothing);     // or use FeatureJ Laplacian to highlight "roundish" black cap
}

if (gaussianBlurStatus){
        run("Find Maxima...", "noise="+noiseTolerance+" output=[Point Selection]");     // detect local maxima, decrease the value if using laplacian
} else{
        run("Find Maxima...", "noise=10 output=[Point Selection] light");
}

selectWindow(title);                                                                            // select the original image
run("Restore Selection");                                                                       // apply the detection

getSelectionCoordinates(x,y);                                                           // get the points coordinates
print (title+" : "+ lengthOf(x) + " birds detected");           // print in the log
//
////////////////////////////////////////////////////////////// end



---------------------------------------------------------------
Dr. Romain Guiet
Bioimaging and Optics Platform (PT-BIOP)
Ecole Polytechnique Fédérale de Lausanne (EPFL)
Faculty of Life Sciences
Station 19, AI 0140
CH-1015 Lausanne

Phone: [+4121 69] 39629
http://biop.epfl.ch/
---------------------------------------------------------------

________________________________________
De : ImageJ Interest Group [[hidden email]] de la part de Emanuele Martini [[hidden email]]
Envoyé : mardi 8 septembre 2015 18:14
À : [hidden email]
Objet : Re: Identification and counting of breeding birds

Hi EOF,
do you need "birds segmentation" in order to extract morphological
parameters or do you need a bird counter, that 'only' identify and count
them?
In second case, I think that you have to move to something SURF (staying in
FIJI http://fiji.sc/Feature_Extraction)
I never tried, but I think that it could be a good starting point.
Have a nice day,
Emanuele Martini




-----
Image Analyst @Ifom-IEO research campus -MI-
--
View this message in context: http://imagej.1557.x6.nabble.com/Identification-and-counting-of-breeding-birds-tp5014264p5014269.html
Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
EOF
Reply | Threaded
Open this post in threaded view
|

Re: Identification and counting of breeding birds

EOF
Hi Romain,
This is great, thanks a lot. I got a little bit further after I posted
the question and used "finding local maxima" of the white against a
black background but ended up with quite a few false positives (bottles,
crabs, other stuff in the image) and false negatives. I will give your
macro a go and let you know how it went on the whole image.
Thanks again, very kind!
Eelke


On 09/10/2015 12:40 PM, Romain Guiet [via ImageJ] wrote:

> Me again ,
> Some parameters that gave me "satisfying" results
>
> gaussianBlurStatus = false ;
> laplacianSmoothing = 3 ;
> noiseTolerance = 6;
>
> gaussianBlurStatus = true;
> gaussianBlur = 2;
> noiseTolerance = 50;
>
> for the corrected code below :
>
> ////////////////////////////////////////////////////////////// start
> //
> gaussianBlurStatus = false ; // use false to use the Laplacian approach
>
> if (gaussianBlurStatus){ // set gaussianBlur value
>          gaussianBlur = 2;
> }else{
>          laplacianSmoothing = 3 ; // or laplacianSmoothing value
> }
>
> noiseTolerance = 6; // set noiseTolerance value
>
> title = getTitle();
>
> run("Select All");
> run("Duplicate...", "title=hsb");
> run("HSB Stack"); // convert to HSB
> Stack.setChannel(2); // selection the channel 2, which is saturation
>
> run("Brightness/Contrast..."); // not necessary for the workflow, just
> so ...
> run("Enhance Contrast", "saturated=0.35"); // ... you can see jpg
> artifact, the macro could work better on tif images
> run("Duplicate...", "title=saturation"); // duplicate it
>
> if (gaussianBlurStatus){
>          run("Gaussian Blur...", "sigma="+gaussianBlur); // blur a bit
> } else{
>          run("FeatureJ Laplacian", "compute
> smoothing="+laplacianSmoothing); // or use FeatureJ Laplacian to
> highlight "roundish" black cap
> }
>
> if (gaussianBlurStatus){
>          run("Find Maxima...", "noise="+noiseTolerance+" output=[Point
> Selection]"); // detect local maxima, decrease the value if using laplacian
> } else{
>          run("Find Maxima...", "noise="+noiseTolerance+" output=[Point
> Selection] light");
> }
>
> selectWindow(title); // select the original image
> run("Restore Selection"); // apply the detection
>
> getSelectionCoordinates(x,y); // get the points coordinates
> print (title+" : "+ lengthOf(x) + " birds detected"); // print in the log
> //
> ////////////////////////////////////////////////////////////// end
>
>
> ---------------------------------------------------------------
> Dr. Romain Guiet
> Bioimaging and Optics Platform (PT-BIOP)
> Ecole Polytechnique Fédérale de Lausanne (EPFL)
> Faculty of Life Sciences
> Station 19, AI 0140
> CH-1015 Lausanne
>
> Phone: [+4121 69] 39629
> http://biop.epfl.ch/
> ---------------------------------------------------------------
>
> ________________________________________
> De : ImageJ Interest Group [[hidden email]
> </user/SendEmail.jtp?type=node&node=5014305&i=0>] de la part de Romain
> Guiet [[hidden email] </user/SendEmail.jtp?type=node&node=5014305&i=1>]
> Envoyé : jeudi 10 septembre 2015 12:39
> À : [hidden email] </user/SendEmail.jtp?type=node&node=5014305&i=2>
> Objet : Re: Identification and counting of breeding birds
>
> Hi Eelke,
>
> you'll find below a short macro that "try" to count birds on your
> images, by detecting their black cap.
> The detection is not 100% accurate, you will find some false positive
> and false negative. These errors could be due to the jpg artifacts. Do
> you have original (raw / tiff ) images without the compression artifact
> ? the result "could" be better...
>
> Strategy : birds have black cap that I tried to detect.
> a- convert image to HSB
> b- use the saturation component
> c- by default use a gaussian blur ( optionnal : use FeatureJ Laplacian
> because cap are "roundish" )
> d- find the local maxima
>
> You can
> - decide to use gaussianBlur or Laplacian (gaussianBlurStatus = true /
> false)
> -tune two parameters :
> #gaussianBlur (/laplacianSmoothing) for  step c
> #noiseTolerance for step d
>
> Do not hesitate to contact me if you have questions,
>
> Cheers,
>
> Romain
>
>
> ////////////////////////////////////////////////////////////// start
> //
> gaussianBlurStatus = false ;
>                 // use false to use the Laplacian approach
>
> if (gaussianBlurStatus){
>                         // set gaussianBlur value
>          gaussianBlur = 2;
> }else{
>          laplacianSmoothing = 3 ;
>                           // or laplacianSmoothing value
> }
>
> noiseTolerance = 10;
>                         // set noiseTolerance value
>
> title = getTitle();
>
> run("Select All");
> run("Duplicate...", "title=hsb");
> run("HSB Stack");
>                                  // convert to HSB
> Stack.setChannel(2);
>                         // selection the channel 2, which is saturation
>
> run("Brightness/Contrast...");
>                 // not necessary for the workflow, just so ...
> run("Enhance Contrast", "saturated=0.35");
>         // ... you can see jpg artifact, the macro could work better on
> tif images
> run("Duplicate...", "title=saturation");
>         // duplicate it
>
> if (gaussianBlurStatus){
>          run("Gaussian Blur...", "sigma="+gaussianBlur);
> // blur a bit
> } else{
>          run("FeatureJ Laplacian", "compute
> smoothing="+laplacianSmoothing);     // or use FeatureJ Laplacian to
> highlight "roundish" black cap
> }
>
> if (gaussianBlurStatus){
>          run("Find Maxima...", "noise="+noiseTolerance+" output=[Point
> Selection]");     // detect local maxima, decrease the value if using
> laplacian
> } else{
>          run("Find Maxima...", "noise=10 output=[Point Selection] light");
> }
>
> selectWindow(title);
>                         // select the original image
> run("Restore Selection");
>                          // apply the detection
>
> getSelectionCoordinates(x,y);
>                  // get the points coordinates
> print (title+" : "+ lengthOf(x) + " birds detected");           // print
> in the log
> //
> ////////////////////////////////////////////////////////////// end
>
>
>
> ---------------------------------------------------------------
> Dr. Romain Guiet
> Bioimaging and Optics Platform (PT-BIOP)
> Ecole Polytechnique Fédérale de Lausanne (EPFL)
> Faculty of Life Sciences
> Station 19, AI 0140
> CH-1015 Lausanne
>
> Phone: [+4121 69] 39629
> http://biop.epfl.ch/
> ---------------------------------------------------------------
>
> ________________________________________
> De : ImageJ Interest Group [[hidden email]
> </user/SendEmail.jtp?type=node&node=5014305&i=3>] de la part de Emanuele
> Martini [[hidden email] </user/SendEmail.jtp?type=node&node=5014305&i=4>]
> Envoyé : mardi 8 septembre 2015 18:14
> À : [hidden email] </user/SendEmail.jtp?type=node&node=5014305&i=5>
> Objet : Re: Identification and counting of breeding birds
>
> Hi EOF,
> do you need "birds segmentation" in order to extract morphological
> parameters or do you need a bird counter, that 'only' identify and count
> them?
> In second case, I think that you have to move to something SURF (staying in
> FIJI http://fiji.sc/Feature_Extraction)
> I never tried, but I think that it could be a good starting point.
> Have a nice day,
> Emanuele Martini
>
>
>
>
> -----
> Image Analyst @Ifom-IEO research campus -MI-
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Identification-and-counting-of-breeding-birds-tp5014264p5014269.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://imagej.1557.x6.nabble.com/Identification-and-counting-of-breeding-birds-tp5014264p5014305.html
>
> To unsubscribe from Identification and counting of breeding birds, click
> here
> <
> NAML
> <
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>