How to ge the height of an object inside an image - java

I have this picture:
It contains circles inside columns. I want to get:
The height of each circle relative to its column (the distance
between the column bottom and the circle)
The height of the whole column
Classify every column so I can use the data from every column
differently according to its rank from left to right using java in
android studio.
I know I'm asking a lot but is that possible?! and if it is how can I do that?
Thanks in advance

Yes it must be possible. I have used this concept in Python using OpenCV but not in Java. The idea is to recognise your target inside an image by image recognition and then calculating pixel ratios. Use the same logic and code in Java as OpenCV is there for Java too.
Helper link below,
https://www.pyimagesearch.com/2016/03/28/measuring-size-of-objects-in-an-image-with-opencv/
If you have already started any other implementation and obtaining errors, post it too.

Related

To find the coordinates of the skeleton of contour of an image using java

My requirement is to find the coordinates of skeleton of an image using JAVA. This is the actual image contour from which i ahve to find the skeleton
Below are my questions.
I could do that by using OpenCV Java but it has gaps and also it is not 1 pixel width. Can we get the skeleton(of 1 pixel width) with out gaps using Java's openCV?This is the skeleton got from openCV JAVA
I can also find the skeleton by using imageJ library of Java but the returned skeleton is in ByteProcessor with which I can not process further to get the coordinates of skeleton. Is there a way to convert ByteProcessor back to image(matrix) so that I can find the coordinates by using openCV findcontours()?
Apart from these two, are there any other way of finding skeleton of an image using Java.
Attached the images for reference. Please advice.
maybe you should use other words to describe your problem, if it describes better, you should better say you need an array with coordinates of the skeleton. I can propose you to make two pixel sliding window for each line and extract contour when pixels are different (blakc/white) then, just link extracting points in an array to get all coordinates
Here is an ImageJ-macro that gives you the coordinates:
orig=getTitle();
nme=split(orig, ".");
path=getDir("image")+nme[0]+".csv";
run("Duplicate...", "title=cpy");
run("Skeletonize");
run("Create Selection");
run("Save XY Coordinates...", "save="+path);
selectWindow(orig);
run("Restore Selection");
close("cpy");
open(path);
It should be easy to convert it to Java (just use the Recorder).

Best way to detect corners of a plaque and reference object (Java, Opencv, Android Studio)

first of all English is not my main language. So I'm sorry for any mistakes and also this is my first time using StackOverflow.
About my problem: I'm doing a research project at my college, where I have to create an app that is able to analyze an image of a plate and its reference object. And return the width and height of that plate using a picture taken with the app. I joined the project after it started so the app has to be made in android studio using java. The thing is, that my major is not in computer science. So maybe I don't have enough bag of knowledge, to know where to look and would like to know if you have tips on what I have to search for or anything that could help me .
Right now I'm doing the whole usual process of getting an object contour (threshold, blur, etc etc) and I have a really good threshold image.
I'm getting the contour of the plaque just fine but I'm having trouble with the reference object (the A4 sheet). I'm currently using Imgproc.approxPolyDP and the sheet proportion to ensure that the outline is that of the sheet and not some other outline of the plate, but if I can make it work for a specific photo it doesn't work for the real-time picture on the app.
So do you guys have any tips? Or should I talk to my teacher for him to make some concessions? I thought about making an interface where the user could select the right contours and then calculate the height and width values ​​but my teacher is very difficult to accept changes in the project.
Thanks in advance!

How to detect if the image contains the given object or area or these two images are the same in OpenCV

I want to check if the image contains the given part (a small image in side it) or these two image are the same.
For better understanding my question look to image bellow.
The image which I am looking for inside another images:
Some other images:
These images are not the same size. As we look to images above the first, third and forth images containing the given image.
So I have tried three ways to do this:
1. The first way is using OpenCV norm function which is in OpenCV Core class.
2. The second way is comparing histograms of images.
3. The third way is using the algorithm FAST and ORB.
But no one was worked better for me, the first way was working when two images are very the same to each other. The second way was working when two images are almost the same. The third way also was working when the part of images are very the same.
So I cannot get good result using above ways.
If anyone can tell how to do this.
Note: I am using OpenCV 3 in Java, SURF and SIFT not supported.
Thanks in advance!

How to Print a Page to PDF Only with X Y Coordinates

I got a peculiar problem. I am business analyst working on a dash-boarding product based on java applet. I don't have access to any elements in the java applet it's like a black box.
I am looking to print a section of page without using html elements (since I don't have access to code). Ideal case would be using something like window.print() that takes Start (X,Y) and End (X,Y) coordinates .Then in the dialog I can select pdf995 option to print as pdf.
For e.g. (23,45) to (93,100) pixels should print the area within that range. Instead of pixels, percentage should be good as well.
Any help is greatly appreciated. Thanks guys.
Maybe this will help. How to get the X,Y coordinates of a point in a PDF
On that question you should have everything you need.
You can use java.awt.Robot ; java.awt.Image to take the ScreenShot and write a Image File (bmp or jpeg, or what you like); next, you can use Jasper Report to create a PDF and view the file report. Jasper its a powerfull library to create reports, website here
You can find some details to how take screen shots here. Its also possible to take screen shots with cordinates. You can see some examples here

combining of two images in Android

I want to combine two images by overlapping them at some fixed x-axis displacement. Suppose There are two images and both are the left and right snaps of the same panoramic view ,
Now the problem is to find the X -axis displacement of the right
image overlapping the left one so that both pixels match and they
form the panoramic view.
The next issue is how they can be merged so that they feel like a single image without any defect.
I have to do this using android , but please tell me using java /android how this can be done.
The problem is complex. Note that each picture is a projection of word on plane. For each photo you can assume that point of projection is same but plane of projection is different. This means that common parts on each photo are distorted (bended) in different way.
This means that transition between photos is not linear and simple transition is not enough!
here you can find better description of the problem.

Categories