Git Product home page Git Product logo

grip's Introduction

logo

Join the chat at https://gitter.im/WPIRoboticsProjects/GRIP Build Status codecov.io Github Releases

GRIP Computer Vision Engine

GRIP (the Graphically Represented Image Processing engine) is an application for rapidly prototyping and deploying computer vision algorithms, primarily for robotics applications. Developing a vision program can be difficult because it is hard to visualize the intermediate results. GRIP simplifies and accelerates the creation of vision systems for experienced users and reduces the barrier to entry for inexperienced users. As a result, many teams with minimal computer vision knowledge have successfully used GRIP since the 2016 FIRST Robotics Competition game.

Features

  • Intuitive drag and drop UI.
  • Active development community.
  • Generates Java, C++, and Python code directly from the pipeline (Example usage here)!
  • Extensible!
  • Deploys and runs headless.
  • Supports various network protocols
  • CUDA acceleration
  • OS Support:
    • Windows
    • OSX
    • Linux (minimum Ubuntu 18.04 or libc version 2.27+)
    • Embedded Linux ARM (NI RoboRIO)

Getting Started

  1. Download the newest release for your operating system.
  2. Run the included installer.
  3. Open GRIP

Check out the release notes and the wiki for more information.

Note for Linux users: GRIP requires GTK2 to be installed. Most Ubuntu-based distributions include it, but some other distros such as Arch may require it to be manually installed. GRIP also requires libc version 2.27 or higher; for Ubuntu-based distributions, this requires Ubuntu 18.04 or newer.

Building GRIP From Source

To build and run, use the included Gradle wrapper script on a Unix System:

./gradlew :ui:run

On Windows:

gradlew :ui:run

If you don't have an internet connection you can build using the --offline flag if you have built GRIP once before.

Running Tests

To do a complete check of functionality of GRIP, use the included Gradle wrapper script on a Unix System:

./gradlew check

On Windows:

gradlew check

CUDA Support

To enable CUDA acceleration, CUDA 10.0 needs to be installed on your computer. CUDA 10.1 may work on Linux systems, but Windows must use 10.0.

When running or building from source, add the Gradle flag -Pcuda to enable CUDA acceleration (eg ./gradlew :ui:run -Pcuda)

Note that CUDA acceleration is not available for all operations.

Code generation does not support CUDA - it is only used for operations running in GRIP.

Contributing

See the guide on setting up build tools in the wiki.

grip's People

Contributors

amansharma123456 avatar austinshalit avatar bbbblarry avatar docprofsky avatar drbobbob avatar gitter-badger avatar grantperkins avatar jacibrunning avatar jlleitschuh avatar mfkahn avatar osulacam avatar patrickpenguinturtle avatar paularudy avatar peterjohnson avatar phurley avatar pmalmsten avatar rich-coe avatar samcarlberg avatar thadhouse avatar thetriplev avatar thomasjclark avatar usaidpro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grip's Issues

Line filter Issues

Line Filter should take a minimum and a maximum.
It should indicate what the length's scale is, or alternatively it should be relative to the size of the mat so it doesn't matter if the resize operation changes.

Objects should not call `eventBus.register(this)` in constructors

Problem

Registering an object to the event bus inside of a constructor call can result in a subscriber being called prior to all of the fields in the class being fully constructed. This can lead to null pointer exceptions for fields that are final and should have been initialized in the classes constructor.

Relavent Gitter Discussion Discovery of problem and discussion of how to fix it.

Guava Google Groups Discussion with Dev

Don't publish the "this" reference during construction

One of the mistakes that can introduce a data race into your class is to expose the this reference to another thread before the constructor has completed. Sometimes the reference is explicit, such as directly storing this in a static field or collection, but other times it can be implicit, such as when you publish a reference to an instance of a non-static inner class in a constructor. Constructors are not ordinary methods -- they have special semantics for initialization safety. An object is assumed to be in a predictable, consistent state after the constructor has completed, and publishing a reference to an incompletely constructed object is dangerous. Listing 2 shows an example of introducing this sort of race condition into a constructor. It may look harmless, but it contains the seeds of serious concurrency problems.
-Brian Goetz

