Skip to content

Instantly share code, notes, and snippets.

View vatsan's full-sized avatar

Srivatsan Ramanujam vatsan

View GitHub Profile
create table ocv.canny_edge_table_plc
as
(
select GetImgSizePLC(img) as imgsize,
CannyEdgeDetectPLC(img) as edges
from ocv.src_image
) distributed randomly;
psql -d <dbname> -h <HAWQ master hostname> -U <username> -c 'select nrows, ncols, edges from ocv.canny_edge_table limit 1;' | python -m ‘ppsqlviz.plotter’ image
pip install ppsqlviz
create table ocv.canny_edge_table
as
(
select img_name,
(canny_edge_detect(img)).*
from ocv.src_image
);
create type canny_output_type
as
(
nrows int,
ncols int,
edges int[]
);
gpssh -f hostfile echo “export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib/ds” >> ~/.bashrc gpstop -r
gpscp -f hostfile canny_edge_detection_so libopencv_core.so.2.4 libopencv_imgproc.so.2.4 libopencv_highgui.so.2.4 =:/usr/local/lib/ds
g++ -shared -Wl,-soname,canny_edge_detection -fPIC -ocanny_edge_detection.so -lopencv_core -lopencv_imgproc -lopencv_highgui CannyEdgeDetectionCtypes.cpp
public static class ImageToSequenceMapper extends Mapper<LongWritable,Text,Text, Text> {
// The input to each mapper is a set of lines from a text file on HDFS, where each line contains a path to an HDFS image file
// The job input format is NLineInputFormat and the job output format is TextOutputFormat
@Override
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
// The input argument value contains the HDFS path to the image file
String imgName = value.toString();
FileSystem fs = FileSystem.get(context.getConfiguration());
FSDataInputStream in = null;
vatsandb=# select id, tweet_body from posdemo.training_data limit 5;
id | tweet_body
------------+-----------------------------------------------------------------------------------------
1467820906 | @localtweeps Wow, tons of replies from you, may have to unfollow so I can see my friends' tweets, you're scrolling the feed a lot.
1467862806 | @MySteezRadio I'm goin' to follow u, since u didn't LOL GO ANGELS!
1467891880 | Argh! I was suuuper sleepy an hour ago, now I'm wide awake. Hope I don't stay up all night. :-/
1467896211 | michigan state you make me sad
1467911846 | @bananaface IM SORRY I GOT YOU SICK. lol. going to bed too. NIGHT!