detection

How can I detect if the user is on localhost in PHP?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 15:46:14
In other words, how can I tell if the person using my web application is on the server it resides on? If I remember correctly, PHPMyAdmin does something like this for security reasons. You can also use $_SERVER['REMOTE_ADDR'] for which IP address of the client requesting is given by the web server. $whitelist = array( '127.0.0.1', '::1' ); if(!in_array($_SERVER['REMOTE_ADDR'], $whitelist)){ // not valid } As a complement, as a function... function isLocalhost($whitelist = ['127.0.0.1', '::1']) { return in_array($_SERVER['REMOTE_ADDR'], $whitelist); } Newer OS users (Win 7, 8) may also find it

mAP metric in object detection and computer vision

僤鯓⒐⒋嵵緔 提交于 2019-11-28 15:11:19
In computer vision and object detection, the common evaluation method is mAP. What is it and how is it calculated? Jonathan Quotes are from the above mentioned Zisserman paper - 4.2 Evaluation of Results (Page 11) : First an "overlap criterion" is defined as an intersection-over-union greater than 0.5. (e.g. if a predicted box satisfies this criterion with respect to a ground-truth box, it is considered a detection). Then a matching is made between the GT boxes and the predicted boxes using this "greedy" approach: Detections output by a method were assigned to ground truth objects satisfying

Color detection in opencv

半腔热情 提交于 2019-11-28 06:07:22
I want to detect a specific color say, blue, from a live video stream. I have written the following code which displays the live video stream and change it into HSV and grayscale. Since I am completely new to opencv I have no idea what to do next. Can someone complete the code for me to detect a specific color. #include<opencv\cv.h> #include<opencv\highgui.h> using namespace cv; int main(){ Mat image; Mat gray; Mat hsv; VideoCapture cap; cap.open(0); namedWindow("window", CV_WINDOW_AUTOSIZE); namedWindow("gray", CV_WINDOW_AUTOSIZE); namedWindow("hsv", CV_WINDOW_AUTOSIZE); while (1){ cap >>

java circle recognition from an arraylist of points

主宰稳场 提交于 2019-11-28 05:15:15
问题 I currently have an arraylist of points from a freehand drawing on a canvas. I was wondering if there is a simple algorithm to detect if that shape represents a circle.I have already researched this a little and the main items I am pointed at are either the Hough transform or having bitmap images but both of these seem a little over the top for what I need it for. Any pointers to algorithms or implementation would be very helpful. thanks in advance sansoms, 回答1: If you do not know what the

Detect if drawing a path is a circle/rectangle in xcode

做~自己de王妃 提交于 2019-11-28 05:10:42
问题 I want to implement a auto complete feature for a drawing app. Once a free hand object is drawn, I want to detect the type of object (circle/rectangle/triangle) and based on the result would want to plot a corresponding object. I have read up a bit about OpenCV but then I would need to convert the user drawing into an image at real time. I am recording the number of points plotted/traced by the touch and also generate a UIBeizerPath of the corresponding path. How do I go about to detecting

Cepstral Analysis for pitch detection

柔情痞子 提交于 2019-11-28 02:55:50
I'm looking to extract pitches from a sound signal. Someone on IRC just explained to me how taking a double FFT achieves this. Specifically: take FFT take log of square of absolute value (can be done with lookup table) take another FFT take absolute value I am attempting this using vDSP I can't understand how I didn't come across this technique earlier. I did a lot of hunting and asking questions; several weeks worth. More to the point, I can't understand why I didn't think of it. I am attempting to achieve this with vDSP library. It looks as though it has functions to handle all of these

Scala Graph Cycle Detection Algo 'return' needed?

一笑奈何 提交于 2019-11-28 02:00:07
问题 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

Why HoughCircles returns 0 circles while trying to detect irises?

喜欢而已 提交于 2019-11-28 01:54:56
问题 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

Detect emoticons in string

时光毁灭记忆、已成空白 提交于 2019-11-28 01:49:26
问题 I found that you need PHP 7 and MySQL 5.5 to use emoticons in a string that you want to upload to the database. I don't have these specification on my server so I want to give an error message in laravel or php. Is there a way to detect emoticons in php? If so then I can create a custom validation or something like that? I've tried alpha_dash validation in Laravel but then it isn't possible to do one old-school like this one :-) 回答1: To follow on from Johannes answer I found a solution on a

Way to automatically see which functions can potentially return exception in c#

别说谁变了你拦得住时间么 提交于 2019-11-28 00:13:43
nothing more frustrating than to see your code crash in the debugger on a method which exceptionned and you didn't try/catch it. Is there an easy way to scan through your sources and tag all functions which can potentially throw exceptions? Does the build in visual assist have some hidden option to colour these functions in a specific color? thanks R I think redgate have some a tool for this "Exception Hunter" They charge for it after a trial. http://www.red-gate.com/products/Exception_Hunter/index.htm All code but the most trivial could throw exceptions (out of memory, at the very least). You