detection

Scala Graph Cycle Detection Algo 'return' needed?

梦想与她 提交于 2019-11-29 12:19:30
I have implemented a small cycle detection algorithm for a DAG in Scala. The 'return' bothers me - I'd like to have a version without the return...possible? def isCyclic() : Boolean = { lock.readLock().lock() try { nodes.foreach(node => node.marker = 1) nodes.foreach(node => {if (1 == node.marker && visit(node)) return true}) } finally { lock.readLock().unlock() } false } private def visit(node: MyNode): Boolean = { node.marker = 3 val nodeId = node.id val children = vertexMap.getChildren(nodeId).toList.map(nodeId => id2nodeMap(nodeId)) children.foreach(child => { if (3 == child.marker || (1 =

How do you detect the CPU architecture type during run-time with GCC and inline asm?

99封情书 提交于 2019-11-29 12:18:34
I need to find the architecture type of a CPU. I do not have access to /proc/cpuinfo, as the machine is running syslinux. I know there is a way to do it with inline ASM, however I believe my syntax is incorrect as my variable iedx is not being set properly. I'm drudging along with ASM, and by no means an expert. If anyone has any tips or can point me in the right direction, I would be much obliged. static int is64Bit(void) { int iedx = 0; asm("mov %eax, 0x80000001"); asm("cpuid"); asm("mov %0, %%eax" : : "a" (iedx)); if ((iedx) && (1 << 29)) { return 1; } return 0; } tyranid How many bugs can

Getting MimeType subtype with Apache tika

∥☆過路亽.° 提交于 2019-11-29 09:30:19
问题 I'd need to get the iana.org MediaType rather than application/zip or application/x-tika-msoffice for documents like, odt, ppt, pptx, xlsx etc. If you look at mimetypes.xml there are mimeType elements composed of the iana.org mime-type and "sub-class-of" <mime-type type="application/msword"> <alias type="application/vnd.ms-word"/> ............................ <glob pattern="*.doc"/> <glob pattern="*.dot"/> <sub-class-of type="application/x-tika-msoffice"/> </mime-type> How to get the iana.org

Peak detection algorithm in Python

一世执手 提交于 2019-11-29 08:54:01
I'm implementing a peak detection algorithm in Python that detects only those peaks that are above a threshold magnitude. I don't want to use the inbuilt function as I have to extend this simulation to Hardware implementation also. from math import sin,isnan from pylab import * def peakdet(v, delta,thresh,x): delta=abs(delta) maxtab = [] mintab = [] v = asarray(v) mn, mx = v[0], v[0] mnpos, mxpos = NaN, NaN lookformax = True for i in arange(len(v)): this = v[i] if abs(this)>thresh: if this > mx: mx = this mxpos = x[i] if this < mn: mn = this mnpos = x[i] if lookformax: if (this < mx-delta): if

Why HoughCircles returns 0 circles while trying to detect irises?

人盡茶涼 提交于 2019-11-29 08:22:21
I am trying to detect the eyes' irises but HoughCircles returns 0 circles. The input image(eyes) is: Then I made the following things with this image: cvtColor(eyes, gray, CV_BGR2GRAY); morphologyEx(gray, gray, 4,cv::getStructuringElement(cv::MORPH_RECT,cv::Size(3,3))); threshold(gray, gray, 0, 255, THRESH_OTSU); vector<Vec3f> circles; HoughCircles(gray, circles, CV_HOUGH_GRADIENT, 2, gray.rows/4); if (circles.size()) cout << "found" << endl; So the final gray image looks like this: I've found this question Using HoughCircles to detect and measure pupil and iris but it didn't help me despite

The way to detect web scraping

对着背影说爱祢 提交于 2019-11-29 07:54:06
问题 I need to detect scraping of info on my website. I tried detection based on behavior patterns, and it seems to be promising, although relatively computing heavy. The base is to collect request timestamps of certain client side and compare their behavior pattern with common pattern or precomputed pattern. To be more precise, I collect time intervals between requests into array, indexed by function of time: i = (integer) ln(interval + 1) / ln(N + 1) * N + 1 Y[i]++ X[i]++ for current client

Detecting cycle maxima (peaks) in noisy time series (In R?) [closed]

爷,独闯天下 提交于 2019-11-29 05:20:40
This question is about an algorithm for determining the number and location of maxima in a sequence of numbers. Thus, there is a statistical flavor to the question, but it is more leaning towards programming, because I am not interested in the specific statistical properties, and the solution needs to be in R. The use of statistics to answer this question is OK, but not a requirement. I want to extract maxima of cycles in time series data (i.e., an ordered sequence of numbers). An example of such data is the solar flare time series (~11 year cycle, between 9 & 14 years). The cycles don't

Issue with tablet detection Synchro Digital

被刻印的时光 ゝ 提交于 2019-11-29 05:16:28
My colleague and I have to develop and implement an application on an Android tablet for a company. We started and almost completed the development of the application in question using the Eclipse AVD (we hadn't recieved the tablet yet) and it works perfectly. We received the tablet on which the application must be installed, the model: SynchroDigital INOSOP10-4.0 RES, 10" with ICS, less than 100 €, the really cheap one. Our problem: my PC doesn't recognize the tablet (WIN7, unable to install drivers when connecting, although I've already successfully developed on Galaxy S and Galaxy Tab). I

detect quite brighter spots on the image

♀尐吖头ヾ 提交于 2019-11-29 05:14:55
I have a bit noisy image where the background is not homogeneous. The image contains brigther convex spots, and I need to detect them. Here's a link for an example image: I know there is a lot of circle detection algorithm, but the difference between the environment and the object is too small. Do you any suggestion, how to segment the brigther spot? Or any idea to increase the intensity difference between them? update: the OpenCV environment is C++. I tried the adaptive threshold with many parameters. Here's the result: It is not bad, but the image contains a lot of other black spots. And

Detect which view your finger is sliding over in Android

佐手、 提交于 2019-11-29 04:36:16
问题 While similar questions have been asked in the past they don't seem to really have been answered which might be due to confusion as to what's being asked. Put simply, I'd like to detect which view is being entered as your finger slides over the screen. The best example of this in action is the soft keyboard on any android phone. When you press any key it shows up as a popup to tell you what letter is under your finger. If you now move your finger over the keyboard in a single gesture the