Contribution from all pixels to 1 pixel
이전 댓글 표시
Hello all,
I've got a series of 2D image slices, with each pixel being a measure of intensity. I'm looking to work out the contribution from all pixels to each individual pixel using a function relating the intensity of each pixel to the distance from the contributing pixel. Would anyone know a fast efficient way to do this? I've tried a function using cumsum but its not going to plan
Thanks
Jim
답변 (1개)
Image Analyst
2012년 8월 2일
0 개 추천
Why do you think that all other pixels have any influence on one single pixel? Do you know your image is , say, blurred with a large point spread function? If so, have you tried inverse filtering or wiener filtering or richardson-lucy deconvolution?
댓글 수: 12
Jim O'Doherty
2012년 8월 3일
Image Analyst
2012년 8월 3일
I think you're going to have to do that by scanning your volume and doing the calculations. It would take far too much memory to do something like bwdist() for every pixel in the volume and store it. Maybe you can use bwdist as you scan and get the distance transform for every pixel, but you can't store the EDT for every voxel, nor do you need to.
Image Analyst
2012년 8월 3일
That will happen, even for mathematically perfect scaling. Just look at your diagrams and imagine what's going to happen to that bay as your "constant distance" increases. You're going to close off that bay. You can use imresize to maintain the shape at a larger resolution but it won't be a constant distance anymore.
Jim O'Doherty
2012년 8월 4일
Jim O'Doherty
2012년 8월 4일
Image Analyst
2012년 8월 4일
That doesn't look right. You've calculating a new d array for every pixel. You're overwriting it because its indexes don't depend on pxRow and pxCol. Maybe I'm misunderstanding what you want but if you want the distance of every pixel to every other pixels, then...well let's just take the upper left pixels and let's say you have a million pixels. So for that upper left pixel you have a million distances. And you have another million distances for the pixel next to it, and so on. Every one of the million pixels will have a million distances. So the grand total is a billion distances, or about 8 GB of memory. I see no reason why you need to store all of those in memory at one time.
Jim O'Doherty
2012년 8월 5일
Image Analyst
2012년 8월 6일
Well I think you know what those are. 4 of them will be 1 and 4 of them will be sqrt(2).
Walter Roberson
2012년 8월 6일
And this would seem to be a good application of conv2() with a square kernel of the distances away from the center pixel. Something like
s2r = 1/sqrt(2);
kernel = [s2r, 1, s2r; 1, 0, 1; s2r, 1, s2r];
Jim O'Doherty
2012년 8월 6일
편집: Jim O'Doherty
2012년 8월 6일
Walter Roberson
2012년 8월 6일
kernels specify a pattern of multiplications and additions, that are to be used in a "sliding window" manner.
When the distances are sqrt(2) do you want to add the full voxel value to the central voxel, or do you want to add the value divided by sqrt(2) ?
If you want to add the full voxel value, then your kernel would, I think, be simply ones(3,3,3)
Jim O'Doherty
2012년 8월 8일
편집: Jim O'Doherty
2012년 8월 8일
카테고리
도움말 센터 및 File Exchange에서 Image Segmentation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!