maximum response of an image
古いコメントを表示
hello sir .I am new to matlab. I need help. I am working with 10 images I want to find the maximum response of image. ie. I wan to compare each pixel value with all other image and check for the maximum value and then the maximum value is written is written to the new image . for eg if my
image A is
[1,2,3
6,5,2
4,3,2]
image B is
[4 ,1,3
2,7,1
1,2,4]
them my maximum response image should be
[4,2,3
6,7,2
4 3 4]
like this I have to do for 10 images and create a 11th one...this is my own idea can this be possible I have got a code from ua forum ..but that doesnot work for me..
So far I have tried
theMaxValues=Zeros(1,N);
img_out = zeros(size(img_in,1), size(img_in,2), N);
for n=1:10
gb = gabor_fn(bw,gamma,psi(1),lambda,theta);
theMaxValues(n) = max(gb(:));
theta = angle+pi/180;
angle= angle + 15;
end
[overallMax, index] = max(theMaxValues);
thetaOfMax = theta(index);
final_gb = gabor_fn(bw,gamma,psi(1),lambda,thetaOfMax);
imshow(final_gb);
回答 (2 件)
G A
2013 年 11 月 13 日
You can try a simple code like this:
A=[1,2,3;
6,5,2;
4,3,2];
B=[4 ,1,3;
2,7,1
1,2,4];
C=A;
C(B>C)=B(B>C) %and so on
C =
4 2 3
6 7 2
4 3 4
Image Analyst
2013 年 11 月 13 日
編集済み: Image Analyst
2013 年 11 月 13 日
Try this:
% Declare 10 sample arrays.
A=[ 1,2,3;
6,5,2;
4,3,2];
B=[ 4 ,1,3;
2,7,1
1,2,4];
image3 = randi(99, [3, 3]);
image4 = randi(99, [3, 3]);
image5 = randi(99, [3, 3]);
image6 = randi(99, [3, 3]);
image7 = randi(99, [3, 3]);
image8 = randi(99, [3, 3]);
image9 = randi(99, [3, 3]);
image10 = randi(99, [3, 3]);
% Stack together into a 3D array.
image3D = cat(3, A, B, image3, image4, image5, image6, image7, image8, image9, image10);
% Find the max along dimension #3.
maxArray = max(image3D, [], 3)
5 件のコメント
rita
2013 年 11 月 13 日
Image Analyst
2013 年 11 月 13 日
Is this some kind of homework problem that has been assigned to you and vidya? http://www.mathworks.com/matlabcentral/answers/105560#answer_114743 If so, you should have tagged it as homework. Anyway the same basic concept should work. I don't have your data so all I can do is to work with sample data that I created.
rita
2013 年 11 月 13 日
Image Analyst
2013 年 11 月 13 日
I found it curious that you had the gabor function like vidya, then you also gave an example that had A, B, and C. But when I gave you a similar example with arbitrarily named image variables, you pointed me back to the gabor code.
Anyway, with your latest code, the first image and second image must both be gray scale, and must both have the same number of rows and columns. Apparently one of more of those criteria are not met. Do this:
whos firstImage
whos secondImage
See what it says are the sizes of each of those images.
カテゴリ
ヘルプ センター および File Exchange で Image Filtering and Enhancement についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!