Creating a probability map for an image

5 views (last 30 days)
OphirP
OphirP on 25 Jun 2018
I have an image ("img") and two arrays - x axis as the pixel intensity and y axis as the probability of a pixel with this intensity to have some property (x and y form a PDF). I want to create a matrix ("map") with the size of img where on each position there's the probability of the pixel in that position on img to have the property, means: map(p) = y(img(p)). I've attempted to use a container map but the performance is very bad and it takes approx. 3 seconds per image to execute (bellow - unique image values is x, Fpdf is y). Is there any better way to achieve this?
MF = containers.Map(unique(img,'sorted'),Fpdf);
FGprobMap = zeros(size(img));
for i=(1:size(img,1))
for j=(1:size(img,2))
pixB = MF(img(i,j));
FGprobMap(i,j) = pixG;
end
end

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!