

Is there a way to fuse the Jpeg image with the correspondant pixel temperature shown in the stringgrid attached.
After the fusion, mouse arround and read the temperatures from the image.
If there is, please can anyone show me how.
Thank you, AmmadeuX
What I understand is that you have three different questions at hand. I will point them out below, along with an answer. But please, you need to do your best to get these types of projects done yourself, and only ask questions here if you have a specific issue which needs to be resolved. It’s always subjective to ask “How to do something”.
Questions 2 and 3 are either-or solutions, meaning each one could be a different question and answer all-together, completely separate. But they both still depend on the first question.
Question 1: “How do I identify the color of a pixel which the mouse is pointed over?”
I am assuming you’re using a standard
TImagecontrol with its default properties, and is not set to re-size, stretch, or center the image. If you need to do that, there’s a different approach.First, you have to identify which pixel the mouse is pointed over. There are a few ways of doing this, but depending on what control you are using to display the image (I’m assuming a standard
TImage), I would recommend using the Mouse Move event (OnMouseMove) to capture movement of the mouse over this control. At this point, you need to identify the current mouse position. Thankfully, this event comes with the X and Y position of the mouse pointer.Then, you need to get the canvas of the image. You can get this with:
Next, read the Canvas’
Pixels[]property to get the color.Question 2: “How do I identify where a color falls on a From/To scale?”
Now that you know what color the mouse is pointed over, you need to identify in which position of your scale this color belongs. For this, it’s easiest to stick with only 1 color channel. Your example above illustrates a combination and fade of different colors, which is way too tricky for me to try to explain. Please ask this as an additional question, because it requires its own thought which I cannot do (requires extensive math which I’m not good at).
Question 3: “How do I link an image to a table of data?”
Since you have a table of temperature readings, you need to read this table by column/row based on the individual pixel provided in the first question above.
Since you already know the X/Y position of the mouse, use these same variables to identify the column/row of the grid. (I discourage using a grid as your primary base of storing this data, you should use a client-dataset instead, and dynamically load the grid with that data.)
Conclusion:
Here’s the code of a sample app I prepared for you. It should help you understand the basics behind what you’re doing. You’ll have to pick your own image, as I didn’t want to pollute this answer’s code with raw image data.
NOTE: Once you edit your question to be clear as to how you expect the image to be linked to the data, then I will modify my answer. Otherwise, this is the best I can explain in its current state.
Unit1.pas
Unit1.dfm