Files
PhotonVision/chameleon-server/src/main/java/com/chameleonvision/config/PipelineConfig.java

133 lines
4.0 KiB
Java
Raw Normal View History

2019-11-27 22:23:02 -05:00
package com.chameleonvision.config;
V2.1 (#37) * Toggle mode * RangeSlider able to be disabled * Added another window from the press of the button * removed warning * Major changes to colorpicker page * Major changes to threshold tab * fix for BGR not RGB * Reverted changes of colorpicker.vue * Updated Readme.md Mainly Development Setup * Update readme small changes * updated readme.md Authors credit update * updated readme.md added usb camera to hardware * Updated UI readme added nodejs installation and explanation * Unit test vision (and implement networktable sending) * finished color picker in the ui * bugfix for correct tab * cleanup and commenting * Reveted changes to range slider * bug fix for color picker * Pipeline mat copy fix * Added crosshair pipe * compilation fix * removed unsued comment * moved calibration stuff to static class under 2d pipeline settings * Added debug print commented * Reverted subclass "Calibration" Fixed bug where single point calibration causes crash when no target is found * disable dual point crosshair for now * Proper no target found fix, and snackbar error now showing * Removed java fix for crash bug * fixed problem with clear points in single point calibration * change compatator to sqared values to make caluclation faster (no need for sqare root function) * fixed roated camera too heigh for the UI * Revert "fixed roated camera too heigh for the UI" This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f. * fixed rotated camera too heigh for UI and corrected scalling * updated pom to fix the camera buffer issue * added pom variables * Created new CaptureStaticProperties when rotating cam * File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports * ignore auto created iml file * ignore auto created iml file * Fix lack of access problems after moving pipleline impl out of the same package * Removed commented lines * Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move * cleaned up single point calibration and bug fixed isBinary in driverMode * Enum fix for the UI * typo * fixed Stream divisor problems see issue 19 in github issues * fixed compilation error for test class * Fixed problem when rotating camera with stream divisor * Spelling + button style change * Add speed limit to UI Updates * Added runtime arg to fix settings permissions, and on-first-init * Added FileHelper class to manage setting permissions for all files. * Removed unnecessary argument * NT can set pipeline to out on bound indexes * bugfix in platform check * added pipeline popup * Round steam divisor resolution * added regex test for camera name and pipe name * Fix for Renaming pipeline leaves old config file #14 * Version change * adde ( ) - and . to regex * Replace NT timestamp with latency * added back NT flush * Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35) * Rebase solvePNP on master * added 3D tab minimap and csv reader * More solvePNP * Create draw pipe for pnp data * SolvePNP piping work * Move sorting into solvepnppipe * Create calibration pipeline * Update CalibrateSolvePNPPipeline.java * add camera tilt angle * Add calibration slider and snapshot button to 3D view * Mirror updates in the socket handler * add 3d calibration mode to the pipeline manager * created calibration functions in ui and backend * Start plumbing calibration * Add snapshot and other handling to the RequestHandler * added select resolution before starting calibration * Rename solvePNPPipe to bounding box solve pnp pipe * Update BoundingBoxSolvePNPPipe.java * Add Mat serializer and CameraCalibrationConfig * Begun calibration saving, fixed UI/Backend snapshot count mismatch * Add (unplumbed) option to set checkerboard size This will allow users to change the units their calibration is in * Create chessboard.png * Fix calibration NPE * changed string serialization to a json send * bug fixed cancellation button * Fix spelling of snapshot in 3d.vue * Plumb resolution change * Set resolution during config, start on config serialization * Update .gitignore * Config fixes * Start transition away from cvpipeline3d * fix NPE on uncalibrated cameras * clear list on fail * Fix video mode index error * ignore getters in camera calibration config * Create json constructor for jsonmat * get solvePNP mostly returning sane values * Fix solvePNP bug and add unit test * FIx calibration mat truncation * added capture amount model upload and minimap data * Standardize on meters in calibration and bounding box * fix json out of bounds and handle null calibration more gracefully * don't put text on calibrate image, go back to inches * convert distance to meters this means calibration will need to be in inches * Actually save raw contor * Update GroupContoursPipe.java * Add all calibration return to camera capture * hard code 2019 target * bugfixed draw2d added fail calib popup, merge end and cancel added the res index to the calib start * Clarify error message and draw more fancy rectangles * Cleanup memory in solvepnp * re did minimap component * fix npe if left/right is null * remove references to 2d * try-catch running the current pipeline * Add method to find corners using the harris corner detector * Possibly fix left/right missmatch * Fix 3D Tab error * FIx file permissions, mat serializer adjustments * fixed mini map for field coordinates * mini map changes fov * Update SolvePNPPipe.java * get rid of target corners * some memory leak fixes * fixed mini map location * added position under minimap * changed player fov look * put all targets in the web send * re did target send to ui added target tables, bugfix calibration * fixed y position * Add tilt angle to capture properties * maybe fix y axis in minimap * Add square size to onCalibrationEnding * Possibly add square size to UI * fix NPE with pitch * Fix bug with sending multiple targets * Only instantiate 3d stuff if we are in 3d mode * Fix array list exceptions * Fix bug in sort contors list was truncated too early * added download chess, tilt setting and ordinal tilt, * added square size connection * removed unused code * Update pom version to 2.1-RELEASE * Send camera calibrations to UI * Stream pose list to a LIst * Only stream necessary parts of the aux list entry * Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions * added fps counter changed squaresize steps bug fixes in tables * bugfix camera settings cam wont change Authored-by: oriagranat9 <oriagranat9@gmail.com> * disable pose print * standardize on calibration in inches and add square size as a divisor This should do the same thing as calibrating in the correct units but it doesnt like meeeeee * updated pom for release, 3d calibration change, cosmetic changes * WIP: 3D res filter * bug fix in index parsing * add good features to track point finder * offset found corners by old tl position * Add method to find most extreme per-quadrant points for solvePNP * re did pipeline duplication * Add release method to standard cv pipeline * remove contor from tracked target * Explicitly release all the intermediate results * avoid creating new mats in group contors pipe * removed mat release * updated pom * Actually cache the last target We were trying to but i never hooked this part up * Fix memory leak in sort contros pipe * Fix memory leak in sort contors pipe * Help more with memory usage in speckle reject and draw pipes * minor bugfixes to the ui * Start moving stream into vision process Should probs move into a pipe to be idimatic * justify bug fix * Fix sort left/right bug * Fix target grouping bug * Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe * Event scripts (#36) * Begin scripting work * More scripting work * Finalize scripting system * Begin implementing script events * Finalize script system Co-authored-by: Banks T <btrout.dhrs@gmail.com> Co-authored-by: OmerZ7 <zipory.omer@gmail.com> Co-authored-by: Matt <matthew.morley.ca@gmail.com> Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
import com.chameleonvision.util.FileHelper;
2019-11-27 22:23:02 -05:00
import com.chameleonvision.util.JacksonHelper;
2019-11-27 19:51:49 -08:00
import com.chameleonvision.vision.pipeline.*;
V2.1 (#37) * Toggle mode * RangeSlider able to be disabled * Added another window from the press of the button * removed warning * Major changes to colorpicker page * Major changes to threshold tab * fix for BGR not RGB * Reverted changes of colorpicker.vue * Updated Readme.md Mainly Development Setup * Update readme small changes * updated readme.md Authors credit update * updated readme.md added usb camera to hardware * Updated UI readme added nodejs installation and explanation * Unit test vision (and implement networktable sending) * finished color picker in the ui * bugfix for correct tab * cleanup and commenting * Reveted changes to range slider * bug fix for color picker * Pipeline mat copy fix * Added crosshair pipe * compilation fix * removed unsued comment * moved calibration stuff to static class under 2d pipeline settings * Added debug print commented * Reverted subclass "Calibration" Fixed bug where single point calibration causes crash when no target is found * disable dual point crosshair for now * Proper no target found fix, and snackbar error now showing * Removed java fix for crash bug * fixed problem with clear points in single point calibration * change compatator to sqared values to make caluclation faster (no need for sqare root function) * fixed roated camera too heigh for the UI * Revert "fixed roated camera too heigh for the UI" This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f. * fixed rotated camera too heigh for UI and corrected scalling * updated pom to fix the camera buffer issue * added pom variables * Created new CaptureStaticProperties when rotating cam * File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports * ignore auto created iml file * ignore auto created iml file * Fix lack of access problems after moving pipleline impl out of the same package * Removed commented lines * Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move * cleaned up single point calibration and bug fixed isBinary in driverMode * Enum fix for the UI * typo * fixed Stream divisor problems see issue 19 in github issues * fixed compilation error for test class * Fixed problem when rotating camera with stream divisor * Spelling + button style change * Add speed limit to UI Updates * Added runtime arg to fix settings permissions, and on-first-init * Added FileHelper class to manage setting permissions for all files. * Removed unnecessary argument * NT can set pipeline to out on bound indexes * bugfix in platform check * added pipeline popup * Round steam divisor resolution * added regex test for camera name and pipe name * Fix for Renaming pipeline leaves old config file #14 * Version change * adde ( ) - and . to regex * Replace NT timestamp with latency * added back NT flush * Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35) * Rebase solvePNP on master * added 3D tab minimap and csv reader * More solvePNP * Create draw pipe for pnp data * SolvePNP piping work * Move sorting into solvepnppipe * Create calibration pipeline * Update CalibrateSolvePNPPipeline.java * add camera tilt angle * Add calibration slider and snapshot button to 3D view * Mirror updates in the socket handler * add 3d calibration mode to the pipeline manager * created calibration functions in ui and backend * Start plumbing calibration * Add snapshot and other handling to the RequestHandler * added select resolution before starting calibration * Rename solvePNPPipe to bounding box solve pnp pipe * Update BoundingBoxSolvePNPPipe.java * Add Mat serializer and CameraCalibrationConfig * Begun calibration saving, fixed UI/Backend snapshot count mismatch * Add (unplumbed) option to set checkerboard size This will allow users to change the units their calibration is in * Create chessboard.png * Fix calibration NPE * changed string serialization to a json send * bug fixed cancellation button * Fix spelling of snapshot in 3d.vue * Plumb resolution change * Set resolution during config, start on config serialization * Update .gitignore * Config fixes * Start transition away from cvpipeline3d * fix NPE on uncalibrated cameras * clear list on fail * Fix video mode index error * ignore getters in camera calibration config * Create json constructor for jsonmat * get solvePNP mostly returning sane values * Fix solvePNP bug and add unit test * FIx calibration mat truncation * added capture amount model upload and minimap data * Standardize on meters in calibration and bounding box * fix json out of bounds and handle null calibration more gracefully * don't put text on calibrate image, go back to inches * convert distance to meters this means calibration will need to be in inches * Actually save raw contor * Update GroupContoursPipe.java * Add all calibration return to camera capture * hard code 2019 target * bugfixed draw2d added fail calib popup, merge end and cancel added the res index to the calib start * Clarify error message and draw more fancy rectangles * Cleanup memory in solvepnp * re did minimap component * fix npe if left/right is null * remove references to 2d * try-catch running the current pipeline * Add method to find corners using the harris corner detector * Possibly fix left/right missmatch * Fix 3D Tab error * FIx file permissions, mat serializer adjustments * fixed mini map for field coordinates * mini map changes fov * Update SolvePNPPipe.java * get rid of target corners * some memory leak fixes * fixed mini map location * added position under minimap * changed player fov look * put all targets in the web send * re did target send to ui added target tables, bugfix calibration * fixed y position * Add tilt angle to capture properties * maybe fix y axis in minimap * Add square size to onCalibrationEnding * Possibly add square size to UI * fix NPE with pitch * Fix bug with sending multiple targets * Only instantiate 3d stuff if we are in 3d mode * Fix array list exceptions * Fix bug in sort contors list was truncated too early * added download chess, tilt setting and ordinal tilt, * added square size connection * removed unused code * Update pom version to 2.1-RELEASE * Send camera calibrations to UI * Stream pose list to a LIst * Only stream necessary parts of the aux list entry * Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions * added fps counter changed squaresize steps bug fixes in tables * bugfix camera settings cam wont change Authored-by: oriagranat9 <oriagranat9@gmail.com> * disable pose print * standardize on calibration in inches and add square size as a divisor This should do the same thing as calibrating in the correct units but it doesnt like meeeeee * updated pom for release, 3d calibration change, cosmetic changes * WIP: 3D res filter * bug fix in index parsing * add good features to track point finder * offset found corners by old tl position * Add method to find most extreme per-quadrant points for solvePNP * re did pipeline duplication * Add release method to standard cv pipeline * remove contor from tracked target * Explicitly release all the intermediate results * avoid creating new mats in group contors pipe * removed mat release * updated pom * Actually cache the last target We were trying to but i never hooked this part up * Fix memory leak in sort contros pipe * Fix memory leak in sort contors pipe * Help more with memory usage in speckle reject and draw pipes * minor bugfixes to the ui * Start moving stream into vision process Should probs move into a pipe to be idimatic * justify bug fix * Fix sort left/right bug * Fix target grouping bug * Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe * Event scripts (#36) * Begin scripting work * More scripting work * Finalize scripting system * Begin implementing script events * Finalize script system Co-authored-by: Banks T <btrout.dhrs@gmail.com> Co-authored-by: OmerZ7 <zipory.omer@gmail.com> Co-authored-by: Matt <matthew.morley.ca@gmail.com> Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
import com.chameleonvision.vision.pipeline.impl.StandardCVPipelineSettings;
2019-11-27 22:23:02 -05:00
2019-11-27 19:51:49 -08:00
import java.io.File;
2019-11-27 22:23:02 -05:00
import java.io.IOException;
2019-11-28 01:15:16 -05:00
import java.nio.file.Files;
2019-11-27 19:51:49 -08:00
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
2019-11-27 22:23:02 -05:00
import java.util.List;
public class PipelineConfig {
private final CameraConfig cameraConfig;
2019-11-27 19:51:49 -08:00
/**
* Construct a new PipelineConfig
* @param cameraConfig the CameraConfig (parent folder, kinda?)
*/
2019-11-28 01:15:16 -05:00
PipelineConfig(CameraConfig cameraConfig) {
2019-11-27 22:23:02 -05:00
this.cameraConfig = cameraConfig;
}
2019-11-28 01:15:16 -05:00
private void checkFolder() {
V2.1 (#37) * Toggle mode * RangeSlider able to be disabled * Added another window from the press of the button * removed warning * Major changes to colorpicker page * Major changes to threshold tab * fix for BGR not RGB * Reverted changes of colorpicker.vue * Updated Readme.md Mainly Development Setup * Update readme small changes * updated readme.md Authors credit update * updated readme.md added usb camera to hardware * Updated UI readme added nodejs installation and explanation * Unit test vision (and implement networktable sending) * finished color picker in the ui * bugfix for correct tab * cleanup and commenting * Reveted changes to range slider * bug fix for color picker * Pipeline mat copy fix * Added crosshair pipe * compilation fix * removed unsued comment * moved calibration stuff to static class under 2d pipeline settings * Added debug print commented * Reverted subclass "Calibration" Fixed bug where single point calibration causes crash when no target is found * disable dual point crosshair for now * Proper no target found fix, and snackbar error now showing * Removed java fix for crash bug * fixed problem with clear points in single point calibration * change compatator to sqared values to make caluclation faster (no need for sqare root function) * fixed roated camera too heigh for the UI * Revert "fixed roated camera too heigh for the UI" This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f. * fixed rotated camera too heigh for UI and corrected scalling * updated pom to fix the camera buffer issue * added pom variables * Created new CaptureStaticProperties when rotating cam * File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports * ignore auto created iml file * ignore auto created iml file * Fix lack of access problems after moving pipleline impl out of the same package * Removed commented lines * Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move * cleaned up single point calibration and bug fixed isBinary in driverMode * Enum fix for the UI * typo * fixed Stream divisor problems see issue 19 in github issues * fixed compilation error for test class * Fixed problem when rotating camera with stream divisor * Spelling + button style change * Add speed limit to UI Updates * Added runtime arg to fix settings permissions, and on-first-init * Added FileHelper class to manage setting permissions for all files. * Removed unnecessary argument * NT can set pipeline to out on bound indexes * bugfix in platform check * added pipeline popup * Round steam divisor resolution * added regex test for camera name and pipe name * Fix for Renaming pipeline leaves old config file #14 * Version change * adde ( ) - and . to regex * Replace NT timestamp with latency * added back NT flush * Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35) * Rebase solvePNP on master * added 3D tab minimap and csv reader * More solvePNP * Create draw pipe for pnp data * SolvePNP piping work * Move sorting into solvepnppipe * Create calibration pipeline * Update CalibrateSolvePNPPipeline.java * add camera tilt angle * Add calibration slider and snapshot button to 3D view * Mirror updates in the socket handler * add 3d calibration mode to the pipeline manager * created calibration functions in ui and backend * Start plumbing calibration * Add snapshot and other handling to the RequestHandler * added select resolution before starting calibration * Rename solvePNPPipe to bounding box solve pnp pipe * Update BoundingBoxSolvePNPPipe.java * Add Mat serializer and CameraCalibrationConfig * Begun calibration saving, fixed UI/Backend snapshot count mismatch * Add (unplumbed) option to set checkerboard size This will allow users to change the units their calibration is in * Create chessboard.png * Fix calibration NPE * changed string serialization to a json send * bug fixed cancellation button * Fix spelling of snapshot in 3d.vue * Plumb resolution change * Set resolution during config, start on config serialization * Update .gitignore * Config fixes * Start transition away from cvpipeline3d * fix NPE on uncalibrated cameras * clear list on fail * Fix video mode index error * ignore getters in camera calibration config * Create json constructor for jsonmat * get solvePNP mostly returning sane values * Fix solvePNP bug and add unit test * FIx calibration mat truncation * added capture amount model upload and minimap data * Standardize on meters in calibration and bounding box * fix json out of bounds and handle null calibration more gracefully * don't put text on calibrate image, go back to inches * convert distance to meters this means calibration will need to be in inches * Actually save raw contor * Update GroupContoursPipe.java * Add all calibration return to camera capture * hard code 2019 target * bugfixed draw2d added fail calib popup, merge end and cancel added the res index to the calib start * Clarify error message and draw more fancy rectangles * Cleanup memory in solvepnp * re did minimap component * fix npe if left/right is null * remove references to 2d * try-catch running the current pipeline * Add method to find corners using the harris corner detector * Possibly fix left/right missmatch * Fix 3D Tab error * FIx file permissions, mat serializer adjustments * fixed mini map for field coordinates * mini map changes fov * Update SolvePNPPipe.java * get rid of target corners * some memory leak fixes * fixed mini map location * added position under minimap * changed player fov look * put all targets in the web send * re did target send to ui added target tables, bugfix calibration * fixed y position * Add tilt angle to capture properties * maybe fix y axis in minimap * Add square size to onCalibrationEnding * Possibly add square size to UI * fix NPE with pitch * Fix bug with sending multiple targets * Only instantiate 3d stuff if we are in 3d mode * Fix array list exceptions * Fix bug in sort contors list was truncated too early * added download chess, tilt setting and ordinal tilt, * added square size connection * removed unused code * Update pom version to 2.1-RELEASE * Send camera calibrations to UI * Stream pose list to a LIst * Only stream necessary parts of the aux list entry * Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions * added fps counter changed squaresize steps bug fixes in tables * bugfix camera settings cam wont change Authored-by: oriagranat9 <oriagranat9@gmail.com> * disable pose print * standardize on calibration in inches and add square size as a divisor This should do the same thing as calibrating in the correct units but it doesnt like meeeeee * updated pom for release, 3d calibration change, cosmetic changes * WIP: 3D res filter * bug fix in index parsing * add good features to track point finder * offset found corners by old tl position * Add method to find most extreme per-quadrant points for solvePNP * re did pipeline duplication * Add release method to standard cv pipeline * remove contor from tracked target * Explicitly release all the intermediate results * avoid creating new mats in group contors pipe * removed mat release * updated pom * Actually cache the last target We were trying to but i never hooked this part up * Fix memory leak in sort contros pipe * Fix memory leak in sort contors pipe * Help more with memory usage in speckle reject and draw pipes * minor bugfixes to the ui * Start moving stream into vision process Should probs move into a pipe to be idimatic * justify bug fix * Fix sort left/right bug * Fix target grouping bug * Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe * Event scripts (#36) * Begin scripting work * More scripting work * Finalize scripting system * Begin implementing script events * Finalize script system Co-authored-by: Banks T <btrout.dhrs@gmail.com> Co-authored-by: OmerZ7 <zipory.omer@gmail.com> Co-authored-by: Matt <matthew.morley.ca@gmail.com> Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
if ( !(new File(cameraConfig.pipelineFolderPath.toUri()).mkdirs())) {
if (Files.notExists(cameraConfig.pipelineFolderPath)) {
2019-11-28 01:15:16 -05:00
System.err.println("Failed to create pipelines folder.");
}
}
V2.1 (#37) * Toggle mode * RangeSlider able to be disabled * Added another window from the press of the button * removed warning * Major changes to colorpicker page * Major changes to threshold tab * fix for BGR not RGB * Reverted changes of colorpicker.vue * Updated Readme.md Mainly Development Setup * Update readme small changes * updated readme.md Authors credit update * updated readme.md added usb camera to hardware * Updated UI readme added nodejs installation and explanation * Unit test vision (and implement networktable sending) * finished color picker in the ui * bugfix for correct tab * cleanup and commenting * Reveted changes to range slider * bug fix for color picker * Pipeline mat copy fix * Added crosshair pipe * compilation fix * removed unsued comment * moved calibration stuff to static class under 2d pipeline settings * Added debug print commented * Reverted subclass "Calibration" Fixed bug where single point calibration causes crash when no target is found * disable dual point crosshair for now * Proper no target found fix, and snackbar error now showing * Removed java fix for crash bug * fixed problem with clear points in single point calibration * change compatator to sqared values to make caluclation faster (no need for sqare root function) * fixed roated camera too heigh for the UI * Revert "fixed roated camera too heigh for the UI" This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f. * fixed rotated camera too heigh for UI and corrected scalling * updated pom to fix the camera buffer issue * added pom variables * Created new CaptureStaticProperties when rotating cam * File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports * ignore auto created iml file * ignore auto created iml file * Fix lack of access problems after moving pipleline impl out of the same package * Removed commented lines * Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move * cleaned up single point calibration and bug fixed isBinary in driverMode * Enum fix for the UI * typo * fixed Stream divisor problems see issue 19 in github issues * fixed compilation error for test class * Fixed problem when rotating camera with stream divisor * Spelling + button style change * Add speed limit to UI Updates * Added runtime arg to fix settings permissions, and on-first-init * Added FileHelper class to manage setting permissions for all files. * Removed unnecessary argument * NT can set pipeline to out on bound indexes * bugfix in platform check * added pipeline popup * Round steam divisor resolution * added regex test for camera name and pipe name * Fix for Renaming pipeline leaves old config file #14 * Version change * adde ( ) - and . to regex * Replace NT timestamp with latency * added back NT flush * Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35) * Rebase solvePNP on master * added 3D tab minimap and csv reader * More solvePNP * Create draw pipe for pnp data * SolvePNP piping work * Move sorting into solvepnppipe * Create calibration pipeline * Update CalibrateSolvePNPPipeline.java * add camera tilt angle * Add calibration slider and snapshot button to 3D view * Mirror updates in the socket handler * add 3d calibration mode to the pipeline manager * created calibration functions in ui and backend * Start plumbing calibration * Add snapshot and other handling to the RequestHandler * added select resolution before starting calibration * Rename solvePNPPipe to bounding box solve pnp pipe * Update BoundingBoxSolvePNPPipe.java * Add Mat serializer and CameraCalibrationConfig * Begun calibration saving, fixed UI/Backend snapshot count mismatch * Add (unplumbed) option to set checkerboard size This will allow users to change the units their calibration is in * Create chessboard.png * Fix calibration NPE * changed string serialization to a json send * bug fixed cancellation button * Fix spelling of snapshot in 3d.vue * Plumb resolution change * Set resolution during config, start on config serialization * Update .gitignore * Config fixes * Start transition away from cvpipeline3d * fix NPE on uncalibrated cameras * clear list on fail * Fix video mode index error * ignore getters in camera calibration config * Create json constructor for jsonmat * get solvePNP mostly returning sane values * Fix solvePNP bug and add unit test * FIx calibration mat truncation * added capture amount model upload and minimap data * Standardize on meters in calibration and bounding box * fix json out of bounds and handle null calibration more gracefully * don't put text on calibrate image, go back to inches * convert distance to meters this means calibration will need to be in inches * Actually save raw contor * Update GroupContoursPipe.java * Add all calibration return to camera capture * hard code 2019 target * bugfixed draw2d added fail calib popup, merge end and cancel added the res index to the calib start * Clarify error message and draw more fancy rectangles * Cleanup memory in solvepnp * re did minimap component * fix npe if left/right is null * remove references to 2d * try-catch running the current pipeline * Add method to find corners using the harris corner detector * Possibly fix left/right missmatch * Fix 3D Tab error * FIx file permissions, mat serializer adjustments * fixed mini map for field coordinates * mini map changes fov * Update SolvePNPPipe.java * get rid of target corners * some memory leak fixes * fixed mini map location * added position under minimap * changed player fov look * put all targets in the web send * re did target send to ui added target tables, bugfix calibration * fixed y position * Add tilt angle to capture properties * maybe fix y axis in minimap * Add square size to onCalibrationEnding * Possibly add square size to UI * fix NPE with pitch * Fix bug with sending multiple targets * Only instantiate 3d stuff if we are in 3d mode * Fix array list exceptions * Fix bug in sort contors list was truncated too early * added download chess, tilt setting and ordinal tilt, * added square size connection * removed unused code * Update pom version to 2.1-RELEASE * Send camera calibrations to UI * Stream pose list to a LIst * Only stream necessary parts of the aux list entry * Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions * added fps counter changed squaresize steps bug fixes in tables * bugfix camera settings cam wont change Authored-by: oriagranat9 <oriagranat9@gmail.com> * disable pose print * standardize on calibration in inches and add square size as a divisor This should do the same thing as calibrating in the correct units but it doesnt like meeeeee * updated pom for release, 3d calibration change, cosmetic changes * WIP: 3D res filter * bug fix in index parsing * add good features to track point finder * offset found corners by old tl position * Add method to find most extreme per-quadrant points for solvePNP * re did pipeline duplication * Add release method to standard cv pipeline * remove contor from tracked target * Explicitly release all the intermediate results * avoid creating new mats in group contors pipe * removed mat release * updated pom * Actually cache the last target We were trying to but i never hooked this part up * Fix memory leak in sort contros pipe * Fix memory leak in sort contors pipe * Help more with memory usage in speckle reject and draw pipes * minor bugfixes to the ui * Start moving stream into vision process Should probs move into a pipe to be idimatic * justify bug fix * Fix sort left/right bug * Fix target grouping bug * Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe * Event scripts (#36) * Begin scripting work * More scripting work * Finalize scripting system * Begin implementing script events * Finalize script system Co-authored-by: Banks T <btrout.dhrs@gmail.com> Co-authored-by: OmerZ7 <zipory.omer@gmail.com> Co-authored-by: Matt <matthew.morley.ca@gmail.com> Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
try {
FileHelper.setFilePerms(cameraConfig.pipelineFolderPath);
} catch (IOException e) {
// ignored
}
2019-11-28 01:15:16 -05:00
}
private File[] getPipelineFiles() {
V2.1 (#37) * Toggle mode * RangeSlider able to be disabled * Added another window from the press of the button * removed warning * Major changes to colorpicker page * Major changes to threshold tab * fix for BGR not RGB * Reverted changes of colorpicker.vue * Updated Readme.md Mainly Development Setup * Update readme small changes * updated readme.md Authors credit update * updated readme.md added usb camera to hardware * Updated UI readme added nodejs installation and explanation * Unit test vision (and implement networktable sending) * finished color picker in the ui * bugfix for correct tab * cleanup and commenting * Reveted changes to range slider * bug fix for color picker * Pipeline mat copy fix * Added crosshair pipe * compilation fix * removed unsued comment * moved calibration stuff to static class under 2d pipeline settings * Added debug print commented * Reverted subclass "Calibration" Fixed bug where single point calibration causes crash when no target is found * disable dual point crosshair for now * Proper no target found fix, and snackbar error now showing * Removed java fix for crash bug * fixed problem with clear points in single point calibration * change compatator to sqared values to make caluclation faster (no need for sqare root function) * fixed roated camera too heigh for the UI * Revert "fixed roated camera too heigh for the UI" This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f. * fixed rotated camera too heigh for UI and corrected scalling * updated pom to fix the camera buffer issue * added pom variables * Created new CaptureStaticProperties when rotating cam * File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports * ignore auto created iml file * ignore auto created iml file * Fix lack of access problems after moving pipleline impl out of the same package * Removed commented lines * Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move * cleaned up single point calibration and bug fixed isBinary in driverMode * Enum fix for the UI * typo * fixed Stream divisor problems see issue 19 in github issues * fixed compilation error for test class * Fixed problem when rotating camera with stream divisor * Spelling + button style change * Add speed limit to UI Updates * Added runtime arg to fix settings permissions, and on-first-init * Added FileHelper class to manage setting permissions for all files. * Removed unnecessary argument * NT can set pipeline to out on bound indexes * bugfix in platform check * added pipeline popup * Round steam divisor resolution * added regex test for camera name and pipe name * Fix for Renaming pipeline leaves old config file #14 * Version change * adde ( ) - and . to regex * Replace NT timestamp with latency * added back NT flush * Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35) * Rebase solvePNP on master * added 3D tab minimap and csv reader * More solvePNP * Create draw pipe for pnp data * SolvePNP piping work * Move sorting into solvepnppipe * Create calibration pipeline * Update CalibrateSolvePNPPipeline.java * add camera tilt angle * Add calibration slider and snapshot button to 3D view * Mirror updates in the socket handler * add 3d calibration mode to the pipeline manager * created calibration functions in ui and backend * Start plumbing calibration * Add snapshot and other handling to the RequestHandler * added select resolution before starting calibration * Rename solvePNPPipe to bounding box solve pnp pipe * Update BoundingBoxSolvePNPPipe.java * Add Mat serializer and CameraCalibrationConfig * Begun calibration saving, fixed UI/Backend snapshot count mismatch * Add (unplumbed) option to set checkerboard size This will allow users to change the units their calibration is in * Create chessboard.png * Fix calibration NPE * changed string serialization to a json send * bug fixed cancellation button * Fix spelling of snapshot in 3d.vue * Plumb resolution change * Set resolution during config, start on config serialization * Update .gitignore * Config fixes * Start transition away from cvpipeline3d * fix NPE on uncalibrated cameras * clear list on fail * Fix video mode index error * ignore getters in camera calibration config * Create json constructor for jsonmat * get solvePNP mostly returning sane values * Fix solvePNP bug and add unit test * FIx calibration mat truncation * added capture amount model upload and minimap data * Standardize on meters in calibration and bounding box * fix json out of bounds and handle null calibration more gracefully * don't put text on calibrate image, go back to inches * convert distance to meters this means calibration will need to be in inches * Actually save raw contor * Update GroupContoursPipe.java * Add all calibration return to camera capture * hard code 2019 target * bugfixed draw2d added fail calib popup, merge end and cancel added the res index to the calib start * Clarify error message and draw more fancy rectangles * Cleanup memory in solvepnp * re did minimap component * fix npe if left/right is null * remove references to 2d * try-catch running the current pipeline * Add method to find corners using the harris corner detector * Possibly fix left/right missmatch * Fix 3D Tab error * FIx file permissions, mat serializer adjustments * fixed mini map for field coordinates * mini map changes fov * Update SolvePNPPipe.java * get rid of target corners * some memory leak fixes * fixed mini map location * added position under minimap * changed player fov look * put all targets in the web send * re did target send to ui added target tables, bugfix calibration * fixed y position * Add tilt angle to capture properties * maybe fix y axis in minimap * Add square size to onCalibrationEnding * Possibly add square size to UI * fix NPE with pitch * Fix bug with sending multiple targets * Only instantiate 3d stuff if we are in 3d mode * Fix array list exceptions * Fix bug in sort contors list was truncated too early * added download chess, tilt setting and ordinal tilt, * added square size connection * removed unused code * Update pom version to 2.1-RELEASE * Send camera calibrations to UI * Stream pose list to a LIst * Only stream necessary parts of the aux list entry * Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions * added fps counter changed squaresize steps bug fixes in tables * bugfix camera settings cam wont change Authored-by: oriagranat9 <oriagranat9@gmail.com> * disable pose print * standardize on calibration in inches and add square size as a divisor This should do the same thing as calibrating in the correct units but it doesnt like meeeeee * updated pom for release, 3d calibration change, cosmetic changes * WIP: 3D res filter * bug fix in index parsing * add good features to track point finder * offset found corners by old tl position * Add method to find most extreme per-quadrant points for solvePNP * re did pipeline duplication * Add release method to standard cv pipeline * remove contor from tracked target * Explicitly release all the intermediate results * avoid creating new mats in group contors pipe * removed mat release * updated pom * Actually cache the last target We were trying to but i never hooked this part up * Fix memory leak in sort contros pipe * Fix memory leak in sort contors pipe * Help more with memory usage in speckle reject and draw pipes * minor bugfixes to the ui * Start moving stream into vision process Should probs move into a pipe to be idimatic * justify bug fix * Fix sort left/right bug * Fix target grouping bug * Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe * Event scripts (#36) * Begin scripting work * More scripting work * Finalize scripting system * Begin implementing script events * Finalize script system Co-authored-by: Banks T <btrout.dhrs@gmail.com> Co-authored-by: OmerZ7 <zipory.omer@gmail.com> Co-authored-by: Matt <matthew.morley.ca@gmail.com> Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
return new File(cameraConfig.pipelineFolderPath.toUri()).listFiles();
2019-11-28 01:15:16 -05:00
}
private boolean folderHasPipelines() {
File[] folderContents = getPipelineFiles();
if(folderContents == null) return false;
return folderContents.length > 0;
}
2019-11-27 22:23:02 -05:00
void check() {
2019-11-27 19:51:49 -08:00
cameraConfig.checkFolder();
2019-11-28 01:15:16 -05:00
checkFolder();
2019-11-27 19:51:49 -08:00
// Check if there's at least one pipe
2019-11-28 01:15:16 -05:00
if (!folderHasPipelines()) {
V2.1 (#37) * Toggle mode * RangeSlider able to be disabled * Added another window from the press of the button * removed warning * Major changes to colorpicker page * Major changes to threshold tab * fix for BGR not RGB * Reverted changes of colorpicker.vue * Updated Readme.md Mainly Development Setup * Update readme small changes * updated readme.md Authors credit update * updated readme.md added usb camera to hardware * Updated UI readme added nodejs installation and explanation * Unit test vision (and implement networktable sending) * finished color picker in the ui * bugfix for correct tab * cleanup and commenting * Reveted changes to range slider * bug fix for color picker * Pipeline mat copy fix * Added crosshair pipe * compilation fix * removed unsued comment * moved calibration stuff to static class under 2d pipeline settings * Added debug print commented * Reverted subclass "Calibration" Fixed bug where single point calibration causes crash when no target is found * disable dual point crosshair for now * Proper no target found fix, and snackbar error now showing * Removed java fix for crash bug * fixed problem with clear points in single point calibration * change compatator to sqared values to make caluclation faster (no need for sqare root function) * fixed roated camera too heigh for the UI * Revert "fixed roated camera too heigh for the UI" This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f. * fixed rotated camera too heigh for UI and corrected scalling * updated pom to fix the camera buffer issue * added pom variables * Created new CaptureStaticProperties when rotating cam * File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports * ignore auto created iml file * ignore auto created iml file * Fix lack of access problems after moving pipleline impl out of the same package * Removed commented lines * Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move * cleaned up single point calibration and bug fixed isBinary in driverMode * Enum fix for the UI * typo * fixed Stream divisor problems see issue 19 in github issues * fixed compilation error for test class * Fixed problem when rotating camera with stream divisor * Spelling + button style change * Add speed limit to UI Updates * Added runtime arg to fix settings permissions, and on-first-init * Added FileHelper class to manage setting permissions for all files. * Removed unnecessary argument * NT can set pipeline to out on bound indexes * bugfix in platform check * added pipeline popup * Round steam divisor resolution * added regex test for camera name and pipe name * Fix for Renaming pipeline leaves old config file #14 * Version change * adde ( ) - and . to regex * Replace NT timestamp with latency * added back NT flush * Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35) * Rebase solvePNP on master * added 3D tab minimap and csv reader * More solvePNP * Create draw pipe for pnp data * SolvePNP piping work * Move sorting into solvepnppipe * Create calibration pipeline * Update CalibrateSolvePNPPipeline.java * add camera tilt angle * Add calibration slider and snapshot button to 3D view * Mirror updates in the socket handler * add 3d calibration mode to the pipeline manager * created calibration functions in ui and backend * Start plumbing calibration * Add snapshot and other handling to the RequestHandler * added select resolution before starting calibration * Rename solvePNPPipe to bounding box solve pnp pipe * Update BoundingBoxSolvePNPPipe.java * Add Mat serializer and CameraCalibrationConfig * Begun calibration saving, fixed UI/Backend snapshot count mismatch * Add (unplumbed) option to set checkerboard size This will allow users to change the units their calibration is in * Create chessboard.png * Fix calibration NPE * changed string serialization to a json send * bug fixed cancellation button * Fix spelling of snapshot in 3d.vue * Plumb resolution change * Set resolution during config, start on config serialization * Update .gitignore * Config fixes * Start transition away from cvpipeline3d * fix NPE on uncalibrated cameras * clear list on fail * Fix video mode index error * ignore getters in camera calibration config * Create json constructor for jsonmat * get solvePNP mostly returning sane values * Fix solvePNP bug and add unit test * FIx calibration mat truncation * added capture amount model upload and minimap data * Standardize on meters in calibration and bounding box * fix json out of bounds and handle null calibration more gracefully * don't put text on calibrate image, go back to inches * convert distance to meters this means calibration will need to be in inches * Actually save raw contor * Update GroupContoursPipe.java * Add all calibration return to camera capture * hard code 2019 target * bugfixed draw2d added fail calib popup, merge end and cancel added the res index to the calib start * Clarify error message and draw more fancy rectangles * Cleanup memory in solvepnp * re did minimap component * fix npe if left/right is null * remove references to 2d * try-catch running the current pipeline * Add method to find corners using the harris corner detector * Possibly fix left/right missmatch * Fix 3D Tab error * FIx file permissions, mat serializer adjustments * fixed mini map for field coordinates * mini map changes fov * Update SolvePNPPipe.java * get rid of target corners * some memory leak fixes * fixed mini map location * added position under minimap * changed player fov look * put all targets in the web send * re did target send to ui added target tables, bugfix calibration * fixed y position * Add tilt angle to capture properties * maybe fix y axis in minimap * Add square size to onCalibrationEnding * Possibly add square size to UI * fix NPE with pitch * Fix bug with sending multiple targets * Only instantiate 3d stuff if we are in 3d mode * Fix array list exceptions * Fix bug in sort contors list was truncated too early * added download chess, tilt setting and ordinal tilt, * added square size connection * removed unused code * Update pom version to 2.1-RELEASE * Send camera calibrations to UI * Stream pose list to a LIst * Only stream necessary parts of the aux list entry * Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions * added fps counter changed squaresize steps bug fixes in tables * bugfix camera settings cam wont change Authored-by: oriagranat9 <oriagranat9@gmail.com> * disable pose print * standardize on calibration in inches and add square size as a divisor This should do the same thing as calibrating in the correct units but it doesnt like meeeeee * updated pom for release, 3d calibration change, cosmetic changes * WIP: 3D res filter * bug fix in index parsing * add good features to track point finder * offset found corners by old tl position * Add method to find most extreme per-quadrant points for solvePNP * re did pipeline duplication * Add release method to standard cv pipeline * remove contor from tracked target * Explicitly release all the intermediate results * avoid creating new mats in group contors pipe * removed mat release * updated pom * Actually cache the last target We were trying to but i never hooked this part up * Fix memory leak in sort contros pipe * Fix memory leak in sort contors pipe * Help more with memory usage in speckle reject and draw pipes * minor bugfixes to the ui * Start moving stream into vision process Should probs move into a pipe to be idimatic * justify bug fix * Fix sort left/right bug * Fix target grouping bug * Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe * Event scripts (#36) * Begin scripting work * More scripting work * Finalize scripting system * Begin implementing script events * Finalize script system Co-authored-by: Banks T <btrout.dhrs@gmail.com> Co-authored-by: OmerZ7 <zipory.omer@gmail.com> Co-authored-by: Matt <matthew.morley.ca@gmail.com> Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
save(new StandardCVPipelineSettings());
2019-11-27 22:23:02 -05:00
}
}
2019-11-28 01:15:16 -05:00
private Path getPipelinePath(CVPipelineSettings setting) {
String pipelineName = setting.nickname.replace(' ', '_');
V2.1 (#37) * Toggle mode * RangeSlider able to be disabled * Added another window from the press of the button * removed warning * Major changes to colorpicker page * Major changes to threshold tab * fix for BGR not RGB * Reverted changes of colorpicker.vue * Updated Readme.md Mainly Development Setup * Update readme small changes * updated readme.md Authors credit update * updated readme.md added usb camera to hardware * Updated UI readme added nodejs installation and explanation * Unit test vision (and implement networktable sending) * finished color picker in the ui * bugfix for correct tab * cleanup and commenting * Reveted changes to range slider * bug fix for color picker * Pipeline mat copy fix * Added crosshair pipe * compilation fix * removed unsued comment * moved calibration stuff to static class under 2d pipeline settings * Added debug print commented * Reverted subclass "Calibration" Fixed bug where single point calibration causes crash when no target is found * disable dual point crosshair for now * Proper no target found fix, and snackbar error now showing * Removed java fix for crash bug * fixed problem with clear points in single point calibration * change compatator to sqared values to make caluclation faster (no need for sqare root function) * fixed roated camera too heigh for the UI * Revert "fixed roated camera too heigh for the UI" This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f. * fixed rotated camera too heigh for UI and corrected scalling * updated pom to fix the camera buffer issue * added pom variables * Created new CaptureStaticProperties when rotating cam * File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports * ignore auto created iml file * ignore auto created iml file * Fix lack of access problems after moving pipleline impl out of the same package * Removed commented lines * Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move * cleaned up single point calibration and bug fixed isBinary in driverMode * Enum fix for the UI * typo * fixed Stream divisor problems see issue 19 in github issues * fixed compilation error for test class * Fixed problem when rotating camera with stream divisor * Spelling + button style change * Add speed limit to UI Updates * Added runtime arg to fix settings permissions, and on-first-init * Added FileHelper class to manage setting permissions for all files. * Removed unnecessary argument * NT can set pipeline to out on bound indexes * bugfix in platform check * added pipeline popup * Round steam divisor resolution * added regex test for camera name and pipe name * Fix for Renaming pipeline leaves old config file #14 * Version change * adde ( ) - and . to regex * Replace NT timestamp with latency * added back NT flush * Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35) * Rebase solvePNP on master * added 3D tab minimap and csv reader * More solvePNP * Create draw pipe for pnp data * SolvePNP piping work * Move sorting into solvepnppipe * Create calibration pipeline * Update CalibrateSolvePNPPipeline.java * add camera tilt angle * Add calibration slider and snapshot button to 3D view * Mirror updates in the socket handler * add 3d calibration mode to the pipeline manager * created calibration functions in ui and backend * Start plumbing calibration * Add snapshot and other handling to the RequestHandler * added select resolution before starting calibration * Rename solvePNPPipe to bounding box solve pnp pipe * Update BoundingBoxSolvePNPPipe.java * Add Mat serializer and CameraCalibrationConfig * Begun calibration saving, fixed UI/Backend snapshot count mismatch * Add (unplumbed) option to set checkerboard size This will allow users to change the units their calibration is in * Create chessboard.png * Fix calibration NPE * changed string serialization to a json send * bug fixed cancellation button * Fix spelling of snapshot in 3d.vue * Plumb resolution change * Set resolution during config, start on config serialization * Update .gitignore * Config fixes * Start transition away from cvpipeline3d * fix NPE on uncalibrated cameras * clear list on fail * Fix video mode index error * ignore getters in camera calibration config * Create json constructor for jsonmat * get solvePNP mostly returning sane values * Fix solvePNP bug and add unit test * FIx calibration mat truncation * added capture amount model upload and minimap data * Standardize on meters in calibration and bounding box * fix json out of bounds and handle null calibration more gracefully * don't put text on calibrate image, go back to inches * convert distance to meters this means calibration will need to be in inches * Actually save raw contor * Update GroupContoursPipe.java * Add all calibration return to camera capture * hard code 2019 target * bugfixed draw2d added fail calib popup, merge end and cancel added the res index to the calib start * Clarify error message and draw more fancy rectangles * Cleanup memory in solvepnp * re did minimap component * fix npe if left/right is null * remove references to 2d * try-catch running the current pipeline * Add method to find corners using the harris corner detector * Possibly fix left/right missmatch * Fix 3D Tab error * FIx file permissions, mat serializer adjustments * fixed mini map for field coordinates * mini map changes fov * Update SolvePNPPipe.java * get rid of target corners * some memory leak fixes * fixed mini map location * added position under minimap * changed player fov look * put all targets in the web send * re did target send to ui added target tables, bugfix calibration * fixed y position * Add tilt angle to capture properties * maybe fix y axis in minimap * Add square size to onCalibrationEnding * Possibly add square size to UI * fix NPE with pitch * Fix bug with sending multiple targets * Only instantiate 3d stuff if we are in 3d mode * Fix array list exceptions * Fix bug in sort contors list was truncated too early * added download chess, tilt setting and ordinal tilt, * added square size connection * removed unused code * Update pom version to 2.1-RELEASE * Send camera calibrations to UI * Stream pose list to a LIst * Only stream necessary parts of the aux list entry * Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions * added fps counter changed squaresize steps bug fixes in tables * bugfix camera settings cam wont change Authored-by: oriagranat9 <oriagranat9@gmail.com> * disable pose print * standardize on calibration in inches and add square size as a divisor This should do the same thing as calibrating in the correct units but it doesnt like meeeeee * updated pom for release, 3d calibration change, cosmetic changes * WIP: 3D res filter * bug fix in index parsing * add good features to track point finder * offset found corners by old tl position * Add method to find most extreme per-quadrant points for solvePNP * re did pipeline duplication * Add release method to standard cv pipeline * remove contor from tracked target * Explicitly release all the intermediate results * avoid creating new mats in group contors pipe * removed mat release * updated pom * Actually cache the last target We were trying to but i never hooked this part up * Fix memory leak in sort contros pipe * Fix memory leak in sort contors pipe * Help more with memory usage in speckle reject and draw pipes * minor bugfixes to the ui * Start moving stream into vision process Should probs move into a pipe to be idimatic * justify bug fix * Fix sort left/right bug * Fix target grouping bug * Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe * Event scripts (#36) * Begin scripting work * More scripting work * Finalize scripting system * Begin implementing script events * Finalize script system Co-authored-by: Banks T <btrout.dhrs@gmail.com> Co-authored-by: OmerZ7 <zipory.omer@gmail.com> Co-authored-by: Matt <matthew.morley.ca@gmail.com> Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
String fullFileName = pipelineName + ".json";
return Path.of(cameraConfig.pipelineFolderPath.toString(), fullFileName);
2019-11-28 01:15:16 -05:00
}
private boolean pipelineExists(CVPipelineSettings setting) {
return Files.exists(getPipelinePath(setting));
2019-11-27 19:51:49 -08:00
}
2019-11-27 22:23:02 -05:00
public void save(CVPipelineSettings settings) {
2019-11-27 22:23:02 -05:00
2019-11-28 01:15:16 -05:00
var path = getPipelinePath(settings);
V2.1 (#37) * Toggle mode * RangeSlider able to be disabled * Added another window from the press of the button * removed warning * Major changes to colorpicker page * Major changes to threshold tab * fix for BGR not RGB * Reverted changes of colorpicker.vue * Updated Readme.md Mainly Development Setup * Update readme small changes * updated readme.md Authors credit update * updated readme.md added usb camera to hardware * Updated UI readme added nodejs installation and explanation * Unit test vision (and implement networktable sending) * finished color picker in the ui * bugfix for correct tab * cleanup and commenting * Reveted changes to range slider * bug fix for color picker * Pipeline mat copy fix * Added crosshair pipe * compilation fix * removed unsued comment * moved calibration stuff to static class under 2d pipeline settings * Added debug print commented * Reverted subclass "Calibration" Fixed bug where single point calibration causes crash when no target is found * disable dual point crosshair for now * Proper no target found fix, and snackbar error now showing * Removed java fix for crash bug * fixed problem with clear points in single point calibration * change compatator to sqared values to make caluclation faster (no need for sqare root function) * fixed roated camera too heigh for the UI * Revert "fixed roated camera too heigh for the UI" This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f. * fixed rotated camera too heigh for UI and corrected scalling * updated pom to fix the camera buffer issue * added pom variables * Created new CaptureStaticProperties when rotating cam * File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports * ignore auto created iml file * ignore auto created iml file * Fix lack of access problems after moving pipleline impl out of the same package * Removed commented lines * Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move * cleaned up single point calibration and bug fixed isBinary in driverMode * Enum fix for the UI * typo * fixed Stream divisor problems see issue 19 in github issues * fixed compilation error for test class * Fixed problem when rotating camera with stream divisor * Spelling + button style change * Add speed limit to UI Updates * Added runtime arg to fix settings permissions, and on-first-init * Added FileHelper class to manage setting permissions for all files. * Removed unnecessary argument * NT can set pipeline to out on bound indexes * bugfix in platform check * added pipeline popup * Round steam divisor resolution * added regex test for camera name and pipe name * Fix for Renaming pipeline leaves old config file #14 * Version change * adde ( ) - and . to regex * Replace NT timestamp with latency * added back NT flush * Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35) * Rebase solvePNP on master * added 3D tab minimap and csv reader * More solvePNP * Create draw pipe for pnp data * SolvePNP piping work * Move sorting into solvepnppipe * Create calibration pipeline * Update CalibrateSolvePNPPipeline.java * add camera tilt angle * Add calibration slider and snapshot button to 3D view * Mirror updates in the socket handler * add 3d calibration mode to the pipeline manager * created calibration functions in ui and backend * Start plumbing calibration * Add snapshot and other handling to the RequestHandler * added select resolution before starting calibration * Rename solvePNPPipe to bounding box solve pnp pipe * Update BoundingBoxSolvePNPPipe.java * Add Mat serializer and CameraCalibrationConfig * Begun calibration saving, fixed UI/Backend snapshot count mismatch * Add (unplumbed) option to set checkerboard size This will allow users to change the units their calibration is in * Create chessboard.png * Fix calibration NPE * changed string serialization to a json send * bug fixed cancellation button * Fix spelling of snapshot in 3d.vue * Plumb resolution change * Set resolution during config, start on config serialization * Update .gitignore * Config fixes * Start transition away from cvpipeline3d * fix NPE on uncalibrated cameras * clear list on fail * Fix video mode index error * ignore getters in camera calibration config * Create json constructor for jsonmat * get solvePNP mostly returning sane values * Fix solvePNP bug and add unit test * FIx calibration mat truncation * added capture amount model upload and minimap data * Standardize on meters in calibration and bounding box * fix json out of bounds and handle null calibration more gracefully * don't put text on calibrate image, go back to inches * convert distance to meters this means calibration will need to be in inches * Actually save raw contor * Update GroupContoursPipe.java * Add all calibration return to camera capture * hard code 2019 target * bugfixed draw2d added fail calib popup, merge end and cancel added the res index to the calib start * Clarify error message and draw more fancy rectangles * Cleanup memory in solvepnp * re did minimap component * fix npe if left/right is null * remove references to 2d * try-catch running the current pipeline * Add method to find corners using the harris corner detector * Possibly fix left/right missmatch * Fix 3D Tab error * FIx file permissions, mat serializer adjustments * fixed mini map for field coordinates * mini map changes fov * Update SolvePNPPipe.java * get rid of target corners * some memory leak fixes * fixed mini map location * added position under minimap * changed player fov look * put all targets in the web send * re did target send to ui added target tables, bugfix calibration * fixed y position * Add tilt angle to capture properties * maybe fix y axis in minimap * Add square size to onCalibrationEnding * Possibly add square size to UI * fix NPE with pitch * Fix bug with sending multiple targets * Only instantiate 3d stuff if we are in 3d mode * Fix array list exceptions * Fix bug in sort contors list was truncated too early * added download chess, tilt setting and ordinal tilt, * added square size connection * removed unused code * Update pom version to 2.1-RELEASE * Send camera calibrations to UI * Stream pose list to a LIst * Only stream necessary parts of the aux list entry * Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions * added fps counter changed squaresize steps bug fixes in tables * bugfix camera settings cam wont change Authored-by: oriagranat9 <oriagranat9@gmail.com> * disable pose print * standardize on calibration in inches and add square size as a divisor This should do the same thing as calibrating in the correct units but it doesnt like meeeeee * updated pom for release, 3d calibration change, cosmetic changes * WIP: 3D res filter * bug fix in index parsing * add good features to track point finder * offset found corners by old tl position * Add method to find most extreme per-quadrant points for solvePNP * re did pipeline duplication * Add release method to standard cv pipeline * remove contor from tracked target * Explicitly release all the intermediate results * avoid creating new mats in group contors pipe * removed mat release * updated pom * Actually cache the last target We were trying to but i never hooked this part up * Fix memory leak in sort contros pipe * Fix memory leak in sort contors pipe * Help more with memory usage in speckle reject and draw pipes * minor bugfixes to the ui * Start moving stream into vision process Should probs move into a pipe to be idimatic * justify bug fix * Fix sort left/right bug * Fix target grouping bug * Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe * Event scripts (#36) * Begin scripting work * More scripting work * Finalize scripting system * Begin implementing script events * Finalize script system Co-authored-by: Banks T <btrout.dhrs@gmail.com> Co-authored-by: OmerZ7 <zipory.omer@gmail.com> Co-authored-by: Matt <matthew.morley.ca@gmail.com> Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
try {
JacksonHelper.serializer(path, settings);
FileHelper.setFilePerms(path);
} catch (IOException e) {
e.printStackTrace();
2019-11-27 22:23:02 -05:00
}
}
public void save(List<CVPipelineSettings> settings) {
for(CVPipelineSettings setting : settings) {
save(setting);
}
}
2019-11-28 01:15:16 -05:00
public void delete(CVPipelineSettings setting) {
if(pipelineExists(setting)) {
try {
Files.delete(getPipelinePath(setting));
} catch (IOException e) {
System.err.println("Failed to delete pipeline!");
}
}
}
public CVPipelineSettings rename(CVPipelineSettings setting, String newName) {
if (pipelineExists(setting)) {
delete(setting);
setting.nickname = newName;
save(setting);
} else {
setting.nickname = newName;
save(setting);
}
return setting;
}
2019-11-27 22:23:02 -05:00
public List<CVPipelineSettings> load() {
2019-11-28 01:15:16 -05:00
check(); // TODO: this ensures there will be a default pipeline. is the check later necessary?
2019-11-27 19:51:49 -08:00
2019-11-28 01:15:16 -05:00
File[] pipelineFiles = getPipelineFiles();
2019-11-27 19:51:49 -08:00
List<CVPipelineSettings> deserializedList = new ArrayList<>();
2019-11-28 01:15:16 -05:00
if(pipelineFiles == null || pipelineFiles.length < 1) {
2019-11-27 19:51:49 -08:00
// TODO handle no pipelines to load
System.err.println("no pipes to load! loading default");
} else {
2019-11-28 01:15:16 -05:00
for(File pipelineFile : pipelineFiles) {
2019-11-27 19:51:49 -08:00
try {
V2.1 (#37) * Toggle mode * RangeSlider able to be disabled * Added another window from the press of the button * removed warning * Major changes to colorpicker page * Major changes to threshold tab * fix for BGR not RGB * Reverted changes of colorpicker.vue * Updated Readme.md Mainly Development Setup * Update readme small changes * updated readme.md Authors credit update * updated readme.md added usb camera to hardware * Updated UI readme added nodejs installation and explanation * Unit test vision (and implement networktable sending) * finished color picker in the ui * bugfix for correct tab * cleanup and commenting * Reveted changes to range slider * bug fix for color picker * Pipeline mat copy fix * Added crosshair pipe * compilation fix * removed unsued comment * moved calibration stuff to static class under 2d pipeline settings * Added debug print commented * Reverted subclass "Calibration" Fixed bug where single point calibration causes crash when no target is found * disable dual point crosshair for now * Proper no target found fix, and snackbar error now showing * Removed java fix for crash bug * fixed problem with clear points in single point calibration * change compatator to sqared values to make caluclation faster (no need for sqare root function) * fixed roated camera too heigh for the UI * Revert "fixed roated camera too heigh for the UI" This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f. * fixed rotated camera too heigh for UI and corrected scalling * updated pom to fix the camera buffer issue * added pom variables * Created new CaptureStaticProperties when rotating cam * File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports * ignore auto created iml file * ignore auto created iml file * Fix lack of access problems after moving pipleline impl out of the same package * Removed commented lines * Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move * cleaned up single point calibration and bug fixed isBinary in driverMode * Enum fix for the UI * typo * fixed Stream divisor problems see issue 19 in github issues * fixed compilation error for test class * Fixed problem when rotating camera with stream divisor * Spelling + button style change * Add speed limit to UI Updates * Added runtime arg to fix settings permissions, and on-first-init * Added FileHelper class to manage setting permissions for all files. * Removed unnecessary argument * NT can set pipeline to out on bound indexes * bugfix in platform check * added pipeline popup * Round steam divisor resolution * added regex test for camera name and pipe name * Fix for Renaming pipeline leaves old config file #14 * Version change * adde ( ) - and . to regex * Replace NT timestamp with latency * added back NT flush * Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35) * Rebase solvePNP on master * added 3D tab minimap and csv reader * More solvePNP * Create draw pipe for pnp data * SolvePNP piping work * Move sorting into solvepnppipe * Create calibration pipeline * Update CalibrateSolvePNPPipeline.java * add camera tilt angle * Add calibration slider and snapshot button to 3D view * Mirror updates in the socket handler * add 3d calibration mode to the pipeline manager * created calibration functions in ui and backend * Start plumbing calibration * Add snapshot and other handling to the RequestHandler * added select resolution before starting calibration * Rename solvePNPPipe to bounding box solve pnp pipe * Update BoundingBoxSolvePNPPipe.java * Add Mat serializer and CameraCalibrationConfig * Begun calibration saving, fixed UI/Backend snapshot count mismatch * Add (unplumbed) option to set checkerboard size This will allow users to change the units their calibration is in * Create chessboard.png * Fix calibration NPE * changed string serialization to a json send * bug fixed cancellation button * Fix spelling of snapshot in 3d.vue * Plumb resolution change * Set resolution during config, start on config serialization * Update .gitignore * Config fixes * Start transition away from cvpipeline3d * fix NPE on uncalibrated cameras * clear list on fail * Fix video mode index error * ignore getters in camera calibration config * Create json constructor for jsonmat * get solvePNP mostly returning sane values * Fix solvePNP bug and add unit test * FIx calibration mat truncation * added capture amount model upload and minimap data * Standardize on meters in calibration and bounding box * fix json out of bounds and handle null calibration more gracefully * don't put text on calibrate image, go back to inches * convert distance to meters this means calibration will need to be in inches * Actually save raw contor * Update GroupContoursPipe.java * Add all calibration return to camera capture * hard code 2019 target * bugfixed draw2d added fail calib popup, merge end and cancel added the res index to the calib start * Clarify error message and draw more fancy rectangles * Cleanup memory in solvepnp * re did minimap component * fix npe if left/right is null * remove references to 2d * try-catch running the current pipeline * Add method to find corners using the harris corner detector * Possibly fix left/right missmatch * Fix 3D Tab error * FIx file permissions, mat serializer adjustments * fixed mini map for field coordinates * mini map changes fov * Update SolvePNPPipe.java * get rid of target corners * some memory leak fixes * fixed mini map location * added position under minimap * changed player fov look * put all targets in the web send * re did target send to ui added target tables, bugfix calibration * fixed y position * Add tilt angle to capture properties * maybe fix y axis in minimap * Add square size to onCalibrationEnding * Possibly add square size to UI * fix NPE with pitch * Fix bug with sending multiple targets * Only instantiate 3d stuff if we are in 3d mode * Fix array list exceptions * Fix bug in sort contors list was truncated too early * added download chess, tilt setting and ordinal tilt, * added square size connection * removed unused code * Update pom version to 2.1-RELEASE * Send camera calibrations to UI * Stream pose list to a LIst * Only stream necessary parts of the aux list entry * Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions * added fps counter changed squaresize steps bug fixes in tables * bugfix camera settings cam wont change Authored-by: oriagranat9 <oriagranat9@gmail.com> * disable pose print * standardize on calibration in inches and add square size as a divisor This should do the same thing as calibrating in the correct units but it doesnt like meeeeee * updated pom for release, 3d calibration change, cosmetic changes * WIP: 3D res filter * bug fix in index parsing * add good features to track point finder * offset found corners by old tl position * Add method to find most extreme per-quadrant points for solvePNP * re did pipeline duplication * Add release method to standard cv pipeline * remove contor from tracked target * Explicitly release all the intermediate results * avoid creating new mats in group contors pipe * removed mat release * updated pom * Actually cache the last target We were trying to but i never hooked this part up * Fix memory leak in sort contros pipe * Fix memory leak in sort contors pipe * Help more with memory usage in speckle reject and draw pipes * minor bugfixes to the ui * Start moving stream into vision process Should probs move into a pipe to be idimatic * justify bug fix * Fix sort left/right bug * Fix target grouping bug * Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe * Event scripts (#36) * Begin scripting work * More scripting work * Finalize scripting system * Begin implementing script events * Finalize script system Co-authored-by: Banks T <btrout.dhrs@gmail.com> Co-authored-by: OmerZ7 <zipory.omer@gmail.com> Co-authored-by: Matt <matthew.morley.ca@gmail.com> Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
var pipe = JacksonHelper.deserializer(Paths.get(pipelineFile.getPath()), StandardCVPipelineSettings.class);
2019-11-27 19:51:49 -08:00
deserializedList.add(pipe);
} catch (IOException e) {
System.err.println("couldn't load cvpipeline2d");
}
}
}
return deserializedList;
2019-11-27 22:23:02 -05:00
}
}