I would like to use ImageDifference to express the change in motion between 0 and 1.

Dynamic[{data = CurrentImage[2], smart = ImageDifference[data[[1]], data[[2]]]}]

If there is no change, 0, Depending on the degree of change, I want to represent between 0 and 1.

Is there a way to represent the image obtained by ImageDifference between 0 and 1?

  • $\begingroup$ Probably many ways e.g. you can sum up grayscaled image and normalize with respect to pixel count. But this question is not about Mathematica. $\endgroup$ – Kuba May 18 '17 at 6:31
  • $\begingroup$ Good idea thank you. I wanted to know if there was a Mathematica function that would solve this problem easily. And I found a function called ImageMeasurements. $\endgroup$ – user21427 May 19 '17 at 22:44
  • $\begingroup$ Are you looking for ImageAdjust? $\endgroup$ – Chip Hurst Jul 17 '17 at 15:48

You can add up the all the pixel values and then divide by the total number of pixels in the image.

Dynamic[data = CurrentImage[2]; 
   {smart = ImageDifference[data[[1]], data[[2]]], 
   {n, m} = ImageDimensions[smart]; 
   Total[Flatten@ImageData[smart]]/(n m)}]
| improve this answer | |
  • $\begingroup$ Thank you for your kind answers. I used to find a function called ImageMeasurements, and I got results similar to your answer. value = Dynamic@ImageMeasurements[smart, "MeanIntensity"]; $\endgroup$ – user21427 May 19 '17 at 22:42
  • 1
    $\begingroup$ @user21427 You should post your solution as self-answer and accept it in order to take this question off the list of unanswered questions. $\endgroup$ – Alexey Popkov Sep 15 '17 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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