List of usage examples for org.opencv.core Point Point
public Point(double x, double y)
From source file:bollettini.BullettinCompiler.java
private void writeELetter(String ELetter) { Point L1 = new Point(80, 160); Point L2 = new Point(555, 160); Point L3 = new Point(1240, 112); Core.putText(bullettin, ELetter, L1, Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Core.putText(bullettin, ELetter, L2, Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Core.putText(bullettin, ELetter, L3, Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); }
From source file:bollettini.BullettinCompiler.java
private void writeReciever(String reciever) { //massimo 24 caratteri String temp = ""; int offset = 26; if (reciever.length() > offset) { temp = reciever.substring(0, offset); } else {//from ww w .j ava2 s . c o m temp = reciever; } Core.putText(bullettin, temp, new Point(93, 188), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Core.putText(bullettin, temp, new Point(567, 188), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Point R = new Point(1000, 159); for (int i = 0; i < 68 && i < reciever.length(); i++) { Core.putText(bullettin, String.valueOf(reciever.charAt(i)), R, Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); R.x += 25.3; if (i == 33) R.set(new double[] { 1000, 190 }); } }
From source file:bollettini.BullettinCompiler.java
private void writeCausal(String purpose) { Core.putText(bullettin, purpose, new Point(17, 237), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Core.putText(bullettin, purpose, new Point(490, 237), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Core.putText(bullettin, purpose, new Point(996, 237), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); }
From source file:bollettini.BullettinCompiler.java
private void writePerformer(String performer) { String temp = ""; int offset = 24; if (performer.length() > offset) { temp = performer.substring(0, offset); } else {//from w w w.j a v a 2 s . c o m temp = performer; } Core.putText(bullettin, temp, new Point(95, 500), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Core.putText(bullettin, temp, new Point(569, 500), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Point A = new Point(1278, 317); for (int i = 0; i < 46 && i < performer.length(); i++) { Core.putText(bullettin, String.valueOf(performer.charAt(i)), A, Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); A.x += 25; if (i == 22) A.set(new double[] { 1278, 348 }); } }
From source file:bollettini.BullettinCompiler.java
private void writeAddress(String address) { String temp = ""; int offset = 24; if (address.length() > offset) { temp = address.substring(0, offset); } else {/* w w w . ja v a 2 s. c o m*/ temp = address; } Core.putText(bullettin, temp, new Point(95, 529), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Core.putText(bullettin, temp, new Point(569, 529), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Point A = new Point(1278, 395); for (int i = 0; i < 46 && i < address.length(); i++) { Core.putText(bullettin, String.valueOf(address.charAt(i)), A, Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); A.x += 25; } }
From source file:bollettini.BullettinCompiler.java
private void writeCap(String cap) { String temp = ""; int offset = 5; if (cap.length() > offset) { temp = cap.substring(0, offset); } else {//w w w.j av a2 s . c o m temp = cap; } Core.putText(bullettin, temp, new Point(43, 557), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Core.putText(bullettin, temp, new Point(516, 557), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Point A = new Point(1278, 442); for (int i = 0; i < 5 && i < cap.length(); i++) { Core.putText(bullettin, String.valueOf(cap.charAt(i)), A, Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); A.x += 25; } }
From source file:bollettini.BullettinCompiler.java
private void writeLocality(String locality) { String temp = ""; int offset = 17; if (locality.length() > offset) { temp = locality.substring(0, offset); } else {//from w w w.j av a2s .c o m temp = locality; } Core.putText(bullettin, temp, new Point(205, 557), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Core.putText(bullettin, temp, new Point(678, 557), Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); Point A = new Point(1430, 442); for (int i = 0; i < 17 && i < locality.length(); i++) { Core.putText(bullettin, String.valueOf(locality.charAt(i)), A, Core.FONT_HERSHEY_COMPLEX, 0.8, new Scalar(0, 0, 0)); A.x += 25; } }
From source file:br.cefetmg.lsi.opencv.multipleObjectTracking.processing.MultipleObjectTracking.java
License:Open Source License
private void trackFilteredObject(Ball theBall, Mat threshold, Mat cameraFeed) { List<Ball> balls = new ArrayList<Ball>(); Mat temp = new Mat(); threshold.copyTo(temp);//from w w w . j av a 2 s . c o m // The two variables below are the return of "findContours" processing. List<MatOfPoint> contours = new ArrayList<MatOfPoint>(); Mat hierarchy = new Mat(); // find contours of filtered image using openCV findContours function Imgproc.findContours(temp, contours, hierarchy, Imgproc.RETR_CCOMP, Imgproc.CHAIN_APPROX_SIMPLE); // use moments method to find our filtered object boolean objectFound = false; if (contours.size() > 0) { int numObjects = contours.size(); //if number of objects greater than MAX_NUM_OBJECTS we have a noisy filter if (numObjects < MAX_NUM_OBJECTS) { for (int i = 0; i < contours.size(); i++) { Moments moment = Imgproc.moments(contours.get(i)); double area = moment.get_m00(); //if the area is less than 20 px by 20px then it is probably just noise //if the area is the same as the 3/2 of the image size, probably just a bad filter //we only want the object with the largest area so we safe a reference area each //iteration and compare it to the area in the next iteration. if (area > MIN_OBJECT_AREA) { Ball ball = new Ball(); ball.setXPos((int) (moment.get_m10() / area)); ball.setYPos((int) (moment.get_m01() / area)); if (theBall != null) { ball.setType(theBall.getType()); ball.setColour(theBall.getColour()); } balls.add(ball); objectFound = true; } else { objectFound = false; } } //let user know you found an object if (objectFound) { //draw object location on screen drawObject(balls, cameraFeed); } } else { Core.putText(cameraFeed, "TOO MUCH NOISE! ADJUST FILTER", new Point(0, 50), 1, 2, new Scalar(0, 0, 255), 2); } } }
From source file:br.cefetmg.lsi.opencv.multipleObjectTracking.processing.MultipleObjectTracking.java
License:Open Source License
private void drawObject(List<Ball> theBalls, Mat frame) { for (int i = 0; i < theBalls.size(); i++) { Ball theBall = theBalls.get(i);/*w w w . j av a 2 s . c o m*/ Core.circle(frame, new Point(theBall.getXPos(), theBall.getYPos()), 10, new Scalar(0, 0, 255)); Core.putText(frame, theBall.getXPos() + " , " + theBall.getYPos(), new Point(theBall.getXPos(), theBall.getYPos() + 20), 1, 1, new Scalar(0, 255, 0)); Core.putText(frame, theBall.getType().toString(), new Point(theBall.getXPos(), theBall.getYPos() - 30), 1, 2, theBall.getColour()); } }
From source file:br.com.prj.TelaPrincipal.java
private void btnProcurarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProcurarActionPerformed // remove todos os labels do componente jPanel1.removeAll();//from ww w. ja v a 2s . c o m // reposicionao o primeiro label boundX = 12; boundY = 22; CascadeClassifier faceDetector = new CascadeClassifier(URL_LIB_FACE); imagemCarregada = Imgcodecs.imread(selectedFile.getAbsolutePath(), Imgcodecs.CV_LOAD_IMAGE_COLOR); // imagem com retangulo dos rostos encontrados imagemDest = new Mat(imagemCarregada.rows(), imagemCarregada.cols(), imagemCarregada.type()); MatOfRect faceDetections = new MatOfRect(); faceDetector.detectMultiScale(imagemCarregada, faceDetections); // tentar verificar se o rect encontrado possui olhos Rect[] faceEncontrada = new Rect[faceDetections.toArray().length]; int i = 0; for (Rect rect : faceDetections.toArray()) { faceEncontrada[i] = new Rect(new Point(rect.x - PAD_LATERAL + 5, rect.y - PAD_SUPERIOR + 5), new Point(rect.x + rect.width + PAD_LATERAL, (rect.y + rect.height + PAD_SUPERIOR) - 5)); adicionarLabel(convertMatToImage(new Mat(imagemCarregada, faceEncontrada[i])), faceEncontrada[i]); // ADICIONA RETANGULO DO ROSTO NA IMAGEM // Imgproc.rectangle(imagemDest, // new Point(rect.x - PAD_LATERAL, rect.y - PAD_SUPERIOR), // new Point(rect.x + rect.width + PAD_LATERAL, (rect.y + rect.height + PAD_SUPERIOR) - 5), // new Scalar(0, 255, 0)); i++; } if (faceDetections.toArray().length == 0) { totalRostos.setText("No foi possvel identificar nenhum rosto na imagem selecionada."); } else { totalRostos .setText("Identificamos " + faceDetections.toArray().length + " rosto(s) na imagem carregada."); } }