We help IT Professionals succeed at work.

stretch float[320,240] to float[640,480] and maintain data integrity

websss asked
Last Modified: 2019-04-25
I have a radiometric image (320px by 240px) with temperature data behind each pixel

I have extracted the temperature data and put into float[320, 240];
Then I can reference by X Y and get the temperature data

This all works fine, I over lay the temperature data over the image, and when the user hovers it shows the temperature data for that pixel

however I need to now increase the size of the image for display purposes and on hover show the temperatures, the image bit is easy, I just set in CSS

However, the original data (X Y pixels) also needs to be stretched so when the user hovers it shows the correct temperatures
The issue is the original data half the size, so would somehow need to duplicate diagonally

here is the code in question which gets the data into the float array.
I now need to return a float array of 640,480, with the correct pixel temperature data
Any idea how i would stretch the float array and maintain the correct pixel data considering the original is 320x240 and the output needs to be 640x480 ?

_tempData = new float[320, 240];

            using (MemoryStream ms = new MemoryStream(Convert.FromBase64String(tempContents)))
                BinaryReader br = new BinaryReader(ms);
                for (int x = 0; x < 320; x++)
                    for (int y = 0; y < 240; y++)

                        //write temp value for pixel
                        float pixelTemperature = br.ReadSingle();
                         _tempData[x, y] = pixelTemperature;

return _tempData;

Open in new window

Watch Question

AndyAinscowFreelance programmer / Consultant

If you are doubling each point in the display then halving the display x, y gives you the matrix index
Top Expert 2016
This one is on us!
(Get your first solution completely free - no credit card required)
AndyAinscowFreelance programmer / Consultant

If you didn't understand my comment then feel free to ask for further clarification.  The comment by sarabande is just explaining why my comment appears to be what you asked for.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.