Removing grill/grate - "horizontal stripes in background"

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

Removing grill/grate - "horizontal stripes in background"

Kiwa
This post was updated on .
Hello All,

I am trying to process this image (as a first step for a live camera processing):
d

(I know this image is not really good, I would need to take a picture directly above the belt)

My goal is to calculate the surface of the food over the surface on the belt.
I would like to remove the background to keep only the "food" and then calculate its area !
The color doesn't matter since I basically want to calculate the surface.
Then grayscale / binary image is fine for me.


I am facing difficulties with the grill/grid in the background.
I tried several approaches :
- Grayscale + Thresholding + Bandpass filter
- Split RBG channel, Threshold min/max on each, Merge
- Edge detection
- Watershed ..

So far, the best image I got is after applying good Levels/Windows.. to the Red channel image.
Here :



Do you guys have any ideas how I could remove the horizontal lines ?

Do you think it's feasible or better to do a detection/object-tracking of the large white/colored features to get multiple ROI for each food part and then work on them separately ?

I am open to any suggestions,

Thanks a lot,
K.
Reply | Threaded
Open this post in threaded view
|

Re: Removing grill/grate - "horizontal stripes in background"

Joel Sheffield
Hi Kiwa,

Will this help?  This is a crude image, and would need some tweaking.
I ran FFT on the image, and then drew a circle of r=34.4 centered on the
center of the image.  Then I used edit>selection>make inverse to invert the
selection, and then filled it with black (It must be true black, 0,0,0).
This blanked out everything but the central area,  and then I ran an
inverse FFT on the result.  The grid is mostly gone, but there is something
of a halo around each of the pieces of food.

Joel

[image: Inline image 1]



Joel B. Sheffield, Ph.D
Department of Biology
Temple University
Philadelphia, PA 19122
Voice: 215 204 8839
e-mail: [hidden email]
URL:  *http://tinyurl.com/khbouft <http://tinyurl.com/khbouft>*


On Thu, Aug 14, 2014 at 10:49 AM, Kiwa <[hidden email]> wrote:

> Hello All,
>
> I am trying to process this image:
> <http://imagej.1557.x6.nabble.com/file/n5009203/Food.jpg>
>
> I would like to remove the background to keep only the "food".
> The color doesn't matter since I basically want to calculate the surface of
> the food.
> (I know this image is not really good, I would need to take a picture
> directly above the belt)
>
> I am facing difficulties with the grill/grid in the background.
> I tried several approaches :
> - Grayscale + Thresholding + Bandpass filter
> - Split RBG channel, Threshold min/max on each, Merge
> - Edge detection
> - Watershed ..
>
> So far, the best image I got is after applying good Levels/Windows.. to the
> Red channel image.
> Here :
> <http://imagej.1557.x6.nabble.com/file/n5009203/Food.jpg>
>
>
> Do you guys have any ideas how I could remove the horizontal lines ?
>
> Do you think it's feasible or better to do a detection/object-tracking of
> the large white/colored features to get multiple ROI for each food part and
> then work on them separately ?
>
> I am open to any suggestions,
>
> Thanks a lot,
> K.
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Removing-grill-grate-horizontal-stripes-in-background-tp5009203.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

