javacv

White Screen is appearing in javaFx application & its getting stuck

天涯浪子 提交于 2019-12-04 16:47:34
We are developing video streaming app using JavaFx and JavaCv, While playing Stream into gridPane(8X8), we are occasionally facing splashing White Screen issue and it's continuous. Details:- new Thread(new Runnable() { @Override public void run() { frameGrabber = new FFmpegFrameGrabber(Url); frameGrabber.setVideoOption("preset","ultrafast"); frameGrabber.setOption("rtsp_transport","tcp"); frameGrabber.setOption("stimeout" , "60000"); frameGrabber.setAudioChannels(0); frameGrabber.setAudioCodec(0); try { frameGrabber.start(); } catch (Exception e) { e.printStackTrace(); } JavaFXFrameConverter

Find contours in JavaCV or OPENCV

自作多情 提交于 2019-12-04 13:39:29
问题 I have a problem but I don't know what! I have the next code, and when I debug it, the debugger stops in the IplImage iplGray = cvCreateImage(cvGetSize(iplUltima), 8, 1 ); CvMemStorage g_storage = null; CvSeq contours = new CvSeq(iplGray); opencv_imgproc.cvCvtColor(iplUltima, iplGray, opencv_imgproc.CV_BGR2GRAY); opencv_imgproc.cvThreshold(iplGray, iplGray, 100, 255, opencv_imgproc.CV_THRESH_BINARY); //HERE, the next line: opencv_imgproc.cvFindContours(iplGray, g_storage, contours, CV_C, CV_C

IplImage Pixel Access JavaCV

≡放荡痞女 提交于 2019-12-04 12:22:34
问题 I'm trying to access Pixel by Pixel of an IplImage. Im using Java and Processing, and sometimes I need to access pixel by pixel. I've done this so far, but I don't know what's wrong: public IplImage PImageToIplImage(PImage imageSrc) { IplImage imageDst; if(imageSrc.format==RGB) { imageDst = IplImage.create(imageSrc.width, imageSrc.height, IPL_DEPTH_8U, 3); ByteBuffer imagePixels=imageDst.getByteBuffer(); int locPImage, locIplImage, x, y; for(y=0; y<imageSrc.height; y++) for(x=0; x<imageSrc

How to iterate through a cvMat matrix in JavaCV?

六眼飞鱼酱① 提交于 2019-12-04 11:35:54
I have an IplImage that I converted in a Matrix, and now I want to iterate cell by cell. CvMat mtx = new CvMat(iplUltima); for (int i = 0; i < 100; i++) { //I need something like mtx[0][i] = someValue; } ¡¡I DID IT!! I share it: CvMat mtx = new CvMat(iplUltima); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { opencv_core.cvSet2D(mtx, i, j, CvScalar.ONE); } } iplUltima = new IplImage (mtx); Where i = row and j = column First, you need to import the following from JavaCV: import com.googlecode.javacv.cpp.opencv_core.CvMat; import static com.googlecode.javacv.cpp.opencv_core.CV

How to identify contour which are not directly separated from each other?

早过忘川 提交于 2019-12-04 11:19:57
Please can some one explain how to identify square shape of contours which are not exactly separated each other. For example I need to identify the number of squares in below image and the x,y coordinates of their edges. I try to go through this question but it didn't work for me. So please can some one explain this using simple code example. This is the image that I can generated can you please explain how to identify above squares in this image. So please be kind enough to explain this. You have to use fact, that red component of each square equals 255, and do the threshold. Here's what I've

How to stitch 100s of images using OpenCV/JavaCV? Most of the current solutions leads to artifacts

邮差的信 提交于 2019-12-04 06:09:56
问题 I am trying to stitch a large number of images which have good amount overlap like these: ExampleImage1 and ExampleImage2. Firstly, i want a 1D line of a grass patch. Something like this: Result. This is a screenshot of the original result, the original picture is more than 2MB. Hence couldnt upload it. This was achieved by breaking down 300 images into small sets and stitching them. Like this example but in a larger scale with more heirarchies - 0.jpg,1.jpg,2.jpg images in stitch1.jpg, 2,3,4

JavaCV video recorder orientation is not proper in portrait mode

你离开我真会死。 提交于 2019-12-04 04:35:30
Hi i am using https://github.com/bytedeco/javacv/ for recording video. When using landscape mode orientation is fine but when i change the orientation to portrait mode the video is rotated -90 degree. Any body have an idea what i may be doing wrong. Here is the code. package org.bytedeco.javacv_android_example.record; import android.app.Activity; import android.content.Context; import android.content.pm.ActivityInfo; import android.hardware.Camera; import android.hardware.Camera.PreviewCallback; import android.media.AudioFormat; import android.media.AudioRecord; import android.media

How to edit this method to draw polygon using javacv?

做~自己de王妃 提交于 2019-12-03 20:50:15
I went through many turorials and cupple of questions in stackoverflow and I found following method which used to draw rectangles. public static void drawSquares( IplImage image, final CvSeq squares ) { if(!squares.isNull()){ CvSeq p = new CvSeq(squares.total()); cvCvtSeqToArray(squares, p, CV_WHOLE_SEQ); System.out.println(squares.total()); for(int i = 0; i < squares.total(); i ++ ) { CvPoint pts = new CvPoint(4); cvCvtSeqToArray(p.position(i), pts, CV_WHOLE_SEQ); // //cvBoundingRect(image, i); int npt[] = {4, 4}; // //DrawLine() reference http://opencv.willowgarage.com/documentation/cpp

How to capture and record video from webcam using JavaCV

◇◆丶佛笑我妖孽 提交于 2019-12-03 20:40:36
I'm new to JavaCV and I have difficult time finding good tutorials about different issues on the topics that I'm interested in. I've succeed to implement some sort of real time video streaming from my webcam but the problem is that I use this code snippet which I found on the net : @Override public void run() { FrameGrabber grabber = new VideoInputFrameGrabber(0); // 1 for next // camera int i = 0; try { grabber.start(); IplImage img; while (true) { img = grabber.grab(); if (img != null) { cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise cvSaveImage((i++) + "-aa.jpg", img); // show

opencv/javacv: How to iterate over contours for shape identification?

穿精又带淫゛_ 提交于 2019-12-03 17:42:02
问题 I'm developing a shape identification project using JavaCV and I have found some OpenCV code to identify U shapes in a particular image. I have tried to convert it into JavaCV but it doesn't give the same output. Can you please help me to convert this OpenCV code into JavaCV? This is the OpenCV code: import cv2 import numpy as np img = cv2.imread('sofud.jpg') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ret,thresh = cv2.threshold(gray,127,255,1) contours,hierarchy = cv2.findContours(thresh,cv2