Resolution

This can be resolved by ensuring that constructors never call a register method

I'm getting errors when I try to acess my webcam's frame rate

java.lang.NullPointerException
    at edu.wpi.grip.ui.preview.TextAreaSocketPreviewView.onSocketChanged(TextAreaSocketPreviewView.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at edu.wpi.grip.core.Socket.setValue(Socket.java:90)
    at edu.wpi.grip.core.OutputSocket.setValue(OutputSocket.java:51)
    at edu.wpi.grip.core.sources.CameraSource.lambda$startVideo$87(CameraSource.java:166)
    at java.lang.Thread.run(Thread.java:745)
Webcam Frame Grabber Thread crashed with uncaught exception:
java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-5
    at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:236)
    at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:423)
    at javafx.scene.Parent$2.onProposedChange(Parent.java:367)
    at com.sun.javafx.collections.VetoableListDecorator.setAll(VetoableListDecorator.java:113)
    at com.sun.javafx.collections.VetoableListDecorator.setAll(VetoableListDecorator.java:108)
    at com.sun.javafx.scene.control.skin.LabeledSkinBase.updateChildren(LabeledSkinBase.java:575)
    at com.sun.javafx.scene.control.skin.LabeledSkinBase.handleControlPropertyChanged(LabeledSkinBase.java:204)
    at com.sun.javafx.scene.control.skin.LabelSkin.handleControlPropertyChanged(LabelSkin.java:49)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase.lambda$registerChangeListener$61(BehaviorSkinBase.java:197)
    at com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler$1.changed(MultiplePropertyChangeListenerHandler.java:55)
    at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:89)
    at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
    at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:103)
    at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:110)
    at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:144)
    at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:49)
    at javafx.beans.property.StringProperty.setValue(StringProperty.java:65)
    at javafx.scene.control.Labeled.setText(Labeled.java:145)
    at edu.wpi.grip.ui.pipeline.input.SliderInputSocketView.lambda$new$69(SliderInputSocketView.java:52)
    at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:349)
    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
    at javafx.beans.property.DoublePropertyBase.fireValueChangedEvent(DoublePropertyBase.java:106)
    at javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.java:113)
    at javafx.beans.property.DoublePropertyBase.set(DoublePropertyBase.java:147)
    at javafx.scene.control.Slider.setValue(Slider.java:213)
    at edu.wpi.grip.ui.pipeline.input.SliderInputSocketView.updateSliderValue(SliderInputSocketView.java:60)
    at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at edu.wpi.grip.core.Socket.setValue(Socket.java:90)
    at edu.wpi.grip.core.OutputSocket.setValue(OutputSocket.java:51)
    at edu.wpi.grip.core.sources.CameraSource.lambda$startVideo$87(CameraSource.java:166)
    at java.lang.Thread.run(Thread.java:745)

Exception: cvGrabFrame() Error: Could not grab frame. (Has start() been called?)

What were the actions performed prior to this error appearing?

System Info:

Property Name Property
javafx.version 8.0.60
java.runtime.name Java(TM) SE Runtime Environment
java.vm.version 25.60-b23
java.vm.vendor Oracle Corporation
java.vm.name Java HotSpot(TM) 64-Bit Server VM
java.runtime.version 1.8.0_60-b27
java.awt.graphicsenv sun.awt.CGraphicsEnvironment
javafx.runtime.version 8.0.60-b27
os.name Mac OS X
os.version 10.11.1
os.arch x86_64
file.encoding UTF-8
java.vm.info mixed mode
java.version 1.8.0_60
sun.arch.data.model 64
sun.cpu.endian little

Stack Trace:

java.lang.IllegalStateException: Failed to grab image
    at edu.wpi.grip.core.sources.CameraSource.lambda$startVideo$23(CameraSource.java:110)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.bytedeco.javacv.FrameGrabber$Exception: cvGrabFrame() Error: Could not grab frame. (Has start() been called?)
    at org.bytedeco.javacv.OpenCVFrameGrabber.grab(OpenCVFrameGrabber.java:244)
    at edu.wpi.grip.core.sources.CameraSource.lambda$startVideo$23(CameraSource.java:108)
    ... 1 more

