Is it possible to access each pixel value using ImageJ - java

I'm starting a project for college that uses ImageJ and Micro Manager. I want to be able to access each pixel of the image taken from a snapshot of the camera feed. My goal is to be able to apply a custom built function to each pixel on the snapshot of the image. Is it possible to do this using ImageJ.

Yes you can, but at which level do you want to work: ImageJ macros or dive into the java code?
If you stay at the macros level, I don't think that you can access the pixel values.
However, if you want to do a little bit of programming, ImageJ uses the ImageProcessor class, which is extended according to the encoding type: ByteProcessor, ShortProcessor, BinaryProcessor, ColorProcessor. Then, you can access the pixel values using the methods getPixels(), getPixel(x,y), getPixelValue(x,y). But be careful to the encoding type, these methods are encoding specific.

Related

Save frames to file onFrameAvailable [Google Project Tango]

I am trying to save to files the RGB frames along with Pose data, and then do some post processing on them. The main issue is that currently the only way to do this using the Tango Java API is to render to a GLSurfaceView, by connecting them via
tangoCameraPreview.connectToTangoCamera(mTango,TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
Then you would use GlReadPixels to read the pixels into an array and save that to a file.
The problem with this is that GlReadPixels is slow. In fact, using this I am getting about 3-4 fps using what I just described.
Looking at other, more general answers on taking a photo bursts, I have seen various people saying that when using SurfaceView instead of GlSurfaceView, they managed to get up to 15fps.
I didn't find any way to use SurfaceView with the tango camera, since connectToTangoCamera needs a GlSurfaceView and I can't just use Camera and bind that to a SurfaceView because when I'm trying to open it (via Camera.open()), it's already being used by Tango. Tango needs to use it in order to get the colorToIMUPose data.
So I'm really not sure what workaround might I find in order to be able to get at least 10fps.
You could use the C++ API with TangoService_connectOnFrameAvailable where you will get a YUV frame buffer in a reasonable speed. Checkout the tango c example video-overlay-jni-example where they do the RGB conversion. I use this way to interface OpenCV filters to the rendering process.

Java : image processing - how to get set of images to same standard

I need to develop the simple skin disease diagnose system using image processing and neural network. To use images in neural network, image should be same standard and, To identify the skin disease we should apply some image processing technique as well.
But I don't know what image processing technique apply first and what are they?
As I read from references I think I need to apply image filtering technique, edge detection technique , etc...
Can someone who is expert in this please specify the image processing technique step by step. no need coding I just want to know image processing technique names and there order.
This is reference:
reference
I think when you say "images should be same standard" you mean that the images should represent similar patterns in similar form in order to train your neural network. However, I suppose you will not train your neural network using the image itself, in other words, the pixel values. You'll probably extract features from images for such purpose.
In the case you are dealing with patterns that can be recognized by its shape, in order to use "images in the same standard" you should apply morphological image operations in all images in your dataset and then extract shape features (area, width/height ratio, straight lines, angles, etc). These features could be the attributes input vector to your neural network and the pattern to be recognized could be the output.
The question is: what are the features necessary to properly identify the skin deseases? If you need to recognize spot in the skin, perhaps texture features. In order to extract texture features you will probably need to correct brightness variance in your dataset.
This is the just the tip of the iceberg. You could start choosing an image processing framework for such purpose:
ImageJ: I guess the most used framework for medical purposes.
Marvin Image Processing Framework (http://marvinproject.sourceforge.net/): easy to use Java image processing framework.
JMagick (http://www.jmagick.org/index.html): Java wrapper for ImageMagick.
The post below is a good start point:
"good resource for exploring image processing in java [closed]"

Object/Models with dynamic sizes and joint movements

I would like to know if it is possible with Unity3D to have an object with the following properties, consider a human for example:
Leg length can be set when you create the object in your game.
Arm length can be set aswell.
It can be set for every part of your model.
Ability to use all joints of bones of your model programatically.
Also is it possible to run Unity3D from Java? Or what would be the best way to get around with Unity3D having a Java background.
Regards.
There are all sorts of Joints available in Unity3D which you can use with Javascript quite effectively. Check out Character, Fixed and Hinge joints - try adding those components to your gameobject and tweaking their values in the inspector. You can connect items / bones with these and set things like max length, bounciness, breakage points, and more. Once you are comforatable with these you can then add them through code using AddComponent.
As far as scaling your objects you can achieve this by making each joint / portion of the figure a different gameobject, and hold them together in a parent object. Then, you can go through the children of the parents and adjust the local scale of each child using this.
Im using C# script with my unity project, from a Java background, and I found it pretty easy to pick up -- in general I've thought C# is pretty similar to Java, and C# script I've found to be pretty similar to C#.

Drawing Top Down Multi way Trees using Swing

I am wondering if there exist libraries that could help me draw such figures on screen quickly using JAVA.
The dataset and number of nodes etc need to be parametrized.
If no such libraries exist, which tools in Swing would get me started. I want a quick and dirty way to represent this information.
Edit :
Also it would help if you could tell me what to search on google to get results for such a tailored query.
You can call GraphViz from within Java, converting any Java-based tree structure into the necessary GraphViz formats, and then reading the resulting .png image back into Java. That is probably the easiest approach, in terms of code-to-write (credit goes to SyntaxT3rr0r for proposing it first).
Customizing JGraph would also work, but I doubt that any of the default node-types would cut it. There are examples in the manual covering how to code your own node types and representations. JGraph allows easy graphical editing of node labels and positions, has hierarchical layouts (the type you use for trees); and it supports "ports" of origin (and also destination) for your parent-child edges. You can try their editor demo (included in their default download) if you just want a quick test.

Fast 24-bit RGB to Grayscale conversion with JMF, Java

I'm developing a simple (or at least thought so) desktop application in Java for real-time image processing. I've chosen to access video frames using the Java Media Framework (JMF). I have a PAL camera and use EasyCAP video converter for digitizing. The device is visible on my Windows machine as a VFW device, allowing for YUV and 24-Bit RGB format acquisitions (32-Bit not available).
I already figured out the basics of the framework. I'm using a javax.media.Processor for media-data controlling and, for the beginning, wanted to add a grayscale-codec (implementing javax.media.Codec) for further rendering. In the codec I can access individual frames as javax.media.Buffer objects.
What is the fastest way to do the grayscale conversion in Java? I'd like to stick to some standard like JAI or so, as I'd like to be able to easily do further conversions using the same framework / methods.
I've been considering the following until now:
Adding a codec on the beginning of the codec chain to convert 24-Bit RGB to 32-Bit RGB. Than using java.nio.ByteBuffer to cast byte[] to int[] pixel-array for further processing with javax.awt.image filters. I've already tried to use com.sun.media.codec.video.colorspace.RGBConverter to achieve that, without success, though.
I'd be really grateful for any help, hope anyone has already done that.
I'd be grateful for any suggestions regarding overall application architecture as well. My general goal is to implement an Optical Flow algorithm in Java to be able to estimate camera attitude in real-time using visual input only.
Have a look at this library at JH Labs ( http://www.jhlabs.com/ip/filters/index.html ).
It is available with source code. You can check the implementation there... specifically GrayscaleFilter.. Also Check the license before use. If you like it then please give credit to the original author.. :)

Categories