Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question

closed as unclear what you're asking by Kuba, Yves Klett, halirutan, Mr.Wizard Sep 18 '13 at 22:10

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Can you explain further, please? Do you have an example? Do you have any code? –  belisarius Sep 18 '13 at 1:24
1  
Something like this post ? –  Vitaliy Kaurov Sep 18 '13 at 3:13
    
@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? –  george2079 Sep 18 '13 at 12:54

1 Answer 1

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} = 
  Flatten[
    ImageData[
      ColorConvert[#, "HSB"]][[1]]
  ] & /@ Flatten@ImagePartition[#, ImageDimensions [#] {1/2, 1}] &@Import[fileLoc];

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

Mathematica graphics

Original picture:

Mathematica graphics

share|improve this answer
    
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. –  sak Sep 18 '13 at 22:24
    
@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. –  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.