load

cv2.lbphfacerecognizer has no attribute 'load' 'predict'

依然范特西╮ 提交于 2019-12-06 05:16:49
问题 import cv2 import numpy as np faceDetect=cv2.CascadeClassifier('haarcascade_frontalface_default.xml'); cam=cv2.VideoCapture(0); rec=cv2.face.LBPHFaceRecognizer_create(); rec.load("recognizerr\\trainingData.yml") id=0 fontface=cv2.FONT_HERSHEY_SIMPLEX while(True): ret,img=cam.read(); gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) faces=faceDetect.detectMultiScale(gray,1.3,5); for(x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2) id,conf=rec.predict(gray[y:y+h,x:x+w]) if(id==1): id=

Is there a way to bind to the load() event of an image after changing it's src?

匆匆过客 提交于 2019-12-06 05:04:09
问题 I have an image <img id='my_img' src='img1.png'> and a button. Clicking the button does the following: $('#my_img').attr('src','img2.png') This second image (img2.png) is fairly large, and I want to know when it is fully loaded (i.e. .load() event). I tried to use .live, .bind, and .complete but none seem to fire. Any ideas? Thanks! Amit 回答1: I think the load event only fires once per img tag. But you can easily make a new image, and load that with a new load handler. var img = new Image();

php array loading into javascript

假如想象 提交于 2019-12-06 05:00:06
问题 so I am a total php/javascript noob. I'm trying load a full php array into a javascript array. I wrote this for Javascript: var names = new Array(); for(var i = 0; i < 48; i++) { names[i] = "<?php echo giveJS() ?>"; } And this for php static $counter = 0; function giveJS() { global $names; global $counter; $counter++; return $names[$counter]; } I already checked if the php array is correctly filled with data. When I write a output line in javascript, like document.write(names[10]); it only

How to set CPU load on a Red Hat Linux box?

一笑奈何 提交于 2019-12-06 04:53:20
问题 I have a RHEL box that I need to put under a moderate and variable amount of CPU load (50%-75%). What is the best way to go about this? Is there a program that can do this that I am not aware of? I am happy to write some C code to make this happen, I just don't know what system calls will help. 回答1: This is exactly what you need: http://weather.ou.edu/~apw/projects/stress/ From the homepage: "stress is a simple workload generator for POSIX systems. It imposes a configurable amount of CPU,

Run a service when device starts after sd finishes loading

≯℡__Kan透↙ 提交于 2019-12-06 04:40:41
I run a service when the device boots and that service just loads an image from sd card and makes it wallpaper. When the device starts i get an error. But after the sd card finishes the loading the service sets the image as wallpaper fine. <action android:name="android.intent.action.BOOT_COMPLETED" /> I start the service like this ^ and i want to ask if there is a way to start the service after sd card finishes loading. You can wait for the SD card to load. One way is to use the android.intent.action.MEDIA_MOUNTED action . Another way is to poll up to some maximum and give up if not mounted:

Why jQuery loses 'event' (click) when some content has been loaded?

喜夏-厌秋 提交于 2019-12-06 04:18:54
问题 I am trying to load content with this next script when I select pages on the sidebar. This script works without problems: if(Modernizr.history) { var newHash = "", $wrapperTag = $("#main-content"), contentTag = '#main-content-inside', activeClass = 'active'; $("#sidebar").delegate("a", "click", function() { _link = $(this).attr("href"); history.pushState(null, null, _link); loadContent(_link); return false; }); function loadContent(href){ $wrapperTag .find(contentTag) $wrapperTag.load(href +

Adding items to NSMutableArray and saving/loading

安稳与你 提交于 2019-12-06 04:18:41
I've used this tutorial to create an app with a table view that is populated using an NSMutableArray. Now I'd like to add the functionality to add additional items to the array and save/load them. I've customized the Fruit class to look like this: #import <UIKit/UIKit.h> @interface Fruit : NSObject { NSString *name; NSString *instructions; NSString *explination; NSString *imagePath; } @property(nonatomic,copy) NSString *name; @property(nonatomic,copy) NSString *instructions; @property(nonatomic,copy) NSString *explination; @property(nonatomic,copy) NSString *imagePath; - (id)initWithName:

Load .yml file into hashmaps using snakeyaml (import junit library)

落爺英雄遲暮 提交于 2019-12-06 03:37:45
问题 I am trying to load opencv's .yml file into arrayLists mean, projection and labels. I ve create those three arraylists and I am trying to parse into them the elements from the .yml file. I ve found snakeYAML documentation . However I didnt find a way to do so properly. I am trying to use final String fileName = "train.yml"; opencvmatrix mat = new opencvmatrix(); Yaml yaml = new Yaml(); try { InputStream ios = new FileInputStream(new File(fileName)); // Parse the YAML file and return the

Loading and appending images progressively

别来无恙 提交于 2019-12-06 03:33:11
I have an issue I can't get over. I made a simple jQuery album gallery and I have this function: function loadAlbum (index) { for (var j=1; j < xmlData[index].length; j++) { var img = new Image(); $(img).load(function() { $(this).hide(); $('#album'+index+' .photoContainer').append(this); $(this).fadeIn(); }) .error(function(){ //alert("Could not load one or more photo!"); }) .attr({ 'src': xmlData[index][j], 'id': 'img'+index+j, 'class': 'photoFrame', 'width': newW, 'height': newH }) .css({ 'width': newW, 'height': newH }); }; }; Now, as you can see all the images src's are imported from an

Extjs store load success handler not getting fired

柔情痞子 提交于 2019-12-06 02:38:21
问题 I have a store load method which returns data via an ajax request. I can see that the data is being returned using Firebug, but my success handler is not getting called: this.getCategoriesStore().load({params:{'id':d.data.category_id}}, { success: function(category) { console.log("Category: " + category.get('name')); }, error: function(e) { console.log(e); } }); I am returning a success parameter, along with the data: {"success":true,"categories":{"id":5,"name":"Frying","section_id":2}} Is