Category: Linux/Unix
-
Shell command remove empty lines in a text file
You can remove empty lines on a fly using “sed” in a shell. This is how sed ‘/^$/d’ input.txt > output.txt Input: and by but Output: and by but
-
Fast perl shell script to remove stopwords from text corpus.
If you are looking to remove certain words from a file1 with list of stopwords from file2 (one per line), use this perl script in the command line. #!/usr/bin/env perl -w # usage: script.pl words text >newfile use English; # poor man’s argument handler open(WORDS, shift @ARGV) || die “failed to open words file: $!”;…
-
Screenshots using Firefox and Xvfb in Amazon EC2
Running a screenshot server in Amazon linux can be little tricky in EC2 but not impossible. I managed to install headless server Xvfb, Firefox in Amazon EC2 and it worked great. I wrote a quick shell script to capture screenshots from list of URLs stored in a file. I have to admit that compiling Xvfb,…
-
How to scan documents using laptop video camera?
I have been such a lazy user of scanners. I really hate pulling up a scanner everytime to scan small documents, then to scan, copy and email, such a tedious work for me. These days there are cameras everywhere in mobile phones, computers and laptops. Even there are apps to use video camera as scanner.…
-
Denoising stained images using kmeans clustering
Lets take a look on how we remove stains in noisy stains in grayscale images. Kaggle has competition on denoising dirty documents https://www.kaggle.com/c/denoising-dirty-documents. Although the the performance of k-means is just average, we will understand here quality of predictions. First we train a set of 144 clean png images (images are uneven dimensions so…
-
Detection of Facial eye points with k-means clustering
K-means is a clustering algorithm which can be applied on various machine learning problems. Lets take a look on how we apply kmeans on grayscale faces to detect coordinates of left and right eye centers. We first slice the eyes from the face reducing the dimensionality, then we apply gabor filter to have a maximum…
-
Applying Gabor filter on faces using OpenCV
Gabor filters are in the heart of computer vision problems. I decided to play around with gabor filters mainly because i heard it gives good response to orientation and pixel intensities. Here we write code in python and use opencv. Let us see how we can apply gabor filter to 36 grayscale facial images (taken…
-
Facial keypoints extraction using Caffe
Facial keypoints extraction is a challenging problem and deep learning is a hot topic and much explored area. Caffe is a popular deep learning library implementing deep learning on large datasets. Caffe is much much faster and convolutional neural networks seems to perform much better with images and can run in GPU and CPU. Running…
-
Qt5widgets cmake error in MacOS X
I was so annoyed with Qt5widgets issues compiling with cmake. After fixing it couple of times, i am posting it for others. $ cmake . CMake Warning at src/CMakeLists.txt:6 (message): The CULA environment variables are not defined. RAN and RBF networks will not be build. CMake Error at src/apps/CMakeLists.txt:22 (find_package): By not providing “FindQt5Widgets.cmake” in…
-
libtool issue with configure in Mac
I was trying to compile the FANN library with OpenCL, in my mac running yosemite, i get this error. i installed Xcode, command line tools still configure fails at libtool command config.status: executing libtool commands sed: ./ltmain.sh: No such file or directory sed: ./ltmain.sh: No such file or directory mv: rename libtoolT to libtool:…