Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

Vision update #3

Open
wants to merge 324 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
324 commits
Select commit Hold shift + click to select a range
36453e2
Merge branch 'SelectionBugFix' of https://github.com/iliterobotics/FR…
danielchristopher1 Jan 31, 2015
a6539cf
Merge pull request #39 from iliterobotics/SelectionBugFix
oconnelc Jan 31, 2015
f561d5c
Added object detector renderable controls
oconnelc Jan 31, 2015
b7ffa7a
Merge pull request #40 from iliterobotics/Controls
oconnelc Jan 31, 2015
ff97c66
The hsv window now converts rgba images to hsv
danielchristopher1 Jan 31, 2015
d04d050
Added min contour %
oconnelc Jan 31, 2015
cfaa915
Merge pull request #41 from iliterobotics/Controls
oconnelc Jan 31, 2015
c28215f
Merge pull request #42 from iliterobotics/HSVWindow
oconnelc Jan 31, 2015
9601c45
Merge branch 'master' into gradleMaster
oconnelc Jan 31, 2015
3cb8adc
Merge pull request #43 from iliterobotics/gradleMaster
oconnelc Jan 31, 2015
0efddc2
Gradle fix
oconnelc Jan 31, 2015
69edfe8
Merge pull request #44 from iliterobotics/gradleMaster
oconnelc Jan 31, 2015
46bd890
Newest and working version with gradle
danielchristopher1 Jan 31, 2015
4b8433a
Fixed another bug with the rectangle selection tool
danielchristopher1 Feb 1, 2015
7ffea81
Beginning to implement the message system
danielchristopher1 Feb 2, 2015
10c7cbe
Added an extra layer of protection for some of the api classes via co…
danielchristopher1 Feb 2, 2015
bcf9daf
Updated the README
danielchristopher1 Feb 2, 2015
775382e
Updated the README
danielchristopher1 Feb 2, 2015
4bc257d
Merge branch 'master' of https://github.com/iliterobotics/FRC-Vision …
danielchristopher1 Feb 2, 2015
c709d5b
Added json dependency to project
danielchristopher1 Feb 2, 2015
58422d6
Merge pull request #48 from iliterobotics/json
oconnelc Feb 2, 2015
c245bd1
Merge pull request #49 from iliterobotics/MessageAPI
oconnelc Feb 2, 2015
ca3320d
Removd gradle properties
oconnelc Feb 5, 2015
22d629d
Changes to the public api
danielchristopher1 Feb 6, 2015
cc90eb9
Changes to the public api
danielchristopher1 Feb 6, 2015
a245543
Merge pull request #50 from iliterobotics/MessageAPI
danielchristopher1 Feb 6, 2015
26d1957
Deleted xml files
danielchristopher1 Feb 11, 2015
52a3a2d
Merge branch 'master' of https://github.com/iliterobotics/FRC-Vision
danielchristopher1 Feb 11, 2015
33d09fa
Updated the API
oconnelc Feb 11, 2015
ca90545
Merge pull request #51 from iliterobotics/VisionAPI
oconnelc Feb 11, 2015
3585f9a
Image Panel is working
danielchristopher1 Feb 11, 2015
333e0da
The ImagePanel now properly uses the api
danielchristopher1 Feb 11, 2015
e4d15fc
Updated ImagePanel
danielchristopher1 Feb 11, 2015
e96e759
Merge pull request #52 from iliterobotics/ImagePanel
oconnelc Feb 11, 2015
a146e09
Worked on the json class
danielchristopher1 Feb 11, 2015
5f7b1ab
Merge pull request #53 from iliterobotics/XML
oconnelc Feb 11, 2015
3dfe9b0
Added number four image
oconnelc Feb 12, 2015
a2ce61f
Merge pull request #56 from iliterobotics/Images
oconnelc Feb 12, 2015
8bd9997
Finished the json manager
danielchristopher1 Feb 12, 2015
62f6cea
Merge pull request #57 from iliterobotics/JSONManager
danielchristopher1 Feb 12, 2015
2c099af
Refactored the ImagePanel to fix some issues with repaint and allow f…
oconnelc Feb 13, 2015
98faa85
Merge pull request #58 from iliterobotics/Images
oconnelc Feb 13, 2015
23df476
First commit
MaruthiBasava Feb 12, 2015
edc42f7
Added Image Blender example
MaruthiBasava Feb 13, 2015
87bc60b
Save dialog now saves to json
danielchristopher1 Feb 13, 2015
0e88cf7
Merge branch 'master' of https://github.com/iliterobotics/FRC-Vision
danielchristopher1 Feb 13, 2015
943db0a
Blended the images
MaruthiBasava Feb 13, 2015
85ba775
Merge pull request #59 from iliterobotics/imageBlender
oconnelc Feb 13, 2015
23183de
Some values now loaded through json
danielchristopher1 Feb 13, 2015
db20c99
Merge pull request #60 from iliterobotics/JSONConfiguration
danielchristopher1 Feb 13, 2015
6401e6c
Cleaned up the ImageBlender code
oconnelc Feb 13, 2015
a849fd2
Merge pull request #61 from iliterobotics/ImageBlender
oconnelc Feb 13, 2015
c0f17a7
Added a slider to control the overlay alpha value
danielchristopher1 Feb 13, 2015
a8063c7
Merge branch 'OverlaySlider'
oconnelc Feb 13, 2015
7c52c7a
Merge branch 'master' of github.com:iliterobotics/FRC-Vision
oconnelc Feb 13, 2015
ce6e339
Fixed the initial slider value and merged in latest changes
oconnelc Feb 13, 2015
cd55f47
Cleaned up the ImageBlender. Specifically added Javadoc, and made it
oconnelc Feb 13, 2015
073f7e5
Merge pull request #63 from iliterobotics/ImageBlenderInitialSize
oconnelc Feb 13, 2015
9d5197e
Overlay image path is now loaded from json
danielchristopher1 Feb 14, 2015
246ac89
Merge pull request #64 from iliterobotics/json
danielchristopher1 Feb 14, 2015
e374760
Added full image overlay
MaruthiBasava Feb 14, 2015
addbd26
Merge pull request #67 from iliterobotics/imageBlender
oconnelc Feb 14, 2015
03ac5b4
Changed JFRAME to JPANEL
MaruthiBasava Feb 14, 2015
4a73604
Added a button to save the current frame
danielchristopher1 Feb 14, 2015
e747473
Merge pull request #68 from iliterobotics/SaveButton
danielchristopher1 Feb 14, 2015
3ae2685
Created multiple camera interface and cleaned up the Propertis
oconnelc Feb 14, 2015
ecf548a
Merge pull request #69 from iliterobotics/MultiImages
oconnelc Feb 14, 2015
b06d7a3
Merge branch 'master' into imageBlender
oconnelc Feb 14, 2015
d84c6e9
Merge branch 'imageBlender'
oconnelc Feb 14, 2015
575f847
Added new camera IP for the alignment camera
oconnelc Feb 14, 2015
8f72d54
Pushed the overlay generator
oconnelc Feb 14, 2015
7826820
Merge pull request #71 from iliterobotics/OverlayGenerator
oconnelc Feb 14, 2015
d2c57d9
Fixed Bugs that were found on the real system
oconnelc Feb 14, 2015
35ca354
Merge pull request #72 from iliterobotics/OverlayGenerator
oconnelc Feb 14, 2015
c3e0f42
Added a tool to generate overlays, updated the color detect to work o…
oconnelc Feb 14, 2015
447e84e
Merge pull request #73 from iliterobotics/OverlayGenerator
oconnelc Feb 14, 2015
e5f07ed
Overlay Generator
oconnelc Feb 14, 2015
e1fd25c
Merge pull request #74 from iliterobotics/OverlayGenerator
oconnelc Feb 14, 2015
ca4a409
Refactored alot, added alot of json related things
danielchristopher1 Feb 14, 2015
c1a6015
Merged Daniel's changes
oconnelc Feb 14, 2015
f6bb7b5
Merge branch 'Development'
oconnelc Feb 14, 2015
b802fed
Cleaned up missing merge
oconnelc Feb 14, 2015
4c7aa9c
Each set of color blob in the json array now has a name
danielchristopher1 Feb 15, 2015
647eae2
Merge pull request #76 from iliterobotics/Development
danielchristopher1 Feb 15, 2015
4ccd197
Blob data is now loaded in from the json file
danielchristopher1 Feb 15, 2015
48392c5
Removed some files that werent needed
danielchristopher1 Feb 15, 2015
aeda386
Merge pull request #77 from iliterobotics/BlobData
danielchristopher1 Feb 15, 2015
3f50146
Minor changes
danielchristopher1 Feb 15, 2015
e5c3a61
Blob data loaded in from json is now given to the blob detection
danielchristopher1 Feb 15, 2015
e81c508
Merge pull request #80 from iliterobotics/BlobTrainer
danielchristopher1 Feb 15, 2015
8742332
BlobConfig file now reloads after changes are made
danielchristopher1 Feb 15, 2015
cbe1d15
Merge pull request #81 from iliterobotics/BlobTrainer
oconnelc Feb 15, 2015
b2cadc8
Added Canny and Sobel tool
oconnelc Feb 15, 2015
46f72c8
Fixed the invalid overlay image path
danielchristopher1 Feb 15, 2015
a8dd772
Merge pull request #83 from iliterobotics/BlobTrainer
danielchristopher1 Feb 15, 2015
fbccec5
Extracted every file path to properties.json
danielchristopher1 Feb 15, 2015
471b09e
Added some notes on how to do muliple object detect
oconnelc Feb 15, 2015
fcf5a36
Updated the ImageBlender to use the static image
oconnelc Feb 15, 2015
0c989da
Merge pull request #84 from iliterobotics/ImageBlenderWithStill
oconnelc Feb 15, 2015
6a823ea
Extracted even more hardcoded values to json
danielchristopher1 Feb 15, 2015
6eaae19
Fixed blob trainer
danielchristopher1 Feb 15, 2015
edfa0fb
Updated to fix some bugs from the last committ
oconnelc Feb 15, 2015
60f5715
Merge pull request #85 from iliterobotics/MULTIPLE_BLOB_NOTES
oconnelc Feb 15, 2015
c5e1b30
Merge pull request #86 from iliterobotics/ImageBlenderWithStill
danielchristopher1 Feb 15, 2015
f0edbdf
Added alpha slider and tote overlay
oconnelc Feb 15, 2015
ac44095
Merge pull request #87 from iliterobotics/ImageBlenderWithStill
oconnelc Feb 15, 2015
aa166ee
Changed overlay graphics
danielchristopher1 Feb 15, 2015
c4074a3
Fixed merge conflicts
danielchristopher1 Feb 15, 2015
ab282e6
Merge pull request #88 from iliterobotics/BlobTrainer
danielchristopher1 Feb 15, 2015
2216edf
Update README.md
danielchristopher1 Feb 15, 2015
4046fff
Added a new method to the api
danielchristopher1 Feb 15, 2015
adf8ab3
Merge pull request #89 from iliterobotics/BlobTrainer
danielchristopher1 Feb 15, 2015
34209f6
Refreshed the project
MaruthiBasava Feb 20, 2015
e1a9ac6
Better refreash rates
MaruthiBasava Feb 20, 2015
c6a8021
Faster Refresh rates
MaruthiBasava Feb 20, 2015
b591cf2
Fixed object detection
oconnelc Feb 28, 2015
0007333
Merge pull request #91 from iliterobotics/objectDetector
oconnelc Feb 28, 2015
4e849e9
Added screenshot
oconnelc Feb 28, 2015
e1aad2c
Added screnshot
oconnelc Feb 28, 2015
18d82d8
Re-added the IP for the camera
oconnelc Feb 28, 2015
88e3189
Took out contours from the BlobModel
oconnelc Feb 28, 2015
b318a88
Overlays now generated from contours
danielchristopher1 Feb 28, 2015
bffac4d
Added some additonal log4j logic
oconnelc Feb 28, 2015
d72968f
Merge pull request #92 from iliterobotics/Development
oconnelc Feb 28, 2015
a2458f5
Merge pull request #93 from iliterobotics/log4j
oconnelc Feb 28, 2015
1c9fa90
Cleaned up the ImageWindow and controls
oconnelc Feb 28, 2015
f88c612
Merge pull request #94 from iliterobotics/cleanup
oconnelc Feb 28, 2015
1f73c64
Cleaned up a lot of operations. Added color selection for overlays an…
oconnelc Feb 28, 2015
8141715
Merge pull request #95 from iliterobotics/cleanup
oconnelc Feb 28, 2015
0c7d4d9
Fixed pause
danielchristopher1 Feb 28, 2015
2b3b5d6
Merge pull request #96 from iliterobotics/Development
oconnelc Feb 28, 2015
7301c46
Fixed some last minute bugs. NPE with pause, width of overlay
oconnelc Feb 28, 2015
ca50ac7
Fixed issue 97: updated to use the correct camera property
oconnelc Mar 4, 2015
84a56ac
Merge pull request #98 from iliterobotics/Issue97
oconnelc Mar 4, 2015
4a34598
Configuration and changes from first FRC match
rudicio Mar 14, 2015
54ede1a
Took out these images
rudicio Mar 14, 2015
b3024a8
Fixed resource loading issue with images. Basically the FRC HMI project
oconnelc Mar 21, 2015
49ccf7d
Took out the alpha slider
oconnelc Mar 21, 2015
836ebc4
Fixed dynamic reconnect
oconnelc Apr 11, 2015
b676b60
Fixed the camera connection
danielchristopher1 Apr 11, 2015
3c9c8e7
Merge pull request #102 from iliterobotics/Development
danielchristopher1 Apr 11, 2015
1fa9c5a
Added log4j logging
oconnelc Apr 11, 2015
9b435aa
Merge branch 'CameraReconnect'
oconnelc Apr 11, 2015
d72f05e
Merged
oconnelc Apr 11, 2015
06fdc27
Camera now reconnects
danielchristopher1 Apr 11, 2015
a40594b
Merge pull request #104 from iliterobotics/Development
danielchristopher1 Apr 11, 2015
0933047
Added Named Thread Factory
oconnelc Apr 11, 2015
a8442b1
Added Gradle wrapper
oconnelc Apr 11, 2015
a52e22c
Merge pull request #105 from iliterobotics/gradleWrapper
oconnelc Apr 11, 2015
bafec1c
Merge pull request #106 from iliterobotics/CameraReconnect
oconnelc Apr 11, 2015
0d0765e
Cleaned up some logger
oconnelc Apr 11, 2015
875c07f
Updated json
rudicio Apr 11, 2015
756b664
Commiting the gradle wrapper jar
oconnelc Oct 29, 2015
4340fdb
Merge pull request #108 from iliterobotics/Vision
oconnelc Oct 29, 2015
c9cc041
Fixed build.gradle t point to version of open-cv being used
oconnelc Oct 31, 2015
cb734ac
Changed the camera configuration to axis-camera.local
oconnelc Nov 7, 2015
e986979
Moved the init logic to be on demand based
oconnelc Nov 7, 2015
08e9bb3
Merge pull request #109 from iliterobotics/development
oconnelc Nov 7, 2015
f485d8b
Fixed the OpenCVUTils task to check and see if the camera is there
oconnelc Nov 7, 2015
eb41134
Merge pull request #110 from iliterobotics/development
oconnelc Nov 8, 2015
018a4bf
Created cam calibration for a single image
oconnelc Jan 9, 2016
8025187
Updated to allow multiple training images
oconnelc Jan 9, 2016
55dc8bc
Added handling for multiple images
oconnelc Jan 9, 2016
e02435a
Moved to calibration package
oconnelc Jan 9, 2016
3c3eaa2
Camera calibration
oconnelc Jan 9, 2016
89839d0
Merge pull request #111 from iliterobotics/camCalibration
oconnelc Jan 9, 2016
22817dd
Updated to use opencv-2410
oconnelc Jan 9, 2016
275a155
Merge pull request #112 from iliterobotics/camCalibration
oconnelc Jan 9, 2016
ac0ab33
Created the HelloOpenCV
oconnelc Jan 31, 2016
d88ea7f
Merge pull request #113 from iliterobotics/Hello
oconnelc Jan 31, 2016
f76a3dd
Updated hello world example
andrewjorquera Feb 5, 2016
0395bb9
Merge pull request #114 from iliterobotics/HelloBranch
oconnelc Feb 5, 2016
3e096ca
Updated camera properties for axis camera IP address
oconnelc Feb 6, 2016
5d8b105
Pulled down team 3019's TowerTracker code and merged it.
oconnelc Feb 4, 2016
a38291b
First commit of TowerTrackerConfig
oconnelc Feb 6, 2016
a4e0ac2
First working reflective tape
oconnelc Feb 6, 2016
d78cd0c
Merge pull request #115 from iliterobotics/colorThresh
oconnelc Feb 6, 2016
4b9824b
Fixed JSON object
oconnelc Feb 6, 2016
571b1f7
Added Json array to double aray method.
AKasera Feb 7, 2016
6627660
Added new interface for listener
andrewjorquera Feb 7, 2016
82d72e5
Changed Lower and Upper Bound variables' value
AKasera Feb 7, 2016
3f43019
Merge pull request #116 from iliterobotics/AtishayTasks
oconnelc Feb 7, 2016
81afd05
Added HueListener to TowerTracker
andrewjorquera Feb 7, 2016
6b73635
Merge branch 'development' into towerListener
oconnelc Feb 7, 2016
1db73f2
Merge branch 'towerListener' into development
oconnelc Feb 7, 2016
30b1a20
added scalars and hard variables
Feb 12, 2016
af9a4fd
Added towerlistener to TowerTracker1885
AKasera Feb 12, 2016
e6857bd
Merge pull request #118 from iliterobotics/AtishayTasks
oconnelc Feb 13, 2016
32b3430
Merge branch 'development' of https://github.com/iliterobotics/FRC-Vi…
Rohan-Hosuru Feb 13, 2016
b7808a7
allowed camera to find if it is centered
andrewjorquera Feb 13, 2016
ae15012
Added alignment string to tower message and alignment enum
andrewjorquera Feb 13, 2016
0286b06
changed threshold calculation to absolute value
andrewjorquera Feb 13, 2016
d926cdb
Merge pull request #119 from iliterobotics/cameraIntersection
oconnelc Feb 13, 2016
4369fa0
Updated to fix the opencv camera connection for Axis Camera
AKasera Feb 20, 2016
b9b4743
Merge pull request #120 from iliterobotics/AtishayTasks
oconnelc Feb 20, 2016
ed1b748
Changed Local Camera Class to Camera Class and updated the constructo…
AKasera Feb 20, 2016
b3f240e
Merge pull request #121 from iliterobotics/AtishayTasks
oconnelc Feb 20, 2016
2e55811
Updated build gradle to launch applications
dhruv138 Feb 20, 2016
8017b5c
Merge pull request #122 from iliterobotics/updatedGradle
oconnelc Feb 20, 2016
58eb04b
Merge branch 'development' of https://github.com/iliterobotics/FRC-Vi…
Rohan-Hosuru Feb 20, 2016
6cea4b7
Updated hello
Rohan-Hosuru Feb 13, 2016
d8db51e
added field camera ip to properties
Rohan-Hosuru Feb 13, 2016
e22f283
Added alignment and BufferedImage value to TowerMessage
AKasera Feb 20, 2016
c954697
Added bufferedImage field
Rohan-Hosuru Feb 21, 2016
4945772
Created ValueWindow class to create extra window that displays necess…
AKasera Feb 21, 2016
7abc6bc
Merge pull request #123 from iliterobotics/AtishayTasks
oconnelc Feb 22, 2016
03795b3
Merge branch 'development' into rohan-tasks
oconnelc Feb 22, 2016
b4f66fd
Merge branch 'rohan-tasks' into development
oconnelc Feb 22, 2016
ee58ade
Updated the tolerance of the contour and added error overlays
oconnelc Feb 22, 2016
dc67c93
Updated the angle to be in radians
oconnelc Feb 22, 2016
440f991
Fixed the properties.json
oconnelc Feb 22, 2016
fc50f8d
Changed the tower trackers camera back to alignment camera
oconnelc Feb 22, 2016
3291887
Updated to use the alignment camera and updated the vertical FOV
oconnelc Feb 22, 2016
42ab8e6
Updated the vertical FOV
oconnelc Feb 22, 2016
accc8ca
Added the ability to try different vertical FOV
oconnelc Feb 22, 2016
b79ec39
Fixed the camera not connecting to local when axis isn't available
oconnelc Feb 26, 2016
aaa0b37
Merge pull request #125 from iliterobotics/CameraConnectionFix
oconnelc Feb 26, 2016
4165a5b
Added accept/cancel option for saving
andrewjorquera Feb 27, 2016
f7bd3e8
Merge pull request #126 from iliterobotics/WindowSave
oconnelc Feb 27, 2016
1ded8fc
Updated the camera IP to use host name, since we are now running DHCP
oconnelc Mar 17, 2016
b4b88a1
Fixed camera buffering issue
oconnelc Mar 17, 2016
6e18ded
Ran dos2unix to remove invisible characters and notification fix
oconnelc Mar 17, 2016
5dfb231
Added images of goal for overlay
oconnelc Mar 17, 2016
f8cdb55
Merge pull request #127 from iliterobotics/BethesdaFixes
oconnelc Mar 17, 2016
83d4c09
Merge pull request #128 from iliterobotics/development
oconnelc Mar 17, 2016
0b42aba
Took out overlay image from last year
oconnelc Mar 17, 2016
e322cbd
Merge pull request #129 from iliterobotics/development
oconnelc Mar 17, 2016
d202d34
Added affine translation assignment for atisay
oconnelc Mar 17, 2016
0050a07
Added Button to Flip the image
AKasera Apr 1, 2016
65b5dd6
Made the start method public for FRC-DataClient
oconnelc Apr 2, 2016
d113865
Created method to flip the image in OpenCVUtils
oconnelc Apr 2, 2016
6764081
Revert "Added Button to Flip the image"
oconnelc Apr 2, 2016
f184be2
Merge pull request #130 from iliterobotics/ChrisDev
oconnelc Apr 2, 2016
fefc613
Added Top and Bottom Rectangles
AKasera Apr 2, 2016
4731774
Merge pull request #131 from iliterobotics/AtishayTasks
oconnelc Apr 2, 2016
f5358c0
Added Y azimuth calculation and renamed azimuth to x azimuth
oconnelc Apr 2, 2016
358a6ef
Merge pull request #132 from iliterobotics/Azimuth
oconnelc Apr 2, 2016
5db895d
Fixed the OFFSET loading a double
oconnelc Apr 2, 2016
b7ddaa8
working auto twist
oconnelc Apr 2, 2016
69c2ee9
Merge branch 'development' of https://github.com/iliterobotics/FRC-Vi…
oconnelc Apr 2, 2016
a917823
Merge pull request #133 from iliterobotics/development
oconnelc Jul 17, 2016
3ccea2a
Took out unneeded files
oconnelc Jan 13, 2018
5a8e6ab
Merged vision code
oconnelc Jan 13, 2018
db04221
Took out unused code
oconnelc Jan 13, 2018
e8860ab
Added log4j dependenciy
oconnelc Jan 13, 2018
5838c71
Updated to use OpenCV 3.2
oconnelc Jan 13, 2018
6f2a804
Took out extra OpenCV library
oconnelc Jan 13, 2018
095bed1
Removed DS_Store dirs
flybotix Jan 26, 2018
a65899e
Merge branch 'master' into VisionUpdate
flybotix Jan 26, 2018
5df420d
Moved vision to proper package. Just need to update to gson now.
flybotix Jan 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ dependencies {
// Poofs library and its dependencies
compile name: 'json-simple-1.1.1'
compile name: 'poofs.2017'
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile 'org.json:json:20090211'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
}
Expand All @@ -65,4 +67,4 @@ jar {

task wrapper(type: Wrapper) {
gradleVersion = '4.4'
}
}
18 changes: 18 additions & 0 deletions src/main/java/org/ilite/frc/common/util/NamedThreadFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.ilite.frc.common.util;

