
How to average every single pixel with its surroundings points so each pixel got the same value.
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nick Yin Larsen
el 13 de Ag. de 2016
Editada: Nick Yin Larsen
el 15 de Ag. de 2016
Hello everyone,
I got a grid that contain two numbers of information for every pixel.

But, what I need to do is to average every pixel in grid number one, so they equal the number 10 or almost 10 if not possible. When the pixel reach the number by combining the pixel values from it's surroundings, the pixel also include information from grid number two, which is the number I seek for.

Shortly again:
I want to find the value in grid number 2 for every time grid number 1 reach a value around 10. What is troublesome is that the size of the combining grid vary from pixel to pixel.
Does anyone have a clue to handle this problem? Do I need to use a filter that runs though every pixel or some kind of integration over an area of 10?? The original data is in 3D and I don’t know if it best do this averaging over a volume (like a cubic) or like a square in 2D slice or something third....
Thank you for your time! :)
0 comentarios
Respuesta aceptada
Image Analyst
el 13 de Ag. de 2016
OK, I did it for you. See attached m-file. For a full size image, it would take a huge amount of time to check every possible permutation for the one for the sum that is closest to 10. Why do you think you need to do this? What is the use case? Also note that there will be edge effects because the corners have only 4 elements and the edges have only 6 elements so their sums will tend to be lower.

5 comentarios
Image Analyst
el 14 de Ag. de 2016
The rate is the rate. It doesn't matter if it's 1 milligram or 10 grams or a kilogram.
If you have the rate (Watts per kg) and you have the mass (in kg), then you can find the power (Watts) in that voxel by multiplying the rate in W/kg by the actual mass in kg of that voxel. Just look at the units: (W/kg)*kg -- the kg cancel out and you get Watts.
Más respuestas (1)
Image Analyst
el 13 de Ag. de 2016
You'll probably have to use nlfilter() because you'll need to apply some special filter that applies special algorithm to each window location. The brute force way (which may be the only way) is to use perms() to check every possible combination of elements in the window. Then check all the sums against 10 to see which cam closest. It's really not that hard so give it a try.
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!