Image previews not displaying

I created a FindLines and FilterLines operation and turned on the image previews for them. Nothing showed up in the preview area, but I did notice that the scrollbar changed, indicating that it was allocating an empty window about the right size. It did work the first time I tried it. I'll continue to play with it to see if I can find a pattern.

Simple Mat Creation

When using "mask" type mats, it would be super helpful to have some sort of simple editing functions in GRIP for creating simple mats. Single-channel rectangle drawing would be fine for this.

Webcams don't work on Windows

Also opening a camera that does not exist causes an exception.

edit: Opening cameras on windows does not work, if the camera exists on that slot or not. The problem seems to be in the way you handle the camera class with opencv. I have used a program written with java to process an image.

System Info:

Property Name Property
javafx.version 8.0.66
java.runtime.name Java(TM) SE Runtime Environment
java.vm.version 25.66-b17
java.vm.vendor Oracle Corporation
java.vm.name Java HotSpot(TM) 64-Bit Server VM
java.runtime.version 1.8.0_66-b17
java.awt.graphicsenv sun.awt.Win32GraphicsEnvironment
javafx.runtime.version 8.0.66-b17
os.name Windows 10
os.version 10.0
os.arch amd64
file.encoding Cp1252
java.vm.info mixed mode
java.version 1.8.0_66
sun.arch.data.model 64
sun.cpu.endian little

Stack Trace:

Exception: cvCreateCameraCapture() Error: Could not create camera capture.

java.io.IOException: A problem occurred trying to start the frame grabber for Webcam 1
    at edu.wpi.grip.core.sources.CameraSource.startVideo(CameraSource.java:97)
    at edu.wpi.grip.core.sources.CameraSource.<init>(CameraSource.java:68)
    at edu.wpi.grip.core.sources.CameraSource.<init>(CameraSource.java:43)
    at edu.wpi.grip.ui.pipeline.AddSourceView.lambda$null$39(AddSourceView.java:94)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.bytedeco.javacv.FrameGrabber$Exception: cvCreateCameraCapture() Error: Could not create camera capture.
    at org.bytedeco.javacv.OpenCVFrameGrabber.start(OpenCVFrameGrabber.java:179)
    at edu.wpi.grip.core.sources.CameraSource.startVideo(CameraSource.java:95)
    ... 6 more

FindBlobs shows original image when no blobs are found, even if "show input image" isn't checked

Using this save file:
Move your camera very fast. The image will show through even though the "show original image" is unchecked.

<grip:Pipeline>
  <sources>
    <grip:Camera>
      <property name="deviceNumber" value="0"/>
    </grip:Camera>
  </sources>
  <steps>
    <grip:Step name="resize">
      <grip:Input step="0" socket="0"/>
      <grip:Input step="0" socket="1"/>
      <grip:Input step="0" socket="2">
        <value>0.25</value>
      </grip:Input>
      <grip:Input step="0" socket="3">
        <value>0.25</value>
      </grip:Input>
      <grip:Input step="0" socket="4">
        <value>INTER_LINEAR</value>
      </grip:Input>
      <grip:Output step="0" socket="0" published="false" previewed="true"/>
    </grip:Step>
    <grip:Step name="Find Blobs">
      <grip:Input step="1" socket="0"/>
      <grip:Input step="1" socket="1">
        <value>1</value>
      </grip:Input>
      <grip:Input step="1" socket="2">
        <value>
          <double>0.0</double>
          <double>1.0</double>
        </value>
      </grip:Input>
      <grip:Input step="1" socket="3">
        <value>false</value>
      </grip:Input>
      <grip:Output step="1" socket="0" published="false" previewed="true"/>
    </grip:Step>
  </steps>
  <connections>
    <grip:Connection>
      <grip:Output step="0" socket="0" published="false" previewed="true"/>
      <grip:Input step="1" socket="0"/>
    </grip:Connection>
    <grip:Connection>
      <grip:Output source="0" socket="0" published="false" previewed="false"/>
      <grip:Input step="0" socket="0"/>
    </grip:Connection>
  </connections>
  <sink>
    <value class="edu.wpi.grip.core.sinks.DummySink"/>
  </sink>