import java.util.concurrent.ThreadFactory;

public class NamedThreadFactory implements ThreadFactory {

private String mThreadName;

public NamedThreadFactory(String pThreadName) {
mThreadName = pThreadName;
}

@Override
public Thread newThread(Runnable pR) {
return new Thread(pR, mThreadName);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.ilite.frc.vision.api.messages;

import java.awt.image.BufferedImage;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import org.ilite.frc.vision.camera.opencv.OpenCVUtils;

/**
* Contains data coming from the camera
* @author Daniel Christopher
* @version 2/1/15
*
*/
public final class RobotVisionMsg {
private final BufferedImage rawImage;
private final List<VisibleObject> visibleObjects;

public RobotVisionMsg(BufferedImage rawImage) {
this.rawImage = rawImage;

visibleObjects = new LinkedList<VisibleObject>();
}

public BufferedImage getRawImage() {
return OpenCVUtils.deepCopy(rawImage);
}

public List<VisibleObject> getVisibleObjects() {
return Collections.unmodifiableList(visibleObjects);
}
}
36 changes: 36 additions & 0 deletions src/main/java/org/ilite/frc/vision/api/messages/VisibleObject.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.ilite.frc.vision.api.messages;

import java.awt.Point;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/**
*
* @author Daniel Christopher
* @version 2/1/15
*
*/
public final class VisibleObject {
private final String name;
private final LinkedList<Point> points;
private final Point centerPoint;

public VisibleObject(String name, LinkedList<Point> points, Point centerPoint) {
this.name = name;
this.points = points;
this.centerPoint = centerPoint;
}

public String getName() {
return name;
}

public List<Point> getPoints() {
return Collections.unmodifiableList(points);
}

public Point getCenterPoint() {
return new Point(centerPoint);
}
}
34 changes: 34 additions & 0 deletions src/main/java/org/ilite/frc/vision/api/system/IVisionSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.ilite.frc.vision.api.system;

import org.ilite.frc.vision.api.messages.RobotVisionMsg;

/**
* Interface to connect to a single camera. This will provide users with the ability
* to register with the camera and receive updates. Implementations of the {@link VisionListener}
* will be notified when there is a new {@link RobotVisionMsg} available
*
*/
public interface IVisionSystem {

/**
* Method to start the camera processing. This should be called before processing can begin.
* Subsequent calls to this method will do nothing
*/
public void start();

/**
* Method to subscribe for vision updates
* @param listener
* Listener to register
*/
public void subscribe(VisionListener listener);

/**
* Method to unsubscribe for vision updates
* @param listener
* listener to stop registering
*/
public void unsubscribe(VisionListener listener);


}
140 changes: 140 additions & 0 deletions src/main/java/org/ilite/frc/vision/api/system/ImageBlender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package org.ilite.frc.vision.api.system;

import java.awt.AlphaComposite;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.ilite.frc.vision.api.messages.RobotVisionMsg;
import org.ilite.frc.vision.camera.opencv.ImagePanel;
import org.ilite.frc.vision.camera.opencv.OverlaySlider;


/**
* A proof of concept to overlay one image on top of each other. This will register
* with the live camera, using the {@link VisionSystemAPI} to get a reference.
* When a new frame comes in, this image will blend the mOverlayImage on top of
* the frame and then render it to the display.
*
* There {@link OverlaySlider} is used to adjust the alpha value. Valid alpha
* values are from 0.0 to 1.0. Essentially the alpha values are percentages, with
* 1.0 representing full opaque and 0.0 being completely invisible.
*
* This class will put the {@link OverlaySlider} on the top of the frame and
* the image panel in the center
*/
public class ImageBlender extends JPanel implements VisionListener {

/**
* The panel that will render the mFinalImage onto this frame.
*/
private final ImagePanel mImagePanel = new ImagePanel();

/**
* {@link List} containing all of the overlays
*/
private final List<BufferedImage>mOverlays = new ArrayList<BufferedImage>();
/**
* The main content of this frame
*/
/**
* The final image that is to be rendered. This will be created once in the
* onVisonDataReceived, once this starts to receive frames from the camera
*/
private BufferedImage mFinalImage;
private BufferedImage mBackgroundImage;

private JLabel mPercentageLabel;
private final DecimalFormat mFormat = new DecimalFormat("000");

/**
* Creates and shows this frame
* @throws IOException
* Thrown if there was an issue loading the overlay Image
*/



public ImageBlender() throws IOException {
super(new BorderLayout());
mOverlays.add(VisionSystemAPI.loadImageAsResource("Overlay.png"));

mImagePanel.getPanel().setPreferredSize(new Dimension(800, 600));

add(mImagePanel.getPanel(), BorderLayout.CENTER);
setVisible(true);
}

/**
* {@inheritDoc}
*/
@Override
public void onVisionDataRecieved(RobotVisionMsg message) {
BufferedImage frameImage = message.getRawImage();
redraw(frameImage);
}

private void redraw(BufferedImage frameImage) {
if(mFinalImage == null) {
mFinalImage = new BufferedImage(frameImage.getWidth(), frameImage.getHeight(), BufferedImage.TYPE_INT_RGB);
setPreferredSize(new Dimension(mFinalImage.getWidth(), mFinalImage.getHeight()));

}
int screenWidth = frameImage.getWidth();
int screenHeight = frameImage.getHeight();

Graphics2D graphics = mFinalImage.createGraphics();
graphics.fillRect(0, 0, mFinalImage.getWidth(), mFinalImage.getHeight());
graphics.drawImage(frameImage, 0, 0,frameImage.getWidth(), frameImage.getHeight(), null);
graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,.5f));

for(BufferedImage anOverlay : mOverlays) {
graphics.drawImage(anOverlay, 0, 0,screenWidth,screenHeight, null);
}
graphics.dispose();

mImagePanel.updateImage(mFinalImage);
}

/**
* Starts the Image Blender and registers it with the {@link VisionSystemAPI}
* @param args
* Not used
* @throws IOException
* thrown if the overlay image could not be loaded
*/
public static void main(String[] args) throws IOException {
JFrame frame = new JFrame();
ImageBlender blender = new ImageBlender();

File background = new File("src/main/resources/images/Screenshot1.jpg");
BufferedImage backgroundImage = ImageIO.read(background);
blender.setbackgroundImage(backgroundImage);

// VisionSystemAPI.getVisionSystem(ECameraType.LOCAL_CAMERA).subscribe(blender);
frame.setContentPane(blender);


frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.pack();

}

private void setbackgroundImage(BufferedImage pBackgroundImage) {
mBackgroundImage = pBackgroundImage;
redraw(mBackgroundImage);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.ilite.frc.vision.api.system;

import org.ilite.frc.vision.api.messages.RobotVisionMsg;

public interface VisionListener {
public void onVisionDataRecieved(RobotVisionMsg message);
}
84 changes: 84 additions & 0 deletions src/main/java/org/ilite/frc/vision/api/system/VisionSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package org.ilite.frc.vision.api.system;

import java.awt.image.BufferedImage;
import java.util.LinkedHashSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicBoolean;

import org.ilite.frc.vision.api.messages.RobotVisionMsg;
import org.ilite.frc.vision.camera.CameraConnectionFactory;
import org.ilite.frc.vision.camera.ICameraConnection;
import org.ilite.frc.vision.camera.ICameraFrameUpdateListener;
import org.ilite.frc.vision.camera.opencv.OpenCVUtils;

final class VisionSystem implements ICameraFrameUpdateListener, IVisionSystem {
private LinkedHashSet<VisionListener> listeners;
private ICameraConnection connection;
/**
* Flag indicating whether this vision system has been initializied.
* This is used to ensure that multiple calls to start do nothing
*/
private final AtomicBoolean mIsInit = new AtomicBoolean(false);
private static final ExecutorService sService = Executors.newCachedThreadPool(new ThreadFactory() {

@Override
public Thread newThread(Runnable pR) {
return new Thread(pR, "Vision System Connection Thread");
}
});

protected VisionSystem(String pIP) {

OpenCVUtils.init();
listeners = new LinkedHashSet<VisionListener>();

connection = CameraConnectionFactory.getCameraConnection(pIP);

connection.addCameraFrameListener(this);

}

@Override
public void frameAvail(BufferedImage pImage) {
RobotVisionMsg message = new RobotVisionMsg(pImage);

for(VisionListener listener : listeners) {
listener.onVisionDataRecieved(message);
}
}

@Override
public void start() {
boolean isInit = mIsInit.getAndSet(true);

if(!isInit) {
sService.submit(new Runnable() {

@Override
public void run() {
connection.start();
}
});
}

}

/* (non-Javadoc)
* @see org.ilite.vision.api.system.IVisionSystem#subscribe(org.ilite.vision.api.system.VisionListener)
*/
@Override
public void subscribe(VisionListener listener) {
listeners.add(listener);
}

/* (non-Javadoc)
* @see org.ilite.vision.api.system.IVisionSystem#unsubscribe(org.ilite.vision.api.system.VisionListener)
*/
@Override
public void unsubscribe(VisionListener listener) {
listeners.remove(listener);
}

}
Loading