I've got images of blood drops in grayscale and I want to generate 3D data where the first two dimensions represent the area of interest and the 3rd dimension represents the pixel intensity of that area. Here's an example image:

enter image description here

My requirement is as shown in D,E,F while the raw images are A,B,C. Also, what algorithms can be used for detection of the plateau areas as detected in G,H,I?

  • $\begingroup$ Matlab? Python? $\endgroup$
    – Maurits
    Mar 22, 2015 at 15:29
  • $\begingroup$ @Maurits I actually need to do this in Java but you can answer using MATLAB code. I'll do the porting myself. $\endgroup$ Mar 22, 2015 at 15:31
  • 1
    $\begingroup$ Matlab has build in commands for this (`surf``) so porting will be hard. Also, make a separate question for the second part $\endgroup$
    – Maurits
    Mar 22, 2015 at 15:37

1 Answer 1


If all you are looking to do is to take the 2D grayscale image and turn it into a 3D representation for visualisation purposes, then perhaps you could consider a function that accepts the image and produces a VRML (or X3D) string describing your 3D model. That model would then be passed to a standard java graphics toolkit (for example Java 3D) which would handle the rendering for you.

Here is a simplistic example: For the 2x2 grayscale image of X = [0,1;1,0], your VRML indexedFace node would look like this:

IndexedFaceSet {
       coord Coordinate {
         point [-1 1 x(0,0), 1 1 x(0,1), 1 -1 x(1,1), -1 -1 x(1,0)]
       coordIndex [ 0 1 2 3 ]   # That is, just one face

In the above snippet, "x(i,j)" is a placeholder for the corresponding value from the image (which will be formated to the actual number) and as you can see it represents the Z dimension of your indexedFaceSet.

Actually, the structure of "point" is just a list (in row major order) of all of you image points, which is very easy to generate by iterating through all pixels of the image. Similarly, the structure of coordIndex is also set to quads (faces defined by 4 points in space) which map to the image's grid. The indexedFaceSet provides capabilities to define the colour of each vertex (each defining point of the face) as well in a way similar to the way "point" is defined.

More information about IndexedFaceSet can be found at:

VRML: http://www.cs.vu.nl/~eliens/documents/vrml/reference/CH3.HTM#IndexedFaceSet

X3D: http://www.web3d.org/documents/specifications/19775-1/V3.2/Part01/components/geometry3D.html#IndexedFaceSet

To render the model in Java, please see https://stackoverflow.com/questions/16625858/plug-in-display-3d-objects-from-vrml-or-x3d

Regarding the detection of spots, if these are images from electrophoresis, please see chapter 3 in this thesis for a comprehensive set of ways of detecting the blobs and extracting their main features: http://citeseerx.ist.psu.edu/viewdoc/download?doi=

I hope this helps


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.