image recognistion with response
John Wood from United Kingdom  [67 posts]
12 year
I am new to Roborealm and knocking on a bit so treat me gently..
My problem is that I need to identify a shape/s as my webcam pans. The background will be different as it pans. I then require a simple o.p (high or low) and my Pic would do the rest. Could be IR link, just a quick pulse.
Just need that starting point and hopefully I will trial and error my way through it...For a cherry on the cake could it place text against each object on the streaming image...
Pushing 70 ish so please go slowly, I built the electronics for the Cam PTZ, can write basic and work with Photo shop so may help get to grips with the filtering.
But this is all new and just need that helping push in the right direction. Time an't on my side...... ;-)

Cheer in anticipation.... John
Anonymous 12 year
Hi John

Can you post a video of what you describe on YouTube and send us a link

John Wood from United Kingdom  [67 posts] 12 year
Thanks for such a quick response.
I will try and explain what I built and what it does.
We have approx 8 to 12 boats on anchorage on the river, basically all in a line. I have a camera with a servo to pan the camera and stepper motors control zoom and focus.
These are controled with a Pic, this holds the position of the boats..but some are on swinging moorings so these have at least two programmed positions  so one of these positions is a vacant view, as is any boat that leaves the mooring and it miss any that are added to the mooring until I reprogram the Pic for it to stop at the new positions.It pans approx 120 deg.
I wish to automate this, see boat, pause,add boat name.etc..the system works great but a pain adding or taking out stop positions...sorry  I can not show you the link as the moorings are empty until April and due to security are not public domain.
Cheers John  
John Wood from United Kingdom  [67 posts] 12 year
I have found a couple of screenshots from last year, one is the zoomed view I use for pausing, the other shows an unzoomed view though this view is to give you an idea of an overall view and is of no consequence for what I want to do.
The boats distances from the camera are approx 1/5th mile to 1/2ml from the camera.
Depending on the tide some boats can be in one of two positions if moored to a single chain so require two pauses to make sure the boat is seen in one or the other...and some boats may leave their mooring for a week or so, the cam still pauses on the vacant mooring....this is why I would like the Cam to pause only where there is a boat present...hope this makes sense.
I would only require a pulse when a boat is in view which would tell the Pic to pause on that boat..

Cheers John  

Anonymous 12 year

There are a couple ways to approach this but let me see if I understand what you are asking for.

You want to automate the process of moving the camera to a set number of  locations (using pan and zoom) and stop when it sees a boat. The boat image would then be presented to another application that would allow you to annotate that image.

Now given that you will probably not have a database of all the boat images to begin with what you are looking for is a non-water detector. I.e. if the camera moves to a position and just see's water, it will move to the next position. But if it sees something that is not water  (note that it could be a rock, buoy, etc) it would send a single to the PIC that something interesting is in view.

At least that's the most generic way to approach this and given that you have a repeatable image position (assuming the pan system does not move much) then this is possible. For example, the zoomed in boat image could be processed into

using the attached robofile. This basically looks for something with rough edges that is not the property of the surrounding water. Note the use of the crop module to eliminate the shoreline since that would probably be incorrectly seen as non-water. You'd probably need something akin to this at each location to avoid triggering off background items.

Is this what you are looking for? Or something similar to that?


John Wood from United Kingdom  [67 posts] 12 year
Hi Steven,
Thanks for you interest in my problem, it is much appreciated.
You have nearly got it in one.
Image comparison would be a no no as the boats can be at varying angles.
You are therefore spot on with attacking the problem at looking for boat against water or as the most solid object.
I was hoping that there may be a mask
that could be set as I use on my home security to take out all the shoreline and above.
The largest problem is that all settings must be transparent to the viewer as it is used by owners to keep an eye on their boats as we have ferocious tides and quite a few boats have broke away from their moorings and sails becoming untied with gales so it's reassuring for owners that they can check their boats from home.
You are correct that the camera pans an area through approx 120 degs and would pan across around 10+ boats of which six or seven will change position twice a day due to the tide.
At present the cam moves to programmed positions eg Servopos 88,115,119,128,133.etc..pausing on each position this loops five times on full zoom then does two no-zoom wide angle pans with no pausing so no recognition require for this action.
I have now got RoboRealm talking with the Pic...the idea is have an output from RR as a boat is sensed this output will stop the pan for the paused view deactivate Pic input then start pan again activate Pic input ready for the next sensed boat.
This is an absolutely fantastic program!!...brilliant..well done and if the above is not doable I have lots of things I want to try with RR.
I will have to get some shut eye as it is 12.30 and have been playing with RR since midday.
I will look at the attachment in the morning... Hope I can get to sleep as my brain and me are buzzing with  this and loads of other ideas for future projects with RR.
Many thanks again.
Sent from my iPhone

John Wood from United Kingdom  [67 posts] 12 year
Hi Steve
Thanks for the code and just amazed at the features, sort of mind boggled with all the variables that are available, goodness knows the thousands of combinations that are available.
With looking at what you have supplied I would never have got there so now is a case of reverse engineering to see it will tweek for what I require.
You have done exactly as I required and pointed me on a course of partly understanding a small part of what is on offer with RR.
My birithday is on the 22nd and I am getting a new laptop so will pay and download onto that computer.
I will no doubt be in touch in the coming days just for tweeking advice.
Just one question, is there a way  to have a min/ max size for the detected size so cut out anything smaller than an average boat and anything larger..
I have just linked to the club camera and can see that this looks the way to go, I do pickup ducks and buoys this does though show it is the way to go, so if a a size filter is possible then even nearer the answer..

I have attached two pictures of the current Club Cam doing it's winter panning, sort of scenic until the boats go back on their moorings, it shows the image captures so really pleased with what you have produced and will have a play see what I can damage... ;-)

Look at the posts and you will see I did not sleep well... ;-)

Thaks again john

John Wood from United Kingdom  [67 posts] 12 year
Hi Steven,

Ignore the size of object  in the last Post as I have seen and played with Blob,etc and got it nearly as I need. Crop I am getting to understand so I will play with these sections.
How or what is the best way to extract data in ascii or dec of the outlined image.
I loaded the Example Red Option Tracking and saw quite a few variables that could be worked with.
In the code you supplied I looked at the Watch Variables and  nothing really could be used to pass on to the PIC.
I played about with the Red Option Tracking and sort of got some data to relate for the  PIC and it did what I was testing for though not what I need, just proved it could talk to the PIC..
If you could guide me to where to extract data I can play around with that..

On the Picture I sent was a dingy not on the Trot we use, the boats are much larger but proved the file you sent is doing the biz...


John Wood from United Kingdom  [67 posts] 12 year
Hi Steven,

Thanks for putting  me on the right track .
Today I tuned the filters and then found usingCOG y axis to extract the data to send to the PIC.
Every thing is working as I require and will test it in all light conditions as White Horses may cause a false alarm, now got to wait for a gale.. ;-)


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index