Java rectangle detection - java

Now i'm working on some image processing project, and i'm stuck.
I can't find proper algorithm to detect rectangles on the image.
Is there any methods in Java which will be helpful to me? Or implementations of Hough transform for rectangles?

Have you had a look at openCV? detect() is what you want. You'll have to train the classifier on your own, however generating rectangles to train it on shouldn't be too hard :-)

Related

opencv android-edge detection

I am creating a project in android ,where i need to detect the edges of the object in very intial stage.But the edges are not appropriate they are broken .I have tried otsu thresholding method for edge detection.
Now i m trying to get the intensity from histogram ,can anyone help me to figure out the mean from the histogram of an image using calchist method in opencv. Also, i am giving a thought to dividing the image into blocks of 3* 3,as then computing each block.,but enable to find how to do that .
I am using opencv library.
Thanks,
Please do respond.
Canny, sobel,prewitt and many edge detection algorithms perform edge detection.
But, as you said,they remain incapable to extract all edges.
You can use some edge linking algorithms to link those broken edges.
I used ant colony algorithm(genetic algorithm) to make the image understandable.
But there are dozens of linking algorithm you can use.
Cheers.

Tracing polygon with holes for Vector based flood fill

I am writing some software that draws vector images and I am trying to implement a paint bucket/flood fill algorithm. My approach to doing this is one learned from inkscape's implementation where I will
take a bitmap snapshot of my drawing surface
do a traditional 4 connected flood fill
trace the resulting polygon and create a vectorized version of the filled area
The flood fill algorithm is straightforward enough, but I have not found a good solution to trace the polygon if the polygon has holes. I have seen this site which suggests that I should run a hole finding algorithm on the polygon and then run a countour tracing algorithm on the results. However, I cannot find a good resource on a hole finding algorithm. Anyone know the names of algorithms that I could implement or find a library on to solve this problem?
If it helps, I am programming in Java (Android)

How to detect a motion in a video by using openCV

I'm new to OpenCV and I want to detect the actions in a video by using openCV. Let say the video is a cricket match, then I want to detect who is the batmat and who is the bowler by using their motions. Can anyone guide me how can I do this with examples or some related videos. All your comments are highly appreciated.
With my limited understanding on image processing, I feel the approach ( especially haar classifiers ) in the accepted answer might not be the best option you have.
Read up on following
Optical flow based processing - That will help you identify motion.
Background subtraction - Ground color is usually green and player clothes also have color.
Contours - They let you identify shapes.
Hough Line transform - There will be lines in your video stream.
Edge detection
I assume one of intentions of doing this project is to learn image processing and just not to get the result. Training a haar xml for identifying a batsman/bowler with +ve/-ve image samples is more like repetitive job than a real learning process. More over, you will need to spend lots of time collecting samples, and then retraining xmls on failure etc. Also, haar classifiers are for object detection are not for motion detection as mentioned in question.
Aishack website has some references projects with image processing ideas. Wait for more responses to this question from experts.
Look into object recognition and Haar classifiers, specifically train_cascade methods of theOpenCV library. You'll need a LOT of still samples of each player type and their typical moves, then train a classifier and then analyze video frames to pick them out. You have a long, but awesome road ahead of you.

Graphic library for plot/drow fractal on Java

I'm looking for a graphic library that allow me to plot a pixel point in a specific color with the purpose of draw a fractal (mandelbrot set). I've read the basic math behind fractal and I understand it, the algorithm is not difficult.
But I don't know what graphic library could I use, I don't need anything sofisticated and complex, just print a pixel set with colors. What do you suggest me? Cairo? OpenGl?.
Note: I only have experience with pygtk. I was reading the Java API and found the the fillRect method and BufferedImages but it seem a little complicate.
Thanks ;)
Unless you want to compute 3D fractals (in which case a library like JOGL Java OpenGL can help), a simple java.awt.Graphics.setColor( java.awt.Color aColor) is enough.
(as show in this program).
In other word, the default awt library in Java should be up to the task: see "Graphics: setColor(Color c)".
I have implemented both mandelbrot and the flame fractal algorithm in native java (no openGL).
The most efficient way is to just store color in an int array or similar,
and then save it as an image file (png or jpg). It is much quicker than using Graphics.

Find Specific Color in an Image

I have an image where I want to find a specific location (coordinate) based on its color. For example
I want to find coordinates of edges of this Black box.
How can i detect Black color in this image in Java?
Note: My target is to develop a program to detect eyes in a face
I would suggest using threshold filter and then convert image to 1-bit format. This should do the trick.
However locating eyes in image is much more harder. You might be interested in open source OpenCV library. Here is port dedicated for Java - javacv. And C++ example of face detection using OpenCV.
as far as I know Fourier transform is used in image processing. With that you get your picture in frequency domain that represents a signal (in case of image signal is two dimensional). You can use Fast Fourier Transform algorimth (FFT in java, Fun with Java, Understanding FFT). There's a lot of papers about eye detection issue you can read and take inspiration from:
http://www.jprr.org/index.php/jprr/article/viewFile/15/7
http://people.ee.ethz.ch/~bfasel/papers/avbpa_face.pdf
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.117.2226&rep=rep1&type=pdf

Categories

Resources