</grip:Pipeline>

Kinect Support

Do you have any plans to package Kinect support with GRIP? I'm not sure how it would work, since every platform implements drivers differently, but it could potentially be very useful.

NullPointerException: Lost Connection to IP Webcam

After shutting down my IP webcam, GRIP threw a null pointer error. Ideally, GRIP would notice that it lost connection, and display the last frame it received as well as a "lost connection" notice somewhere in the UI. Ideal behavior would also include a UI control or intermittent pinging to restore connectivity when it becomes available.

Stack Trace:

java.lang.NullPointerException
    at org.bytedeco.javacv.IPCameraFrameGrabber.grab(IPCameraFrameGrabber.java:121)
    at edu.wpi.grip.core.sources.CameraSource.lambda$startVideo$23(CameraSource.java:108)
    at java.lang.Thread.run(Thread.java:745)

Appveyor is broken

Don't know how to fix this. We should probably check the log file and try to figure out what is going wrong.

Chocolatey installed 0/1 package(s). 1 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log

Solve the FRC 2014 vision challenge

In aerial assist, you could get more points in autonomous if your robot scored in the "hot" goal. One of the approaches to this was using computer vision to identify which goal was lit up There's a page on screensteps explaining one approach (there's also c code using the NI libraries)

If add the following features, this program would theoretically be useful in 2014:

  • HSV/HSL threshold operation
  • Particle analysis
    • Find a list of clusters
    • Filter particles
      • Minimum size
      • Aspect ratio range

The remaining math in the screensteps page would probably happen in the control system code, not in GRIP.

Can't save and load projects with axis camera sources

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1770)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1653)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.control.MenuItem.fire(MenuItem.java:462)
    at com.sun.javafx.scene.control.ControlAcceleratorSupport.lambda$doAcceleratorInstall$12(ControlAcceleratorSupport.java:165)
    at com.sun.javafx.scene.control.ControlAcceleratorSupport$$Lambda$251/1135422936.run(Unknown Source)
    at com.sun.javafx.scene.KeyboardShortcutsHandler.processAccelerators(KeyboardShortcutsHandler.java:347)
    at com.sun.javafx.scene.KeyboardShortcutsHandler.dispatchBubblingEvent(KeyboardShortcutsHandler.java:163)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$KeyHandler.process(Scene.java:3965)
    at javafx.scene.Scene$KeyHandler.access$1800(Scene.java:3911)
    at javafx.scene.Scene.impl_processKeyEvent(Scene.java:2040)
    at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2502)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:197)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:147)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$349(GlassViewEventHandler.java:228)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$339/1953432847.get(Unknown Source)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:404)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:227)
    at com.sun.glass.ui.View.handleKeyEvent(View.java:546)
    at com.sun.glass.ui.View.notifyKey(View.java:956)
    at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
    at com.sun.glass.ui.gtk.GtkApplication.lambda$null$48(GtkApplication.java:139)
    at com.sun.glass.ui.gtk.GtkApplication$$Lambda$41/1327763628.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1767)
    ... 39 more
Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot initialize CameraSource without either a device number or address : Cannot initialize CameraSource without either a device number or address
---- Debugging information ----
message             : Cannot initialize CameraSource without either a device number or address
cause-exception     : java.lang.IllegalArgumentException
cause-message       : Cannot initialize CameraSource without either a device number or address
class               : edu.wpi.grip.core.sources.CameraSource
required-type       : edu.wpi.grip.core.sources.CameraSource
converter-type      : edu.wpi.grip.core.serialization.SourceConverter
line number         : 3
class[1]            : java.util.ArrayList
converter-type[1]   : com.thoughtworks.xstream.converters.collections.CollectionConverter
class[2]            : edu.wpi.grip.core.Pipeline
converter-type[2]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
version             : 0.1.0
-------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.addCurrentElementToCollection(CollectionConverter.java:98)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:91)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:85)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.unmarshal(CollectionConverter.java:80)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:480)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:412)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:263)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1206)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1190)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1061)
    at edu.wpi.grip.core.serialization.Project.open(Project.java:58)
    at edu.wpi.grip.core.serialization.Project.open(Project.java:52)
    at edu.wpi.grip.ui.MainWindowView.openProject(MainWindowView.java:146)
    ... 49 more