Inverse FFT of Food.jpg (47K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Removing grill/grate - "horizontal stripes in background"

Michael Schmid
In reply to this post by Kiwa
Hi Kiwa,

in such a situation good lighting is the key to success:

(1) with light from left and right only, you should be able to eliminate the reflections on the grid
(2) have the background as dark as possible (block light that would illuminate background objects below the grid)
(3) have the same light intensity in all of the image (currently, it gets much darker towards the back).

Michael
________________________________________________________________
On Aug 14, 2014, at 16:49, Kiwa wrote:

> Hello All,
>
> I am trying to process this image:
> <http://imagej.1557.x6.nabble.com/file/n5009203/Food.jpg>
>
> I would like to remove the background to keep only the "food".
> The color doesn't matter since I basically want to calculate the surface of
> the food.
> (I know this image is not really good, I would need to take a picture
> directly above the belt)
>
> I am facing difficulties with the grill/grid in the background.
> I tried several approaches :
> - Grayscale + Thresholding + Bandpass filter
> - Split RBG channel, Threshold min/max on each, Merge
> - Edge detection
> - Watershed ..
>
> So far, the best image I got is after applying good Levels/Windows.. to the
> Red channel image.
> Here :
> <http://imagej.1557.x6.nabble.com/file/n5009203/Food.jpg>
>
>
> Do you guys have any ideas how I could remove the horizontal lines ?
>
> Do you think it's feasible or better to do a detection/object-tracking of
> the large white/colored features to get multiple ROI for each food part and
> then work on them separately ?
>
> I am open to any suggestions,
>
> Thanks a lot,
> K.
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Removing-grill-grate-horizontal-stripes-in-background-tp5009203.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: Removing grill/grate - "horizontal stripes in background"

Kiwa
This post was updated on .
In reply to this post by Joel Sheffield
@Joel :
Hi Joel,
Thanks for your response.
 With some other operations with your image as a starting point I got this :



This kind of result is fine, since I can get the coverage of the food on the belt from an histogram.
However, FFT and inverse FFT seems to take some time, so it maybe not fit a live camera feed.
But it is still a nice first solution for my problem !

How did you choose to use R=34.4 ?
Since my goal is to make it automatic for every frame of a video, I wonder if I can put it as a parameter.
Does it mean that the filter is cutting small frequencies (ie small edges?) ?
Is it already filtering only horizontal small frequencies ? if not, is there any other selection filter (your circle) that I can use to cut only the horizontal line ?

Thanks again!



Regards,
Kiwa.
Reply | Threaded
Open this post in threaded view
|

Re: Removing grill/grate - "horizontal stripes in background"

Kiwa
In reply to this post by Michael Schmid
@Michael :

Thanks for your advice.
(3) have the same light intensity in all of the image (currently, it gets much darker towards the back).

I will take more precaution with my footage.
Put the camera directly above the belt. I will probably process only the center region of the picture since the shadow in the back is getting the region much darker.
(2) have the background as dark as possible (block light that would illuminate background objects below the grid)
I unfortunately can't change the background.

(1) with light from left and right only, you should be able to eliminate the reflections on the grid

That's interesting ! Is there any particular good way to install the light from left/right to avoid reflections ?

Thanks again !



Regards,
Kiwa.
Reply | Threaded
Open this post in threaded view
|

Re: Removing grill/grate - "horizontal stripes in background"

Michael Schmid
In reply to this post by Kiwa
Hi Kiwa,

putting the camera straight above the belt/grid is a good idea, for sure.

My idea was having the light from left&right at a rather glancing angle. With proper shields at the left&right this may prevent illuminating the background objects below the grid.

Concerning the reflections, let us assume that the camera has a viewing angle of +/-20 ° left and right w.r.t. its axis, which I assume perpendicular. Then, the light must be at the sides of the belt such that it is more than 20° from the vertical direction when seen from any position of the grid. This simply follows when assuming specular reflection at the top of the grid.
  http://en.wikipedia.org/wiki/Specular_reflection

More glancing (having the lights further down) is better, however, because the grid won't be ideal, it will have imperfections that may still cause specular reflection.

Michael
________________________________________________________________
On Aug 14, 2014, at 19:21, Kiwa wrote:

> @Joel :
> Hi Joel,
> Thanks for your response.
> With some other operations with your image as a starting point I got this :
>
> <http://imagej.1557.x6.nabble.com/file/n5009210/Inverse_FFT_of_Food_processed.jpg>
>
> This kind of result is fine, since I can get the coverage of the food on the
> belt from an histogram.
> However, FFT and inverse FFT seems to take some time, so it maybe not fit a
> live camera feed.
> But it is still a nice first solution for my problem !
>
> How did you choose to use R=34.4 ?
> Since my goal is to make it automatic for every frame of a video, I wonder
> if I can put it as a parameter.
> Does it mean that the filter is cutting small frequencies (ie small edges?)
> ?
> Is it already filtering only horizontal small frequencies ? if not, is there
> any other selection filter (your circle) that I can use to cut only the
> horizontal line ?
>
> Thanks again!
>
> @Michael :
>
> Thanks for your advice.
> /(3) have the same light intensity in all of the image (currently, it gets
> much darker towards the back).
> /
> I will take more precaution with my footage.
> Put the camera directly above the belt. I will probably process only the
> center region of the picture since the shadow in the back is getting the
> region much darker.
> /(2) have the background as dark as possible (block light that would
> illuminate background objects below the grid) /
> I unfortunately can't change the background.
>
> /(1) with light from left and right only, you should be able to eliminate
> the reflections on the grid
> /
> That's interesting ! Is there any particular good way to install the light
> from left/right to avoid reflections ?
>
> Thanks again !
>
>
>
> Regards,
> Kiwa.

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

Re: Removing grill/grate - "horizontal stripes in background"

Joel Sheffield
In reply to this post by Kiwa
@Kiwa
I'm glad that it was helpful.  I chose the value of 34 just by trying
several different sizes to see what would work.  You might do better to try
some others as well.  Actually, the filter is removing the lower
frequencies.  In the FFT display, the highest frequencies are towards the
center.  That display is also rotated 90 degrees from the image, so you
could experiment with an oval, rather than a circle to see if you get more
clarity of the samples. I tried it, but the image preserved the vertical
grid lines.  Not so useful.

As far as speed is concerned, You might try a lower resolution
image....fewer pixels to process.


Joel





Joel B. Sheffield, Ph.D
Department of Biology
Temple University
Philadelphia, PA 19122
Voice: 215 204 8839
e-mail: [hidden email]
URL:  *http://tinyurl.com/khbouft <http://tinyurl.com/khbouft>*


On Thu, Aug 14, 2014 at 1:21 PM, Kiwa <[hidden email]> wrote:

> @Joel :
> Hi Joel,
> Thanks for your response.
>  With some other operations with your image as a starting point I got this
> :
>
> <
> http://imagej.1557.x6.nabble.com/file/n5009210/Inverse_FFT_of_Food_processed.jpg
> >
>
> This kind of result is fine, since I can get the coverage of the food on
> the
> belt from an histogram.
> However, FFT and inverse FFT seems to take some time, so it maybe not fit a
> live camera feed.
> But it is still a nice first solution for my problem !
>
> How did you choose to use R=34.4 ?
> Since my goal is to make it automatic for every frame of a video, I wonder
> if I can put it as a parameter.
> Does it mean that the filter is cutting small frequencies (ie small edges?)
> ?
> Is it already filtering only horizontal small frequencies ? if not, is
> there
> any other selection filter (your circle) that I can use to cut only the
> horizontal line ?
>
> Thanks again!
>
> @Michael :
>
> Thanks for your advice.
> /(3) have the same light intensity in all of the image (currently, it gets
> much darker towards the back).
> /
> I will take more precaution with my footage.
> Put the camera directly above the belt. I will probably process only the
> center region of the picture since the shadow in the back is getting the
> region much darker.
> /(2) have the background as dark as possible (block light that would
> illuminate background objects below the grid) /
> I unfortunately can't change the background.
>
> /(1) with light from left and right only, you should be able to eliminate
> the reflections on the grid
> /
> That's interesting ! Is there any particular good way to install the light
> from left/right to avoid reflections ?
>
> Thanks again !
>
>
>
> Regards,
> Kiwa.
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Removing-grill-grate-horizontal-stripes-in-background-tp5009203p5009210.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