2015年3月22日 星期日

opencv with cuda error

when i test my opencv package in c file by using the command
$ gcc cvtest.c -o cvtest  `pkg-config opencv --cflags --libs`
There are with some error

/usr/bin/ld: cannot find -lcufft
/usr/bin/ld: cannot find -lnpps
/usr/bin/ld: cannot find -lnppi
/usr/bin/ld: cannot find -lnppc
/usr/bin/ld: cannot find -lcudart

According to this post in stackoverflow
http://stackoverflow.com/questions/24322466/makefile-opencv-stopped-working

i change the command with -L to my cuda lib path
$gcc -L /usr/local/cuda/lib64 cvtest.c -o cvtest  `pkg-config opencv --cflags --libs`

it's working

or put the cuda lib path in LIBRARY_PATH
export LIBRARY_PATH=/usr/local/cuda/lib64

2015年3月16日 星期一

WIN7 + UBUNTU Installtation

先裝win7後裝UBUNTU14.04 直接進入UBUNTU的解決方式

sudo update-grub

sudo gedit /etc/default/grub


將 GRUB_HIDDEN_TIMEOUT=0註解

#GRUB_HIDDEN_TIMEOUT=0

sudo update-grub

sudo reboot

2015年1月14日 星期三

R tm

when using



library(tm)
library(tm.plugin.mail)

#'corpus' folder in current path, 'SPAM' folder in 'corpus'
cname <- file.path(".", "corpus","SPAM")

# readMail from "tm.plugin.mail" can remove some heads of email
docs <- Corpus(DirSource(cname),readerControl = list(reader = readMail))

#docs <- Corpus(DirSource(cname)) #read mail as text

for (j in seq(docs))
{
    #change encoding from "iso-8859-1" to "UTF-8"
    docs[[j]]<- iconv(docs[[j]],"iso-8859-1","UTF-8")

    # Transforms
    docs[[j]] <- gsub("/", " ", docs[[j]])                      #transform "/" to " "
    docs[[j]] <- gsub("@", " ", docs[[j]])
    docs[[j]] <- gsub("\\|", " ", docs[[j]])
    docs[[j]] <- gsub("specific transform", "ST", docs[[j]])
    docs[[j]] <- gsub("other specific transform", "OST", docs[[j]])
}

docs <- tm_map(docs, tolower, iconv(enc2utf8(docs), sub = "byte"))  #lowercase
docs <- tm_map(docs, removeNumbers)
docs <- tm_map(docs, removePunctuation)
docs <- tm_map(docs, removeWords, stopwords("english"))
docs <- tm_map(docs, removeWords, c("own", "stop", "words", "oil"))
docs <- tm_map(docs, stripWhitespace)
docs <- tm_map(docs, stemDocument) #stemming
# Document term matrix.
dtm <- DocumentTermMatrix(docs) # documents as the rows,  terms as the columns
#dtm <- DocumentTermMatrix(docs, control=list(weighting = weightTfIdf))     # tfidf

opencv anaconda error

when import cv2, there is an error

ImportError: /anaconda/bin/../lib/libm.so.6: version `GLIBC_2.15' not found (required by /usr/lib/x86_64-linux-gnu/libxvidcore.so.4)

just copy libm.so.6 from '/usr/lib/x86_64-linux-gnu' to '/home/username/anaconda/lib/'
then it can work

2015年1月4日 星期日

install error on rnnlib

rnnlib source
http://sourceforge.net/p/rnnl/wiki/Home/

refer to
http://sourceforge.net/p/rnnl/discussion/1183966/thread/84f2025b/#742b/f9c9/c849/5687

error message:
Helpers.hpp:311:41: error: ‘range_min_size’ was not declared in this scope
Container.hpp:157:24: error: ‘resize’ was not declared in this scope

Helpers.hpp:
Moving the 4 templates for range_min_size to the top of the file fixed all the issues.

move line 532 ~ 547 to line 163

 template<class R1, class R2> static size_t range_min_size (const R1& a, const R2& b)
{
    return min(boost::size(a), boost::size(b));
}
template<class R1, class R2, class R3> static size_t range_min_size (const R1& a, const R2& b, const R3& c)
{
    return min(min(boost::size(a), boost::size(b)), boost::size(c));
}
template<class R1, class R2, class R3, class R4> static size_t range_min_size (const R1& a, const R2& b, const R3& c, const R4& d)
{
    return min(min(min(boost::size(a), boost::size(b)), boost::size(c)), boost::size(d));
}
template<class R1, class R2, class R3, class R4, class R5> static size_t range_min_size (const R1& a, const R2& b, const R3& c, const R4& d, const R5& e)
{
    return min(min(min(min(boost::size(a), boost::size(b)), boost::size(c)), boost::size(d)), boost::size(e));
}

Container.hpp:
On line 157, revise "resize" instead of "this->resize."