Caused by: java.lang.IllegalArgumentException: Cannot initialize CameraSource without either a device number or address
    at edu.wpi.grip.core.sources.CameraSource.createFromProperties(CameraSource.java:122)
    at edu.wpi.grip.core.serialization.SourceConverter.unmarshal(SourceConverter.java:53)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    ... 72 more

Sources should have a start and stop method

Sources should not be started until either the user chooses to add it in the UI, the core triggers a start event (headless. This will ensure that sources that are loaded from a

Starting a source:

  • UI
    • New sources (added by the UI) should be verified that they can start without a problem
      • These sources will start running after the creation UI closes
    • Sources loaded from a save file will be created stopped
      • These sources will start running after the user presses the "play" button
      • There will also be a "start all sources" button that will post a StartAllSourcesEvent
  • Headless mode
    • Sources loaded from a save file will be created stopped
      • These sources will be initialized with a post StartAllSourcesEvent

Closing a camera

Closing a camera crashes Grip, the camera wont show up even if i put in the right values.

New Pipeline Structure

Pipeline should be run in a separate thread

The pipeline should have a timer and will run at a specific rate.
Setting the source value will no longer runs the pipeline; instead it flags a dirty bit.

for(;;) {
    if(sem.wait(time) || sources.dirty) {
        run();
    }
}

This will make everything sequential and makes mutable data safe.

Operations To Remove

Please create a list of operations and inputs that should be removed and leave them here.

  • batch distance
  • ddepth
  • houghlines
  • mask <== Better to keep and extend the functionality.
  • cvtColor -> dstCn

#bluescreen windows 10

While running Find Lines and Filter lines for an extended period of time I encountered a blue screen. I was running a TV show on a second monitor which might been related.

Input sockets can have multiple connections

Currently it is possible to connect multiple things to an input of a step. This shouldn't be allowed - it makes the value of the socket ambiguous and dependent on the timing of the events in the application. Instead, when the user tries to make a connection to an input socket that is already connected to something, we could either not allow it, or just remove the old connection.

steps

Dependency Injection Pattern Choice

Dependency Injection

When implementing dependency injection there are two common patterns that are used. Constructor Injection and Field Injection.

Please use this post to collect evidence supporting/against one pattern or the other.

Field Injection

  • Harder to test

    Field Injection
    Guice injects fields with the @Inject annotation. This is the most concise injection, but the least testable.
    -Guice wiki

  • Slower

    Second issue is performance. A constructor call (direct or by reflection) is always faster than a bunch of reflection field assignments. Dependency injection frameworks must use reflection analysis to build dependency tree and create reflection constructors. This process causes additional performance hit.
    -Maciej Chałapuk

  • Breaks the encapsulation paradigm

    From the philosophical point of view, field injection breaks encapsulation, which is one of four fundamentals of object-oriented programming, which is the main paradigm of Java.
    -Maciej Chałapuk

  • Encourages Dependency hiding

    If there was one thing I could take away from #Spring it was being able to use @Autowired on fields… sigh #BedCon
    It encourages hiding dependencies, which is the opposite of what DI actually wants to achieve…

  • Considered 'Auto-Magic' by manny

    So i have always stayed away from field injection... There is a lot of what I consider automagic behind the scenes, and from my opinion I always prefer explicit over implicit.

    • Scott Hepburn (Kronos Inc. Software Engineer, uses Spring)
  • Impossible to create instances of a class without using reflection

  • Reduces the amount of "boilerplate" code you have to write.

  • JavaFX uses field injection by default

Constructor Injection

  • Promotes smaller classes

    • If you start adding too many constructor fields it becomes a sign to refactor your code.
  • Promotes being able to define concrete state rules about a class.

    The core of the problem here is that code you’ve written allows clients to create instances of the class in an invalid state. The whole purpose of a type is clients being able to rely on the invariants it enforces. It’s one of the reasons you use an EmailAddress type over a plain String to represent email adresses in your code: clients can be sure the instance they get is a valid email address as the value object enforces this constraint during construction. A String can potentially be anything, validated or not - how do you know?
    -Oliver Gierke

  • Provides a way to write tests without an injection framework

    At least with constructor and setter injection, you have the option of not using the frameworks and/or reflection in your tests.

Project Lombok will solve the code bloat problem.

Error Handling with Return to Normal

Event: ErrorEvent

  • Throwable
  • Optional Message
  • Origin

Event: ErrorClearedEvent

  • Origin

ErrorWitness (final class)

  • Constructor
    • EventBus
    • Origin
  • Methods
    • error
      • throwable
      • Optional message
    • allClear
      • only posts the status when the witness's state has changed.
    • question
      • returns true if there is no error

Exception: cvCreateCameraCapture() Error: Could not create camera capture.

What were the actions performed prior to this error appearing?

yeah uh uh type - Jonathan Leitschuh

tried to use a webcam on windows

System Info:

Property Name Property
javafx.version 8.0.66
java.runtime.name Java(TM) SE Runtime Environment
java.vm.version 25.66-b17
java.vm.vendor Oracle Corporation
java.vm.name Java HotSpot(TM) 64-Bit Server VM
java.runtime.version 1.8.0_66-b17
java.awt.graphicsenv sun.awt.Win32GraphicsEnvironment
javafx.runtime.version 8.0.66-b17
os.name Windows 10
os.version 10.0
os.arch amd64
file.encoding windows-1252
java.vm.info mixed mode
java.version 1.8.0_66
sun.arch.data.model 64
sun.cpu.endian little

Stack Trace:

java.io.IOException: A problem occurred trying to start the frame grabber for Webcam 0
    at edu.wpi.grip.core.sources.CameraSource.startVideo(CameraSource.java:97)
    at edu.wpi.grip.core.sources.CameraSource.<init>(CameraSource.java:68)
    at edu.wpi.grip.core.sources.CameraSource.<init>(CameraSource.java:43)
    at edu.wpi.grip.ui.pipeline.AddSourceView.lambda$null$39(AddSourceView.java:94)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.bytedeco.javacv.FrameGrabber$Exception: cvCreateCameraCapture() Error: Could not create camera capture.
    at org.bytedeco.javacv.OpenCVFrameGrabber.start(OpenCVFrameGrabber.java:179)
    at edu.wpi.grip.core.sources.CameraSource.startVideo(CameraSource.java:95)
    ... 6 more

GRIP should not prompt me to use webcams I don't have

Trying to use any webcam other then 0 when your system only has 1 webcam throws an exception. Ideally GRIP would enumerate the webcams on your system and only present ones that won't make it crash.

Stack Trace:

java.io.IOException: A problem occurred trying to start the frame grabber for Webcam 1
    at edu.wpi.grip.core.sources.CameraSource.startVideo(CameraSource.java:97)
    at edu.wpi.grip.core.sources.CameraSource.<init>(CameraSource.java:68)
    at edu.wpi.grip.core.sources.CameraSource.<init>(CameraSource.java:43)
    at edu.wpi.grip.ui.pipeline.AddSourceView.lambda$null$39(AddSourceView.java:94)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.bytedeco.javacv.FrameGrabber$Exception: cvCreateCameraCapture() Error: Could not create camera capture.
    at org.bytedeco.javacv.OpenCVFrameGrabber.start(OpenCVFrameGrabber.java:179)
    at edu.wpi.grip.core.sources.CameraSource.startVideo(CameraSource.java:95)
    ... 6 more

ArithmeticException: / by zero

What were the actions performed prior to this error appearing?

I added a webcam. I'm using a USB webcam (Logitech 9000 Pro) on Windows 10 64-bit

Message: Camera Frame Grabber Thread crashed with uncaught exception

System Info:

Property Name Property
javafx.version 8.0.66
java.runtime.name Java(TM) SE Runtime Environment
java.vm.version 25.66-b17
java.vm.vendor Oracle Corporation
java.vm.name Java HotSpot(TM) 64-Bit Server VM
java.runtime.version 1.8.0_66-b17
java.awt.graphicsenv sun.awt.Win32GraphicsEnvironment
javafx.runtime.version 8.0.66-b17
os.name Windows 10
os.version 10.0
os.arch amd64
file.encoding Cp1252
java.vm.info mixed mode
java.version 1.8.0_66
sun.arch.data.model 64
sun.cpu.endian little

Stack Trace:

java.lang.ArithmeticException: / by zero
    at edu.wpi.grip.core.sources.CameraSource.lambda$start$18(CameraSource.java:158)
    at java.lang.Thread.run(Thread.java:745)

The RoboRIO Deployment Problem

Sources

  1. Having multiple clients try to access the frames of a webcam at the same time can create problems (right??) so we have to ensure that when GRIP deploys we have to stop the local instances sources.
  2. Currently it is impossible to create a source that is not valid on your machine. This source may, however, due to networking or webcams being plugged into different ports, be valid on the roboRIO, how do we handle this?

Sinks

If we have a sink that is publishing after we deploy GRIP over to the robot then there will be two network tables nodes publishing to the same values. As such, we should make it so that when when we push the jar over to the robot it should should suspend camera access on the local machine.

Get this on startup

Is this OK?

:ui:run
ID Type Value
Dec 10, 2015 9:50:18 AM com.sun.javafx.css.StyleConverterImpl getInstance
SEVERE: StyleConverterImpl : converter Class is null for : com.sun.javafx.scene.layout.region.CornerRadiiConverter
Dec 10, 2015 9:50:18 AM com.sun.javafx.css.StyleConverterImpl readBinary
SEVERE: could not deserialize com.sun.javafx.scene.layout.region.CornerRadiiConverter
could not deserialize com.sun.javafx.scene.layout.region.CornerRadiiConverter

Building 90% > :ui:run

Input sockets keep values from old connections

When a connection to an input socket is removed, the socket still has the last value obtained from that connection. One of the reasons this is bad is because some types (like Mats) are basically pointers, so the value of the input socket keeps changing as long as the Mat keeps getting modified by the step it used to be connected to.

OpenCV Operation Issues

Let's collect all of the issues related to the generated OpenCV functions in one place so we can keep up with the progress on them easily. Here are the ones I've found by playing around with it a little.

  • We probably shouldn't map an input socket to the dtype or ddepth parameter. We want to provide as low-level access as necessary, but these don't really seem to map to useful ideas in the application, even though they happen to parameters to many opencv functions.
  • accumulateSquare (and other accumulate functions that we don't wrap) aren't really operations, they're more like implementations of the += operator. It doesn't make sense to make operations for them.
  • batchDistance crashes. The domain for K should be 1 to MAX_VALUE, not MIN_VALUE to MAX_VALUE.
  • canny crashes. We need to implement checkbox socket controls.
  • compare, flipcode, etc... Many enums are shown as integers. We should detect which parameters seem to be enums.
  • cornerHarris, cornerMinEigenVal, possible more output Mats of floats. We should allow float Mats to be previewed.
  • dilate probably remove the border stuff, or at least make it actually work.
  • normalize keeps printing errors about "Unknown/unsupported norm type". I guess the enums aren't being generated with the right values.
  • pow, sqrt only work on floating point Mats. I'm also not sure if we need to support these operations right now, but if we discover that taking the square root of an image is useful, we should add a way to convert between pixel data types.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.