-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Max threshold to the default algorithm, and added a "do not engage" default algorithm #524
Conversation
…by temporary camera whiteouts from sudden exposure changes
…as the algorithm iterates through x/y pixels it now ignores the pixel if it is inside the do-not-engage rectangle
@@ -401,12 +401,14 @@ public void setDne(Rectangle rectangle) { | |||
*/ | |||
public ArrayList<Integer> getThresholds() | |||
{ | |||
if (detectorAlgorithm instanceof WebcamMotionDetectorDefaultAlgorithm | |||
|| detectorAlgorithm instanceof WebcamMotionDetectorDefaultWithDNE) | |||
if (detectorAlgorithm instanceof WebcamMotionDetectorDefaultAlgorithm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kkanzelmeyer,
This code is of course valid, but it would be better to have getThreasholds() extracted to an interface, such as:
public interface ThresholdsAlgorithm {
ArrayList<Integer> getThresholds();
}
And then, both WebcamMotionDetectorDefaultAlgorithm
and WebcamMotionDetectorDefaultWithDNE
can implement this interface. With this we can change this code to check instanceof interface instead of every class:
public ArrayList<Integer> getThresholds()
if (detectorAlgorithm instanceof ThresholdsAlgorithm) {
return ((ThresholdsAlgorithm) detectorAlgorithm).getThresholds();
}
throw new UnsupportedOperationException("This method is only valid for algorithms which implements " + ThresholdsAlgorithm.class);
}
<name>Webcam Capture - GStreamer 1.x Driver</name> | ||
<description>Webcam Capture driver using GStreamer 1.x framework to grab frames from camera devices</description> | ||
|
||
<repositories> | ||
<repository> | ||
<id>ftp-repo</id> | ||
<name>sarxos-ftp-repo</name> | ||
<url>http://sarxos.pl/maven2</url> | ||
<!-- <url>http://repo.sarxos.pl/maven2</url> --> | ||
<url>http://repo.sarxos.pl/maven2/index.php</url> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be without index.php. I'm not sure if this won't confuse Maven when it tries to download artifact from this repo.
The "Do No Engage" algorithm is simply a rectangle specified by the user in which the algorithm will ignore motion. The feature is implemented by allowing the user to pass a Rectangle into the algorithm, and then the algorithm only processes pixels that are not contained in the Rectangle. This commit is a squash of pull request #524 by Kevin Kanzelmeyer (@kkanzelmeyer). It was produced by cherry picking all changes into the master, squasing, removing all changes that relates to pom.xml files (these were unnecessary) and the ones related to GStramer 1.x driver and then finally reworking to address comments from review.
Hi @kkanzelmeyer, I downloaded your pull request, squashed multiplied commits into one, removed unnecessary changes and reworked it to remove other issues I found when testing. I also simplified the solution by removing debugging mechanisms, integrating DNE feature into default motion detection algorithm and I also added example demonstrating how to use it. You can find changes in: 9ee9d94 Since this feature is already merged into the master as one commit I will simply close this pull request. Thank you Kevin! |
Very cool, thank you for adding the feature to the project!
Kevin Kanzelmeyer
…On Fri, Aug 18, 2017 at 7:35 AM, Bartosz Firyn ***@***.***> wrote:
Hi @kkanzelmeyer <https://github.com/kkanzelmeyer>,
I downloaded your pull request, squashed multiplied commits into one,
removed unnecessary changes and reworked it to remove other issues I found
when testing. I also simplified the solution by removing debugging
mechanisms, integrating DNE feature into default motion detection algorithm
and I also added example demonstrating how to use it.
You can find changes in:
9ee9d94
<9ee9d94>
Since this feature is already merged into the master as one commit I will
simply close this pull request.
Thank you Kevin!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#524 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACxaoYuaSpS-0M7zKzaMqWpkF-Ai2XpZks5sZYUagaJpZM4LuGSA>
.
|
I have a camera fixed outside watching an area of my house. It's been using this webcam-capture library for almost two years. Its been great! I noticed that when clouds pass in front of the sun it would cause the aperture of the webcam to open. Then when the clouds passed the camera would be flooded with light for one or two frames while the exposure adjusted to the light, which triggered a motion event. I was able to to mostly negate the problem by setting a fixed exposure value so that the exposure wouldn't change so much when the environmental light changes. However, it gave me the idea to implement a max threshold feature in the motion sensor algorithm so that sudden "white outs" caused by exposure would not trigger a motion event. The default max threshold is set to 100, effectively removing the limit. An accessor method has been added to allow the user to adjust the value.
Another challenge I encountered having a motion detection camera deployed is the hanging flower seen in the upper right of the image below. When the wind blows and the plant swings it would trigger a motion event (rightfully so). It gave me the idea to add a "Do Not Engage" feature to the algorithm. The "Do No Engage" feature is simply a rectangle specified by the user in which the algorithm will ignore motion. The feature is implemented by allowing the user to pass a
Rectangle
into the algorithm, and then the algorithm only processes pixels that are not contained in theRectangle
.