Splash water detection at swimming pool using thermal image

3 views (last 30 days)
[EDIT: 20110525 13:50 CDT - reformat - WDR]
Greeting. I am developing an algorithm for splash water detection in the swimming pool. Here is my proposed algorithm.
2) extract the black pixel from the image, as the splash water is represented with black colour.
3) once extract the black pixel, convert it to white in black and white image, save it as 'be4' image. http://i52.tinypic.com/almgd4.jpg
4) repeat step 1-3 for the next image. Save it as 'now' image after converting it to black and white. image 2 --> http://i52.tinypic.com/50d9c.jpg 'now' image --> http://i56.tinypic.com/t6b7l2.jpg
5) Conduct image subtraction between 'be4' and 'now' image. The result is imageResult. http://i52.tinypic.com/jijmt5.jpg
Problem: I do not know to use which criteria to differentiate the splash water from the other noise in the image [ like water wave ]. Here I attach my code.
a ='C:\Users\Ace\Desktop\splashTest\';
A =dir( strcat (a, '*.bmp' ));
for icount = 1 : length( A )
%load the background
%icount = 1;
buf = strcat(a, A(icount).name);
im1 = imread (buf);
%imshow(im1)
[y, x, z] = size(im1);
%obtain black item
for i = 1:x
for j = 1:y
RG = uint16( im1(j, i, 1) )+ uint16( im1(j, i, 2) );
if RG == 0
temp = 1;
else
temp = 0;
end
bw2(j,i) = temp;
end
end
%figure, imshow(bw2);
%load previous image whose black has been extracted and coverted to
%white.
be4 = bw2;
buf = strcat(a, A(icount+1).name);
im1 = imread (buf);
[y, x, z] = size(im1);
%obtain black item
for i = 1:x
for j = 1:y
RG = uint16( im1(j, i, 1) )+ uint16( im1(j, i, 2) );
if RG == 0
temp = 1;
else
temp = 0;
end
bw2(j,i) = temp;
end
end
figure, imshow(bw2);
now = bw2;
imResult = imabsdiff( be4, now );
%figure; imshow( imResult );
Sorry for my long-winded statement. I am very clueless now. Google also gives me no promising result. I hope Image Processing experts can suggest me some ideas. Thanks in advance.

Answers (1)

Sean de Wolski
Sean de Wolski on 25 May 2011
bw2 = ~any(im1(:,:,[1 2]),3); %your first set of for-loops, it'll be the same for the second where your define temp.
Instead of imabsdiff, you could use xor for logical images it'll be the same result just faster.
I guess I don't really understand what you mean by wave noise. Do you want to get rid of big black area, black areas that are touching the object in the previous image? Please describe what makes something "noise" as you refer to it.
  4 Comments
Eric
Eric on 26 May 2011
Sometimes when the swimmer swims nears to the image border, the splash water will touch the image border.
Erm Do you suggest that I should use imclearborder, followed by bwareaopen before I compare 2 images?
Sean de Wolski
Sean de Wolski on 26 May 2011
For the above image that would work. However, if the splash is on the border it wouldn't. It's very difficult for me (and everyone else) to give you pointers for generalization when we don't really know the scope of the project and every permutation of the images.
If you want the splash, define it: what makes it different from everything else: is it usually located in one spot (beneath the diving board?), is it always some shape that could be measured, it always a certain size, or distance from the pool edge, how about its magnitude of change between images? These are just a few of probably thousands of criteria you can use. Pick a few to build a profile of the splash, then the actual image processing is doable.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!