java - Print Name Near Detected Face in Opencv? -
i need print name/text near face detected face rectangle below code detect face. can suggest me method that?
websource.retrieve(frame); graphics g = jpanel2.getgraphics(); matofrect facedetections = new matofrect(); facedetector.detectmultiscale(frame, facedetections); rect rectcrop = null; (rect rect : facedetections.toarray()) { system.out.println("ttt"); core.rectangle(frame, new point(rect.x, rect.y), new point(rect.x + rect.width, rect.y + rect.height), new scalar(0, 255,0)); rectcrop = new rect(rect.x, rect.y,125, 150); //facedetector.detectmultiscale(frame, facedetections); int fcz= facedetections.toarray().length; system.out.println("fcz="+fcz); system.out.println(string.format("detected %s faces", facedetections.toarray().length)); }
i used core.puttext , worked below code
core.puttext(frame,"name", new point(rect.x + rect.width, rect.y + rect.height),core.font_hershey_plain,10,new scalar(0, 255,0));
Comments
Post a Comment