Need help coding pixel values for an image

조회 수: 8 (최근 30일)
Molly
Molly 2022년 9월 13일
답변: DGM 2023년 9월 8일
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.

답변 (2개)

Rijuta
Rijuta 2023년 9월 8일
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:

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by