- #1
Jarfi
- 384
- 12
- TL;DR Summary
- How do I combine heatmaps, or images using simple matrix mathematics, in the simplest possible way?
Hello,
I am working with heatmaps and similar. And I want to be able to add/subtract them and a few other custom operations.
Here is a quick rundown:
1: Generate nxn (or nxm if possible) matrix, each element represents a heatmap color, or alternatively this could simply be defined as an image, let's call it M1
2: Generate another nxn matrix, but say with all elements transparents, except a certain area which represents a picture of an object, say a house. Alternatively, it can be an overlay of numbers, all 0 but in the area of interest, there are values 1-255, which can be a picture of something. Let's call it M2
3: I now want to do operations, such as M1 + M2 to get an overlay image, but not only this, I want to be able to control the change of basis or translate the position of the house in matrix M2 before adding it in M1, and do this multiple times, so I can add multiple houses onto the main image.
Main image = M1 + M2 * (location 1 transformation) + M2 * (location 2 transformation) so that I can add two houses to the matrix M1, on location 1 and location 2.
what is the most simple way to do this...? I assume the transformation can be defined in some way , so that all I need is matrix multiplication, so that most programming language can handle it?
But what if the house is size 50x50, and the main matrix is 500x500, but I put the house at location [0,250], so that half of the house would end up outside, but the other half still appears in the matrix, is this possible using some mathematical (non algorithmic) matrix transformation?
I am working with heatmaps and similar. And I want to be able to add/subtract them and a few other custom operations.
Here is a quick rundown:
1: Generate nxn (or nxm if possible) matrix, each element represents a heatmap color, or alternatively this could simply be defined as an image, let's call it M1
2: Generate another nxn matrix, but say with all elements transparents, except a certain area which represents a picture of an object, say a house. Alternatively, it can be an overlay of numbers, all 0 but in the area of interest, there are values 1-255, which can be a picture of something. Let's call it M2
3: I now want to do operations, such as M1 + M2 to get an overlay image, but not only this, I want to be able to control the change of basis or translate the position of the house in matrix M2 before adding it in M1, and do this multiple times, so I can add multiple houses onto the main image.
Main image = M1 + M2 * (location 1 transformation) + M2 * (location 2 transformation) so that I can add two houses to the matrix M1, on location 1 and location 2.
what is the most simple way to do this...? I assume the transformation can be defined in some way , so that all I need is matrix multiplication, so that most programming language can handle it?
But what if the house is size 50x50, and the main matrix is 500x500, but I put the house at location [0,250], so that half of the house would end up outside, but the other half still appears in the matrix, is this possible using some mathematical (non algorithmic) matrix transformation?