Skip to content

Instantly share code, notes, and snippets.

torso <- function(d, n=5L, ...) {
stopifnot(length(n) == 1L)
center <- as.integer(nrow(d)/2)
left <- as.integer(center-n/3)
right <- as.integer(center + n/3)
d[seq.int(from= left, to = right, by = 1L),]
}
topntail <- function(d, n=4L) {
rbind(head(d,n), tail(d,n))

Keybase proof

I hereby claim:

  • I am bhive01 on github.
  • I am bhive01 (https://keybase.io/bhive01) on keybase.
  • I have a public key whose fingerprint is 8786 42F9 9118 5EAB 328A 14DE 3733 D0FF 46A0 E89F

To claim this, I am signing this object:

@bhive01
bhive01 / rVisionOpticalFlowDemo.R
Last active July 6, 2017 14:58
rVision Optical Flow Demo
library(Rvision)
library(tidyverse)
vid_loc <- paste0(find.package("Rvision"), "/sample_vid/SampleVideo_1080x720_5mb.mp4")
vid1 <- video(vid_loc)
res <- data.frame(frame_pos = seq(2,nframes(vid1), 5), total_movement = NA)
old <- readFrame(vid1, 1)
library(tidyverse)
library(plotly)
df1 <-
structure(list(L = c(70.3645369132914, 65.4398664741782, 68.666743417908,
77.365430427141, 70.0547601723453, 70.6484131213004, 71.4986501504573,
66.1120379621642, 73.2774689981553, 69.562646734966, 69.1207716412117,
70.0365107157227, 70.5193220131868, 64.283933268896, 61.3740110269355,
68.0741114422373, 68.5654828591618, 70.8832243213418, 64.2919216622958,
69.292675612121, 68.8174984026827, 66.8429923577925, 74.8780440157137,
---
title: "fileIOinR"
author: "Brandon Hurr"
date: "May 12, 2017"
output: html_document
---
```{r setup, include=FALSE}
library(devtools)
library(iotools)
Brandons-iMac:~ brandonhurr$ otool -l /usr/local/opt/gdal2/lib/libgdal.20.dylib
/usr/local/opt/gdal2/lib/libgdal.20.dylib:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
0xfeedfacf 16777223 3 0x00 6 53 4680 0x00118085
Load command 0
cmd LC_SEGMENT_64
cmdsize 632
segname __TEXT
vmaddr 0x0000000000000000
library(tibble)
shapes <-
tibble(
pch = c(1:20),
shape_name = c(
"circle",
"triangle",
"cross",
"x",
"diamond",
import os, sys # for deleting file
import subprocess # for sending file via SCP back to unit
import argparse #needed for getting filename from script run
# for taking the image
from time import sleep
from picamera import PiCamera
# construct the argument parse and parse the arguments
#base packages
import os, sys
import errno
import datetime
from time import gmtime, strftime, sleep
#rPi packages
from picamera import PiCamera
import RPi.GPIO as GPIO
#base packages
import os, sys
import errno
import datetime
from time import gmtime, strftime, sleep
#rPi packages
from picamera import PiCamera
import RPi.GPIO as GPIO