Clear Filters
Clear Filters

Need help coding pixel values for an image

4 views (last 30 days)
Molly
Molly on 13 Sep 2022
Answered: DGM on 8 Sep 2023
I am working on an experiemnt where we take IR images with a contour scale and then take those images to matlab to assign tempertaure values for each pixel from the given scale.
This is how it was explained to me, how could i put this into a code:
  • take the length of the scale and read the picture in matlab and output it back into matlab
  • Image Is a set of pixels in different colors- a matrix of values/numbers. Take the number of pixels and divide them linearly between the two extremes (given on the bottom of the images) and create a linear scale.
  • Take a pixel and read that pixel and find its grade scale RGB value in matlab. Go across each pixel and put it into a loop.
  • For every pixel read the value and see where it falls and do a linear interpolation. Come up with the temperature of each pixel.

Answers (2)

Rijuta
Rijuta on 8 Sep 2023
Hi Molly,
I understand that you want to code pixel values for an image. To implement the described process in MATLAB, you can follow these steps:
1. Read the image into MATLAB using the `imread` function.
2. Determine the length of the contour scale and calculate the temperature range per pixel. If the scale has `n` divisions and the temperature range is from `T_min` to `T_max`, the temperature range will be given by temperature_range = (T_max - T_min) / n.
3. Extract the RGB values of a pixel in the grade scale. You can use the `impixel` function to interactively select a pixel and obtain its RGB value.
4. Define a loop to iterate over each pixel in the image and calculate the corresponding temperature
5. The resulting will contain the calculated temperature values for each pixel in the original image.
I hope these steps help you achieve the required results. Please refer to the links below for related documentation:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!