How can two images be used to create a scatter plot, image 1 being the x axis, image 2 being the y axis, and the color of each plot point being the bin count?

  • $\begingroup$ Can you explain further, please? Do you have an example? Do you have any code? $\endgroup$ – Dr. belisarius Sep 18 '13 at 1:24
  • 1
    $\begingroup$ Something like this post ? $\endgroup$ – Vitaliy Kaurov Sep 18 '13 at 3:13
  • $\begingroup$ @sak please clarify exactly what you mean by "image 1 being the x axis". Assuming color images how do you propose to map a color value to a scalar? $\endgroup$ – george2079 Sep 18 '13 at 12:54

Something like this?

First, I Import the pictures, in this case a stereogram pair from Wikipedia (so that I have reasonably similar images; this to make the exercise somewhat interesting). I split them using ImagePartition and then extract the Hue information using a color space conversion and successive extraction of the H part of the HSB representation of the image pixels. SmoothDensityHistogram does the rest.

fileLoc="http://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Asiatic_hybrid_lilium_stereogram_flipped.jpg/800px-Asiatic_hybrid_  lilium_stereogram_flipped.jpg"
{pic1, pic2} = 
      ColorConvert[#, "HSB"]][[1]]
  ] & /@ Flatten@ImagePartition[#, ImageDimensions [#] {1/2, 1}] &@Import[fileLoc];

  Transpose[{pic1, pic2}], 
  Method -> {"DistributionAxes" -> "SmoothHistogram"}, 
  ColorFunction -> ColorData["SunsetColors"]

Mathematica graphics

Original picture:

Mathematica graphics

| improve this answer | |
  • $\begingroup$ Assume image1 and image2 contain gray scale intensity values 0..255. To create the scatter plot, take corresponding pixels from each image at row,col, then use the value from image1 as the cartesian x coordinate, and the value from image2 as the cartesian y coordinate, and plot the point on a graph, binning the results like a 3D histogram to show population and add false color showing bins with high counts. $\endgroup$ – sak Sep 18 '13 at 22:24
  • $\begingroup$ @sak I trust you will be able to easily adapt the answer above to the demands of your homework assignment. Please be more specific in your question next time. I note you refer to the color of the pictures whereas they happen to be B/W now. $\endgroup$ – Sjoerd C. de Vries Sep 19 '13 at 13:50

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